1 29 package org.jruby.ast.executable; 30 31 import java.util.Map ; 32 import java.util.HashMap ; 33 34 37 public abstract class YARVInstructions { 38 public static final int NOP = 0; 39 public static final int GETLOCAL = 1; 40 public static final int SETLOCAL = 2; 41 public static final int GETSPECIAL = 3; 42 public static final int SETSPECIAL = 4; 43 public static final int GETDYNAMIC = 5; 44 public static final int SETDYNAMIC = 6; 45 public static final int GETINSTANCEVARIABLE = 7; 46 public static final int SETINSTANCEVARIABLE = 8; 47 public static final int GETCLASSVARIABLE = 9; 48 public static final int SETCLASSVARIABLE = 10; 49 public static final int GETCONSTANT = 11; 50 public static final int SETCONSTANT = 12; 51 public static final int GETGLOBAL = 13; 52 public static final int SETGLOBAL = 14; 53 public static final int PUTNIL = 15; 54 public static final int PUTSELF = 16; 55 public static final int PUTUNDEF = 17; 56 public static final int PUTOBJECT = 18; 57 public static final int PUTSTRING = 19; 58 public static final int CONCATSTRINGS = 20; 59 public static final int TOSTRING = 21; 60 public static final int TOREGEXP = 22; 61 public static final int NEWARRAY = 23; 62 public static final int DUPARRAY = 24; 63 public static final int EXPANDARRAY = 25; 64 public static final int CONCATARRAY = 26; 65 public static final int SPLATARRAY = 27; 66 public static final int CHECKINCLUDEARRAY = 28; 67 public static final int NEWHASH = 29; 68 public static final int NEWRANGE = 30; 69 public static final int PUTNOT = 31; 70 public static final int POP = 32; 71 public static final int DUP = 33; 72 public static final int DUPN = 34; 73 public static final int SWAP = 35; 74 public static final int REPUT = 36; 75 public static final int TOPN = 37; 76 public static final int SETN = 38; 77 public static final int EMPTSTACK = 39; 78 public static final int DEFINEMETHOD = 40; 79 public static final int ALIAS = 41; 80 public static final int UNDEF = 42; 81 public static final int DEFINED = 43; 82 public static final int POSTEXE = 44; 83 public static final int TRACE = 45; 84 public static final int DEFINECLASS = 46; 85 public static final int SEND = 47; 86 public static final int INVOKESUPER = 48; 87 public static final int INVOKEBLOCK = 49; 88 public static final int LEAVE = 50; 89 public static final int FINISH = 51; 90 public static final int THROW = 52; 91 public static final int JUMP = 53; 92 public static final int BRANCHIF = 54; 93 public static final int BRANCHUNLESS = 55; 94 public static final int GETINLINECACHE = 56; 95 public static final int ONCEINLINECACHE = 57; 96 public static final int SETINLINECACHE = 58; 97 public static final int OPT_CASE_DISPATCH = 59; 98 public static final int OPT_CHECKENV = 60; 99 public static final int OPT_PLUS = 61; 100 public static final int OPT_MINUS = 62; 101 public static final int OPT_MULT = 63; 102 public static final int OPT_DIV = 64; 103 public static final int OPT_MOD = 65; 104 public static final int OPT_EQ = 66; 105 public static final int OPT_LT = 67; 106 public static final int OPT_LE = 68; 107 public static final int OPT_LTLT = 69; 108 public static final int OPT_AREF = 70; 109 public static final int OPT_ASET = 71; 110 public static final int OPT_LENGTH = 72; 111 public static final int OPT_SUCC = 73; 112 public static final int OPT_REGEXPMATCH1 = 74; 113 public static final int OPT_REGEXPMATCH2 = 75; 114 public static final int OPT_CALL_NATIVE_COMPILED = 76; 115 public static final int BITBLT = 77; 116 public static final int ANSWER = 78; 117 public static final int GETLOCAL_OP_2 = 79; 118 public static final int GETLOCAL_OP_3 = 80; 119 public static final int GETLOCAL_OP_4 = 81; 120 public static final int SETLOCAL_OP_2 = 82; 121 public static final int SETLOCAL_OP_3 = 83; 122 public static final int SETLOCAL_OP_4 = 84; 123 public static final int GETDYNAMIC_OP__WC__0 = 85; 124 public static final int GETDYNAMIC_OP_1_0 = 86; 125 public static final int GETDYNAMIC_OP_2_0 = 87; 126 public static final int GETDYNAMIC_OP_3_0 = 88; 127 public static final int GETDYNAMIC_OP_4_0 = 89; 128 public static final int SETDYNAMIC_OP__WC__0 = 90; 129 public static final int SETDYNAMIC_OP_1_0 = 91; 130 public static final int SETDYNAMIC_OP_2_0 = 92; 131 public static final int SETDYNAMIC_OP_3_0 = 93; 132 public static final int SETDYNAMIC_OP_4_0 = 94; 133 public static final int PUTOBJECT_OP_INT2FIX_0_0_C_ = 95; 134 public static final int PUTOBJECT_OP_INT2FIX_0_1_C_ = 96; 135 public static final int PUTOBJECT_OP_QTRUE = 97; 136 public static final int PUTOBJECT_OP_QFALSE = 98; 137 public static final int SEND_OP__WC___WC__QFALSE_0__WC_ = 99; 138 public static final int SEND_OP__WC__0_QFALSE_0__WC_ = 100; 139 public static final int SEND_OP__WC__1_QFALSE_0__WC_ = 101; 140 public static final int SEND_OP__WC__2_QFALSE_0__WC_ = 102; 141 public static final int SEND_OP__WC__3_QFALSE_0__WC_ = 103; 142 public static final int SEND_OP__WC___WC__QFALSE_0X04__WC_ = 104; 143 public static final int SEND_OP__WC__0_QFALSE_0X04__WC_ = 105; 144 public static final int SEND_OP__WC__1_QFALSE_0X04__WC_ = 106; 145 public static final int SEND_OP__WC__2_QFALSE_0X04__WC_ = 107; 146 public static final int SEND_OP__WC__3_QFALSE_0X04__WC_ = 108; 147 public static final int SEND_OP__WC__0_QFALSE_0X0C__WC_ = 109; 148 public static final int UNIFIED_PUTOBJECT_PUTOBJECT = 110; 149 public static final int UNIFIED_PUTOBJECT_PUTSTRING = 111; 150 public static final int UNIFIED_PUTOBJECT_SETLOCAL = 112; 151 public static final int UNIFIED_PUTOBJECT_SETDYNAMIC = 113; 152 public static final int UNIFIED_PUTSTRING_PUTSTRING = 114; 153 public static final int UNIFIED_PUTSTRING_PUTOBJECT = 115; 154 public static final int UNIFIED_PUTSTRING_SETLOCAL = 116; 155 public static final int UNIFIED_PUTSTRING_SETDYNAMIC = 117; 156 public static final int UNIFIED_DUP_SETLOCAL = 118; 157 public static final int UNIFIED_GETLOCAL_GETLOCAL = 119; 158 public static final int UNIFIED_GETLOCAL_PUTOBJECT = 120; 159 160 public static final Map INSTS_TO_INDEX = new HashMap (); 161 static { 162 INSTS_TO_INDEX.put("nop",new Integer (0)); 163 INSTS_TO_INDEX.put("getlocal",new Integer (1)); 164 INSTS_TO_INDEX.put("setlocal",new Integer (2)); 165 INSTS_TO_INDEX.put("getspecial",new Integer (3)); 166 INSTS_TO_INDEX.put("setspecial",new Integer (4)); 167 INSTS_TO_INDEX.put("getdynamic",new Integer (5)); 168 INSTS_TO_INDEX.put("setdynamic",new Integer (6)); 169 INSTS_TO_INDEX.put("getinstancevariable",new Integer (7)); 170 INSTS_TO_INDEX.put("setinstancevariable",new Integer (8)); 171 INSTS_TO_INDEX.put("getclassvariable",new Integer (9)); 172 INSTS_TO_INDEX.put("setclassvariable",new Integer (10)); 173 INSTS_TO_INDEX.put("getconstant",new Integer (11)); 174 INSTS_TO_INDEX.put("setconstant",new Integer (12)); 175 INSTS_TO_INDEX.put("getglobal",new Integer (13)); 176 INSTS_TO_INDEX.put("setglobal",new Integer (14)); 177 INSTS_TO_INDEX.put("putnil",new Integer (15)); 178 INSTS_TO_INDEX.put("putself",new Integer (16)); 179 INSTS_TO_INDEX.put("putundef",new Integer (17)); 180 INSTS_TO_INDEX.put("putobject",new Integer (18)); 181 INSTS_TO_INDEX.put("putstring",new Integer (19)); 182 INSTS_TO_INDEX.put("concatstrings",new Integer (20)); 183 INSTS_TO_INDEX.put("tostring",new Integer (21)); 184 INSTS_TO_INDEX.put("toregexp",new Integer (22)); 185 INSTS_TO_INDEX.put("newarray",new Integer (23)); 186 INSTS_TO_INDEX.put("duparray",new Integer (24)); 187 INSTS_TO_INDEX.put("expandarray",new Integer (25)); 188 INSTS_TO_INDEX.put("concatarray",new Integer (26)); 189 INSTS_TO_INDEX.put("splatarray",new Integer (27)); 190 INSTS_TO_INDEX.put("checkincludearray",new Integer (28)); 191 INSTS_TO_INDEX.put("newhash",new Integer (29)); 192 INSTS_TO_INDEX.put("newrange",new Integer (30)); 193 INSTS_TO_INDEX.put("putnot",new Integer (31)); 194 INSTS_TO_INDEX.put("pop",new Integer (32)); 195 INSTS_TO_INDEX.put("dup",new Integer (33)); 196 INSTS_TO_INDEX.put("dupn",new Integer (34)); 197 INSTS_TO_INDEX.put("swap",new Integer (35)); 198 INSTS_TO_INDEX.put("reput",new Integer (36)); 199 INSTS_TO_INDEX.put("topn",new Integer (37)); 200 INSTS_TO_INDEX.put("setn",new Integer (38)); 201 INSTS_TO_INDEX.put("emptstack",new Integer (39)); 202 INSTS_TO_INDEX.put("definemethod",new Integer (40)); 203 INSTS_TO_INDEX.put("alias",new Integer (41)); 204 INSTS_TO_INDEX.put("undef",new Integer (42)); 205 INSTS_TO_INDEX.put("defined",new Integer (43)); 206 INSTS_TO_INDEX.put("postexe",new Integer (44)); 207 INSTS_TO_INDEX.put("trace",new Integer (45)); 208 INSTS_TO_INDEX.put("defineclass",new Integer (46)); 209 INSTS_TO_INDEX.put("send",new Integer (47)); 210 INSTS_TO_INDEX.put("invokesuper",new Integer (48)); 211 INSTS_TO_INDEX.put("invokeblock",new Integer (49)); 212 INSTS_TO_INDEX.put("leave",new Integer (50)); 213 INSTS_TO_INDEX.put("finish",new Integer (51)); 214 INSTS_TO_INDEX.put("throw",new Integer (52)); 215 INSTS_TO_INDEX.put("jump",new Integer (53)); 216 INSTS_TO_INDEX.put("branchif",new Integer (54)); 217 INSTS_TO_INDEX.put("branchunless",new Integer (55)); 218 INSTS_TO_INDEX.put("getinlinecache",new Integer (56)); 219 INSTS_TO_INDEX.put("onceinlinecache",new Integer (57)); 220 INSTS_TO_INDEX.put("setinlinecache",new Integer (58)); 221 INSTS_TO_INDEX.put("opt_case_dispatch",new Integer (59)); 222 INSTS_TO_INDEX.put("opt_checkenv",new Integer (60)); 223 INSTS_TO_INDEX.put("opt_plus",new Integer (61)); 224 INSTS_TO_INDEX.put("opt_minus",new Integer (62)); 225 INSTS_TO_INDEX.put("opt_mult",new Integer (63)); 226 INSTS_TO_INDEX.put("opt_div",new Integer (64)); 227 INSTS_TO_INDEX.put("opt_mod",new Integer (65)); 228 INSTS_TO_INDEX.put("opt_eq",new Integer (66)); 229 INSTS_TO_INDEX.put("opt_lt",new Integer (67)); 230 INSTS_TO_INDEX.put("opt_le",new Integer (68)); 231 INSTS_TO_INDEX.put("opt_ltlt",new Integer (69)); 232 INSTS_TO_INDEX.put("opt_aref",new Integer (70)); 233 INSTS_TO_INDEX.put("opt_aset",new Integer (71)); 234 INSTS_TO_INDEX.put("opt_length",new Integer (72)); 235 INSTS_TO_INDEX.put("opt_succ",new Integer (73)); 236 INSTS_TO_INDEX.put("opt_regexpmatch1",new Integer (74)); 237 INSTS_TO_INDEX.put("opt_regexpmatch2",new Integer (75)); 238 INSTS_TO_INDEX.put("opt_call_native_compiled",new Integer (76)); 239 INSTS_TO_INDEX.put("bitblt",new Integer (77)); 240 INSTS_TO_INDEX.put("answer",new Integer (78)); 241 INSTS_TO_INDEX.put("getlocal_op_2",new Integer (79)); 242 INSTS_TO_INDEX.put("getlocal_op_3",new Integer (80)); 243 INSTS_TO_INDEX.put("getlocal_op_4",new Integer (81)); 244 INSTS_TO_INDEX.put("setlocal_op_2",new Integer (82)); 245 INSTS_TO_INDEX.put("setlocal_op_3",new Integer (83)); 246 INSTS_TO_INDEX.put("setlocal_op_4",new Integer (84)); 247 INSTS_TO_INDEX.put("getdynamic_op__wc__0",new Integer (85)); 248 INSTS_TO_INDEX.put("getdynamic_op_1_0",new Integer (86)); 249 INSTS_TO_INDEX.put("getdynamic_op_2_0",new Integer (87)); 250 INSTS_TO_INDEX.put("getdynamic_op_3_0",new Integer (88)); 251 INSTS_TO_INDEX.put("getdynamic_op_4_0",new Integer (89)); 252 INSTS_TO_INDEX.put("setdynamic_op__wc__0",new Integer (90)); 253 INSTS_TO_INDEX.put("setdynamic_op_1_0",new Integer (91)); 254 INSTS_TO_INDEX.put("setdynamic_op_2_0",new Integer (92)); 255 INSTS_TO_INDEX.put("setdynamic_op_3_0",new Integer (93)); 256 INSTS_TO_INDEX.put("setdynamic_op_4_0",new Integer (94)); 257 INSTS_TO_INDEX.put("putobject_op_int2fix_0_0_c_",new Integer (95)); 258 INSTS_TO_INDEX.put("putobject_op_int2fix_0_1_c_",new Integer (96)); 259 INSTS_TO_INDEX.put("putobject_op_qtrue",new Integer (97)); 260 INSTS_TO_INDEX.put("putobject_op_qfalse",new Integer (98)); 261 INSTS_TO_INDEX.put("send_op__wc___wc__qfalse_0__wc_",new Integer (99)); 262 INSTS_TO_INDEX.put("send_op__wc__0_qfalse_0__wc_",new Integer (100)); 263 INSTS_TO_INDEX.put("send_op__wc__1_qfalse_0__wc_",new Integer (101)); 264 INSTS_TO_INDEX.put("send_op__wc__2_qfalse_0__wc_",new Integer (102)); 265 INSTS_TO_INDEX.put("send_op__wc__3_qfalse_0__wc_",new Integer (103)); 266 INSTS_TO_INDEX.put("send_op__wc___wc__qfalse_0x04__wc_",new Integer (104)); 267 INSTS_TO_INDEX.put("send_op__wc__0_qfalse_0x04__wc_",new Integer (105)); 268 INSTS_TO_INDEX.put("send_op__wc__1_qfalse_0x04__wc_",new Integer (106)); 269 INSTS_TO_INDEX.put("send_op__wc__2_qfalse_0x04__wc_",new Integer (107)); 270 INSTS_TO_INDEX.put("send_op__wc__3_qfalse_0x04__wc_",new Integer (108)); 271 INSTS_TO_INDEX.put("send_op__wc__0_qfalse_0x0c__wc_",new Integer (109)); 272 INSTS_TO_INDEX.put("unified_putobject_putobject",new Integer (110)); 273 INSTS_TO_INDEX.put("unified_putobject_putstring",new Integer (111)); 274 INSTS_TO_INDEX.put("unified_putobject_setlocal",new Integer (112)); 275 INSTS_TO_INDEX.put("unified_putobject_setdynamic",new Integer (113)); 276 INSTS_TO_INDEX.put("unified_putstring_putstring",new Integer (114)); 277 INSTS_TO_INDEX.put("unified_putstring_putobject",new Integer (115)); 278 INSTS_TO_INDEX.put("unified_putstring_setlocal",new Integer (116)); 279 INSTS_TO_INDEX.put("unified_putstring_setdynamic",new Integer (117)); 280 INSTS_TO_INDEX.put("unified_dup_setlocal",new Integer (118)); 281 INSTS_TO_INDEX.put("unified_getlocal_getlocal",new Integer (119)); 282 INSTS_TO_INDEX.put("unified_getlocal_putobject",new Integer (120)); 283 } 284 public static int instruction(String name) { 285 return ((Integer )INSTS_TO_INDEX.get(name)).intValue(); 286 } 287 288 public static final String [] INDEX_TO_NAME = new String [] { 289 "nop", 290 "getlocal", 291 "setlocal", 292 "getspecial", 293 "setspecial", 294 "getdynamic", 295 "setdynamic", 296 "getinstancevariable", 297 "setinstancevariable", 298 "getclassvariable", 299 "setclassvariable", 300 "getconstant", 301 "setconstant", 302 "getglobal", 303 "setglobal", 304 "putnil", 305 "putself", 306 "putundef", 307 "putobject", 308 "putstring", 309 "concatstrings", 310 "tostring", 311 "toregexp", 312 "newarray", 313 "duparray", 314 "expandarray", 315 "concatarray", 316 "splatarray", 317 "checkincludearray", 318 "newhash", 319 "newrange", 320 "putnot", 321 "pop", 322 "dup", 323 "dupn", 324 "swap", 325 "reput", 326 "topn", 327 "setn", 328 "emptstack", 329 "definemethod", 330 "alias", 331 "undef", 332 "defined", 333 "postexe", 334 "trace", 335 "defineclass", 336 "send", 337 "invokesuper", 338 "invokeblock", 339 "leave", 340 "finish", 341 "throw", 342 "jump", 343 "branchif", 344 "branchunless", 345 "getinlinecache", 346 "onceinlinecache", 347 "setinlinecache", 348 "opt_case_dispatch", 349 "opt_checkenv", 350 "opt_plus", 351 "opt_minus", 352 "opt_mult", 353 "opt_div", 354 "opt_mod", 355 "opt_eq", 356 "opt_lt", 357 "opt_le", 358 "opt_ltlt", 359 "opt_aref", 360 "opt_aset", 361 "opt_length", 362 "opt_succ", 363 "opt_regexpmatch1", 364 "opt_regexpmatch2", 365 "opt_call_native_compiled", 366 "bitblt", 367 "answer", 368 "getlocal_op_2", 369 "getlocal_op_3", 370 "getlocal_op_4", 371 "setlocal_op_2", 372 "setlocal_op_3", 373 "setlocal_op_4", 374 "getdynamic_op__wc__0", 375 "getdynamic_op_1_0", 376 "getdynamic_op_2_0", 377 "getdynamic_op_3_0", 378 "getdynamic_op_4_0", 379 "setdynamic_op__wc__0", 380 "setdynamic_op_1_0", 381 "setdynamic_op_2_0", 382 "setdynamic_op_3_0", 383 "setdynamic_op_4_0", 384 "putobject_op_int2fix_0_0_c_", 385 "putobject_op_int2fix_0_1_c_", 386 "putobject_op_qtrue", 387 "putobject_op_qfalse", 388 "send_op__wc___wc__qfalse_0__wc_", 389 "send_op__wc__0_qfalse_0__wc_", 390 "send_op__wc__1_qfalse_0__wc_", 391 "send_op__wc__2_qfalse_0__wc_", 392 "send_op__wc__3_qfalse_0__wc_", 393 "send_op__wc___wc__qfalse_0x04__wc_", 394 "send_op__wc__0_qfalse_0x04__wc_", 395 "send_op__wc__1_qfalse_0x04__wc_", 396 "send_op__wc__2_qfalse_0x04__wc_", 397 "send_op__wc__3_qfalse_0x04__wc_", 398 "send_op__wc__0_qfalse_0x0c__wc_", 399 "unified_putobject_putobject", 400 "unified_putobject_putstring", 401 "unified_putobject_setlocal", 402 "unified_putobject_setdynamic", 403 "unified_putstring_putstring", 404 "unified_putstring_putobject", 405 "unified_putstring_setlocal", 406 "unified_putstring_setdynamic", 407 "unified_dup_setlocal", 408 "unified_getlocal_getlocal", 409 "unified_getlocal_putobject"}; 410 411 public static String name(int index) { 412 return INDEX_TO_NAME[index]; 413 } 414 415 public static final int ARGS_SPLAT_FLAG = 2; 416 public static final int ARGS_BLOCKARG_FLAG = 4; 417 public static final int FCALL_FLAG = 8; 418 public static final int VCALL_FLAG = 16; 419 public static final int TAILCALL_FLAG = 32; 420 public static final int TAILRECURSION_FLAG = 64; 421 public static final int SUPER = 128; 422 } 423 | Popular Tags |