summaryrefslogtreecommitdiff
path: root/iseq.c
AgeCommit message (Collapse)Author
2014-12-17compile.c: struct accessorsnobu
* compile.c (rb_method_for_self_aref, rb_method_for_self_aset): move from iseq.c to build from node instead of arrays. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-17iseq.c: default optionnobu
* iseq.c (rb_iseq_new_with_opt): allow NULL option as COMPILE_OPTION_DEFAULT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-17iseq.c: absolute_pathnobu
* iseq.c (caller_location): separate absolute_path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-16iseq.c: remove useless codenobu
* iseq.c (rb_method_for_self_aref): remove unused declaration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-16iseq.c: struct accessorsnobu
* iseq.c (rb_method_for_self_aref, rb_method_for_self_aset): call accessor functions directly, not to be affected by [] and []= methods. [ruby-core:66846] [Bug #10601] * struct.c (define_aref_method, define_aset_method): ditto. * vm_insnhelper.c (rb_vm_opt_struct_aref, rb_vm_opt_struct_aset): direct accessors of Struct. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-16compile.c: wrap funcptrnobu
* compile.c (iseq_build_from_ary_body): enclose funcptr with Integer as raw pointer cannot appear in an Array. * iseq.c (iseq_data_to_ary): extract funcptr from Integer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-16iseq.c: show function name if possiblenobu
* iseq.c (rb_insn_operand_intern): show the name of the nearest run-time symbol if possible. * compile.c (insn_data_to_s_detail): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-16compile.c: check funcptrnobu
* compile.c (iseq_build_from_ary_body): cannot load dumped funcptr. * iseq.c (iseq_data_to_ary): cannot dump funcptr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-15iseq.c: use caller locationnobu
* iseq.c (rb_method_for_self_aref, rb_method_for_self_aset): set same location as the caller. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-15iseq.c: intermediate arraysnobu
* iseq.c (rb_method_for_self_aref, rb_method_for_self_aset): hide and clear intermediate array objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-11* class.c (class_alloc): Strat from age == 2.ko1
Class and Module objects can be living long life. * iseq.c: Same for ISeq objects. * gc.c (RVALUE_AGE_RESET): added. * gc.c (newobj_of): allow to generate (age != 0) objects. * gc.c (rb_copy_wb_protected_attribute): reset age for wb unprotected objects. * include/ruby/ruby.h: add RUBY_TYPED_PROMOTED1 as an unrecommended flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-10struct.c: use iseqvalnobu
* struct.c (define_aref_method, define_aset_method): use iseq VALUE instead of rb_iseq_t to prevent from GC, as RB_GC_GUARD makes sense only for local variables. [Feature #10575] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-09struct: avoid all O(n) behavior on accessnormal
This avoids O(n) on lookups with structs over 10 members. This also avoids O(n) behavior on all assignments on Struct members. Members 0..9 still use existing C methods to read in O(1) time Benchmark results: vm2_struct_big_aref_hi* 1.305 vm2_struct_big_aref_lo* 1.157 vm2_struct_big_aset* 3.306 vm2_struct_small_aref* 1.015 vm2_struct_small_aset* 3.273 Note: I chose use loading instructions from an array instead of writing directly to linked-lists in compile.c for ease-of-maintainability. We may move the method definitions to prelude.rb-like files in the future. I have also tested this patch with the following patch to disable the C ref_func methods and ensured the test suite and rubyspec works --- a/struct.c +++ b/struct.c @@ -209,7 +209,7 @@ setup_struct(VALUE nstr, VALUE members) ID id = SYM2ID(ptr_members[i]); VALUE off = LONG2NUM(i); - if (i < N_REF_FUNC) { + if (0 && i < N_REF_FUNC) { rb_define_method_id(nstr, id, ref_func[i], 0); } else { * iseq.c (rb_method_for_self_aref, rb_method_for_self_aset): new methods to generate bytecode for struct.c [Feature #10575] * struct.c (rb_struct_ref, rb_struct_set): remove (define_aref_method, define_aset_method): new functions (setup_struct): use new functions * test/ruby/test_struct.rb: add test for struct >10 members * benchmark/bm_vm2_struct_big_aref_hi.rb: new benchmark * benchmark/bm_vm2_struct_big_aref_lo.rb: ditto * benchmark/bm_vm2_struct_big_aset.rb: ditto * benchmark/bm_vm2_struct_small_aref.rb: ditto * benchmark/bm_vm2_struct_small_aset.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-05iseq.c: remove unused rb_iseq_new_with_boptnormal
* iseq.c (prepare_iseq_build): remove unused block_opt param (rb_iseq_new_with_bopt_and_opt): remove (rb_iseq_new_with_opt): inline removed function (rb_iseq_new_with_bopt): remove (iseq_load): adjust prepare_iseq_build call [Feature #10565] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-03mostly fix rb_iseq_loadnormal
This allows reporters commenters of [Feature #8543] to load instruction sequences directly. Some test cases are still failing but documented in test/-ext-/iseq_load/test_iseq_load.rb. * compile.c (rb_iseq_build_from_exception): entry->sp is unsigned (iseq_build_callinfo_from_hash): account for kw_arg (iseq_build_from_ary_body): update for r35459 (CHECK_STRING, CHECK_INTEGER): remove unused checks (int_param): new function for checking new `params' hash (iseq_build_kw): new function for loading rb_iseq_param_keyword (rb_iseq_build_from_ary): account for `misc' entry and general structure changes [Feature #8543] * iseq.c (CHECK_HASH): new macro (for `misc' and `param' entries) (iseq_load): account for `misc' and `params' hashes (iseq_data_to_ary): add final opt to arg_opt_labels, fix kw support, account for unsigned entry->sp * ext/-test-/iseq_load/iseq_load.c: new ext for test * ext/-test-/iseq_load/extconf.rb: ditto * test/-ext-/iseq_load/test_iseq_load.rb: new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-03iseq.c: avoid segfault on incomplete iseqnormal
Compile failures will trigger iseq_free before iseq->callinfo_entries are allocated at all. * iseq.c (iseq_free): avoid segfault on incomplete iseq * test/ruby/test_syntax.rb (test_invalid_next): new test for syntax error, not segfault git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-02iseq.c: use lvar indexnobu
* iseq.c (iseq_data_to_ary): use local variable indexes for hidden variable instead of meaningless ID values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01iseq.c (iseq_data_to_ary): keep hidden variablesnormal
We must not ignore hidden variables when rb_id2str fails. Thanks to wanabe [ruby-core:66566] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01use 0 for reservednobu
use 0 for rb_data_type_t::reserved instead of NULL, since its type may be changed in the future and possibly not a pointer type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-27iseq.c (iseq_data_to_ary): add missing GC guardnormal
It seems possible for a compiler to optimize away nbody because we only access it via RARRAY_AREF and RARRAY_LEN macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-26iseq.c (iseq_s_compile_file): close IO when donenormal
This will prevent some leaked FD warnings in future tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-23iseq.c: preserve encoding at disassemblingnobu
* iseq.c (rb_insn_operand_intern): preserve encoding of method name in CALL_INFO at disassembling. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-03* iseq.c (iseq_free): resolve memory leak.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-03* iseq.c (iseq_memsize): catch up recent changes.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-03* vm_core.h: change semantics of opt_num and opt_table.ko1
`opt_num' was the number of optional parameters + 1. `opt_table' has "opt_num" entries. Change them to: `opt_num' is the number of optional parameters. `opt_talbe' has "opt_num + 1" entries. This change simplify parameter fitting logics. * compile.c: catch up this change. * iseq.c: ditto. * proc.c: ditto. * vm_args.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-02* vm_core.h: change iseq parameter data structure.ko1
https://bugs.ruby-lang.org/issues/10440#change-49694 * change terminology `arg' to `param'. * move rb_iseq_t::arg_* to rb_iseq_t::param. * move rb_iseq_t::arg_size to rb_iseq_t::param::size. * move rb_iseq_t::argc to rb_iseq_t::param::lead_num. * move rb_iseq_t::arg_opts to rb_iseq_t::param::opt_num. * move rb_iseq_t::arg_rest to rb_iseq_t::param::rest_start. * move rb_iseq_t::arg_post_num to rb_iseq_t::param::post_num. * move rb_iseq_t::arg_post_start to rb_iseq_t::param::post_start. * move rb_iseq_t::arg_block to rb_iseq_t::param::block_start. * move rb_iseq_t::arg_keyword* to rb_iseq_t::param::keyword. rb_iseq_t::param::keyword is allocated only when keyword parameters are available. * introduce rb_iseq_t::param::flags to represent parameter availability. For example, rb_iseq_t::param::flags::has_kw represents that this iseq has keyword parameters and rb_iseq_t::param::keyword is allocated. We don't need to compare with -1 to check availability. * remove rb_iseq_t::arg_simple. * compile.c: catch up this change. * iseq.c: ditto. * proc.c: ditto. * vm.c, vm_args.c, vm_dump.c, vm_insnhelper.c: ditto. * iseq.c (iseq_data_to_ary): support keyword argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-02* rewrite method/block parameter fitting logic to optimizeko1
keyword arguments/parameters and a splat argument. [Feature #10440] (Details are described in this ticket) Most of complex part is moved to vm_args.c. Now, ISeq#to_a does not catch up new instruction format. * vm_core.h: change iseq data structures. * introduce rb_call_info_kw_arg_t to represent keyword arguments. * add rb_call_info_t::kw_arg. * rename rb_iseq_t::arg_post_len to rb_iseq_t::arg_post_num. * rename rb_iseq_t::arg_keywords to arg_keyword_num. * rename rb_iseq_t::arg_keyword to rb_iseq_t::arg_keyword_bits. to represent keyword bitmap parameter index. This bitmap parameter shows that which keyword parameters are given or not given (0 for given). It is refered by `checkkeyword' instruction described bellow. * rename rb_iseq_t::arg_keyword_check to rb_iseq_t::arg_keyword_rest to represent keyword rest parameter index. * add rb_iseq_t::arg_keyword_default_values to represent default keyword values. * rename VM_CALL_ARGS_SKIP_SETUP to VM_CALL_ARGS_SIMPLE to represent (ci->flag & (SPLAT|BLOCKARG)) && ci->blockiseq == NULL && ci->kw_arg == NULL. * vm_insnhelper.c, vm_args.c: rewrite with refactoring. * rewrite splat argument code. * rewrite keyword arguments/parameters code. * merge method and block parameter fitting code into one code base. * vm.c, vm_eval.c: catch up these changes. * compile.c (new_callinfo): callinfo requires kw_arg parameter. * compile.c (compile_array_): check the last argument Hash object or not. If Hash object and all keys are Symbol literals, they are compiled to keyword arguments. * insns.def (checkkeyword): add new instruction. This instruction check the availability of corresponding keyword. For example, a method "def foo k1: 'v1'; end" is cimpiled to the following instructions. 0000 checkkeyword 2, 0 # check k1 is given. 0003 branchif 9 # if given, jump to address #9 0005 putstring "v1" 0007 setlocal_OP__WC__0 3 # k1 = 'v1' 0009 trace 8 0011 putnil 0012 trace 16 0014 leave * insns.def (opt_send_simple): removed and add new instruction "opt_send_without_block". * parse.y (new_args_tail_gen): reorder variables. Before this patch, a method "def foo(k1: 1, kr1:, k2: 2, **krest, &b)" has parameter variables "k1, kr1, k2, &b, internal_id, krest", but this patch reorders to "kr1, k1, k2, internal_id, krest, &b". (locate a block variable at last) * parse.y (vtable_pop): added. This function remove latest `n' variables from vtable. * iseq.c: catch up iseq data changes. * proc.c: ditto. * class.c (keyword_error): export as rb_keyword_error(). * common.mk: depend vm_args.c for vm.o. * hash.c (rb_hash_has_key): export. * internal.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-14symbol.c: rename rb_str_dynamic_internnobu
* iseq.c, marshal.c, string.c: use rb_str_intern instead of rb_str_dynamic_intern. * symbol.c (rb_str_intern): rename rb_str_dynamic_intern. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-01iseq.c (rb_iseq_line_trace_each): explicit castnormal
Fix https://travis-ci.org/ruby/ruby/jobs/36814282 Tested with -Wconversion since my gcc lacks -Wshorten-64-to-32 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21iseq.c (rb_iseq_defined_string): trim redundant semi-colonnormal
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10compile: translate iseq in-placenormal
running "ruby -rpp -e 'pp GC.stat'", a reduction in malloc usage is shown: before: :malloc_increase=>118784, :oldmalloc_increase=>1178736, after: :malloc_increase=>99832, :oldmalloc_increase=>1031976, For "ruby -e exit", valgrind reports over 300K reduction in overall allocations (and unnecessary memory copies). before: total heap usage: 49,622 allocs, 20,492 frees, 8,697,493 bytes allocated after: total heap usage: 48,935 allocs, 19,805 frees, 8,373,773 bytes allocated (numbers from x86-64) v2 changes based on ko1 recommendations [ruby-core:64883]: - squashed in-place direct thread translation to avoid alloc+copy - renamed rb_iseq_untranslate_threaded_code to rb_iseq_original_iseq, cache new iseq->iseq_original field. * compile.c (rb_iseq_translate_threaded_code): modify in-place w/o copy (rb_vm_addr2insn): new function for debug (rb_iseq_original_iseq): ditto (iseq_set_sequence): assign iseq_encoded directly [Feature #10185] * vm_core (rb_iseq_t): move original ->iseq to bottom * iseq.c (iseq_free, iseq_free): adjust for new layout (rb_iseq_disasm): use original iseq for dump (iseq_data_to_ary): ditto (rb_iseq_line_trace_each): ditto (rb_iseq_build_for_ruby2cext): use iseq_encoded directly * vm_dump.c (rb_vmdebug_debug_print_pre): use original iseq git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-25rb_iseq_location_t: change first_lineno type to VALUEnormal
Nearly all current uses of iseq->location.first_lineno are as a VALUE, not a size_t. The only exception was the experimental (and currently unused) rb_iseq_build_for_ruby2cext function. * vm_core.h (rb_iseq_location_t): change first_lineno type to VALUE * iseq.c (rb_iseq_build_for_ruby2cext): update based on argument git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-15* iseq.c (rb_iseq_clone): Should not insert write barrier fromko1
non-RVALUE data (to non-RVALUE data, of course). Ruby 2.1 also has a same problem. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-28symbols instead of IDsnobu
* encoding.c (rb_enc_get_index): deal with symbols instead of IDs to get rid of inadvertent pin-downs. * enum.c (chunk_ii): ditto. * enumerator.c (append_method): ditto. * iseq.c (iseq_load): ditto. * marshal.c (w_symbol, r_symlink, r_symreal, r_symbol): ditto. * signal.c (trap_handler): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-26struct iseq_compile_data_storage: 16 bytes (from 32) overheadnormal
This reduces the iseq_compile_data_storage header from 32 to 16 bytes on 64-bit systems. pos and size fields cannot exceed 32-bit sizes due to stack size limits. Using a flexible array for the buffer also saves us 8 bytes of pointer overhead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-26rb_iseq_t: reduce to (280 bytes from 288 bytes) on 64-bitnormal
iseq_size and line_info_size may be 32-bit. 4GB instruction sequences should be big enough for anyone. Other existing line info counters are 32-bit, and nobody should need all that. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25introduce ZALLOC{,_N} to replace ALLOC{,_N}+MEMZERO usenormal
Using calloc where possible reduces code and binary sizes. * include/ruby/ruby.h (ZALLOC, ZALLOC_N): implement (Data_Make_Struct, TypedData_Make_Struct): ZALLOC replaces ALLOC+memset * compile.c (iseq_seq_sequence): ZALLOC_N replaces ALLOC_N+MEMZERO * cont.c (fiber_t_alloc): ZALLOC replaces ALLOC+MEMZERO * io.c (rb_io_reopen): ditto * iseq.c (prepare_iseq_build): ditto * parse.y (new_args_tail_gen, parser_new, ripper_s_allocate): ditto * re.c (match_alloc): ditto * variable.c (rb_const_set): ditto * ext/socket/raddrinfo.c (get_addrinfo): ditto * ext/strscan/strscan.c (strscan_s_allocate): ditto * gc.c (rb_objspace_alloc): calloc replaces malloc+MEMZERO git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-16* iseq.c (rb_iseq_defined_string): use rb_gc_mark_object() instead ofko1
marking from vm_mark(). * vm.c (rb_vm_mark): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-14vm_core.h (struct rb_iseq_struct): reduce to 296 bytes on 64-bitnormal
Most iseq do not have a catch_table, so avoid needlessly adding 4-8 bytes to the struct for the common case. Changes from v2: - iseq_catch_table_size removed, use if (...) for (;...;) Changes from v1: - renamed iseq->_catch_table to iseq->catch_table - iseq_catch_table_bytes: made a static inline function - iseq_catch_table_size: new function replaces the iseq_catch_table_each iterator macro * iseq.h (struct iseq_catch_table): new flexible array struct (iseq_catch_table_bytes): allocated size function * vm_core.h (struct rb_iseq_struct): uupdate catch_table member * compile.c (iseq_set_exception_table): update for struct changes * iseq.c (iseq_free): ditto * iseq.c (iseq_memsize): ditto * iseq.c (rb_iseq_disasm): ditto * iseq.c (iseq_data_to_ary): ditto * iseq.c (rb_iseq_build_for_ruby2cext): ditto (untested) * vm.c (vm_exec): ditto * vm_core.h (struct rb_iseq_struct): ditto * vm_insnhelper.c (vm_throw): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-18constify parametersnobu
* include/ruby/intern.h: constify `argv` parameters. * include/ruby/ruby.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-12iseq.c: linear searchnobu
* iseq.c (iseq_type_from_id): linear search instead of hash lookup for small fixed number keys. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-12iseq.c: potential memory leaknobu
* iseq.c (iseq_load): keep type_map to get rid of memory leak. based on a patch by Eric Wong at [ruby-core:59699]. [Bug #9399] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-12ruby/util.h: DECIMAL_SIZE_OF_BITSnobu
* include/ruby/util.h (DECIMAL_SIZE_OF_BITS): a preprocessor constant macro to approximate decimal representation size of n-bits integer. * iseq.c (register_label): use DECIMAL_SIZE_OF_BITS for better approximation. * ext/bigdecimal/bigdecimal.c (BigMath_s_log): ditto. * common.mk (iseq.o), ext/bigdecimal/depend (bigdecimal.o): add dependency to ruby/util.h for DECIMAL_SIZE_OF_BITS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-25compile.c: unnamed keyword rest checknobu
* compile.c (iseq_set_arguments): set arg_keyword_check from nd_cflag, which is set by parser. internal ID is used for unnamed keyword rest argument, which should be separated from no keyword check. * iseq.c (rb_iseq_parameters): if no keyword check, keyword rest is present. * parse.y (new_args_tail_gen): set keywords check to nd_cflag, which equals to that keyword rest is not present. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-25iseq.c: fix parameter of unnamed rest keywords argumentnobu
* iseq.c (rb_iseq_parameters): push argument type symbol only for unnamed rest keywords argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20* include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN intoko1
RB_OBJ_WRITE and RB_OBJ_WRITTEN. * array.c, class.c, compile.c, hash.c, internal.h, iseq.c, proc.c, process.c, re.c, string.c, variable.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08gc.c: promote long-lived NODE_CREF objects to oldgentmm1
* include/ruby/ruby.h: add RGENGC_WB_PROTECTED_NODE_CREF setting In a large app, this reduces the size of remembered_shady_object_count by 80%. [Bug #9225] [ruby-core:58947] * gc.c (rb_node_newnode): add FL_WB_PROTECTED flag to NODE_CREF * class.c (rewrite_cref_stack): insert OBJ_WRITE for NODE_CREF * iseq.c (set_relation): ditto * iseq.c (rb_iseq_clone): ditto * vm_eval.c (rb_yield_refine_block): ditto * vm_insnhelper.c (vm_cref_push): ditto * vm_insnhelper.h (COPY_CREF): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-26* compile.c: Use rb_fstring() to de-duplicate string literals in code. ↵tmm1
[ruby-core:58599] [Bug #9159] [ruby-core:54405] * iseq.c (prepare_iseq_build): De-duplicate iseq labels and source locations. * re.c (rb_reg_initialize): Use rb_fstring() for regex string. * string.c (rb_fstring): Handle non-string and already-fstr arguments. * vm_eval.c (eval_string_with_cref): De-duplicate eval source filename. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-15iseq.c: fix values for truenobu
* iseq.c (make_compile_option): fill with 1 of int, not char if opt is true. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e