diff options
author | Joe Burmeister <joe.burmeister@codethink.co.uk> | 2012-08-20 16:04:29 +0000 |
---|---|---|
committer | Joe Burmeister <joe.burmeister@codethink.co.uk> | 2012-08-20 16:04:29 +0000 |
commit | 3b8f5d15de83045de136586ea36ea6c9cfb841d7 (patch) | |
tree | 2869e289eeabe83ddda29194742b79b16c4572e8 | |
parent | 86f774fa1cd1adf70c3b547feee1fa07c36f9b02 (diff) | |
download | ruby-3b8f5d15de83045de136586ea36ea6c9cfb841d7.tar.gz |
Baked autogenerated files so can be bootstrapped without Ruby.
Also change in configure to use "catv -e" instead of "cat -e" due to Baserock using Busybox's cat.
-rw-r--r-- | .id.h.time | 0 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | id.h | 175 | ||||
-rw-r--r-- | insns.inc | 179 | ||||
-rw-r--r-- | insns_info.inc | 695 | ||||
-rw-r--r-- | known_errors.inc | 731 | ||||
-rw-r--r-- | miniprelude.c | 66 | ||||
-rw-r--r-- | newline.c | 189 | ||||
-rw-r--r-- | node_name.inc | 208 | ||||
-rw-r--r-- | opt_sc.inc | 670 | ||||
-rw-r--r-- | optinsn.inc | 30 | ||||
-rw-r--r-- | optunifs.inc | 116 | ||||
-rw-r--r-- | vm.inc | 3051 | ||||
-rw-r--r-- | vmtc.inc | 97 |
14 files changed, 6208 insertions, 1 deletions
diff --git a/.id.h.time b/.id.h.time new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/.id.h.time diff --git a/configure.in b/configure.in index 6d2468987c..3f4725dc60 100644 --- a/configure.in +++ b/configure.in @@ -1951,7 +1951,7 @@ AC_ARG_WITH(dln-a-out, AC_CACHE_CHECK(whether ELF binaries are produced, rb_cv_binary_elf, [AC_TRY_LINK([],[], [ -AS_CASE(["`head -1 conftest$EXEEXT | cat -e`"], +AS_CASE(["`head -1 conftest$EXEEXT | catv -e`"], ['^?ELF'*], [rb_cv_binary_elf=yes], [rb_cv_binary_elf=no])], rb_cv_binary_elf=no)]) @@ -0,0 +1,175 @@ +/* DO NOT EDIT THIS FILE DIRECTLY */ +/********************************************************************** + + id.h - + + $Author$ + created at: Sun Oct 19 21:12:51 2008 + + Copyright (C) 2007 Koichi Sasada + +**********************************************************************/ + +#ifndef RUBY_ID_H +#define RUBY_ID_H + +#define ID_SCOPE_SHIFT 3 +#define ID_SCOPE_MASK 0x07 +#define ID_LOCAL 0x00 +#define ID_INSTANCE 0x01 +#define ID_GLOBAL 0x03 +#define ID_ATTRSET 0x04 +#define ID_CONST 0x05 +#define ID_CLASS 0x06 +#define ID_JUNK 0x07 +#define ID_INTERNAL ID_JUNK + +#ifdef USE_PARSE_H +#include "parse.h" +#endif + +#include "vm_opts.h" /* for SUPPORT_JOKE */ + +#define symIFUNC ID2SYM(idIFUNC) +#define symCFUNC ID2SYM(idCFUNC) + +#if !defined tLAST_TOKEN && defined YYTOKENTYPE +#define tLAST_TOKEN tLAST_TOKEN +#endif + +enum ruby_method_ids { +#ifndef tLAST_TOKEN + tUPLUS = 321, + tUMINUS = 322, + tPOW = 323, + tCMP = 324, + tEQ = 325, + tEQQ = 326, + tNEQ = 327, + tGEQ = 328, + tLEQ = 329, + tANDOP = 330, + tOROP = 331, + tMATCH = 332, + tNMATCH = 333, + tDOT2 = 334, + tDOT3 = 335, + tAREF = 336, + tASET = 337, + tLSHFT = 338, + tRSHFT = 339, + tLAMBDA = 352, + idNULL = 365, + idRespond_to = 366, + idIFUNC = 367, + idCFUNC = 368, + id_core_set_method_alias = 369, + id_core_set_variable_alias = 370, + id_core_undef_method = 371, + id_core_define_method = 372, + id_core_define_singleton_method = 373, + id_core_set_postexe = 374, + tLAST_TOKEN = 375, +#endif + idDot2 = tDOT2, + idDot3 = tDOT3, + idUPlus = tUPLUS, + idUMinus = tUMINUS, + idPow = tPOW, + idCmp = tCMP, + idPLUS = '+', + idMINUS = '-', + idMULT = '*', + idDIV = '/', + idMOD = '%', + idLT = '<', + idLTLT = tLSHFT, + idLE = tLEQ, + idGT = '>', + idGE = tGEQ, + idEq = tEQ, + idEqq = tEQQ, + idNeq = tNEQ, + idNot = '!', + idBackquote = '`', + idEqTilde = tMATCH, + idNeqTilde = tNMATCH, + idAREF = tAREF, + idASET = tASET, + idLAST_TOKEN = tLAST_TOKEN >> ID_SCOPE_SHIFT, + tIntern, + tMethodMissing, + tLength, + tSize, + tGets, + tSucc, + tEach, + tLambda, + tSend, + t__send__, + tInitialize, + tUScore, +#if SUPPORT_JOKE + tBitblt, + tAnswer, +#endif + tLAST_ID, +#define TOKEN2ID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_LOCAL) +#if SUPPORT_JOKE + TOKEN2ID(Bitblt), + TOKEN2ID(Answer), +#endif + TOKEN2ID(Intern), + TOKEN2ID(MethodMissing), + TOKEN2ID(Length), + TOKEN2ID(Size), + TOKEN2ID(Gets), + TOKEN2ID(Succ), + TOKEN2ID(Each), + TOKEN2ID(Lambda), + TOKEN2ID(Send), + TOKEN2ID(__send__), + TOKEN2ID(Initialize), + TOKEN2ID(UScore), + TOKEN2ID(LAST_ID) +}; + +#ifdef tLAST_TOKEN +struct ruby_method_ids_check { +#define ruby_method_id_check_for(name, value) \ + int checking_for_##name[name == (value) ? 1 : -1] +ruby_method_id_check_for(tUPLUS, 321); +ruby_method_id_check_for(tUMINUS, 322); +ruby_method_id_check_for(tPOW, 323); +ruby_method_id_check_for(tCMP, 324); +ruby_method_id_check_for(tEQ, 325); +ruby_method_id_check_for(tEQQ, 326); +ruby_method_id_check_for(tNEQ, 327); +ruby_method_id_check_for(tGEQ, 328); +ruby_method_id_check_for(tLEQ, 329); +ruby_method_id_check_for(tANDOP, 330); +ruby_method_id_check_for(tOROP, 331); +ruby_method_id_check_for(tMATCH, 332); +ruby_method_id_check_for(tNMATCH, 333); +ruby_method_id_check_for(tDOT2, 334); +ruby_method_id_check_for(tDOT3, 335); +ruby_method_id_check_for(tAREF, 336); +ruby_method_id_check_for(tASET, 337); +ruby_method_id_check_for(tLSHFT, 338); +ruby_method_id_check_for(tRSHFT, 339); +ruby_method_id_check_for(tLAMBDA, 352); +ruby_method_id_check_for(idNULL, 365); +ruby_method_id_check_for(idRespond_to, 366); +ruby_method_id_check_for(idIFUNC, 367); +ruby_method_id_check_for(idCFUNC, 368); +ruby_method_id_check_for(id_core_set_method_alias, 369); +ruby_method_id_check_for(id_core_set_variable_alias, 370); +ruby_method_id_check_for(id_core_undef_method, 371); +ruby_method_id_check_for(id_core_define_method, 372); +ruby_method_id_check_for(id_core_define_singleton_method, 373); +ruby_method_id_check_for(id_core_set_postexe, 374); +ruby_method_id_check_for(tLAST_TOKEN, 375); +}; +#endif + +#endif /* RUBY_ID_H */ diff --git a/insns.inc b/insns.inc new file mode 100644 index 0000000000..b4d2865c7d --- /dev/null +++ b/insns.inc @@ -0,0 +1,179 @@ +/** -*-c-*- + This file contains YARV instructions list. + + ---- + This file is auto generated by insns2vm.rb + DO NOT TOUCH! + + If you want to fix something, you must edit 'template/insns.inc.tmpl' + or insns2vm.rb + */ + + +/* BIN : Basic Instruction Name */ +#define BIN(n) YARVINSN_##n + +enum ruby_vminsn_type { + BIN(nop) = 0, + + BIN(getlocal) = 1, + + BIN(setlocal) = 2, + + BIN(getspecial) = 3, + + BIN(setspecial) = 4, + + BIN(getdynamic) = 5, + + BIN(setdynamic) = 6, + + BIN(getinstancevariable) = 7, + + BIN(setinstancevariable) = 8, + + BIN(getclassvariable) = 9, + + BIN(setclassvariable) = 10, + + BIN(getconstant) = 11, + + BIN(setconstant) = 12, + + BIN(getglobal) = 13, + + BIN(setglobal) = 14, + + BIN(putnil) = 15, + + BIN(putself) = 16, + + BIN(putobject) = 17, + + BIN(putspecialobject) = 18, + + BIN(putiseq) = 19, + + BIN(putstring) = 20, + + BIN(concatstrings) = 21, + + BIN(tostring) = 22, + + BIN(toregexp) = 23, + + BIN(newarray) = 24, + + BIN(duparray) = 25, + + BIN(expandarray) = 26, + + BIN(concatarray) = 27, + + BIN(splatarray) = 28, + + BIN(checkincludearray) = 29, + + BIN(newhash) = 30, + + BIN(newrange) = 31, + + BIN(pop) = 32, + + BIN(dup) = 33, + + BIN(dupn) = 34, + + BIN(swap) = 35, + + BIN(reput) = 36, + + BIN(topn) = 37, + + BIN(setn) = 38, + + BIN(adjuststack) = 39, + + BIN(defined) = 40, + + BIN(trace) = 41, + + BIN(defineclass) = 42, + + BIN(send) = 43, + + BIN(invokesuper) = 44, + + BIN(invokeblock) = 45, + + BIN(leave) = 46, + + BIN(finish) = 47, + + BIN(throw) = 48, + + BIN(jump) = 49, + + BIN(branchif) = 50, + + BIN(branchunless) = 51, + + BIN(getinlinecache) = 52, + + BIN(onceinlinecache) = 53, + + BIN(setinlinecache) = 54, + + BIN(opt_case_dispatch) = 55, + + BIN(opt_checkenv) = 56, + + BIN(opt_plus) = 57, + + BIN(opt_minus) = 58, + + BIN(opt_mult) = 59, + + BIN(opt_div) = 60, + + BIN(opt_mod) = 61, + + BIN(opt_eq) = 62, + + BIN(opt_neq) = 63, + + BIN(opt_lt) = 64, + + BIN(opt_le) = 65, + + BIN(opt_gt) = 66, + + BIN(opt_ge) = 67, + + BIN(opt_ltlt) = 68, + + BIN(opt_aref) = 69, + + BIN(opt_aset) = 70, + + BIN(opt_length) = 71, + + BIN(opt_size) = 72, + + BIN(opt_succ) = 73, + + BIN(opt_not) = 74, + + BIN(opt_regexpmatch1) = 75, + + BIN(opt_regexpmatch2) = 76, + + BIN(opt_call_c_function) = 77, + + BIN(bitblt) = 78, + + BIN(answer) = 79, + + VM_INSTRUCTION_SIZE = 80 +}; + diff --git a/insns_info.inc b/insns_info.inc new file mode 100644 index 0000000000..951f2fc41f --- /dev/null +++ b/insns_info.inc @@ -0,0 +1,695 @@ +/** -*-c-*- + This file contains instruction information for yarv instruction sequence. + + ---- + This file is auto generated by insns2vm.rb + DO NOT TOUCH! + + If you want to fix something, you must edit 'template/insns_info.inc.tmpl' + or insns2vm.rb + */ + +#define TS_OFFSET 'O' +#define TS_NUM 'N' +#define TS_LINDEX 'L' +#define TS_DINDEX 'D' +#define TS_VALUE 'V' +#define TS_ID 'I' +#define TS_GENTRY 'G' +#define TS_IC 'C' +#define TS_CDHASH 'H' +#define TS_ISEQ 'S' +#define TS_VARIABLE '.' +#define TS_FUNCPTR 'F' + +static const char *const insn_name_info[] = { + "nop", + "getlocal", + "setlocal", + "getspecial", + "setspecial", + "getdynamic", + "setdynamic", + "getinstancevariable", + "setinstancevariable", + "getclassvariable", + "setclassvariable", + "getconstant", + "setconstant", + "getglobal", + "setglobal", + "putnil", + "putself", + "putobject", + "putspecialobject", + "putiseq", + "putstring", + "concatstrings", + "tostring", + "toregexp", + "newarray", + "duparray", + "expandarray", + "concatarray", + "splatarray", + "checkincludearray", + "newhash", + "newrange", + "pop", + "dup", + "dupn", + "swap", + "reput", + "topn", + "setn", + "adjuststack", + "defined", + "trace", + "defineclass", + "send", + "invokesuper", + "invokeblock", + "leave", + "finish", + "throw", + "jump", + "branchif", + "branchunless", + "getinlinecache", + "onceinlinecache", + "setinlinecache", + "opt_case_dispatch", + "opt_checkenv", + "opt_plus", + "opt_minus", + "opt_mult", + "opt_div", + "opt_mod", + "opt_eq", + "opt_neq", + "opt_lt", + "opt_le", + "opt_gt", + "opt_ge", + "opt_ltlt", + "opt_aref", + "opt_aset", + "opt_length", + "opt_size", + "opt_succ", + "opt_not", + "opt_regexpmatch1", + "opt_regexpmatch2", + "opt_call_c_function", + "bitblt", + "answer", + +}; + +static const char *const insn_operand_info[] = { + "", + "L", + "L", + "VN", + "V", + "DN", + "DN", + "IC", + "IC", + "I", + "I", + "I", + "I", + "G", + "G", + "", + "", + "V", + "N", + "S", + "V", + "N", + "", + "NN", + "N", + "V", + "NN", + "", + "V", + "V", + "N", + "N", + "", + "", + "N", + "", + "", + "N", + "N", + "N", + "NVV", + "N", + "ISN", + "INSNC", + "NSN", + "NN", + "", + "", + "N", + "O", + "O", + "O", + "OC", + "OC", + "C", + "HO", + "", + "C", + "C", + "C", + "C", + "C", + "C", + "CC", + "C", + "C", + "C", + "C", + "C", + "C", + "C", + "C", + "C", + "C", + "C", + "V", + "", + "F", + "", + "", + +}; + +static const int insn_len_info[] = { + 1, + 2, + 2, + 3, + 2, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 1, + 3, + 2, + 2, + 3, + 1, + 2, + 2, + 2, + 2, + 1, + 1, + 2, + 1, + 1, + 2, + 2, + 2, + 4, + 2, + 4, + 6, + 4, + 3, + 1, + 1, + 2, + 2, + 2, + 2, + 3, + 3, + 2, + 3, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 1, + +}; + +#ifdef USE_INSN_RET_NUM +static const int insn_stack_push_num_info[] = { + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 0, + 2, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + +}; +#endif + +#ifdef USE_INSN_STACK_INCREASE +static int +insn_stack_increase(int depth, int insn, VALUE *opes) +{ + switch(insn){ + case BIN(nop):{ + return depth + 0; + } + case BIN(getlocal):{ + return depth + 1; + } + case BIN(setlocal):{ + return depth + -1; + } + case BIN(getspecial):{ + return depth + 1; + } + case BIN(setspecial):{ + return depth + -1; + } + case BIN(getdynamic):{ + return depth + 1; + } + case BIN(setdynamic):{ + return depth + -1; + } + case BIN(getinstancevariable):{ + return depth + 1; + } + case BIN(setinstancevariable):{ + return depth + -1; + } + case BIN(getclassvariable):{ + return depth + 1; + } + case BIN(setclassvariable):{ + return depth + -1; + } + case BIN(getconstant):{ + return depth + 0; + } + case BIN(setconstant):{ + return depth + -2; + } + case BIN(getglobal):{ + return depth + 1; + } + case BIN(setglobal):{ + return depth + -1; + } + case BIN(putnil):{ + return depth + 1; + } + case BIN(putself):{ + return depth + 1; + } + case BIN(putobject):{ + return depth + 1; + } + case BIN(putspecialobject):{ + return depth + 1; + } + case BIN(putiseq):{ + return depth + 1; + } + case BIN(putstring):{ + return depth + 1; + } + case BIN(concatstrings):{ + int inc = 0; + int num = FIX2INT(opes[0]); + inc += 1 - num;; + return depth + inc; + } + case BIN(tostring):{ + return depth + 0; + } + case BIN(toregexp):{ + int inc = 0; + int cnt = FIX2INT(opes[1]); + inc += 1 - cnt;; + return depth + inc; + } + case BIN(newarray):{ + int inc = 0; + int num = FIX2INT(opes[0]); + inc += 1 - num;; + return depth + inc; + } + case BIN(duparray):{ + return depth + 1; + } + case BIN(expandarray):{ + int inc = 0; + int num = FIX2INT(opes[0]); + int flag = FIX2INT(opes[1]); + inc += num - 1 + (flag & 1 ? 1 : 0);; + return depth + inc; + } + case BIN(concatarray):{ + return depth + -1; + } + case BIN(splatarray):{ + return depth + 0; + } + case BIN(checkincludearray):{ + return depth + 0; + } + case BIN(newhash):{ + int inc = 0; + int num = FIX2INT(opes[0]); + inc += 1 - num;; + return depth + inc; + } + case BIN(newrange):{ + return depth + -1; + } + case BIN(pop):{ + return depth + -1; + } + case BIN(dup):{ + return depth + 1; + } + case BIN(dupn):{ + int inc = 0; + int n = FIX2INT(opes[0]); + inc += n;; + return depth + inc; + } + case BIN(swap):{ + return depth + 0; + } + case BIN(reput):{ + int inc = 0; + inc += 0;; + return depth + inc; + } + case BIN(topn):{ + int inc = 0; + inc += 1;; + return depth + inc; + } + case BIN(setn):{ + int inc = 0; + inc += 0; + return depth + inc; + } + case BIN(adjuststack):{ + int inc = 0; + int n = FIX2INT(opes[0]); + inc -= n; + return depth + inc; + } + case BIN(defined):{ + return depth + 0; + } + case BIN(trace):{ + return depth + 0; + } + case BIN(defineclass):{ + return depth + -1; + } + case BIN(send):{ + int inc = 0; + int op_argc = FIX2INT(opes[1]); + int op_flag = FIX2INT(opes[3]); + inc += - (int)(op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));; + return depth + inc; + } + case BIN(invokesuper):{ + int inc = 0; + int op_argc = FIX2INT(opes[0]); + int op_flag = FIX2INT(opes[2]); + inc += - (int)(op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));; + return depth + inc; + } + case BIN(invokeblock):{ + int inc = 0; + int num = FIX2INT(opes[0]); + inc += 1 - num;; + return depth + inc; + } + case BIN(leave):{ + return depth + 0; + } + case BIN(finish):{ + return depth + 0; + } + case BIN(throw):{ + return depth + 0; + } + case BIN(jump):{ + return depth + 0; + } + case BIN(branchif):{ + return depth + -1; + } + case BIN(branchunless):{ + return depth + -1; + } + case BIN(getinlinecache):{ + return depth + 1; + } + case BIN(onceinlinecache):{ + return depth + 1; + } + case BIN(setinlinecache):{ + return depth + 0; + } + case BIN(opt_case_dispatch):{ + int inc = 0; + inc += -1;; + return depth + inc; + } + case BIN(opt_checkenv):{ + return depth + 0; + } + case BIN(opt_plus):{ + return depth + -1; + } + case BIN(opt_minus):{ + return depth + -1; + } + case BIN(opt_mult):{ + return depth + -1; + } + case BIN(opt_div):{ + return depth + -1; + } + case BIN(opt_mod):{ + return depth + -1; + } + case BIN(opt_eq):{ + return depth + -1; + } + case BIN(opt_neq):{ + return depth + -1; + } + case BIN(opt_lt):{ + return depth + -1; + } + case BIN(opt_le):{ + return depth + -1; + } + case BIN(opt_gt):{ + return depth + -1; + } + case BIN(opt_ge):{ + return depth + -1; + } + case BIN(opt_ltlt):{ + return depth + -1; + } + case BIN(opt_aref):{ + return depth + -1; + } + case BIN(opt_aset):{ + return depth + -2; + } + case BIN(opt_length):{ + return depth + 0; + } + case BIN(opt_size):{ + return depth + 0; + } + case BIN(opt_succ):{ + return depth + 0; + } + case BIN(opt_not):{ + return depth + 0; + } + case BIN(opt_regexpmatch1):{ + return depth + 0; + } + case BIN(opt_regexpmatch2):{ + return depth + -1; + } + case BIN(opt_call_c_function):{ + return depth + 0; + } + case BIN(bitblt):{ + return depth + 1; + } + case BIN(answer):{ + return depth + 1; + } + + default: + rb_bug("insn_sp_increase: unreachable"); + } + return 0; +} +#endif + +/* some utilities */ + +static int +insn_len(VALUE insn) +{ + return insn_len_info[(int)insn]; +} + +static const char * +insn_name(VALUE insn) +{ + return insn_name_info[(int)insn]; +} + +static const char * +insn_op_types(VALUE insn) +{ + return insn_operand_info[(int)insn]; +} + +static int +insn_op_type(VALUE insn, long pos) +{ + int len = insn_len(insn) - 1; + if(pos < len){ + return insn_operand_info[(int)insn][pos]; + } + else{ + return 0; + } +} + +#ifdef USE_INSN_RET_NUM +static int +insn_ret_num(VALUE insn) +{ + return insn_stack_push_num_info[(int)insn]; +} +#endif diff --git a/known_errors.inc b/known_errors.inc new file mode 100644 index 0000000000..41a83e94f8 --- /dev/null +++ b/known_errors.inc @@ -0,0 +1,731 @@ +/** -*-c-*- + * DO NOT EDIT + * This file is automatically generated by tools/generic_erb.rb from + * template/known_errors.inc.tmpl and defs/known_errors.def. + */ + +#ifdef EPERM + defined_error("EPERM", EPERM) +#else + undefined_error("EPERM") +#endif +#ifdef ENOENT + defined_error("ENOENT", ENOENT) +#else + undefined_error("ENOENT") +#endif +#ifdef ESRCH + defined_error("ESRCH", ESRCH) +#else + undefined_error("ESRCH") +#endif +#ifdef EINTR + defined_error("EINTR", EINTR) +#else + undefined_error("EINTR") +#endif +#ifdef EIO + defined_error("EIO", EIO) +#else + undefined_error("EIO") +#endif +#ifdef ENXIO + defined_error("ENXIO", ENXIO) +#else + undefined_error("ENXIO") +#endif +#ifdef E2BIG + defined_error("E2BIG", E2BIG) +#else + undefined_error("E2BIG") +#endif +#ifdef ENOEXEC + defined_error("ENOEXEC", ENOEXEC) +#else + undefined_error("ENOEXEC") +#endif +#ifdef EBADF + defined_error("EBADF", EBADF) +#else + undefined_error("EBADF") +#endif +#ifdef ECHILD + defined_error("ECHILD", ECHILD) +#else + undefined_error("ECHILD") +#endif +#ifdef EAGAIN + defined_error("EAGAIN", EAGAIN) +#else + undefined_error("EAGAIN") +#endif +#ifdef ENOMEM + defined_error("ENOMEM", ENOMEM) +#else + undefined_error("ENOMEM") +#endif +#ifdef EACCES + defined_error("EACCES", EACCES) +#else + undefined_error("EACCES") +#endif +#ifdef EFAULT + defined_error("EFAULT", EFAULT) +#else + undefined_error("EFAULT") +#endif +#ifdef ENOTBLK + defined_error("ENOTBLK", ENOTBLK) +#else + undefined_error("ENOTBLK") +#endif +#ifdef EBUSY + defined_error("EBUSY", EBUSY) +#else + undefined_error("EBUSY") +#endif +#ifdef EEXIST + defined_error("EEXIST", EEXIST) +#else + undefined_error("EEXIST") +#endif +#ifdef EXDEV + defined_error("EXDEV", EXDEV) +#else + undefined_error("EXDEV") +#endif +#ifdef ENODEV + defined_error("ENODEV", ENODEV) +#else + undefined_error("ENODEV") +#endif +#ifdef ENOTDIR + defined_error("ENOTDIR", ENOTDIR) +#else + undefined_error("ENOTDIR") +#endif +#ifdef EISDIR + defined_error("EISDIR", EISDIR) +#else + undefined_error("EISDIR") +#endif +#ifdef EINVAL + defined_error("EINVAL", EINVAL) +#else + undefined_error("EINVAL") +#endif +#ifdef ENFILE + defined_error("ENFILE", ENFILE) +#else + undefined_error("ENFILE") +#endif +#ifdef EMFILE + defined_error("EMFILE", EMFILE) +#else + undefined_error("EMFILE") +#endif +#ifdef ENOTTY + defined_error("ENOTTY", ENOTTY) +#else + undefined_error("ENOTTY") +#endif +#ifdef ETXTBSY + defined_error("ETXTBSY", ETXTBSY) +#else + undefined_error("ETXTBSY") +#endif +#ifdef EFBIG + defined_error("EFBIG", EFBIG) +#else + undefined_error("EFBIG") +#endif +#ifdef ENOSPC + defined_error("ENOSPC", ENOSPC) +#else + undefined_error("ENOSPC") +#endif +#ifdef ESPIPE + defined_error("ESPIPE", ESPIPE) +#else + undefined_error("ESPIPE") +#endif +#ifdef EROFS + defined_error("EROFS", EROFS) +#else + undefined_error("EROFS") +#endif +#ifdef EMLINK + defined_error("EMLINK", EMLINK) +#else + undefined_error("EMLINK") +#endif +#ifdef EPIPE + defined_error("EPIPE", EPIPE) +#else + undefined_error("EPIPE") +#endif +#ifdef EDOM + defined_error("EDOM", EDOM) +#else + undefined_error("EDOM") +#endif +#ifdef ERANGE + defined_error("ERANGE", ERANGE) +#else + undefined_error("ERANGE") +#endif +#ifdef EDEADLK + defined_error("EDEADLK", EDEADLK) +#else + undefined_error("EDEADLK") +#endif +#ifdef ENAMETOOLONG + defined_error("ENAMETOOLONG", ENAMETOOLONG) +#else + undefined_error("ENAMETOOLONG") +#endif +#ifdef ENOLCK + defined_error("ENOLCK", ENOLCK) +#else + undefined_error("ENOLCK") +#endif +#ifdef ENOSYS + defined_error("ENOSYS", ENOSYS) +#else + undefined_error("ENOSYS") +#endif +#ifdef ENOTEMPTY + defined_error("ENOTEMPTY", ENOTEMPTY) +#else + undefined_error("ENOTEMPTY") +#endif +#ifdef ELOOP + defined_error("ELOOP", ELOOP) +#else + undefined_error("ELOOP") +#endif +#ifdef EWOULDBLOCK + defined_error("EWOULDBLOCK", EWOULDBLOCK) +#else + undefined_error("EWOULDBLOCK") +#endif +#ifdef ENOMSG + defined_error("ENOMSG", ENOMSG) +#else + undefined_error("ENOMSG") +#endif +#ifdef EIDRM + defined_error("EIDRM", EIDRM) +#else + undefined_error("EIDRM") +#endif +#ifdef ECHRNG + defined_error("ECHRNG", ECHRNG) +#else + undefined_error("ECHRNG") +#endif +#ifdef EL2NSYNC + defined_error("EL2NSYNC", EL2NSYNC) +#else + undefined_error("EL2NSYNC") +#endif +#ifdef EL3HLT + defined_error("EL3HLT", EL3HLT) +#else + undefined_error("EL3HLT") +#endif +#ifdef EL3RST + defined_error("EL3RST", EL3RST) +#else + undefined_error("EL3RST") +#endif +#ifdef ELNRNG + defined_error("ELNRNG", ELNRNG) +#else + undefined_error("ELNRNG") +#endif +#ifdef EUNATCH + defined_error("EUNATCH", EUNATCH) +#else + undefined_error("EUNATCH") +#endif +#ifdef ENOCSI + defined_error("ENOCSI", ENOCSI) +#else + undefined_error("ENOCSI") +#endif +#ifdef EL2HLT + defined_error("EL2HLT", EL2HLT) +#else + undefined_error("EL2HLT") +#endif +#ifdef EBADE + defined_error("EBADE", EBADE) +#else + undefined_error("EBADE") +#endif +#ifdef EBADR + defined_error("EBADR", EBADR) +#else + undefined_error("EBADR") +#endif +#ifdef EXFULL + defined_error("EXFULL", EXFULL) +#else + undefined_error("EXFULL") +#endif +#ifdef ENOANO + defined_error("ENOANO", ENOANO) +#else + undefined_error("ENOANO") +#endif +#ifdef EBADRQC + defined_error("EBADRQC", EBADRQC) +#else + undefined_error("EBADRQC") +#endif +#ifdef EBADSLT + defined_error("EBADSLT", EBADSLT) +#else + undefined_error("EBADSLT") +#endif +#ifdef EDEADLOCK + defined_error("EDEADLOCK", EDEADLOCK) +#else + undefined_error("EDEADLOCK") +#endif +#ifdef EBFONT + defined_error("EBFONT", EBFONT) +#else + undefined_error("EBFONT") +#endif +#ifdef ENOSTR + defined_error("ENOSTR", ENOSTR) +#else + undefined_error("ENOSTR") +#endif +#ifdef ENODATA + defined_error("ENODATA", ENODATA) +#else + undefined_error("ENODATA") +#endif +#ifdef ETIME + defined_error("ETIME", ETIME) +#else + undefined_error("ETIME") +#endif +#ifdef ENOSR + defined_error("ENOSR", ENOSR) +#else + undefined_error("ENOSR") +#endif +#ifdef ENONET + defined_error("ENONET", ENONET) +#else + undefined_error("ENONET") +#endif +#ifdef ENOPKG + defined_error("ENOPKG", ENOPKG) +#else + undefined_error("ENOPKG") +#endif +#ifdef EREMOTE + defined_error("EREMOTE", EREMOTE) +#else + undefined_error("EREMOTE") +#endif +#ifdef ENOLINK + defined_error("ENOLINK", ENOLINK) +#else + undefined_error("ENOLINK") +#endif +#ifdef EADV + defined_error("EADV", EADV) +#else + undefined_error("EADV") +#endif +#ifdef ESRMNT + defined_error("ESRMNT", ESRMNT) +#else + undefined_error("ESRMNT") +#endif +#ifdef ECOMM + defined_error("ECOMM", ECOMM) +#else + undefined_error("ECOMM") +#endif +#ifdef EPROTO + defined_error("EPROTO", EPROTO) +#else + undefined_error("EPROTO") +#endif +#ifdef EMULTIHOP + defined_error("EMULTIHOP", EMULTIHOP) +#else + undefined_error("EMULTIHOP") +#endif +#ifdef EDOTDOT + defined_error("EDOTDOT", EDOTDOT) +#else + undefined_error("EDOTDOT") +#endif +#ifdef EBADMSG + defined_error("EBADMSG", EBADMSG) +#else + undefined_error("EBADMSG") +#endif +#ifdef EOVERFLOW + defined_error("EOVERFLOW", EOVERFLOW) +#else + undefined_error("EOVERFLOW") +#endif +#ifdef ENOTUNIQ + defined_error("ENOTUNIQ", ENOTUNIQ) +#else + undefined_error("ENOTUNIQ") +#endif +#ifdef EBADFD + defined_error("EBADFD", EBADFD) +#else + undefined_error("EBADFD") +#endif +#ifdef EREMCHG + defined_error("EREMCHG", EREMCHG) +#else + undefined_error("EREMCHG") +#endif +#ifdef ELIBACC + defined_error("ELIBACC", ELIBACC) +#else + undefined_error("ELIBACC") +#endif +#ifdef ELIBBAD + defined_error("ELIBBAD", ELIBBAD) +#else + undefined_error("ELIBBAD") +#endif +#ifdef ELIBSCN + defined_error("ELIBSCN", ELIBSCN) +#else + undefined_error("ELIBSCN") +#endif +#ifdef ELIBMAX + defined_error("ELIBMAX", ELIBMAX) +#else + undefined_error("ELIBMAX") +#endif +#ifdef ELIBEXEC + defined_error("ELIBEXEC", ELIBEXEC) +#else + undefined_error("ELIBEXEC") +#endif +#ifdef EILSEQ + defined_error("EILSEQ", EILSEQ) +#else + undefined_error("EILSEQ") +#endif +#ifdef ERESTART + defined_error("ERESTART", ERESTART) +#else + undefined_error("ERESTART") +#endif +#ifdef ESTRPIPE + defined_error("ESTRPIPE", ESTRPIPE) +#else + undefined_error("ESTRPIPE") +#endif +#ifdef EUSERS + defined_error("EUSERS", EUSERS) +#else + undefined_error("EUSERS") +#endif +#ifdef ENOTSOCK + defined_error("ENOTSOCK", ENOTSOCK) +#else + undefined_error("ENOTSOCK") +#endif +#ifdef EDESTADDRREQ + defined_error("EDESTADDRREQ", EDESTADDRREQ) +#else + undefined_error("EDESTADDRREQ") +#endif +#ifdef EMSGSIZE + defined_error("EMSGSIZE", EMSGSIZE) +#else + undefined_error("EMSGSIZE") +#endif +#ifdef EPROTOTYPE + defined_error("EPROTOTYPE", EPROTOTYPE) +#else + undefined_error("EPROTOTYPE") +#endif +#ifdef ENOPROTOOPT + defined_error("ENOPROTOOPT", ENOPROTOOPT) +#else + undefined_error("ENOPROTOOPT") +#endif +#ifdef EPROTONOSUPPORT + defined_error("EPROTONOSUPPORT", EPROTONOSUPPORT) +#else + undefined_error("EPROTONOSUPPORT") +#endif +#ifdef ESOCKTNOSUPPORT + defined_error("ESOCKTNOSUPPORT", ESOCKTNOSUPPORT) +#else + undefined_error("ESOCKTNOSUPPORT") +#endif +#ifdef EOPNOTSUPP + defined_error("EOPNOTSUPP", EOPNOTSUPP) +#else + undefined_error("EOPNOTSUPP") +#endif +#ifdef EPFNOSUPPORT + defined_error("EPFNOSUPPORT", EPFNOSUPPORT) +#else + undefined_error("EPFNOSUPPORT") +#endif +#ifdef EAFNOSUPPORT + defined_error("EAFNOSUPPORT", EAFNOSUPPORT) +#else + undefined_error("EAFNOSUPPORT") +#endif +#ifdef EADDRINUSE + defined_error("EADDRINUSE", EADDRINUSE) +#else + undefined_error("EADDRINUSE") +#endif +#ifdef EADDRNOTAVAIL + defined_error("EADDRNOTAVAIL", EADDRNOTAVAIL) +#else + undefined_error("EADDRNOTAVAIL") +#endif +#ifdef ENETDOWN + defined_error("ENETDOWN", ENETDOWN) +#else + undefined_error("ENETDOWN") +#endif +#ifdef ENETUNREACH + defined_error("ENETUNREACH", ENETUNREACH) +#else + undefined_error("ENETUNREACH") +#endif +#ifdef ENETRESET + defined_error("ENETRESET", ENETRESET) +#else + undefined_error("ENETRESET") +#endif +#ifdef ECONNABORTED + defined_error("ECONNABORTED", ECONNABORTED) +#else + undefined_error("ECONNABORTED") +#endif +#ifdef ECONNRESET + defined_error("ECONNRESET", ECONNRESET) +#else + undefined_error("ECONNRESET") +#endif +#ifdef ENOBUFS + defined_error("ENOBUFS", ENOBUFS) +#else + undefined_error("ENOBUFS") +#endif +#ifdef EISCONN + defined_error("EISCONN", EISCONN) +#else + undefined_error("EISCONN") +#endif +#ifdef ENOTCONN + defined_error("ENOTCONN", ENOTCONN) +#else + undefined_error("ENOTCONN") +#endif +#ifdef ESHUTDOWN + defined_error("ESHUTDOWN", ESHUTDOWN) +#else + undefined_error("ESHUTDOWN") +#endif +#ifdef ETOOMANYREFS + defined_error("ETOOMANYREFS", ETOOMANYREFS) +#else + undefined_error("ETOOMANYREFS") +#endif +#ifdef ETIMEDOUT + defined_error("ETIMEDOUT", ETIMEDOUT) +#else + undefined_error("ETIMEDOUT") +#endif +#ifdef ECONNREFUSED + defined_error("ECONNREFUSED", ECONNREFUSED) +#else + undefined_error("ECONNREFUSED") +#endif +#ifdef EHOSTDOWN + defined_error("EHOSTDOWN", EHOSTDOWN) +#else + undefined_error("EHOSTDOWN") +#endif +#ifdef EHOSTUNREACH + defined_error("EHOSTUNREACH", EHOSTUNREACH) +#else + undefined_error("EHOSTUNREACH") +#endif +#ifdef EALREADY + defined_error("EALREADY", EALREADY) +#else + undefined_error("EALREADY") +#endif +#ifdef EINPROGRESS + defined_error("EINPROGRESS", EINPROGRESS) +#else + undefined_error("EINPROGRESS") +#endif +#ifdef ESTALE + defined_error("ESTALE", ESTALE) +#else + undefined_error("ESTALE") +#endif +#ifdef EUCLEAN + defined_error("EUCLEAN", EUCLEAN) +#else + undefined_error("EUCLEAN") +#endif +#ifdef ENOTNAM + defined_error("ENOTNAM", ENOTNAM) +#else + undefined_error("ENOTNAM") +#endif +#ifdef ENAVAIL + defined_error("ENAVAIL", ENAVAIL) +#else + undefined_error("ENAVAIL") +#endif +#ifdef EISNAM + defined_error("EISNAM", EISNAM) +#else + undefined_error("EISNAM") +#endif +#ifdef EREMOTEIO + defined_error("EREMOTEIO", EREMOTEIO) +#else + undefined_error("EREMOTEIO") +#endif +#ifdef EDQUOT + defined_error("EDQUOT", EDQUOT) +#else + undefined_error("EDQUOT") +#endif +#ifdef ECANCELED + defined_error("ECANCELED", ECANCELED) +#else + undefined_error("ECANCELED") +#endif +#ifdef EKEYEXPIRED + defined_error("EKEYEXPIRED", EKEYEXPIRED) +#else + undefined_error("EKEYEXPIRED") +#endif +#ifdef EKEYREJECTED + defined_error("EKEYREJECTED", EKEYREJECTED) +#else + undefined_error("EKEYREJECTED") +#endif +#ifdef EKEYREVOKED + defined_error("EKEYREVOKED", EKEYREVOKED) +#else + undefined_error("EKEYREVOKED") +#endif +#ifdef EMEDIUMTYPE + defined_error("EMEDIUMTYPE", EMEDIUMTYPE) +#else + undefined_error("EMEDIUMTYPE") +#endif +#ifdef ENOKEY + defined_error("ENOKEY", ENOKEY) +#else + undefined_error("ENOKEY") +#endif +#ifdef ENOMEDIUM + defined_error("ENOMEDIUM", ENOMEDIUM) +#else + undefined_error("ENOMEDIUM") +#endif +#ifdef ENOTRECOVERABLE + defined_error("ENOTRECOVERABLE", ENOTRECOVERABLE) +#else + undefined_error("ENOTRECOVERABLE") +#endif +#ifdef EOWNERDEAD + defined_error("EOWNERDEAD", EOWNERDEAD) +#else + undefined_error("EOWNERDEAD") +#endif +#ifdef ERFKILL + defined_error("ERFKILL", ERFKILL) +#else + undefined_error("ERFKILL") +#endif +#ifdef EAUTH + defined_error("EAUTH", EAUTH) +#else + undefined_error("EAUTH") +#endif +#ifdef EBADRPC + defined_error("EBADRPC", EBADRPC) +#else + undefined_error("EBADRPC") +#endif +#ifdef EDOOFUS + defined_error("EDOOFUS", EDOOFUS) +#else + undefined_error("EDOOFUS") +#endif +#ifdef EFTYPE + defined_error("EFTYPE", EFTYPE) +#else + undefined_error("EFTYPE") +#endif +#ifdef ENEEDAUTH + defined_error("ENEEDAUTH", ENEEDAUTH) +#else + undefined_error("ENEEDAUTH") +#endif +#ifdef ENOATTR + defined_error("ENOATTR", ENOATTR) +#else + undefined_error("ENOATTR") +#endif +#ifdef ENOTSUP + defined_error("ENOTSUP", ENOTSUP) +#else + undefined_error("ENOTSUP") +#endif +#ifdef EPROCLIM + defined_error("EPROCLIM", EPROCLIM) +#else + undefined_error("EPROCLIM") +#endif +#ifdef EPROCUNAVAIL + defined_error("EPROCUNAVAIL", EPROCUNAVAIL) +#else + undefined_error("EPROCUNAVAIL") +#endif +#ifdef EPROGMISMATCH + defined_error("EPROGMISMATCH", EPROGMISMATCH) +#else + undefined_error("EPROGMISMATCH") +#endif +#ifdef EPROGUNAVAIL + defined_error("EPROGUNAVAIL", EPROGUNAVAIL) +#else + undefined_error("EPROGUNAVAIL") +#endif +#ifdef ERPCMISMATCH + defined_error("ERPCMISMATCH", ERPCMISMATCH) +#else + undefined_error("ERPCMISMATCH") +#endif +#ifdef EIPSEC + defined_error("EIPSEC", EIPSEC) +#else + undefined_error("EIPSEC") +#endif diff --git a/miniprelude.c b/miniprelude.c new file mode 100644 index 0000000000..9f166f554d --- /dev/null +++ b/miniprelude.c @@ -0,0 +1,66 @@ +/* -*-c-*- + THIS FILE WAS AUTOGENERATED BY tool/compile_prelude.rb. DO NOT EDIT. + + sources: prelude +*/ +#include "ruby/ruby.h" +#include "internal.h" +#include "vm_core.h" + + +static const char prelude_name0[] = "<internal:prelude>"; +static const char prelude_code0[] = +"class Mutex\n" +" # call-seq:\n" +" # mutex.synchronize { ... }\n" +" #\n" +" # Obtains a lock, runs the block, and releases the lock when the\n" +" # block completes. See the example under Mutex.\n" +" def synchronize\n" +" self.lock\n" +" begin\n" +" yield\n" +" ensure\n" +" self.unlock rescue nil\n" +" end\n" +" end\n" +"end\n" +"\n" +"class Thread\n" +" MUTEX_FOR_THREAD_EXCLUSIVE = Mutex.new # :nodoc:\n" +"\n" +" # call-seq:\n" +" # Thread.exclusive { block } => obj\n" +" #\n" +" # Wraps a block in Thread.critical, restoring the original value\n" +" # upon exit from the critical section, and returns the value of the\n" +" # block.\n" +" def self.exclusive\n" +" MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{\n" +" yield\n" +" }\n" +" end\n" +"end\n" +; + +#define PRELUDE_COUNT 0 + + +static void +prelude_eval(VALUE code, VALUE name, VALUE line) +{ + rb_iseq_eval(rb_iseq_compile_with_option(code, name, Qnil, line, Qtrue)); +} + +void +Init_prelude(void) +{ + prelude_eval( + rb_usascii_str_new(prelude_code0, sizeof(prelude_code0) - 1), + rb_usascii_str_new(prelude_name0, sizeof(prelude_name0) - 1), + INT2FIX(1)); + +#if 0 + puts(prelude_code0); +#endif +} diff --git a/newline.c b/newline.c new file mode 100644 index 0000000000..e4ec532a2e --- /dev/null +++ b/newline.c @@ -0,0 +1,189 @@ +/* autogenerated. */ +/* src="transcode-tblgen.rb", len=28123, checksum=30477 */ +/* src="newline.trans", len=3162, checksum=42485 */ + +#include "transcode_data.h" + + + +static const unsigned char +newline_byte_array[516] = { +#define universal_newline_offsets 0 +0, 255, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + +#define crlf_newline_offsets 258 +0, 255, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + +}; +static const unsigned int +newline_word_array[11] = { +#define universal_newline_infos WORDINDEX2INFO(0) + FUNso, + +#define universal_newline WORDINDEX2INFO(1) + universal_newline_offsets, + universal_newline_infos, + +#define crlf_newline_infos WORDINDEX2INFO(3) + NOMAP, o2(0x0d,0x0a), + +#define crlf_newline WORDINDEX2INFO(5) + crlf_newline_offsets, + crlf_newline_infos, + +#define cr_newline_infos WORDINDEX2INFO(7) + NOMAP, o1(0x0d), + +#define cr_newline WORDINDEX2INFO(9) + crlf_newline_offsets, + cr_newline_infos, + +}; +#define TRANSCODE_TABLE_INFO newline_byte_array, 516, newline_word_array, 11, ((int)sizeof(unsigned int)) + + +#define STATE (sp[0]) +#define NORMAL 0 +#define JUST_AFTER_CR 1 + +/* no way to access this information, yet. */ +#define NEWLINES_MET (sp[1]) +#define MET_LF 0x01 +#define MET_CRLF 0x02 +#define MET_CR 0x04 + +static int +universal_newline_init(void *statep) +{ + unsigned char *sp = statep; + STATE = NORMAL; + NEWLINES_MET = 0; + return 0; +} + +static ssize_t +fun_so_universal_newline(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize) +{ + unsigned char *sp = statep; + int len; + if (s[0] == '\n') { + if (STATE == NORMAL) { + NEWLINES_MET |= MET_LF; + } + else { /* JUST_AFTER_CR */ + NEWLINES_MET |= MET_CRLF; + } + o[0] = '\n'; + len = 1; + STATE = NORMAL; + } + else { + len = 0; + if (STATE == JUST_AFTER_CR) { + o[0] = '\n'; + len = 1; + NEWLINES_MET |= MET_CR; + } + if (s[0] == '\r') { + STATE = JUST_AFTER_CR; + } + else { + o[len++] = s[0]; + STATE = NORMAL; + } + } + + return len; +} + +static ssize_t +universal_newline_finish(void *statep, unsigned char *o, size_t osize) +{ + unsigned char *sp = statep; + int len = 0; + if (STATE == JUST_AFTER_CR) { + o[0] = '\n'; + len = 1; + NEWLINES_MET |= MET_CR; + } + STATE = NORMAL; + return len; +} + +static const rb_transcoder +rb_universal_newline = { + "", "universal_newline", universal_newline, + TRANSCODE_TABLE_INFO, + 1, /* input_unit_length */ + 1, /* max_input */ + 2, /* max_output */ + asciicompat_converter, /* asciicompat_type */ + 2, universal_newline_init, universal_newline_init, /* state_size, state_init, state_fini */ + NULL, NULL, NULL, fun_so_universal_newline, + universal_newline_finish +}; + +static const rb_transcoder +rb_crlf_newline = { + "", "crlf_newline", crlf_newline, + TRANSCODE_TABLE_INFO, + 1, /* input_unit_length */ + 1, /* max_input */ + 2, /* max_output */ + asciicompat_converter, /* asciicompat_type */ + 0, NULL, NULL, /* state_size, state_init, state_fini */ + NULL, NULL, NULL, NULL +}; + +static const rb_transcoder +rb_cr_newline = { + "", "cr_newline", cr_newline, + TRANSCODE_TABLE_INFO, + 1, /* input_unit_length */ + 1, /* max_input */ + 1, /* max_output */ + asciicompat_converter, /* asciicompat_type */ + 0, NULL, NULL, /* state_size, state_init, state_fini */ + NULL, NULL, NULL, NULL +}; + +void +Init_newline(void) +{ + rb_register_transcoder(&rb_universal_newline); + rb_register_transcoder(&rb_crlf_newline); + rb_register_transcoder(&rb_cr_newline); +} + diff --git a/node_name.inc b/node_name.inc new file mode 100644 index 0000000000..bec9522bad --- /dev/null +++ b/node_name.inc @@ -0,0 +1,208 @@ + case NODE_SCOPE: + return "NODE_SCOPE"; + case NODE_BLOCK: + return "NODE_BLOCK"; + case NODE_IF: + return "NODE_IF"; + case NODE_CASE: + return "NODE_CASE"; + case NODE_WHEN: + return "NODE_WHEN"; + case NODE_OPT_N: + return "NODE_OPT_N"; + case NODE_WHILE: + return "NODE_WHILE"; + case NODE_UNTIL: + return "NODE_UNTIL"; + case NODE_ITER: + return "NODE_ITER"; + case NODE_FOR: + return "NODE_FOR"; + case NODE_BREAK: + return "NODE_BREAK"; + case NODE_NEXT: + return "NODE_NEXT"; + case NODE_REDO: + return "NODE_REDO"; + case NODE_RETRY: + return "NODE_RETRY"; + case NODE_BEGIN: + return "NODE_BEGIN"; + case NODE_RESCUE: + return "NODE_RESCUE"; + case NODE_RESBODY: + return "NODE_RESBODY"; + case NODE_ENSURE: + return "NODE_ENSURE"; + case NODE_AND: + return "NODE_AND"; + case NODE_OR: + return "NODE_OR"; + case NODE_MASGN: + return "NODE_MASGN"; + case NODE_LASGN: + return "NODE_LASGN"; + case NODE_DASGN: + return "NODE_DASGN"; + case NODE_DASGN_CURR: + return "NODE_DASGN_CURR"; + case NODE_GASGN: + return "NODE_GASGN"; + case NODE_IASGN: + return "NODE_IASGN"; + case NODE_IASGN2: + return "NODE_IASGN2"; + case NODE_CDECL: + return "NODE_CDECL"; + case NODE_CVASGN: + return "NODE_CVASGN"; + case NODE_CVDECL: + return "NODE_CVDECL"; + case NODE_OP_ASGN1: + return "NODE_OP_ASGN1"; + case NODE_OP_ASGN2: + return "NODE_OP_ASGN2"; + case NODE_OP_ASGN_AND: + return "NODE_OP_ASGN_AND"; + case NODE_OP_ASGN_OR: + return "NODE_OP_ASGN_OR"; + case NODE_CALL: + return "NODE_CALL"; + case NODE_FCALL: + return "NODE_FCALL"; + case NODE_VCALL: + return "NODE_VCALL"; + case NODE_SUPER: + return "NODE_SUPER"; + case NODE_ZSUPER: + return "NODE_ZSUPER"; + case NODE_ARRAY: + return "NODE_ARRAY"; + case NODE_ZARRAY: + return "NODE_ZARRAY"; + case NODE_VALUES: + return "NODE_VALUES"; + case NODE_HASH: + return "NODE_HASH"; + case NODE_RETURN: + return "NODE_RETURN"; + case NODE_YIELD: + return "NODE_YIELD"; + case NODE_LVAR: + return "NODE_LVAR"; + case NODE_DVAR: + return "NODE_DVAR"; + case NODE_GVAR: + return "NODE_GVAR"; + case NODE_IVAR: + return "NODE_IVAR"; + case NODE_CONST: + return "NODE_CONST"; + case NODE_CVAR: + return "NODE_CVAR"; + case NODE_NTH_REF: + return "NODE_NTH_REF"; + case NODE_BACK_REF: + return "NODE_BACK_REF"; + case NODE_MATCH: + return "NODE_MATCH"; + case NODE_MATCH2: + return "NODE_MATCH2"; + case NODE_MATCH3: + return "NODE_MATCH3"; + case NODE_LIT: + return "NODE_LIT"; + case NODE_STR: + return "NODE_STR"; + case NODE_DSTR: + return "NODE_DSTR"; + case NODE_XSTR: + return "NODE_XSTR"; + case NODE_DXSTR: + return "NODE_DXSTR"; + case NODE_EVSTR: + return "NODE_EVSTR"; + case NODE_DREGX: + return "NODE_DREGX"; + case NODE_DREGX_ONCE: + return "NODE_DREGX_ONCE"; + case NODE_ARGS: + return "NODE_ARGS"; + case NODE_ARGS_AUX: + return "NODE_ARGS_AUX"; + case NODE_OPT_ARG: + return "NODE_OPT_ARG"; + case NODE_POSTARG: + return "NODE_POSTARG"; + case NODE_ARGSCAT: + return "NODE_ARGSCAT"; + case NODE_ARGSPUSH: + return "NODE_ARGSPUSH"; + case NODE_SPLAT: + return "NODE_SPLAT"; + case NODE_TO_ARY: + return "NODE_TO_ARY"; + case NODE_BLOCK_ARG: + return "NODE_BLOCK_ARG"; + case NODE_BLOCK_PASS: + return "NODE_BLOCK_PASS"; + case NODE_DEFN: + return "NODE_DEFN"; + case NODE_DEFS: + return "NODE_DEFS"; + case NODE_ALIAS: + return "NODE_ALIAS"; + case NODE_VALIAS: + return "NODE_VALIAS"; + case NODE_UNDEF: + return "NODE_UNDEF"; + case NODE_CLASS: + return "NODE_CLASS"; + case NODE_MODULE: + return "NODE_MODULE"; + case NODE_SCLASS: + return "NODE_SCLASS"; + case NODE_COLON2: + return "NODE_COLON2"; + case NODE_COLON3: + return "NODE_COLON3"; + case NODE_DOT2: + return "NODE_DOT2"; + case NODE_DOT3: + return "NODE_DOT3"; + case NODE_FLIP2: + return "NODE_FLIP2"; + case NODE_FLIP3: + return "NODE_FLIP3"; + case NODE_SELF: + return "NODE_SELF"; + case NODE_NIL: + return "NODE_NIL"; + case NODE_TRUE: + return "NODE_TRUE"; + case NODE_FALSE: + return "NODE_FALSE"; + case NODE_ERRINFO: + return "NODE_ERRINFO"; + case NODE_DEFINED: + return "NODE_DEFINED"; + case NODE_POSTEXE: + return "NODE_POSTEXE"; + case NODE_ALLOCA: + return "NODE_ALLOCA"; + case NODE_BMETHOD: + return "NODE_BMETHOD"; + case NODE_MEMO: + return "NODE_MEMO"; + case NODE_IFUNC: + return "NODE_IFUNC"; + case NODE_DSYM: + return "NODE_DSYM"; + case NODE_ATTRASGN: + return "NODE_ATTRASGN"; + case NODE_PRELUDE: + return "NODE_PRELUDE"; + case NODE_LAMBDA: + return "NODE_LAMBDA"; + case NODE_OPTBLOCK: + return "NODE_OPTBLOCK"; diff --git a/opt_sc.inc b/opt_sc.inc new file mode 100644 index 0000000000..2dfba0d4fc --- /dev/null +++ b/opt_sc.inc @@ -0,0 +1,670 @@ +/* -*-c-*- *********************************************************/ +/*******************************************************************/ +/*******************************************************************/ +/** + This file is for threaded code. + + ---- + This file is auto generated by insns2vm.rb + DO NOT TOUCH! + + If you want to fix something, you must edit 'template/opt_sc.inc.tmpl' + or rb/insns2vm.rb + */ + +#define SC_STATE_SIZE 6 + +#define SCS_XX 1 +#define SCS_AX 2 +#define SCS_BX 3 +#define SCS_AB 4 +#define SCS_BA 5 + +#define SC_ERROR 0xffffffff + +static const VALUE sc_insn_info[][SC_STATE_SIZE] = { + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR}, + { +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR, +SC_ERROR} +}; + +static const VALUE sc_insn_next[] = { + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX, + SCS_XX +}; + diff --git a/optinsn.inc b/optinsn.inc new file mode 100644 index 0000000000..281da07a54 --- /dev/null +++ b/optinsn.inc @@ -0,0 +1,30 @@ +/* -*-c-*- *********************************************************/ +/*******************************************************************/ +/*******************************************************************/ +/** + This file is for threaded code. + + ---- + This file is auto generated by insns2vm.rb + DO NOT TOUCH! + + If you want to fix something, you must edit 'template/optinsn.inc.tmpl' + or rb/insns2vm.rb + */ + +static INSN * +insn_operands_unification(INSN *insnobj){ +#ifdef OPT_OPERANDS_UNIFICATION + /* optimize rule */ + switch(insnobj->insn_id){ + + + + default: + /* do nothing */; + break; + } +#endif + return insnobj; +} + diff --git a/optunifs.inc b/optunifs.inc new file mode 100644 index 0000000000..5fc82c9200 --- /dev/null +++ b/optunifs.inc @@ -0,0 +1,116 @@ +/* -*-c-*- *********************************************************/ +/*******************************************************************/ +/*******************************************************************/ +/** + This file is for threaded code. + + ---- + This file is auto generated by insns2vm.rb + DO NOT TOUCH! + + If you want to fix something, you must edit 'template/optunifs.inc.tmpl' + or rb/insns2vm.rb + */ + +/* + static const int UNIFIED_insn_name_1[] = {id, size, ...}; + static const int UNIFIED_insn_name_2[] = {id, size, ...}; + ... + + static const int *const UNIFIED_insn_name[] = {size, + UNIFIED_insn_name_1, + UNIFIED_insn_name_2, ...}; + ... + + static const int *const *const unified_insns_data[] = { + UNIFIED_insn_nameA, + UNIFIED_insn_nameB, ...}; + */ + + + +static const int *const *const unified_insns_data[] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0}; + + +#undef GET_INSN_NAME + diff --git a/vm.inc b/vm.inc new file mode 100644 index 0000000000..ed6cffc8c0 --- /dev/null +++ b/vm.inc @@ -0,0 +1,3051 @@ +/* -*-c-*- *********************************************************/ +/*******************************************************************/ +/*******************************************************************/ +/** + This file is VM main loop. + + ---- + This file is auto generated by insns2vm.rb + DO NOT TOUCH! + + If you want to fix something, you must edit 'insns.c' + */ + + +INSN_ENTRY(nop){ +{ + + + DEBUG_ENTER_INSN("nop"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + #define CURRENT_INSN_nop 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_nop_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(nop)); +{ +#line 40 "insns.def" + /* none */ + +#line 32 "vm.inc" +#undef CURRENT_INSN_nop +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(nop);}}} +INSN_ENTRY(getlocal){ +{ + VALUE val; + lindex_t idx = (lindex_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("getlocal"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_getlocal 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_getlocal_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(getlocal)); + USAGE_ANALYSIS_OPERAND(BIN(getlocal), 0, idx); +{ +#line 58 "insns.def" + val = *(GET_LFP() - idx); + +#line 56 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_getlocal +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(getlocal);}}} +INSN_ENTRY(setlocal){ +{ + lindex_t idx = (lindex_t)GET_OPERAND(1); + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("setlocal"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_setlocal 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_setlocal_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(setlocal)); + USAGE_ANALYSIS_OPERAND(BIN(setlocal), 0, idx); +{ +#line 72 "insns.def" + (*(GET_LFP() - idx)) = val; + +#line 82 "vm.inc" +#undef CURRENT_INSN_setlocal +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(setlocal);}}} +INSN_ENTRY(getspecial){ +{ + VALUE val; + rb_num_t type = (rb_num_t)GET_OPERAND(2); + VALUE key = (VALUE)GET_OPERAND(1); + + DEBUG_ENTER_INSN("getspecial"); + ADD_PC(1+2); + PREFETCH(GET_PC()); + #define CURRENT_INSN_getspecial 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_getspecial_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(getspecial)); + USAGE_ANALYSIS_OPERAND(BIN(getspecial), 0, key); + USAGE_ANALYSIS_OPERAND(BIN(getspecial), 1, type); +{ +#line 86 "insns.def" + val = vm_getspecial(th, GET_LFP(), key, type); + +#line 108 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_getspecial +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(getspecial);}}} +INSN_ENTRY(setspecial){ +{ + VALUE key = (VALUE)GET_OPERAND(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("setspecial"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_setspecial 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_setspecial_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(setspecial)); + USAGE_ANALYSIS_OPERAND(BIN(setspecial), 0, key); +{ +#line 100 "insns.def" + lfp_svar_set(th, GET_LFP(), key, obj); + +#line 134 "vm.inc" +#undef CURRENT_INSN_setspecial +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(setspecial);}}} +INSN_ENTRY(getdynamic){ +{ + VALUE val; + rb_num_t level = (rb_num_t)GET_OPERAND(2); + dindex_t idx = (dindex_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("getdynamic"); + ADD_PC(1+2); + PREFETCH(GET_PC()); + #define CURRENT_INSN_getdynamic 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_getdynamic_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(getdynamic)); + USAGE_ANALYSIS_OPERAND(BIN(getdynamic), 0, idx); + USAGE_ANALYSIS_OPERAND(BIN(getdynamic), 1, level); +{ +#line 116 "insns.def" + rb_num_t i; + VALUE *dfp2 = GET_DFP(); + for (i = 0; i < level; i++) { + dfp2 = GET_PREV_DFP(dfp2); + } + val = *(dfp2 - idx); + +#line 165 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_getdynamic +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(getdynamic);}}} +INSN_ENTRY(setdynamic){ +{ + rb_num_t level = (rb_num_t)GET_OPERAND(2); + dindex_t idx = (dindex_t)GET_OPERAND(1); + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("setdynamic"); + ADD_PC(1+2); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_setdynamic 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_setdynamic_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(setdynamic)); + USAGE_ANALYSIS_OPERAND(BIN(setdynamic), 0, idx); + USAGE_ANALYSIS_OPERAND(BIN(setdynamic), 1, level); +{ +#line 137 "insns.def" + rb_num_t i; + VALUE *dfp2 = GET_DFP(); + for (i = 0; i < level; i++) { + dfp2 = GET_PREV_DFP(dfp2); + } + *(dfp2 - idx) = val; + +#line 198 "vm.inc" +#undef CURRENT_INSN_setdynamic +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(setdynamic);}}} +INSN_ENTRY(getinstancevariable){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(2); + ID id = (ID)GET_OPERAND(1); + + DEBUG_ENTER_INSN("getinstancevariable"); + ADD_PC(1+2); + PREFETCH(GET_PC()); + #define CURRENT_INSN_getinstancevariable 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_getinstancevariable_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(getinstancevariable)); + USAGE_ANALYSIS_OPERAND(BIN(getinstancevariable), 0, id); + USAGE_ANALYSIS_OPERAND(BIN(getinstancevariable), 1, ic); +{ +#line 157 "insns.def" + val = vm_getivar(GET_SELF(), id, ic); + +#line 224 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_getinstancevariable +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(getinstancevariable);}}} +INSN_ENTRY(setinstancevariable){ +{ + IC ic = (IC)GET_OPERAND(2); + ID id = (ID)GET_OPERAND(1); + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("setinstancevariable"); + ADD_PC(1+2); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_setinstancevariable 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_setinstancevariable_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(setinstancevariable)); + USAGE_ANALYSIS_OPERAND(BIN(setinstancevariable), 0, id); + USAGE_ANALYSIS_OPERAND(BIN(setinstancevariable), 1, ic); +{ +#line 172 "insns.def" + vm_setivar(GET_SELF(), id, val, ic); + +#line 252 "vm.inc" +#undef CURRENT_INSN_setinstancevariable +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(setinstancevariable);}}} +INSN_ENTRY(getclassvariable){ +{ + VALUE val; + ID id = (ID)GET_OPERAND(1); + + DEBUG_ENTER_INSN("getclassvariable"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_getclassvariable 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_getclassvariable_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(getclassvariable)); + USAGE_ANALYSIS_OPERAND(BIN(getclassvariable), 0, id); +{ +#line 186 "insns.def" + NODE * const cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP()); + val = rb_cvar_get(vm_get_cvar_base(cref), id); + +#line 277 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_getclassvariable +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(getclassvariable);}}} +INSN_ENTRY(setclassvariable){ +{ + ID id = (ID)GET_OPERAND(1); + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("setclassvariable"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_setclassvariable 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_setclassvariable_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(setclassvariable)); + USAGE_ANALYSIS_OPERAND(BIN(setclassvariable), 0, id); +{ +#line 201 "insns.def" + NODE * const cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP()); + rb_cvar_set(vm_get_cvar_base(cref), id, val); + +#line 304 "vm.inc" +#undef CURRENT_INSN_setclassvariable +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(setclassvariable);}}} +INSN_ENTRY(getconstant){ +{ + VALUE val; + ID id = (ID)GET_OPERAND(1); + VALUE klass = TOPN(0); + DEBUG_ENTER_INSN("getconstant"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_getconstant 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_getconstant_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(getconstant)); + USAGE_ANALYSIS_OPERAND(BIN(getconstant), 0, id); +{ +#line 223 "insns.def" + val = vm_get_ev_const(th, GET_ISEQ(), klass, id, 0); + +#line 329 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_getconstant +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(getconstant);}}} +INSN_ENTRY(setconstant){ +{ + ID id = (ID)GET_OPERAND(1); + VALUE val = TOPN(1); + VALUE cbase = TOPN(0); + DEBUG_ENTER_INSN("setconstant"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_setconstant 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_setconstant_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(setconstant)); + USAGE_ANALYSIS_OPERAND(BIN(setconstant), 0, id); +{ +#line 245 "insns.def" + vm_check_if_namespace(cbase); + rb_const_set(cbase, id, val); + INC_VM_STATE_VERSION(); + +#line 358 "vm.inc" +#undef CURRENT_INSN_setconstant +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(setconstant);}}} +INSN_ENTRY(getglobal){ +{ + VALUE val; + GENTRY entry = (GENTRY)GET_OPERAND(1); + + DEBUG_ENTER_INSN("getglobal"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_getglobal 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_getglobal_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(getglobal)); + USAGE_ANALYSIS_OPERAND(BIN(getglobal), 0, entry); +{ +#line 261 "insns.def" + val = GET_GLOBAL((VALUE)entry); + +#line 382 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_getglobal +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(getglobal);}}} +INSN_ENTRY(setglobal){ +{ + GENTRY entry = (GENTRY)GET_OPERAND(1); + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("setglobal"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_setglobal 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_setglobal_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(setglobal)); + USAGE_ANALYSIS_OPERAND(BIN(setglobal), 0, entry); +{ +#line 275 "insns.def" + SET_GLOBAL((VALUE)entry, val); + +#line 408 "vm.inc" +#undef CURRENT_INSN_setglobal +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(setglobal);}}} +INSN_ENTRY(putnil){ +{ + VALUE val; + + + DEBUG_ENTER_INSN("putnil"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + #define CURRENT_INSN_putnil 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_putnil_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(putnil)); +{ +#line 294 "insns.def" + val = Qnil; + +#line 431 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_putnil +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(putnil);}}} +INSN_ENTRY(putself){ +{ + VALUE val; + + + DEBUG_ENTER_INSN("putself"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + #define CURRENT_INSN_putself 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_putself_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(putself)); +{ +#line 308 "insns.def" + val = GET_SELF(); + +#line 456 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_putself +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(putself);}}} +INSN_ENTRY(putobject){ +{ + VALUE val = (VALUE)GET_OPERAND(1); + + DEBUG_ENTER_INSN("putobject"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_putobject 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_putobject_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(putobject)); + USAGE_ANALYSIS_OPERAND(BIN(putobject), 0, val); +{ +#line 324 "insns.def" + /* */ + +#line 481 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_putobject +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(putobject);}}} +INSN_ENTRY(putspecialobject){ +{ + VALUE val; + rb_num_t value_type = (rb_num_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("putspecialobject"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_putspecialobject 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_putspecialobject_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(putspecialobject)); + USAGE_ANALYSIS_OPERAND(BIN(putspecialobject), 0, value_type); +{ +#line 339 "insns.def" + enum vm_special_object_type type = (enum vm_special_object_type)value_type; + + switch (type) { + case VM_SPECIAL_OBJECT_VMCORE: + val = rb_mRubyVMFrozenCore; + break; + case VM_SPECIAL_OBJECT_CBASE: + val = vm_get_cbase(GET_ISEQ(), GET_LFP(), GET_DFP()); + break; + case VM_SPECIAL_OBJECT_CONST_BASE: + val = vm_get_const_base(GET_ISEQ(), GET_LFP(), GET_DFP()); + break; + default: + rb_bug("putspecialobject insn: unknown value_type"); + } + +#line 521 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_putspecialobject +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(putspecialobject);}}} +INSN_ENTRY(putiseq){ +{ + VALUE ret; + ISEQ iseq = (ISEQ)GET_OPERAND(1); + + DEBUG_ENTER_INSN("putiseq"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_putiseq 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_putiseq_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(putiseq)); + USAGE_ANALYSIS_OPERAND(BIN(putiseq), 0, iseq); +{ +#line 367 "insns.def" + ret = iseq->self; + +#line 547 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(ret); +#undef CURRENT_INSN_putiseq +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(putiseq);}}} +INSN_ENTRY(putstring){ +{ + VALUE val; + VALUE str = (VALUE)GET_OPERAND(1); + + DEBUG_ENTER_INSN("putstring"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_putstring 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_putstring_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(putstring)); + USAGE_ANALYSIS_OPERAND(BIN(putstring), 0, str); +{ +#line 381 "insns.def" + val = rb_str_resurrect(str); + +#line 573 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_putstring +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(putstring);}}} +INSN_ENTRY(concatstrings){ +{ + VALUE val; + rb_num_t num = (rb_num_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("concatstrings"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_concatstrings 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_concatstrings_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(concatstrings)); + USAGE_ANALYSIS_OPERAND(BIN(concatstrings), 0, num); +{ +#line 395 "insns.def" + rb_num_t i = num - 1; + + val = rb_str_resurrect(TOPN(i)); + while (i-- > 0) { + const VALUE v = TOPN(i); + rb_str_append(val, v); + } + POPN(num); + +#line 606 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_concatstrings +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(concatstrings);}}} +INSN_ENTRY(tostring){ +{ + + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("tostring"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_tostring 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_tostring_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(tostring)); +{ +#line 416 "insns.def" + val = rb_obj_as_string(val); + +#line 631 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_tostring +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(tostring);}}} +INSN_ENTRY(toregexp){ +{ + VALUE val; + rb_num_t cnt = (rb_num_t)GET_OPERAND(2); + rb_num_t opt = (rb_num_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("toregexp"); + ADD_PC(1+2); + PREFETCH(GET_PC()); + #define CURRENT_INSN_toregexp 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_toregexp_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(toregexp)); + USAGE_ANALYSIS_OPERAND(BIN(toregexp), 0, opt); + USAGE_ANALYSIS_OPERAND(BIN(toregexp), 1, cnt); +{ +#line 431 "insns.def" + VALUE rb_reg_new_ary(VALUE ary, int options); + rb_num_t i; + const VALUE ary = rb_ary_tmp_new(cnt); + for (i = 0; i < cnt; i++) { + rb_ary_store(ary, cnt-i-1, TOPN(i)); + } + POPN(cnt); + val = rb_reg_new_ary(ary, (int)opt); + rb_ary_clear(ary); + +#line 667 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_toregexp +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(toregexp);}}} +INSN_ENTRY(newarray){ +{ + VALUE val; + rb_num_t num = (rb_num_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("newarray"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_newarray 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_newarray_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(newarray)); + USAGE_ANALYSIS_OPERAND(BIN(newarray), 0, num); +{ +#line 453 "insns.def" + val = rb_ary_new4((long)num, STACK_ADDR_FROM_TOP(num)); + POPN(num); + +#line 694 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_newarray +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(newarray);}}} +INSN_ENTRY(duparray){ +{ + VALUE val; + VALUE ary = (VALUE)GET_OPERAND(1); + + DEBUG_ENTER_INSN("duparray"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_duparray 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_duparray_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(duparray)); + USAGE_ANALYSIS_OPERAND(BIN(duparray), 0, ary); +{ +#line 468 "insns.def" + val = rb_ary_resurrect(ary); + +#line 720 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_duparray +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(duparray);}}} +INSN_ENTRY(expandarray){ +{ + rb_num_t flag = (rb_num_t)GET_OPERAND(2); + rb_num_t num = (rb_num_t)GET_OPERAND(1); + VALUE ary = TOPN(0); + DEBUG_ENTER_INSN("expandarray"); + ADD_PC(1+2); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_expandarray 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_expandarray_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(expandarray)); + USAGE_ANALYSIS_OPERAND(BIN(expandarray), 0, num); + USAGE_ANALYSIS_OPERAND(BIN(expandarray), 1, flag); +{ +#line 489 "insns.def" + vm_expandarray(GET_CFP(), ary, num, (int)flag); + +#line 748 "vm.inc" +#undef CURRENT_INSN_expandarray +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(expandarray);}}} +INSN_ENTRY(concatarray){ +{ + VALUE ary; + + VALUE ary1 = TOPN(1); + VALUE ary2st = TOPN(0); + DEBUG_ENTER_INSN("concatarray"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_concatarray 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_concatarray_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(concatarray)); +{ +#line 503 "insns.def" + const VALUE ary2 = ary2st; + VALUE tmp1 = rb_check_convert_type(ary1, T_ARRAY, "Array", "to_a"); + VALUE tmp2 = rb_check_convert_type(ary2, T_ARRAY, "Array", "to_a"); + + if (NIL_P(tmp1)) { + tmp1 = rb_ary_new3(1, ary1); + } + + if (NIL_P(tmp2)) { + tmp2 = rb_ary_new3(1, ary2); + } + + if (tmp1 == ary1) { + tmp1 = rb_ary_dup(ary1); + } + ary = rb_ary_concat(tmp1, tmp2); + +#line 788 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(ary); +#undef CURRENT_INSN_concatarray +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(concatarray);}}} +INSN_ENTRY(splatarray){ +{ + VALUE obj; + + VALUE ary = TOPN(0); + DEBUG_ENTER_INSN("splatarray"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_splatarray 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_splatarray_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(splatarray)); + USAGE_ANALYSIS_OPERAND(BIN(splatarray), 0, flag); +{ +#line 532 "insns.def" + VALUE tmp = rb_check_convert_type(ary, T_ARRAY, "Array", "to_a"); + if (NIL_P(tmp)) { + tmp = rb_ary_new3(1, ary); + } + obj = tmp; + +#line 819 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(obj); +#undef CURRENT_INSN_splatarray +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(splatarray);}}} +INSN_ENTRY(checkincludearray){ +{ + VALUE result; + VALUE flag = (VALUE)GET_OPERAND(1); + VALUE obj = TOPN(1); + VALUE ary = TOPN(0); + DEBUG_ENTER_INSN("checkincludearray"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_checkincludearray 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_checkincludearray_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(checkincludearray)); + USAGE_ANALYSIS_OPERAND(BIN(checkincludearray), 0, flag); +{ +#line 550 "insns.def" + int i; + result = Qfalse; + + if (TYPE(ary) != T_ARRAY) { + ary = rb_Array(ary); + } + + if (flag == Qtrue) { + /* NODE_CASE */ + for (i = 0; i < RARRAY_LEN(ary); i++) { + /* TODO: fix me (use another method dispatch) */ + if (RTEST(rb_funcall2(RARRAY_PTR(ary)[i], idEqq, 1, &obj))) { + result = Qtrue; + break; + } + } + } + else { + obj = Qfalse; + /* NODE_WHEN */ + for (i = 0; i < RARRAY_LEN(ary); i++) { + if (RTEST(RARRAY_PTR(ary)[i])) { + obj = result = Qtrue; + break; + } + } + } + +#line 873 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 2); + PUSH(obj); + PUSH(result); +#undef CURRENT_INSN_checkincludearray +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(checkincludearray);}}} +INSN_ENTRY(newhash){ +{ + VALUE val; + rb_num_t num = (rb_num_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("newhash"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_newhash 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_newhash_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(newhash)); + USAGE_ANALYSIS_OPERAND(BIN(newhash), 0, num); +{ +#line 591 "insns.def" + rb_num_t i; + val = rb_hash_new(); + + for (i = num; i > 0; i -= 2) { + const VALUE v = TOPN(i - 2); + const VALUE k = TOPN(i - 1); + rb_hash_aset(val, k, v); + } + POPN(num); + +#line 908 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_newhash +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(newhash);}}} +INSN_ENTRY(newrange){ +{ + VALUE val; + rb_num_t flag = (rb_num_t)GET_OPERAND(1); + VALUE low = TOPN(1); + VALUE high = TOPN(0); + DEBUG_ENTER_INSN("newrange"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_newrange 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_newrange_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(newrange)); + USAGE_ANALYSIS_OPERAND(BIN(newrange), 0, flag); +{ +#line 613 "insns.def" + val = rb_range_new(low, high, (int)flag); + +#line 936 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_newrange +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(newrange);}}} +INSN_ENTRY(pop){ +{ + + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("pop"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_pop 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_pop_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(pop)); +{ +#line 631 "insns.def" + val = val; + /* none */ + +#line 962 "vm.inc" +#undef CURRENT_INSN_pop +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(pop);}}} +INSN_ENTRY(dup){ +{ + VALUE val2; + VALUE val1; + + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("dup"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_dup 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_dup_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(dup)); +{ +#line 646 "insns.def" + val1 = val2 = val; + +#line 987 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 2); + PUSH(val1); + PUSH(val2); +#undef CURRENT_INSN_dup +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(dup);}}} +INSN_ENTRY(dupn){ +{ + rb_num_t n = (rb_num_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("dupn"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_dupn 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_dupn_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(dupn)); + USAGE_ANALYSIS_OPERAND(BIN(dupn), 0, n); +{ +#line 660 "insns.def" + rb_num_t i; + VALUE *sp = STACK_ADDR_FROM_TOP(n); + for (i = 0; i < n; i++) { + GET_SP()[i] = sp[i]; + } + INC_SP(n); + +#line 1018 "vm.inc" +#undef CURRENT_INSN_dupn +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(dupn);}}} +INSN_ENTRY(swap){ +{ + + VALUE val = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("swap"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_swap 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_swap_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(swap)); +{ +#line 680 "insns.def" + /* none */ + +#line 1042 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 2); + PUSH(obj); + PUSH(val); +#undef CURRENT_INSN_swap +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(swap);}}} +INSN_ENTRY(reput){ +{ + + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("reput"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_reput 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_reput_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(reput)); +{ +#line 694 "insns.def" + /* none */ + +#line 1068 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_reput +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(reput);}}} +INSN_ENTRY(topn){ +{ + VALUE val; + rb_num_t n = (rb_num_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("topn"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_topn 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_topn_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(topn)); + USAGE_ANALYSIS_OPERAND(BIN(topn), 0, n); +{ +#line 708 "insns.def" + val = TOPN(n); + +#line 1094 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_topn +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(topn);}}} +INSN_ENTRY(setn){ +{ + rb_num_t n = (rb_num_t)GET_OPERAND(1); + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("setn"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_setn 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_setn_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(setn)); + USAGE_ANALYSIS_OPERAND(BIN(setn), 0, n); +{ +#line 722 "insns.def" + TOPN(n-1) = val; + +#line 1120 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_setn +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(setn);}}} +INSN_ENTRY(adjuststack){ +{ + rb_num_t n = (rb_num_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("adjuststack"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_adjuststack 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_adjuststack_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(adjuststack)); + USAGE_ANALYSIS_OPERAND(BIN(adjuststack), 0, n); +{ +#line 736 "insns.def" + DEC_SP(n); + +#line 1145 "vm.inc" +#undef CURRENT_INSN_adjuststack +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(adjuststack);}}} +INSN_ENTRY(defined){ +{ + VALUE val; + VALUE needstr = (VALUE)GET_OPERAND(3); + VALUE obj = (VALUE)GET_OPERAND(2); + rb_num_t op_type = (rb_num_t)GET_OPERAND(1); + VALUE v = TOPN(0); + DEBUG_ENTER_INSN("defined"); + ADD_PC(1+3); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_defined 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_defined_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(defined)); + USAGE_ANALYSIS_OPERAND(BIN(defined), 0, op_type); + USAGE_ANALYSIS_OPERAND(BIN(defined), 1, obj); + USAGE_ANALYSIS_OPERAND(BIN(defined), 2, needstr); +{ +#line 755 "insns.def" + VALUE klass; + const char *expr_type = 0; + enum defined_type type = (enum defined_type)op_type; + + val = Qnil; + + switch (type) { + case DEFINED_IVAR: + if (rb_ivar_defined(GET_SELF(), SYM2ID(obj))) { + expr_type = "instance-variable"; + } + break; + case DEFINED_IVAR2: + klass = vm_get_cbase(GET_ISEQ(), GET_LFP(), GET_DFP()); + break; + case DEFINED_GVAR: + if (rb_gvar_defined(rb_global_entry(SYM2ID(obj)))) { + expr_type = "global-variable"; + } + break; + case DEFINED_CVAR: + { + NODE *cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP()); + klass = vm_get_cvar_base(cref); + if (rb_cvar_defined(klass, SYM2ID(obj))) { + expr_type = "class variable"; + } + break; + } + case DEFINED_CONST: + klass = v; + if (vm_get_ev_const(th, GET_ISEQ(), klass, SYM2ID(obj), 1)) { + expr_type = "constant"; + } + break; + case DEFINED_FUNC: + klass = CLASS_OF(v); + if (rb_method_boundp(klass, SYM2ID(obj), 0)) { + expr_type = "method"; + } + break; + case DEFINED_METHOD:{ + VALUE klass = CLASS_OF(v); + const rb_method_entry_t *me = rb_method_entry(klass, SYM2ID(obj)); + + if (me) { + if (!(me->flag & NOEX_PRIVATE)) { + if (!((me->flag & NOEX_PROTECTED) && + !rb_obj_is_kind_of(GET_SELF(), + rb_class_real(klass)))) { + expr_type = "method"; + } + } + } + { + VALUE args[2]; + VALUE r; + + args[0] = obj; args[1] = Qfalse; + r = rb_check_funcall(v, rb_intern("respond_to_missing?"), 2, args); + if (r != Qundef && RTEST(r)) + expr_type = "method"; + } + break; + } + case DEFINED_YIELD: + if (GET_BLOCK_PTR()) { + expr_type = "yield"; + } + break; + case DEFINED_ZSUPER:{ + rb_iseq_t *iseq = GET_ISEQ(); + while (iseq) { + if (iseq->defined_method_id) { + break; + } + iseq = iseq->parent_iseq; + } + if (iseq) { + VALUE klass = vm_search_normal_superclass(iseq->klass, GET_SELF()); + if (rb_method_boundp(klass, iseq->defined_method_id, 0)) { + expr_type = "super"; + } + } + break; + } + case DEFINED_REF:{ + val = vm_getspecial(th, GET_LFP(), Qfalse, FIX2INT(obj)); + if (val != Qnil) { + expr_type = "global-variable"; + } + break; + } + default: + rb_bug("unimplemented defined? type (VM)"); + break; + } + if (expr_type != 0) { + if (needstr != Qfalse) { + val = rb_str_new2(expr_type); + } + else { + val = Qtrue; + } + } + +#line 1278 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_defined +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(defined);}}} +INSN_ENTRY(trace){ +{ + rb_num_t nf = (rb_num_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("trace"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_trace 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_trace_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(trace)); + USAGE_ANALYSIS_OPERAND(BIN(trace), 0, nf); +{ +#line 873 "insns.def" + rb_event_flag_t flag = (rb_event_flag_t)nf; + + EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */); + +#line 1305 "vm.inc" +#undef CURRENT_INSN_trace +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(trace);}}} +INSN_ENTRY(defineclass){ +{ + VALUE val; + rb_num_t define_type = (rb_num_t)GET_OPERAND(3); + ISEQ class_iseq = (ISEQ)GET_OPERAND(2); + ID id = (ID)GET_OPERAND(1); + VALUE cbase = TOPN(1); + VALUE super = TOPN(0); + DEBUG_ENTER_INSN("defineclass"); + ADD_PC(1+3); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_defineclass 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_defineclass_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(defineclass)); + USAGE_ANALYSIS_OPERAND(BIN(defineclass), 0, id); + USAGE_ANALYSIS_OPERAND(BIN(defineclass), 1, class_iseq); + USAGE_ANALYSIS_OPERAND(BIN(defineclass), 2, define_type); +{ +#line 897 "insns.def" + VALUE klass; + + switch ((int)define_type) { + case 0: /* scoped: class Foo::Bar */ + case 3: /* no scope: class Bar */ + /* val is dummy. classdef returns class scope value */ + + if (super == Qnil) { + super = rb_cObject; + } + + vm_check_if_namespace(cbase); + + /* find klass */ + rb_autoload_load(cbase, id); + if ((klass = vm_search_const_defined_class(cbase, id)) != 0) { + /* already exist */ + klass = define_type == 0 ? rb_public_const_get_at(klass, id) : rb_const_get_at(klass, id); + if (TYPE(klass) != T_CLASS) { + rb_raise(rb_eTypeError, "%s is not a class", rb_id2name(id)); + } + + if (super != rb_cObject) { + VALUE tmp; + tmp = rb_class_real(RCLASS_SUPER(klass)); + + if (tmp != super) { + rb_raise(rb_eTypeError, "superclass mismatch for class %s", + rb_id2name(id)); + } + } + } + else { + /* new class declaration */ + klass = rb_define_class_id(id, super); + rb_set_class_path_string(klass, cbase, rb_id2str(id)); + rb_const_set(cbase, id, klass); + rb_class_inherited(super, klass); + } + break; + case 1: + /* val is dummy. classdef returns class scope value */ + /* super is dummy */ + klass = rb_singleton_class(cbase); + break; + case 2: /* scoped: module Foo::Bar or module ::Bar */ + case 5: /* no scope: module Bar */ + /* val is dummy. classdef returns class scope value */ + /* super is dummy */ + + vm_check_if_namespace(cbase); + + /* find klass */ + if ((klass = vm_search_const_defined_class(cbase, id)) != 0) { + klass = define_type == 2 ? rb_public_const_get_at(klass, id) : rb_const_get_at(klass, id); + /* already exist */ + if (TYPE(klass) != T_MODULE) { + rb_raise(rb_eTypeError, "%s is not a module", rb_id2name(id)); + } + } + else { + /* new module declaration */ + klass = rb_define_module_id(id); + rb_set_class_path_string(klass, cbase, rb_id2str(id)); + rb_const_set(cbase, id, klass); + } + break; + default: + rb_bug("unknown defineclass type: %d", (int)define_type); + } + + COPY_CREF(class_iseq->cref_stack, vm_cref_push(th, klass, NOEX_PUBLIC, NULL)); + + /* enter scope */ + vm_push_frame(th, class_iseq, + VM_FRAME_MAGIC_CLASS, klass, (VALUE) GET_BLOCK_PTR(), + class_iseq->iseq_encoded, GET_SP(), 0, + class_iseq->local_size); + RESTORE_REGS(); + + INC_VM_STATE_VERSION(); + NEXT_INSN(); + +#line 1416 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_defineclass +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(defineclass);}}} +INSN_ENTRY(send){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(5); + rb_num_t op_flag = (rb_num_t)GET_OPERAND(4); + ISEQ blockiseq = (ISEQ)GET_OPERAND(3); + rb_num_t op_argc = (rb_num_t)GET_OPERAND(2); + ID op_id = (ID)GET_OPERAND(1); + + DEBUG_ENTER_INSN("send"); + ADD_PC(1+5); + PREFETCH(GET_PC()); + #define CURRENT_INSN_send 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_send_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(send)); + USAGE_ANALYSIS_OPERAND(BIN(send), 0, op_id); + USAGE_ANALYSIS_OPERAND(BIN(send), 1, op_argc); + USAGE_ANALYSIS_OPERAND(BIN(send), 2, blockiseq); + USAGE_ANALYSIS_OPERAND(BIN(send), 3, op_flag); + USAGE_ANALYSIS_OPERAND(BIN(send), 4, ic); +{ +#line 1003 "insns.def" + const rb_method_entry_t *me; + VALUE recv, klass; + rb_block_t *blockptr = 0; + VALUE flag = op_flag; + int num = caller_setup_args(th, GET_CFP(), flag, (int)op_argc, + (rb_iseq_t *)blockiseq, &blockptr); + ID id = op_id; + + /* get receiver */ + recv = TOPN(num); + klass = CLASS_OF(recv); + me = vm_method_search(id, klass, ic); + CALL_METHOD(num, blockptr, flag, id, me, recv); + +#line 1462 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_send +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(send);}}} +INSN_ENTRY(invokesuper){ +{ + VALUE val; + rb_num_t op_flag = (rb_num_t)GET_OPERAND(3); + ISEQ blockiseq = (ISEQ)GET_OPERAND(2); + rb_num_t op_argc = (rb_num_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("invokesuper"); + ADD_PC(1+3); + PREFETCH(GET_PC()); + #define CURRENT_INSN_invokesuper 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_invokesuper_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(invokesuper)); + USAGE_ANALYSIS_OPERAND(BIN(invokesuper), 0, op_argc); + USAGE_ANALYSIS_OPERAND(BIN(invokesuper), 1, blockiseq); + USAGE_ANALYSIS_OPERAND(BIN(invokesuper), 2, op_flag); +{ +#line 1031 "insns.def" + rb_block_t *blockptr = !(op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? GET_BLOCK_PTR() : 0; + VALUE flag = op_flag; + int num = caller_setup_args(th, GET_CFP(), flag, + (int)op_argc, blockiseq, &blockptr); + VALUE recv, klass; + ID id; + const rb_method_entry_t *me; + + flag = VM_CALL_SUPER_BIT | VM_CALL_FCALL_BIT; + + recv = GET_SELF(); + vm_search_superclass(GET_CFP(), GET_ISEQ(), recv, TOPN(num), &id, &klass); + + /* temporary measure for [Bug #2402] [Bug #2502] [Bug #3136] */ + if (!rb_obj_is_kind_of(recv, klass)) { + rb_raise(rb_eNotImpError, "super from singleton method that is defined to multiple classes is not supported; this will be fixed in 1.9.3 or later"); + } + + me = rb_method_entry(klass, id); + + CALL_METHOD(num, blockptr, flag, id, me, recv); + +#line 1512 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_invokesuper +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(invokesuper);}}} +INSN_ENTRY(invokeblock){ +{ + VALUE val; + rb_num_t flag = (rb_num_t)GET_OPERAND(2); + rb_num_t num = (rb_num_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("invokeblock"); + ADD_PC(1+2); + PREFETCH(GET_PC()); + #define CURRENT_INSN_invokeblock 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_invokeblock_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(invokeblock)); + USAGE_ANALYSIS_OPERAND(BIN(invokeblock), 0, num); + USAGE_ANALYSIS_OPERAND(BIN(invokeblock), 1, flag); +{ +#line 1066 "insns.def" + val = vm_invoke_block(th, GET_CFP(), num, flag); + if (val == Qundef) { + RESTORE_REGS(); + NEXT_INSN(); + } + +#line 1544 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_invokeblock +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(invokeblock);}}} +INSN_ENTRY(leave){ +{ + + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("leave"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_leave 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_leave_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(leave)); +{ +#line 1084 "insns.def" + if (OPT_CHECKED_RUN) { + if (reg_cfp->sp != reg_cfp->bp) { + rb_bug("Stack consistency error (sp: %"PRIdPTRDIFF", bp: %"PRIdPTRDIFF")", + VM_SP_CNT(th, reg_cfp->sp), VM_SP_CNT(th, reg_cfp->bp)); + } + } + + RUBY_VM_CHECK_INTS(); + vm_pop_frame(th); + RESTORE_REGS(); + +#line 1578 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_leave +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(leave);}}} +INSN_ENTRY(finish){ +{ + + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("finish"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_finish 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_finish_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(finish)); +{ +#line 1107 "insns.def" +#if OPT_CALL_THREADED_CODE + rb_bug("unused instruction on OPT_CALL_THREADED_CODE"); +#else + th->cfp++; + return val; +#endif + +#line 1608 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_finish +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(finish);}}} +INSN_ENTRY(throw){ +{ + VALUE val; + rb_num_t throw_state = (rb_num_t)GET_OPERAND(1); + VALUE throwobj = TOPN(0); + DEBUG_ENTER_INSN("throw"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_throw 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_throw_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(throw)); + USAGE_ANALYSIS_OPERAND(BIN(throw), 0, throw_state); +{ +#line 1130 "insns.def" + RUBY_VM_CHECK_INTS(); + val = vm_throw(th, GET_CFP(), throw_state, throwobj); + THROW_EXCEPTION(val); + /* unreachable */ + +#line 1638 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_throw +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(throw);}}} +INSN_ENTRY(jump){ +{ + OFFSET dst = (OFFSET)GET_OPERAND(1); + + DEBUG_ENTER_INSN("jump"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_jump 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_jump_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(jump)); + USAGE_ANALYSIS_OPERAND(BIN(jump), 0, dst); +{ +#line 1151 "insns.def" + RUBY_VM_CHECK_INTS(); + JUMP(dst); + +#line 1664 "vm.inc" +#undef CURRENT_INSN_jump +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(jump);}}} +INSN_ENTRY(branchif){ +{ + OFFSET dst = (OFFSET)GET_OPERAND(1); + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("branchif"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_branchif 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_branchif_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(branchif)); + USAGE_ANALYSIS_OPERAND(BIN(branchif), 0, dst); +{ +#line 1166 "insns.def" + if (RTEST(val)) { + RUBY_VM_CHECK_INTS(); + JUMP(dst); + } + +#line 1691 "vm.inc" +#undef CURRENT_INSN_branchif +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(branchif);}}} +INSN_ENTRY(branchunless){ +{ + OFFSET dst = (OFFSET)GET_OPERAND(1); + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("branchunless"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_branchunless 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_branchunless_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(branchunless)); + USAGE_ANALYSIS_OPERAND(BIN(branchunless), 0, dst); +{ +#line 1183 "insns.def" + if (!RTEST(val)) { + RUBY_VM_CHECK_INTS(); + JUMP(dst); + } + +#line 1718 "vm.inc" +#undef CURRENT_INSN_branchunless +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(branchunless);}}} +INSN_ENTRY(getinlinecache){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(2); + OFFSET dst = (OFFSET)GET_OPERAND(1); + + DEBUG_ENTER_INSN("getinlinecache"); + ADD_PC(1+2); + PREFETCH(GET_PC()); + #define CURRENT_INSN_getinlinecache 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_getinlinecache_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(getinlinecache)); + USAGE_ANALYSIS_OPERAND(BIN(getinlinecache), 0, dst); + USAGE_ANALYSIS_OPERAND(BIN(getinlinecache), 1, ic); +{ +#line 1205 "insns.def" + if (ic->ic_vmstat == GET_VM_STATE_VERSION()) { + val = ic->ic_value.value; + JUMP(dst); + } + else { + /* none */ + val = Qnil; + } + +#line 1751 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_getinlinecache +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(getinlinecache);}}} +INSN_ENTRY(onceinlinecache){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(2); + OFFSET dst = (OFFSET)GET_OPERAND(1); + + DEBUG_ENTER_INSN("onceinlinecache"); + ADD_PC(1+2); + PREFETCH(GET_PC()); + #define CURRENT_INSN_onceinlinecache 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_onceinlinecache_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(onceinlinecache)); + USAGE_ANALYSIS_OPERAND(BIN(onceinlinecache), 0, dst); + USAGE_ANALYSIS_OPERAND(BIN(onceinlinecache), 1, ic); +{ +#line 1226 "insns.def" + retry: + if (ic->ic_vmstat) { + val = ic->ic_value.value; + JUMP(dst); + } + else if (ic->ic_value.value == Qundef) + { + RUBY_VM_CHECK_INTS(); + rb_thread_schedule(); + goto retry; + } + else { + /* none */ + ic->ic_value.value = Qundef; + val = Qnil; + } + +#line 1794 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_onceinlinecache +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(onceinlinecache);}}} +INSN_ENTRY(setinlinecache){ +{ + IC ic = (IC)GET_OPERAND(1); + VALUE val = TOPN(0); + DEBUG_ENTER_INSN("setinlinecache"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_setinlinecache 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_setinlinecache_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(setinlinecache)); + USAGE_ANALYSIS_OPERAND(BIN(setinlinecache), 0, ic); +{ +#line 1255 "insns.def" + if (ic->ic_value.value == Qundef) { + rb_ary_push(GET_ISEQ()->mark_ary, val); + } + ic->ic_value.value = val; + ic->ic_vmstat = GET_VM_STATE_VERSION() - ruby_vm_const_missing_count; + ruby_vm_const_missing_count = 0; + +#line 1825 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_setinlinecache +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(setinlinecache);}}} +INSN_ENTRY(opt_case_dispatch){ +{ + OFFSET else_offset = (OFFSET)GET_OPERAND(2); + CDHASH hash = (CDHASH)GET_OPERAND(1); + VALUE key = TOPN(0); + DEBUG_ENTER_INSN("opt_case_dispatch"); + ADD_PC(1+2); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_opt_case_dispatch 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_case_dispatch_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_case_dispatch)); + USAGE_ANALYSIS_OPERAND(BIN(opt_case_dispatch), 0, hash); + USAGE_ANALYSIS_OPERAND(BIN(opt_case_dispatch), 1, else_offset); +{ +#line 1274 "insns.def" + switch(TYPE(key)) { + case T_FLOAT: { + double ival; + if (modf(RFLOAT_VALUE(key), &ival) == 0.0) { + key = FIXABLE(ival) ? LONG2FIX((long)ival) : rb_dbl2big(ival); + } + } + case T_SYMBOL: /* fall through */ + case T_FIXNUM: + case T_BIGNUM: + case T_STRING: + if (BASIC_OP_UNREDEFINED_P(BOP_EQQ)) { + st_data_t val; + if (st_lookup(RHASH_TBL(hash), key, &val)) { + JUMP(FIX2INT((VALUE)val)); + } + else { + JUMP(else_offset); + } + break; + } + default: + break; + } + +#line 1876 "vm.inc" +#undef CURRENT_INSN_opt_case_dispatch +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_case_dispatch);}}} +INSN_ENTRY(opt_checkenv){ +{ + + + DEBUG_ENTER_INSN("opt_checkenv"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + #define CURRENT_INSN_opt_checkenv 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_checkenv_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_checkenv)); +{ +#line 1311 "insns.def" + if (GET_CFP()->bp != GET_DFP() + 1) { + VALUE *new_dfp = GET_CFP()->bp - 1; + /* TODO: copy env and clean stack at creating env? */ + *new_dfp = *GET_DFP(); + SET_DFP(new_dfp); + } + +#line 1903 "vm.inc" +#undef CURRENT_INSN_opt_checkenv +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_checkenv);}}} +INSN_ENTRY(opt_plus){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_plus"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_plus 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_plus_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_plus)); + USAGE_ANALYSIS_OPERAND(BIN(opt_plus), 0, ic); +{ +#line 1333 "insns.def" + if (0) { + + } +#if 1 + else if (FIXNUM_2_P(recv, obj) && + BASIC_OP_UNREDEFINED_P(BOP_PLUS)) { + /* fixnum + fixnum */ +#ifndef LONG_LONG_VALUE + val = (recv + (obj & (~1))); + if ((~(recv ^ obj) & (recv ^ val)) & + ((VALUE)0x01 << ((sizeof(VALUE) * CHAR_BIT) - 1))) { + val = rb_big_plus(rb_int2big(FIX2LONG(recv)), + rb_int2big(FIX2LONG(obj))); + } +#else + long a, b, c; + a = FIX2LONG(recv); + b = FIX2LONG(obj); + c = a + b; + if (FIXABLE(c)) { + val = LONG2FIX(c); + } + else { + val = rb_big_plus(rb_int2big(a), rb_int2big(b)); + } +#endif + } +#endif + + else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { + if (0) { + } +#if 1 + else if (HEAP_CLASS_OF(recv) == rb_cFloat && + HEAP_CLASS_OF(obj) == rb_cFloat && + BASIC_OP_UNREDEFINED_P(BOP_PLUS)) { + val = DBL2NUM(RFLOAT_VALUE(recv) + RFLOAT_VALUE(obj)); + } +#endif + +#if 1 + else if (HEAP_CLASS_OF(recv) == rb_cString && + HEAP_CLASS_OF(obj) == rb_cString && + BASIC_OP_UNREDEFINED_P(BOP_PLUS)) { + val = rb_str_plus(recv, obj); + } +#endif +#if 1 + else if (HEAP_CLASS_OF(recv) == rb_cArray && + BASIC_OP_UNREDEFINED_P(BOP_PLUS)) { + val = rb_ary_plus(recv, obj); + } +#endif + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + INSN_LABEL(normal_dispatch): + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idPLUS, recv); + } + +#line 1991 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_plus +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_plus);}}} +INSN_ENTRY(opt_minus){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_minus"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_minus 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_minus_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_minus)); + USAGE_ANALYSIS_OPERAND(BIN(opt_minus), 0, ic); +{ +#line 1409 "insns.def" + if (FIXNUM_2_P(recv, obj) && + BASIC_OP_UNREDEFINED_P(BOP_MINUS)) { + long a, b, c; + + a = FIX2LONG(recv); + b = FIX2LONG(obj); + c = a - b; + + if (FIXABLE(c)) { + val = LONG2FIX(c); + } + else { + val = rb_big_minus(rb_int2big(a), rb_int2big(b)); + } + } + else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { + if (0) { + } +#if 1 + else if (HEAP_CLASS_OF(recv) == rb_cFloat && + HEAP_CLASS_OF(obj) == rb_cFloat && + BASIC_OP_UNREDEFINED_P(BOP_MINUS)) { + val = DBL2NUM(RFLOAT_VALUE(recv) - RFLOAT_VALUE(obj)); + } +#endif + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + /* other */ + INSN_LABEL(normal_dispatch): + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idMINUS, recv); + } + +#line 2054 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_minus +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_minus);}}} +INSN_ENTRY(opt_mult){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_mult"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_mult 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_mult_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_mult)); + USAGE_ANALYSIS_OPERAND(BIN(opt_mult), 0, ic); +{ +#line 1458 "insns.def" + if (FIXNUM_2_P(recv, obj) && + BASIC_OP_UNREDEFINED_P(BOP_MULT)) { + long a, b; + + a = FIX2LONG(recv); + if (a == 0) { + val = recv; + } + else { + volatile long c; + b = FIX2LONG(obj); + c = a * b; + + if (FIXABLE(c) && c / a == b) { + val = LONG2FIX(c); + } + else { + val = rb_big_mul(rb_int2big(a), rb_int2big(b)); + } + } + } + else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { + if (0) { + } +#if 1 + else if (HEAP_CLASS_OF(recv) == rb_cFloat && + HEAP_CLASS_OF(obj) == rb_cFloat && + BASIC_OP_UNREDEFINED_P(BOP_MULT)) { + val = DBL2NUM(RFLOAT_VALUE(recv) * RFLOAT_VALUE(obj)); + } +#endif + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + INSN_LABEL(normal_dispatch): + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idMULT, recv); + } + +#line 2122 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_mult +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_mult);}}} +INSN_ENTRY(opt_div){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_div"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_div 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_div_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_div)); + USAGE_ANALYSIS_OPERAND(BIN(opt_div), 0, ic); +{ +#line 1512 "insns.def" + if (FIXNUM_2_P(recv, obj) && + BASIC_OP_UNREDEFINED_P(BOP_DIV)) { + long x, y, div; + + x = FIX2LONG(recv); + y = FIX2LONG(obj); + { + /* copied from numeric.c#fixdivmod */ + long mod; + if (y == 0) + goto INSN_LABEL(normal_dispatch); + if (y < 0) { + if (x < 0) + div = -x / -y; + else + div = -(x / -y); + } + else { + if (x < 0) + div = -(-x / y); + else + div = x / y; + } + mod = x - div * y; + if ((mod < 0 && y > 0) || (mod > 0 && y < 0)) { + mod += y; + div -= 1; + } + } + val = LONG2NUM(div); + } + else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { + if (0) { + } +#if 1 + else if (HEAP_CLASS_OF(recv) == rb_cFloat && + HEAP_CLASS_OF(obj) == rb_cFloat && + BASIC_OP_UNREDEFINED_P(BOP_DIV)) { + val = DBL2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj)); + } +#endif + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + INSN_LABEL(normal_dispatch): + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idDIV, recv); + } + +#line 2200 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_div +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_div);}}} +INSN_ENTRY(opt_mod){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_mod"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_mod 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_mod_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_mod)); + USAGE_ANALYSIS_OPERAND(BIN(opt_mod), 0, ic); +{ +#line 1576 "insns.def" + if (FIXNUM_2_P(recv, obj) && + BASIC_OP_UNREDEFINED_P(BOP_MOD)) { + long x, y, mod; + + x = FIX2LONG(recv); + y = FIX2LONG(obj); + { + /* copied from numeric.c#fixdivmod */ + long div; + + if (y == 0) + rb_num_zerodiv(); + if (y < 0) { + if (x < 0) + div = -x / -y; + else + div = -(x / -y); + } + else { + if (x < 0) + div = -(-x / y); + else + div = x / y; + } + mod = x - div * y; + if ((mod < 0 && y > 0) || (mod > 0 && y < 0)) { + mod += y; + div -= 1; + } + } + val = LONG2FIX(mod); + } + else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { + if (0) { + } + else if (HEAP_CLASS_OF(recv) == rb_cFloat && + HEAP_CLASS_OF(obj) == rb_cFloat && + BASIC_OP_UNREDEFINED_P(BOP_MOD)) { + val = DBL2NUM(ruby_float_mod(RFLOAT_VALUE(recv), RFLOAT_VALUE(obj))); + } + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + INSN_LABEL(normal_dispatch): + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idMOD, recv); + } + +#line 2277 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_mod +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_mod);}}} +INSN_ENTRY(opt_eq){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_eq"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_eq 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_eq_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_eq)); + USAGE_ANALYSIS_OPERAND(BIN(opt_eq), 0, ic); +{ +#line 1639 "insns.def" + val = opt_eq_func(recv, obj, ic); + + if (val == Qundef) { + /* other */ + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idEq, recv); + } + +#line 2312 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_eq +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_eq);}}} +INSN_ENTRY(opt_neq){ +{ + VALUE val; + IC ic_eq = (IC)GET_OPERAND(2); + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_neq"); + ADD_PC(1+2); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_neq 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_neq_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_neq)); + USAGE_ANALYSIS_OPERAND(BIN(opt_neq), 0, ic); + USAGE_ANALYSIS_OPERAND(BIN(opt_neq), 1, ic_eq); +{ +#line 1660 "insns.def" + extern VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2); + const rb_method_entry_t *me = vm_method_search(idNeq, CLASS_OF(recv), ic); + val = Qundef; + + if (check_cfunc(me, rb_obj_not_equal)) { + val = opt_eq_func(recv, obj, ic_eq); + + if (val != Qundef) { + val = RTEST(val) ? Qfalse : Qtrue; + } + } + + if (val == Qundef) { + /* other */ + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idNeq, recv); + } + +#line 2359 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_neq +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_neq);}}} +INSN_ENTRY(opt_lt){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_lt"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_lt 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_lt_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_lt)); + USAGE_ANALYSIS_OPERAND(BIN(opt_lt), 0, ic); +{ +#line 1691 "insns.def" + if (FIXNUM_2_P(recv, obj) && + BASIC_OP_UNREDEFINED_P(BOP_LT)) { + SIGNED_VALUE a = recv, b = obj; + + if (a < b) { + val = Qtrue; + } + else { + val = Qfalse; + } + } + else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { + if (0) { + } +#if 1 + else if (HEAP_CLASS_OF(recv) == rb_cFloat && + HEAP_CLASS_OF(obj) == rb_cFloat && + BASIC_OP_UNREDEFINED_P(BOP_LT)) { + double a = RFLOAT_VALUE(recv); + double b = RFLOAT_VALUE(obj); +#if defined(_MSC_VER) && _MSC_VER < 1300 + if (isnan(a) || isnan(b)) val = Qfalse; + else +#endif + val = a < b ? Qtrue : Qfalse; + } +#endif + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + INSN_LABEL(normal_dispatch): + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idLT, recv); + } + +#line 2423 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_lt +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_lt);}}} +INSN_ENTRY(opt_le){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_le"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_le 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_le_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_le)); + USAGE_ANALYSIS_OPERAND(BIN(opt_le), 0, ic); +{ +#line 1741 "insns.def" + if (FIXNUM_2_P(recv, obj) && + BASIC_OP_UNREDEFINED_P(BOP_LE)) { + SIGNED_VALUE a = recv, b = obj; + + if (a <= b) { + val = Qtrue; + } + else { + val = Qfalse; + } + } + else { + /* other */ + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idLE, recv); + } + +#line 2467 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_le +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_le);}}} +INSN_ENTRY(opt_gt){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_gt"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_gt 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_gt_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_gt)); + USAGE_ANALYSIS_OPERAND(BIN(opt_gt), 0, ic); +{ +#line 1771 "insns.def" + if (FIXNUM_2_P(recv, obj) && + BASIC_OP_UNREDEFINED_P(BOP_GT)) { + SIGNED_VALUE a = recv, b = obj; + + if (a > b) { + val = Qtrue; + } + else { + val = Qfalse; + } + } + else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { + if (0) { + } +#if 1 + else if (HEAP_CLASS_OF(recv) == rb_cFloat && + HEAP_CLASS_OF(obj) == rb_cFloat && + BASIC_OP_UNREDEFINED_P(BOP_GT)) { + double a = RFLOAT_VALUE(recv); + double b = RFLOAT_VALUE(obj); +#if defined(_MSC_VER) && _MSC_VER < 1300 + if (isnan(a) || isnan(b)) val = Qfalse; + else +#endif + val = a > b ? Qtrue : Qfalse; + } +#endif + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + INSN_LABEL(normal_dispatch): + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idGT, recv); + } + +#line 2531 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_gt +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_gt);}}} +INSN_ENTRY(opt_ge){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_ge"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_ge 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_ge_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_ge)); + USAGE_ANALYSIS_OPERAND(BIN(opt_ge), 0, ic); +{ +#line 1821 "insns.def" + if (FIXNUM_2_P(recv, obj) && + BASIC_OP_UNREDEFINED_P(BOP_GE)) { + SIGNED_VALUE a = recv, b = obj; + + if (a >= b) { + val = Qtrue; + } + else { + val = Qfalse; + } + } + else { + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idGE, recv); + } + +#line 2574 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_ge +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_ge);}}} +INSN_ENTRY(opt_ltlt){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_ltlt"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_ltlt 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_ltlt_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_ltlt)); + USAGE_ANALYSIS_OPERAND(BIN(opt_ltlt), 0, ic); +{ +#line 1850 "insns.def" + if (!SPECIAL_CONST_P(recv)) { + if (0) { + } + else if (HEAP_CLASS_OF(recv) == rb_cString && + BASIC_OP_UNREDEFINED_P(BOP_LTLT)) { + val = rb_str_concat(recv, obj); + } + else if (HEAP_CLASS_OF(recv) == rb_cArray && + BASIC_OP_UNREDEFINED_P(BOP_LTLT)) { + val = rb_ary_push(recv, obj); + } + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + INSN_LABEL(normal_dispatch): + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idLTLT, recv); + } + +#line 2622 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_ltlt +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_ltlt);}}} +INSN_ENTRY(opt_aref){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_aref"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_aref 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_aref_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_aref)); + USAGE_ANALYSIS_OPERAND(BIN(opt_aref), 0, ic); +{ +#line 1884 "insns.def" + if (!SPECIAL_CONST_P(recv) && BASIC_OP_UNREDEFINED_P(BOP_AREF)) { + if (HEAP_CLASS_OF(recv) == rb_cArray && FIXNUM_P(obj)) { + val = rb_ary_entry(recv, FIX2LONG(obj)); + } + else if (HEAP_CLASS_OF(recv) == rb_cHash) { + val = rb_hash_aref(recv, obj); + } + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + INSN_LABEL(normal_dispatch): + PUSH(recv); + PUSH(obj); + CALL_SIMPLE_METHOD(1, idAREF, recv); + } + +#line 2666 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_aref +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_aref);}}} +INSN_ENTRY(opt_aset){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(2); + VALUE obj = TOPN(1); + VALUE set = TOPN(0); + DEBUG_ENTER_INSN("opt_aset"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(3); + #define CURRENT_INSN_opt_aset 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_aset_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_aset)); + USAGE_ANALYSIS_OPERAND(BIN(opt_aset), 0, ic); +{ +#line 1914 "insns.def" + if (!SPECIAL_CONST_P(recv) && + BASIC_OP_UNREDEFINED_P(BOP_ASET)) { + if (HEAP_CLASS_OF(recv) == rb_cArray && FIXNUM_P(obj)) { + rb_ary_store(recv, FIX2LONG(obj), set); + val = set; + } + else if (HEAP_CLASS_OF(recv) == rb_cHash) { + rb_hash_aset(recv, obj, set); + val = set; + } + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + INSN_LABEL(normal_dispatch): + PUSH(recv); + PUSH(obj); + PUSH(set); + CALL_SIMPLE_METHOD(2, idASET, recv); + } + +#line 2715 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_aset +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_aset);}}} +INSN_ENTRY(opt_length){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(0); + DEBUG_ENTER_INSN("opt_length"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_opt_length 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_length_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_length)); + USAGE_ANALYSIS_OPERAND(BIN(opt_length), 0, ic); +{ +#line 1948 "insns.def" + if (LIKELY(!SPECIAL_CONST_P(recv) && + BASIC_OP_UNREDEFINED_P(BOP_LENGTH))) { + if (HEAP_CLASS_OF(recv) == rb_cString) { + val = rb_str_length(recv); + } + else if (HEAP_CLASS_OF(recv) == rb_cArray) { + val = LONG2NUM(RARRAY_LEN(recv)); + } + else if (HEAP_CLASS_OF(recv) == rb_cHash) { + val = INT2FIX(RHASH_SIZE(recv)); + } + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + INSN_LABEL(normal_dispatch): + PUSH(recv); + CALL_SIMPLE_METHOD(0, idLength, recv); + } + +#line 2761 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_length +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_length);}}} +INSN_ENTRY(opt_size){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(0); + DEBUG_ENTER_INSN("opt_size"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_opt_size 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_size_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_size)); + USAGE_ANALYSIS_OPERAND(BIN(opt_size), 0, ic); +{ +#line 1981 "insns.def" + if (LIKELY(BASIC_OP_UNREDEFINED_P(BOP_SIZE) && + !SPECIAL_CONST_P(recv))) { + if (HEAP_CLASS_OF(recv) == rb_cString) { + val = rb_str_length(recv); + } + else if (HEAP_CLASS_OF(recv) == rb_cArray) { + val = LONG2NUM(RARRAY_LEN(recv)); + } + else if (HEAP_CLASS_OF(recv) == rb_cHash) { + val = INT2FIX(RHASH_SIZE(recv)); + } + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + INSN_LABEL(normal_dispatch): + PUSH(recv); + CALL_SIMPLE_METHOD(0, idSize, recv); + } + +#line 2807 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_size +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_size);}}} +INSN_ENTRY(opt_succ){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(0); + DEBUG_ENTER_INSN("opt_succ"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_opt_succ 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_succ_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_succ)); + USAGE_ANALYSIS_OPERAND(BIN(opt_succ), 0, ic); +{ +#line 2014 "insns.def" + if (SPECIAL_CONST_P(recv)) { + if (FIXNUM_P(recv) && + BASIC_OP_UNREDEFINED_P(BOP_SUCC)) { + const VALUE obj = INT2FIX(1); + /* fixnum + INT2FIX(1) */ + val = (recv + (obj & (~1))); + if ((~(recv ^ obj) & (recv ^ val)) & ((unsigned long)LONG_MAX + 1)) { + val = rb_big_plus(rb_int2big(FIX2LONG(recv)), + rb_int2big(FIX2LONG(obj))); + } + } + else { + goto INSN_LABEL(normal_dispatch); + } + } + else { + if (HEAP_CLASS_OF(recv) == rb_cString && + BASIC_OP_UNREDEFINED_P(BOP_SUCC)) { + val = rb_str_succ(recv); + } + else if (HEAP_CLASS_OF(recv) == rb_cTime && + BASIC_OP_UNREDEFINED_P(BOP_SUCC)) { + val = rb_time_succ(recv); + } + else + { + goto INSN_LABEL(normal_dispatch); + } + } + if (0) { + INSN_LABEL(normal_dispatch): + PUSH(recv); + CALL_SIMPLE_METHOD(0, idSucc, recv); + } + +#line 2867 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_succ +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_succ);}}} +INSN_ENTRY(opt_not){ +{ + VALUE val; + IC ic = (IC)GET_OPERAND(1); + VALUE recv = TOPN(0); + DEBUG_ENTER_INSN("opt_not"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_opt_not 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_not_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_not)); + USAGE_ANALYSIS_OPERAND(BIN(opt_not), 0, ic); +{ +#line 2061 "insns.def" + extern VALUE rb_obj_not(VALUE obj); + const rb_method_entry_t *me = vm_method_search(idNot, CLASS_OF(recv), ic); + + if (check_cfunc(me, rb_obj_not)) { + val = RTEST(recv) ? Qfalse : Qtrue; + } + else { + PUSH(recv); + CALL_SIMPLE_METHOD(0, idNot, recv); + } + +#line 2903 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_not +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_not);}}} +INSN_ENTRY(opt_regexpmatch1){ +{ + VALUE val; + VALUE r = (VALUE)GET_OPERAND(1); + VALUE obj = TOPN(0); + DEBUG_ENTER_INSN("opt_regexpmatch1"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + POPN(1); + #define CURRENT_INSN_opt_regexpmatch1 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_regexpmatch1_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_regexpmatch1)); + USAGE_ANALYSIS_OPERAND(BIN(opt_regexpmatch1), 0, r); +{ +#line 2085 "insns.def" + val = rb_reg_match(r, obj); + +#line 2930 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_regexpmatch1 +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_regexpmatch1);}}} +INSN_ENTRY(opt_regexpmatch2){ +{ + VALUE val; + + VALUE obj2 = TOPN(1); + VALUE obj1 = TOPN(0); + DEBUG_ENTER_INSN("opt_regexpmatch2"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + POPN(2); + #define CURRENT_INSN_opt_regexpmatch2 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_regexpmatch2_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_regexpmatch2)); +{ +#line 2099 "insns.def" + if (TYPE(obj2) == T_STRING) { + val = rb_reg_match(obj1, obj2); + } + else { + val = rb_funcall(obj2, idEqTilde, 1, obj1); + } + +#line 2962 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(val); +#undef CURRENT_INSN_opt_regexpmatch2 +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_regexpmatch2);}}} +INSN_ENTRY(opt_call_c_function){ +{ + rb_insn_func_t funcptr = (rb_insn_func_t)GET_OPERAND(1); + + DEBUG_ENTER_INSN("opt_call_c_function"); + ADD_PC(1+1); + PREFETCH(GET_PC()); + #define CURRENT_INSN_opt_call_c_function 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_opt_call_c_function_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(opt_call_c_function)); + USAGE_ANALYSIS_OPERAND(BIN(opt_call_c_function), 0, funcptr); +{ +#line 2118 "insns.def" + reg_cfp = (funcptr)(th, reg_cfp); + + if (reg_cfp == 0) { + VALUE err = th->errinfo; + th->errinfo = Qnil; + THROW_EXCEPTION(err); + } + + RESTORE_REGS(); + NEXT_INSN(); + +#line 2996 "vm.inc" +#undef CURRENT_INSN_opt_call_c_function +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(opt_call_c_function);}}} +INSN_ENTRY(bitblt){ +{ + VALUE ret; + + + DEBUG_ENTER_INSN("bitblt"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + #define CURRENT_INSN_bitblt 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_bitblt_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(bitblt)); +{ +#line 2141 "insns.def" + ret = rb_str_new2("a bit of bacon, lettuce and tomato"); + +#line 3019 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(ret); +#undef CURRENT_INSN_bitblt +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(bitblt);}}} +INSN_ENTRY(answer){ +{ + VALUE ret; + + + DEBUG_ENTER_INSN("answer"); + ADD_PC(1+0); + PREFETCH(GET_PC()); + #define CURRENT_INSN_answer 1 + #define INSN_IS_SC() 0 + #define INSN_LABEL(lab) LABEL_answer_##lab + #define LABEL_IS_SC(lab) LABEL_##lab##_##t + USAGE_ANALYSIS_INSN(BIN(answer)); +{ +#line 2155 "insns.def" + ret = INT2FIX(42); + +#line 3044 "vm.inc" + CHECK_STACK_OVERFLOW(REG_CFP, 1); + PUSH(ret); +#undef CURRENT_INSN_answer +#undef INSN_IS_SC +#undef INSN_LABEL +#undef LABEL_IS_SC + END_INSN(answer);}}} + diff --git a/vmtc.inc b/vmtc.inc new file mode 100644 index 0000000000..f1a044f2f6 --- /dev/null +++ b/vmtc.inc @@ -0,0 +1,97 @@ +/* -*-c-*- *********************************************************/ +/*******************************************************************/ +/*******************************************************************/ +/** + This file is for threaded code. + + ---- + This file is auto generated by insns2vm.rb + DO NOT TOUCH! + + If you want to fix something, you must edit 'template/vmtc.inc.tmpl' + or insns2vm.rb + */ + +static const void *const insns_address_table[] = { + LABEL_PTR(nop), + LABEL_PTR(getlocal), + LABEL_PTR(setlocal), + LABEL_PTR(getspecial), + LABEL_PTR(setspecial), + LABEL_PTR(getdynamic), + LABEL_PTR(setdynamic), + LABEL_PTR(getinstancevariable), + LABEL_PTR(setinstancevariable), + LABEL_PTR(getclassvariable), + LABEL_PTR(setclassvariable), + LABEL_PTR(getconstant), + LABEL_PTR(setconstant), + LABEL_PTR(getglobal), + LABEL_PTR(setglobal), + LABEL_PTR(putnil), + LABEL_PTR(putself), + LABEL_PTR(putobject), + LABEL_PTR(putspecialobject), + LABEL_PTR(putiseq), + LABEL_PTR(putstring), + LABEL_PTR(concatstrings), + LABEL_PTR(tostring), + LABEL_PTR(toregexp), + LABEL_PTR(newarray), + LABEL_PTR(duparray), + LABEL_PTR(expandarray), + LABEL_PTR(concatarray), + LABEL_PTR(splatarray), + LABEL_PTR(checkincludearray), + LABEL_PTR(newhash), + LABEL_PTR(newrange), + LABEL_PTR(pop), + LABEL_PTR(dup), + LABEL_PTR(dupn), + LABEL_PTR(swap), + LABEL_PTR(reput), + LABEL_PTR(topn), + LABEL_PTR(setn), + LABEL_PTR(adjuststack), + LABEL_PTR(defined), + LABEL_PTR(trace), + LABEL_PTR(defineclass), + LABEL_PTR(send), + LABEL_PTR(invokesuper), + LABEL_PTR(invokeblock), + LABEL_PTR(leave), + LABEL_PTR(finish), + LABEL_PTR(throw), + LABEL_PTR(jump), + LABEL_PTR(branchif), + LABEL_PTR(branchunless), + LABEL_PTR(getinlinecache), + LABEL_PTR(onceinlinecache), + LABEL_PTR(setinlinecache), + LABEL_PTR(opt_case_dispatch), + LABEL_PTR(opt_checkenv), + LABEL_PTR(opt_plus), + LABEL_PTR(opt_minus), + LABEL_PTR(opt_mult), + LABEL_PTR(opt_div), + LABEL_PTR(opt_mod), + LABEL_PTR(opt_eq), + LABEL_PTR(opt_neq), + LABEL_PTR(opt_lt), + LABEL_PTR(opt_le), + LABEL_PTR(opt_gt), + LABEL_PTR(opt_ge), + LABEL_PTR(opt_ltlt), + LABEL_PTR(opt_aref), + LABEL_PTR(opt_aset), + LABEL_PTR(opt_length), + LABEL_PTR(opt_size), + LABEL_PTR(opt_succ), + LABEL_PTR(opt_not), + LABEL_PTR(opt_regexpmatch1), + LABEL_PTR(opt_regexpmatch2), + LABEL_PTR(opt_call_c_function), + LABEL_PTR(bitblt), + LABEL_PTR(answer), +}; + |