
1: /** -*-c-*- 2: This file contains instruction information for yarv instruction sequence. 3: 4: ---- 5: This file is auto generated by insns2vm.rb 6: DO NOT TOUCH! 7: 8: If you want to fix something, you must edit 'template/insns_info.inc.tmpl' 9: or insns2vm.rb 10: */ 11: 12: #define TS_ISEQ 'S' 13: #define TS_GENTRY 'G' 14: #define TS_OFFSET 'O' 15: #define TS_DINDEX 'D' 16: #define TS_VARIABLE '.' 17: #define TS_CDHASH 'H' 18: #define TS_IC 'C' 19: #define TS_ID 'I' 20: #define TS_FUNCPTR 'F' 21: #define TS_VALUE 'V' 22: #define TS_LINDEX 'L' 23: #define TS_NUM 'N' 24: 25: static char *insn_name_info[] = { 26: "nop", 27: "getlocal", 28: "setlocal", 29: "getspecial", 30: "setspecial", 31: "getdynamic", 32: "setdynamic", 33: "getinstancevariable", 34: "setinstancevariable", 35: "getclassvariable", 36: "setclassvariable", 37: "getconstant", 38: "setconstant", 39: "getglobal", 40: "setglobal", 41: "putnil", 42: "putself", 43: "putobject", 44: "putstring", 45: "concatstrings", 46: "tostring", 47: "toregexp", 48: "newarray", 49: "duparray", 50: "expandarray", 51: "concatarray", 52: "splatarray", 53: "checkincludearray", 54: "newhash", 55: "newrange", 56: "pop", 57: "dup", 58: "dupn", 59: "swap", 60: "reput", 61: "topn", 62: "setn", 63: "emptstack", 64: "definemethod", 65: "alias", 66: "undef", 67: "defined", 68: "postexe", 69: "trace", 70: "defineclass", 71: "send", 72: "invokesuper", 73: "invokeblock", 74: "leave", 75: "finish", 76: "throw", 77: "jump", 78: "branchif", 79: "branchunless", 80: "getinlinecache", 81: "onceinlinecache", 82: "setinlinecache", 83: "opt_case_dispatch", 84: "opt_checkenv", 85: "opt_plus", 86: "opt_minus", 87: "opt_mult", 88: "opt_div", 89: "opt_mod", 90: "opt_eq", 91: "opt_neq", 92: "opt_lt", 93: "opt_le", 94: "opt_gt", 95: "opt_ge", 96: "opt_ltlt", 97: "opt_aref", 98: "opt_aset", 99: "opt_length", 100: "opt_succ", 101: "opt_not", 102: "opt_regexpmatch1", 103: "opt_regexpmatch2", 104: "opt_call_c_function", 105: "bitblt", 106: "answer", 107: 108: }; 109: 110: static char *insn_operand_info[] = { 111: "", 112: "L", 113: "L", 114: "VN", 115: "V", 116: "DN", 117: "DN", 118: "I", 119: "I", 120: "I", 121: "I", 122: "I", 123: "I", 124: "G", 125: "G", 126: "", 127: "", 128: "V", 129: "V", 130: "N", 131: "", 132: "N", 133: "N", 134: "V", 135: "NN", 136: "", 137: "V", 138: "V", 139: "N", 140: "N", 141: "", 142: "", 143: "N", 144: "", 145: "", 146: "N", 147: "N", 148: "", 149: "ISN", 150: "V", 151: "", 152: "NVV", 153: "S", 154: "N", 155: "ISN", 156: "INSNC", 157: "NSN", 158: "NN", 159: "", 160: "", 161: "N", 162: "O", 163: "O", 164: "O", 165: "CO", 166: "CO", 167: "O", 168: "HO", 169: "", 170: "", 171: "", 172: "", 173: "", 174: "", 175: "C", 176: "CC", 177: "", 178: "", 179: "", 180: "", 181: "", 182: "", 183: "", 184: "", 185: "", 186: "C", 187: "V", 188: "", 189: "F", 190: "", 191: "", 192: 193: }; 194: 195: static int insn_len_info[] = { 196: 1, 197: 2, 198: 2, 199: 3, 200: 2, 201: 3, 202: 3, 203: 2, 204: 2, 205: 2, 206: 2, 207: 2, 208: 2, 209: 2, 210: 2, 211: 1, 212: 1, 213: 2, 214: 2, 215: 2, 216: 1, 217: 2, 218: 2, 219: 2, 220: 3, 221: 1, 222: 2, 223: 2, 224: 2, 225: 2, 226: 1, 227: 1, 228: 2, 229: 1, 230: 1, 231: 2, 232: 2, 233: 1, 234: 4, 235: 2, 236: 1, 237: 4, 238: 2, 239: 2, 240: 4, 241: 6, 242: 4, 243: 3, 244: 1, 245: 1, 246: 2, 247: 2, 248: 2, 249: 2, 250: 3, 251: 3, 252: 2, 253: 3, 254: 1, 255: 1, 256: 1, 257: 1, 258: 1, 259: 1, 260: 2, 261: 3, 262: 1, 263: 1, 264: 1, 265: 1, 266: 1, 267: 1, 268: 1, 269: 1, 270: 1, 271: 2, 272: 2, 273: 1, 274: 2, 275: 1, 276: 1, 277: 278: }; 279: 280: #ifdef USE_INSN_RET_NUM 281: static int insn_stack_push_num_info[] = { 282: 0, 283: 1, 284: 0, 285: 1, 286: 0, 287: 1, 288: 0, 289: 1, 290: 0, 291: 1, 292: 0, 293: 1, 294: 0, 295: 1, 296: 0, 297: 1, 298: 1, 299: 1, 300: 1, 301: 1, 302: 1, 303: 1, 304: 1, 305: 1, 306: 1, 307: 1, 308: 1, 309: 2, 310: 1, 311: 1, 312: 0, 313: 2, 314: 1, 315: 2, 316: 1, 317: 1, 318: 1, 319: 1, 320: 0, 321: 0, 322: 0, 323: 1, 324: 0, 325: 0, 326: 1, 327: 1, 328: 1, 329: 1, 330: 1, 331: 1, 332: 1, 333: 0, 334: 0, 335: 0, 336: 1, 337: 1, 338: 1, 339: 0, 340: 0, 341: 1, 342: 1, 343: 1, 344: 1, 345: 1, 346: 1, 347: 1, 348: 1, 349: 1, 350: 1, 351: 1, 352: 1, 353: 1, 354: 1, 355: 1, 356: 1, 357: 1, 358: 1, 359: 1, 360: 0, 361: 1, 362: 1, 363: 364: }; 365: #endif 366: 367: #ifdef USE_INSN_STACK_INCREASE 368: static int 369: insn_stack_increase(int depth, int insn, VALUE *opes) 370: { 371: switch(insn){ 372: case BIN(nop):{ 373: return depth + 0; 374: } 375: case BIN(getlocal):{ 376: return depth + 1; 377: } 378: case BIN(setlocal):{ 379: return depth + -1; 380: } 381: case BIN(getspecial):{ 382: return depth + 1; 383: } 384: case BIN(setspecial):{ 385: return depth + -1; 386: } 387: case BIN(getdynamic):{ 388: return depth + 1; 389: } 390: case BIN(setdynamic):{ 391: return depth + -1; 392: } 393: case BIN(getinstancevariable):{ 394: return depth + 1; 395: } 396: case BIN(setinstancevariable):{ 397: return depth + -1; 398: } 399: case BIN(getclassvariable):{ 400: return depth + 1; 401: } 402: case BIN(setclassvariable):{ 403: return depth + -1; 404: } 405: case BIN(getconstant):{ 406: return depth + 0; 407: } 408: case BIN(setconstant):{ 409: return depth + -2; 410: } 411: case BIN(getglobal):{ 412: return depth + 1; 413: } 414: case BIN(setglobal):{ 415: return depth + -1; 416: } 417: case BIN(putnil):{ 418: return depth + 1; 419: } 420: case BIN(putself):{ 421: return depth + 1; 422: } 423: case BIN(putobject):{ 424: return depth + 1; 425: } 426: case BIN(putstring):{ 427: return depth + 1; 428: } 429: case BIN(concatstrings):{ 430: int inc = 0; 431: unsigned long num = FIX2INT(opes[0]); 432: inc += 1 - num;; 433: return depth + inc; 434: } 435: case BIN(tostring):{ 436: return depth + 0; 437: } 438: case BIN(toregexp):{ 439: return depth + 0; 440: } 441: case BIN(newarray):{ 442: int inc = 0; 443: unsigned long num = FIX2INT(opes[0]); 444: inc += 1 - num;; 445: return depth + inc; 446: } 447: case BIN(duparray):{ 448: return depth + 1; 449: } 450: case BIN(expandarray):{ 451: int inc = 0; 452: unsigned long num = FIX2INT(opes[0]); 453: unsigned long flag = FIX2INT(opes[1]); 454: inc += flag == 0x02 ? num : ((num > 0) ? num - 1 + (flag ? 1 : 0) : num + 1 - (flag ? 1 : 0));; 455: return depth + inc; 456: } 457: case BIN(concatarray):{ 458: return depth + -1; 459: } 460: case BIN(splatarray):{ 461: return depth + 0; 462: } 463: case BIN(checkincludearray):{ 464: return depth + 0; 465: } 466: case BIN(newhash):{ 467: int inc = 0; 468: unsigned long num = FIX2INT(opes[0]); 469: inc += 1 - num;; 470: return depth + inc; 471: } 472: case BIN(newrange):{ 473: return depth + -1; 474: } 475: case BIN(pop):{ 476: return depth + -1; 477: } 478: case BIN(dup):{ 479: return depth + 1; 480: } 481: case BIN(dupn):{ 482: int inc = 0; 483: unsigned long n = FIX2INT(opes[0]); 484: inc += n;; 485: return depth + inc; 486: } 487: case BIN(swap):{ 488: return depth + 0; 489: } 490: case BIN(reput):{ 491: int inc = 0; 492: inc += 0;; 493: return depth + inc; 494: } 495: case BIN(topn):{ 496: int inc = 0; 497: unsigned long n = FIX2INT(opes[0]); 498: inc += 1;; 499: return depth + inc; 500: } 501: case BIN(setn):{ 502: int inc = 0; 503: unsigned long n = FIX2INT(opes[0]); 504: inc += 0; 505: return depth + inc; 506: } 507: case BIN(emptstack):{ 508: int inc = 0; 509: inc = 0; depth = 0;; 510: return depth + inc; 511: } 512: case BIN(definemethod):{ 513: return depth + -1; 514: } 515: case BIN(alias):{ 516: return depth + -2; 517: } 518: case BIN(undef):{ 519: return depth + -1; 520: } 521: case BIN(defined):{ 522: return depth + 0; 523: } 524: case BIN(postexe):{ 525: return depth + 0; 526: } 527: case BIN(trace):{ 528: return depth + 0; 529: } 530: case BIN(defineclass):{ 531: return depth + -1; 532: } 533: case BIN(send):{ 534: int inc = 0; 535: unsigned long op_argc = FIX2INT(opes[1]); 536: unsigned long op_flag = FIX2INT(opes[3]); 537: inc += - (op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));; 538: return depth + inc; 539: } 540: case BIN(invokesuper):{ 541: int inc = 0; 542: unsigned long op_argc = FIX2INT(opes[0]); 543: unsigned long op_flag = FIX2INT(opes[2]); 544: inc += - op_argc;; 545: return depth + inc; 546: } 547: case BIN(invokeblock):{ 548: int inc = 0; 549: unsigned long num = FIX2INT(opes[0]); 550: unsigned long flag = FIX2INT(opes[1]); 551: inc += 1 - num;; 552: return depth + inc; 553: } 554: case BIN(leave):{ 555: return depth + 0; 556: } 557: case BIN(finish):{ 558: return depth + 0; 559: } 560: case BIN(throw):{ 561: return depth + 0; 562: } 563: case BIN(jump):{ 564: return depth + 0; 565: } 566: case BIN(branchif):{ 567: return depth + -1; 568: } 569: case BIN(branchunless):{ 570: return depth + -1; 571: } 572: case BIN(getinlinecache):{ 573: return depth + 1; 574: } 575: case BIN(onceinlinecache):{ 576: return depth + 1; 577: } 578: case BIN(setinlinecache):{ 579: return depth + 0; 580: } 581: case BIN(opt_case_dispatch):{ 582: int inc = 0; 583: inc += -1;; 584: return depth + inc; 585: } 586: case BIN(opt_checkenv):{ 587: return depth + 0; 588: } 589: case BIN(opt_plus):{ 590: return depth + -1; 591: } 592: case BIN(opt_minus):{ 593: return depth + -1; 594: } 595: case BIN(opt_mult):{ 596: return depth + -1; 597: } 598: case BIN(opt_div):{ 599: return depth + -1; 600: } 601: case BIN(opt_mod):{ 602: return depth + -1; 603: } 604: case BIN(opt_eq):{ 605: return depth + -1; 606: } 607: case BIN(opt_neq):{ 608: return depth + -1; 609: } 610: case BIN(opt_lt):{ 611: return depth + -1; 612: } 613: case BIN(opt_le):{ 614: return depth + -1; 615: } 616: case BIN(opt_gt):{ 617: return depth + -1; 618: } 619: case BIN(opt_ge):{ 620: return depth + -1; 621: } 622: case BIN(opt_ltlt):{ 623: return depth + -1; 624: } 625: case BIN(opt_aref):{ 626: return depth + -1; 627: } 628: case BIN(opt_aset):{ 629: return depth + -2; 630: } 631: case BIN(opt_length):{ 632: return depth + 0; 633: } 634: case BIN(opt_succ):{ 635: return depth + 0; 636: } 637: case BIN(opt_not):{ 638: return depth + 0; 639: } 640: case BIN(opt_regexpmatch1):{ 641: return depth + 0; 642: } 643: case BIN(opt_regexpmatch2):{ 644: return depth + -1; 645: } 646: case BIN(opt_call_c_function):{ 647: return depth + 0; 648: } 649: case BIN(bitblt):{ 650: return depth + 1; 651: } 652: case BIN(answer):{ 653: return depth + 1; 654: } 655: 656: default: 657: rb_bug("insn_sp_increase: unreachable"); 658: } 659: return 0; 660: } 661: #endif 662: 663: /* some utilities */ 664: 665: static int 666: insn_len(int insn) 667: { 668: return insn_len_info[insn]; 669: } 670: 671: static char * 672: insn_name(int insn) 673: { 674: return insn_name_info[insn]; 675: } 676: 677: static char * 678: insn_op_types(int insn) 679: { 680: return insn_operand_info[insn]; 681: } 682: 683: static int 684: insn_op_type(int insn, int pos) 685: { 686: int len = insn_len(insn) - 1; 687: if(pos < len){ 688: return insn_operand_info[insn][pos]; 689: } 690: else{ 691: return 0; 692: } 693: } 694: 695: #ifdef USE_INSN_RET_NUM 696: static int 697: insn_ret_num(int insn) 698: { 699: return insn_stack_push_num_info[insn]; 700: } 701: #endif