summaryrefslogtreecommitdiff
path: root/insns.def
AgeCommit message (Collapse)Author
2017-09-18intern instructionnobu
* insns.def (intern): new instruction to turn string into symbol. opt_call_c_function can not dump. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-18refinements in string interpolationnobu
* compile.c (iseq_compile_each0): insert to_s method call, so that refinements activated at the caller should take place. [Feature #13812] * insns.def (tostring): fix up converted object to a string, infect and fallback. * insns.def (branchiftype): new instruction for conversion. branches if TOS is an instance of the given type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14Add a new instruction `trace2` for hooking with custom datamame
This is needed for passing to the hook function the measuring target type (line/branch/method) and the site of coverage event fired. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-05add rb_hash_new_with_size()shyouhei
Sometimes, size of a hash can be calcluated a priori. By providing such info to the constructor we can avoid unnecessary internal re- allocations. This can boost for instance creation of hash literals. [Bug #13861] Signed-off-by: Urabe, Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-15Remove not exist arguments from comments of insnsyui-knk
is_local argument was introduced on r11639 and removed on r11813. * insns.def (getinstancevariable, setinstancevariable): Remove a not exist argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28move fields to ec.ko1
* vm_core.h (rb_thread.h): move errinfo and trace_arg to rb_execution_context_t. * cont.c (fiber_switch, rb_cont_call): do not restore "trace_arg" here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23vm_insnhelper.c: vm_stack_consistency_errornobu
* vm_insnhelper.c (vm_stack_consistency_error): extracted from insns.def for further info in the future. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-31add debug counters for local variable (lavr) access.ko1
* debug_counter.h: add the following counters: * lvar_get: counter for lvar get. * lvar_get_dynamic: counter for lvar get from upper frames. * lvar_set: coutner for lvar set. * lvar_set_dynamic: coutner for lvar set from upper frames. * lvar_set_slowpath: counter for lavr set using slowpath. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-25insns.def: [DOC] Fix description of tostringk0kubun
rb_obj_as_string() calls not #to_str (idTo_str) but #to_s (idTo_s). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-08Translate missing rdoc comment for opt_send_without_block.hsbt
fix [GH-1608], Patch by @k0kubun git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-27refactor newhash (revision 58463 another try) [fix GH-1600]shyouhei
* st.c (rb_hash_bulk_insert): new API to bulk insert entries into a hash. Given arguments are first inserted into the table at once, then reindexed. This is faster than inserting things using rb_hash_aset() one by one. This arrangement (rb_ prefixed function placed in st.c) is unavoidable because it both touches table internal and write barrier at once. * internal.h: delcare the new function. * hash.c (rb_hash_s_create): use the new function. * vm.c (core_hash_merge): ditto. * insns.def (newhash): ditto. * test/ruby/test_hash.rb: more coverage on hash creation. * test/ruby/test_literal.rb: ditto. ----------------------------------------------------------- benchmark results: minimum results in each 7 measurements. Execution time (sec) name before after loop_whileloop2 0.136 0.137 vm2_bighash* 1.249 0.623 Speedup ratio: compare with the result of `before' (greater is better) name after loop_whileloop2 0.996 vm2_bighash* 2.004 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-24revert newhash refactoringshyouhei
We need to fix GC bug before merging this. Revert revisions 58452, 58435, 58434, 58428, 58427 in this order. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-21refactor hash literalshyouhei
Same as rb_ary_tmp_new_from_values(), it reduces vm_exec_core binary size from 26,176 bytes to 26,080 bytes. But this time, also with a bit of optimizations: - Because we are allocating a new hash and no back references are introduced at all, we can safely skip write barriers. - Also, the iteration never recurs. We can avoid complicated function callbacks by using st_insert instead of st_update. ---- * hash.c (rb_hash_new_from_values): refactor extract the bulk insert into a function. * hash.c (rb_hash_new_from_object): also refactor. * hash.c (rb_hash_s_create): use the new functions. * insns.def (newhash): ditto. * vm.c (core_hash_from_ary): ditto. * iternal.h: export the new function. ----------------------------------------------------------- benchmark results: minimum results in each 7 measurements. Execution time (sec) name before after loop_whileloop2 0.135 0.134 vm2_bighash* 1.236 0.687 Speedup ratio: compare with the result of `before' (greater is better) name after loop_whileloop2 1.008 vm2_bighash* 1.798 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-20refactor torexp to use routine in array.cshyouhei
Found a part where copy&paste can be eliminated. Reduces vm_exec_core from 26,228 bytes to 26,176 bytes in size on my machine. I believe it does not affect any runtime performance. ---- * array.c (rb_ary_tmp_new_from_values): extend existing rb_ary_new_from_values function so that it can take additional value for klass. * array.c (rb_ary_new_from_values): use the new function. * insns.def (toregexp): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-18typo fix (sorry!) [ci skip]shyouhei
Surprisingly this was not a syntax error on my machine. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-18fix compile error.ko1
* insns.def (trace): use cast `flag` to pass compilation with clang on MacOSX. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-18tabify (sorry!) [ci skip]shyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-18split insns.def into functionsshyouhei
Contemporary C compilers are good at function inlining. They fold multiple functions into one. However they are not yet smart enough to unfold a function into several ones. So generally speaking, it is wiser for a C programmer to manually split C functions whenever possible. That should make rooms for compilers to optimize at will. Before this changeset insns.def was converted into single HUGE function called vm_exec_core(). By moving each instruction's core into individual functions, generated C source code is reduced from 3,428 lines to 2,847 lines. Looking at the generated assembly however, it seems my compiler (gcc 6.2) is extraordinary smart so that it inlines almost all functions I introduced in this changeset back into that vm_exec_core. On my machine compiled machine binary of the function does not shrink very much in size (28,432 bytes to 26,816 bytes, according to nm(1)). I believe this change is zero-cost. Several benchmarks I exercised showed no significant difference beyond error mergin. For instance 3 repeated runs of optcarrot benchmark on my machine resulted in: before this: 28.330329285707490, 27.513378371065920, 29.40420215754537 after this: 27.107195867280414, 25.549324021385907, 30.31581919050884 in fps (greater==faster). ---- * internal.h (rb_obj_not_equal): used from vm_insnhelper.c * insns.def: move vast majority of lines into vm_insnhelper.c * vm_insnhelper.c: moved here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-27fix redefinition optimization for -"literal string" (UMinus)normal
Unfortunately this enlarges insns.def by yet another instruction. However, it is much prettier than opt_str_freeze in use, and maybe we can avoid having so many instructions in the future. [ruby-core:80368] * insns.def (DEFINE_INSN): new instruction: opt_str_uminus (maybe temporary) * compile.c (iseq_compile_each0): split instructions * test/ruby/test_optimization.rb (test_string_uminus): new test * vm.c (vm_init_redefined_flag): set redefinintion flag for uminus * vm_core.h (enum ruby_basic_operators): add BOP_UMINUS git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-09revert RB_FIXABLE related changesets [Bug #13288][Bug #13293][Bug #13294]shyouhei
This commit is auto-generated using following command: svn diff -r57807:57788 include internal.h bignum.c numeric.c compile.c insns.def object.c sprintf.c | patch -p0 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-06optimize FIXABLE macroshyouhei
Looking at the source code, FIXABLE tends to be just before LOING2FIX to check applicability of that operation. Why not try computing first then check for overflow, which should be optimial. I also tried the same thing for unsigned types but resulted in slower execution. It seems RB_POSFIXABLE() is fast enough on modern CPUs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-02Use carry flag to reduce instructionsnaruse
NOTE: (1) Fixnum's LSB is always 1. It means you can always run `x - 1` without overflow. (2) Of course `z = x + (y-1)` may overflow. Now z's LSB is always 1, and the MSB of true result is also 1. You can get true result in long as `(1<<63)|(z>>1)`, and it equals to `(z<<63)|(z>>1)` == `ror(z)`. GCC and Clang have __builtin_add_ovewflow: * https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html * https://clang.llvm.org/docs/LanguageExtensions.html#checked-arithmetic-builtins git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-13insns.def: float comparisonnobu
* insns.def (opt_lt, opt_le, opt_gt, opt_ge): optimize flonum and on-heap float comparison. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-07adjust indent [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-07fix optimization for hash aset/aref with fstringeregon
Patch by Eric Wong [ruby-core:78797]. I don't like the idea of making insns.def any bigger to support a corner case, and "test_hash_aref_fstring_identity" shows how contrived this is. [ruby-core:78783] [Bug #12855] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-28insns.def: adjust index typenobu
* insns.def (checkmatch): adjust type of the index variable, to get rid of (potential) overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05* vm_trace.c (tracepoint_attr_callee_id, rb_tracearg_callee_id):ktsj
add TracePoint#callee_id. [ruby-core:77241] [Feature #12747] * cont.c, eval.c, gc.c, include/ruby/intern.h, insns.def, thread.c, vm.c, vm_backtrace.c, vm_core.h, vm_eval.c, vm_insnhelper.c, vm_trace.c: ditto. * test/ruby/test_settracefunc.rb: tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-28insns.def: opt_case_dispatch trivial optimizationnobu
* insns.def (opt_case_dispatch): extract float value only if the Float method is not redefnined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08* insns.def (setclassvariable, setconstant): warn when self is ashugo
refinement. [Bug #10103] [ruby-core:64143] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28* vm_core.h: revisit the structure of frame, block and env.ko1
[Bug #12628] This patch introduce many changes. * Introduce concept of "Block Handler (BH)" to represent passed blocks. * move rb_control_frame_t::flag to ep[0] (as a special local variable). This flags represents not only frame type, but also env flags such as escaped. * rename `rb_block_t` to `struct rb_block`. * Make Proc, Binding and RubyVM::Env objects wb-protected. Check [Bug #12628] for more details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-26* vm_insnhelper.c: introduce rb_vm_pop_frame() and use itko1
instead of setting rb_thread_t::cfp directly. * vm_insnhelper.c (vm_pop_frame): return the result of finish frame or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-17 * insns.def: tabify [ci skip]shyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-29* insns.def (opt_succ): optimize like r55515. (but this argument isnaruse
consntant) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-27* insns.def (opt_plus): use `- 1` instead of `& (~1)` to allownaruse
compilers to use x86 LEA instruction (3 operand). Even if 3 operand LEA's latency is 3 cycle after SandyBridge, it reduces code size and can be faster because of super scalar. * insns.def (opt_plus): calculate and use rb_int2big. On positive Fixnum overflow, `recv - 1 + obj` doesn't carry because recv's msb and obj's msb are 0, and resulted msb is 1. Therefore simply rshift and cast as signed long works fine. On negative Fixnum overflow, it will carry because both arguments' msb are 1, and resulted msb is also 1. In this case it needs to restore carried sign bit after rshift. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17[Feature #12005] Unify Fixnum and Bignum into Integerakr
* [Feature #12005] Unify Fixnum and Bignum into Integer * include/ruby/ruby.h (rb_class_of): Return rb_cInteger for fixnums. * insns.def (INTEGER_REDEFINED_OP_FLAG): Unified from FIXNUM_REDEFINED_OP_FLAG and BIGNUM_REDEFINED_OP_FLAG. * vm_core.h: Ditto. * vm_insnhelper.c (opt_eq_func): Use INTEGER_REDEFINED_OP_FLAG instead of FIXNUM_REDEFINED_OP_FLAG. * vm.c (vm_redefinition_check_flag): Use rb_cInteger instead of rb_cFixnum and rb_cBignum. (C): Use Integer instead of Fixnum and Bignum. * numeric.c (fix_succ): Removed. (Init_Numeric): Define Fixnum as Integer. * bignum.c (bignew): Use rb_cInteger instead of Rb_cBignum. (rb_int_coerce): replaced from rb_big_coerce and return fixnums as-is. (Init_Bignum): Define Bignum as Integer. Don't define ===. * error.c (builtin_class_name): Return "Integer" for fixnums. * sprintf.c (ruby__sfvextra): Use rb_cInteger instead of rb_cFixnum. * ext/-test-/testutil: New directory to test. Currently it provides utilities for fixnum and bignum. * ext/json/generator/generator.c: Define mInteger_to_json. * lib/mathn.rb (Fixnum#/): Redefinition removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-10* insns.def (defineclass): Also raise an error when redeclaring theeregon
superclass of a class as Object and it has another superclass. [Bug #12367] [ruby-core:75446] * test/ruby/test_class.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08* configure.in: check function attirbute const and pure,naruse
and define CONSTFUNC and PUREFUNC if available. Note that I don't add those options as default because it still shows many false-positive (it seems not to consider longjmp). * vm_eval.c (stack_check): get rb_thread_t* as an argument to avoid duplicate call of GET_THREAD(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-05string.c: rb_str_concat_literalsnobu
* string.c (rb_str_concat_literals): concatenate literal string fragments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-21* internal.h (rb_fix_divmod_fix): like r54213, use FIX2NUM only ifnaruse
x == FIXNUM_MIN && y == -1. This must be a rare case and it is expected compiler to handle well. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-20* internal.h (DLONG): defined if long is 32bit (and LONG_LONG is 64bit;naruse
but LONG_LONG is always defined as 64bit), or there's int128_t. * internal.h (DL2NUM): defined if DLONG is defined. * internal.h (rb_fix_mul_fix): defined for `Fixnum * Fixnum`. * insns.def (opt_mul): use rb_fix_mul_fix(). * numeric.c (fix_mul): ditto. * time.c (mul): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17* compile.c (NODE_CALL): add optimization shortcut for Array#max/min.mame
Now `[x, y].max` is optimized so that a temporal array object is not created in some condition. * insns.def (opt_newarray_max, opt_newarray_min): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-08* intern.h (rb_divmod): assume compilers `/` and `%` comply C99naruse
and reduce branching. If a compiler doesn't comply, add #ifdefs. * intern.h (rb_div): added for Ruby's behavior. * intern.h (rb_mod): added for Ruby's behavior. * insns.def (opt_div): use rb_div. * insns.def (opt_mod): use rb_mod. * numeric.c (fixdivmod): removed. * numeric.c (fix_divide): use rb_div. * numeric.c (fix_mod): use rb_mod. * numeric.c (fix_divmod): use rb_divmod. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-08* insns.def (opt_mod): show its method name on ZeroDivisionError.naruse
[Bug #12158] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-15* insns.def (opt_plus): simply use LONG2NUM() instead of wronglynaruse
complex overflow case. * insns.def (opt_sub): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-05improve r53741naruse
* Remove branching by a==0 case Before r53741: % perf stat ./miniruby -e'a=100;i=0;while i<0xfffffff;i+=1;a=(a*557+2)%100000;end' Performance counter stats for './miniruby -vea=100;i=0;while i<0xfffffff;i+=1;a=(a*557+2)%100000;end': 16412.994492 task-clock (msec) # 0.999 CPUs utilized 195 context-switches # 0.012 K/sec 2 cpu-migrations # 0.000 K/sec 876 page-faults # 0.053 K/sec 48488588328 cycles # 2.954 GHz 18464835712 stalled-cycles-frontend # 38.08% frontend cycles idle <not supported> stalled-cycles-backend 85665428518 instructions # 1.77 insns per cycle # 0.22 stalled cycles # per insn 10207419707 branches # 621.911 M/sec 6334713 branch-misses # 0.06% of all branches 16.426858699 seconds time elapsed After this: % perf stat ./miniruby -ve'a=100;i=0;while i<0xfffffff;i+=1;a=(a*557+2)%100000;end' Performance counter stats for './miniruby -vea=100;i=0;while i<0xfffffff;i+=1;a=(a*557+2)%100000;end': 13363.540634 task-clock (msec) # 0.999 CPUs utilized 137 context-switches # 0.010 K/sec 2 cpu-migrations # 0.000 K/sec 874 page-faults # 0.065 K/sec 39477429278 cycles # 2.954 GHz 14615402375 stalled-cycles-frontend # 37.02% frontend cycles idle <not supported> stalled-cycles-backend 83514678452 instructions # 2.12 insns per cycle # 0.18 stalled cycles per insn 9401528135 branches # 703.521 M/sec 432567 branch-misses # 0.00% of all branches 13.371484310 seconds time elapsed git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-05* insns.def (opt_mult): Use int128_t for overflow detection.naruse
* bignum.c (rb_uint128t2big): added for opt_mult. * bignum.c (rb_uint128t2big): added for rb_uint128t2big.. * configure.in: define int128_t, uint128_t and related MACROs. Initially introduced by r41379 but reverted by r50749. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-10insns.def: description [ci skip]nobu
* insns.def: [DOC] add missing English description. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-03Move a comment to the appropriate position.yui-knk
The position of `/* fall through */` was moved by r52931. * insns.def (opt_case_dispatch): Move a comment to the appropriate position. [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-11insns.def (opt_case_dispatch): avoid converting Infinitynormal
Infinity cannot be written as an optimizable literal, so it can never match a key in a CDHASH. Avoid converting it to prevent FloatDomainError. * insns.def (opt_case_dispatch): avoid converting Infinity * test/ruby/test_optimization.rb (test_opt_case_dispatch_inf): new [ruby-dev:49423] [Bug #11804] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08* introduce new ISeq binary format serializer/de-serializerko1
and a pre-compilation/runtime loader sample. [Feature #11788] * iseq.c: add new methods: * RubyVM::InstructionSequence#to_binary_format(extra_data = nil) * RubyVM::InstructionSequence.from_binary_format(binary) * RubyVM::InstructionSequence.from_binary_format_extra_data(binary) * compile.c: implement body of this new feature. * load.c (rb_load_internal0), iseq.c (rb_iseq_load_iseq): call RubyVM::InstructionSequence.load_iseq(fname) with loading script name if this method is defined. We can return any ISeq object as a result value. Otherwise loading will be continue as usual. This interface is not matured and is not extensible. So that we don't guarantee the future compatibility of this method. Basically, you should'nt use this method. * iseq.h: move ISEQ_MAJOR/MINOR_VERSION (and some definitions) from iseq.c. * encoding.c (rb_data_is_encoding), internal.h: added. * vm_core.h: add several supports for lazy load. * add USE_LAZY_LOAD macro to specify enable or disable of this feature. * add several fields to rb_iseq_t. * introduce new macro rb_iseq_check(). * insns.def: some check for lazy loading feature. * vm_insnhelper.c: ditto. * proc.c: ditto. * vm.c: ditto. * test/lib/iseq_loader_checker.rb: enabled iff suitable environment variables are provided. * test/runner.rb: enable lib/iseq_loader_checker.rb. * sample/iseq_loader.rb: add sample compiler and loader. $ ruby sample/iseq_loader.rb [dir] will compile all ruby scripts in [dir]. With default setting, this compile creates *.rb.yarb files in same directory of target .rb scripts. $ ruby -r sample/iseq_loader.rb [app] will run with enable to load compiled binary data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e