aboutsummaryrefslogtreecommitdiffstats
path: root/iseq.h
Commit message (Collapse)AuthorAgeFilesLines
* * iseq.h (struct iseq_compile_data): use struct rb_id_tablenaruse2016-05-141-1/+1
| | | | | | | | | | | | | | | instead of st_table. * iseq.c (prepare_iseq_build): don't allocate ivar_cache_table until it has at least one element. * iseq.c (compile_data_free): free ivar_cache_table only if it is allocated. * compile.c (get_ivar_ic_value): allocate if the table is not allocated yet. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (iseq_compile_each): share InlineCache during sametarui2016-05-111-0/+1
| | | | | | | | | | | | | | | instance variable accesses. Reducing memory consumption, rasing cache hit rate and rasing branch prediction hit rate are expected. A part of [Bug #12274]. * iseq.h (struct iseq_compile_data): introduce instance variable IC table for sharing. * iseq.c (prepare_iseq_build, compile_data_free): construct/destruct above table. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.h: coverage_enabled flagnobu2016-03-101-0/+1
| | | | | | | | | | * iseq.c (prepare_iseq_build): enable coverage by coverage_enabled option, not by parse_in_eval flag in the thread context. * iseq.h (rb_compile_option_struct): add coverage_enabled flag. * parse.y (yycompile0): set coverage_enabled flag if coverage array is made. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.h: bit flagsnobu2016-03-101-10/+10
| | | | | | | * iseq.h (rb_compile_option_struct): turn boolean flags to bit fields. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.h: remove trailing commanobu2016-02-231-4/+5
| | | | | | | * iseq.h (iseq_mark_ary_index): get rid of trailing comma and name the magic number for iseq_mark_ary_create. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * introduce new ISeq binary format serializer/de-serializerko12015-12-081-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* error.c: name_err_local_variablesnobu2015-12-081-0/+3
| | | | | | | | * error.c (name_err_local_variables): new method NameError#local_variables for internal use only. [Feature #11777] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h, iseq.h: remove rb_iseq_t::variable_body.ko12015-12-021-5/+36
| | | | | | | | | | | | | | | | Fields in rb_iseq_t::variable_body are contained by rb_iseq_t::body::mark_ary (hidden Array object). Index 0 to 2 of mark_ary are reserved by these objects. * iseq.c: catch up this fix. * compile.c (rb_iseq_original_iseq): trivial rewrite. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.h: introduce ISEQ_ORIGINAL_ISEQ() andko12015-12-021-3/+6
| | | | | | | | | | | | | | | ISEQ_ORIGINAL_ISEQ_ALLOC() macro. * compile.c: use them to access original iseq buffer. * iseq.c: ditto. * vm_core.h: rename iseq field to support this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.h: introduce ISEQ_FLIP_CNT_INCREMENT() macro.ko12015-12-021-1/+1
| | | | | | | | | | | * compile.c (iseq_compile_each): use it. * vm_core.h: rename flip_cnt field to support this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.h: introduce ISEQ_COVERAGE() and ISEQ_COVERAGE_SET() macro.ko12015-12-021-1/+3
| | | | | | | | | | | | | | | | | * compile.c: use them. * iseq.c: ditto. * iseq.c (rb_iseq_coverage): added. * thread.c (update_coverage): use rb_iseq_coverage(). * vm_core.h: rename coverage field name to support this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.h: introduce ISEQ_COMPILE_DATA() macro.ko12015-12-021-0/+2
| | | | | | | | | | | * compile.c, iseq.c: use ISEQ_COMPILE_DATA(). * vm_core.h: rename compile_data field to support this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.h: rename membernobu2015-11-251-1/+1
| | | | | | | | | | | * iseq.h (rb_compile_option_struct): rename the member frozen_string_literal_debug as debug_frozen_string_literal. [Feature #11725] * ruby.c (proc_options): do not set $DEBUG and $VERBOSE only if no arguments is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ruby.c: introduce --enable-frozen-string-literal-debug option.ko12015-10-231-0/+1
| | | | | | | | | | | | | | | | | | | | | If this option is enabled, the modify error will be: can't modify frozen String (RuntimeError) => can't modify frozen String, created at test.rb:3 (RuntimeError) * iseq.h: add compile option frozen_string_literal_debug. * compile.c: catch up this fix. * error.c (rb_error_frozen): ditto. * iseq.c (set_compile_option_from_hash): ditto. * test/ruby/test_rubyoptions.rb: add a test for this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fronzen-string-literal pragmanobu2015-09-271-0/+1
| | | | | | | | | | | | | * compile.c (iseq_compile_each): override compile option by option given by pragma. * iseq.c (rb_iseq_make_compile_option): extract a function to overwrite rb_compile_option_t. * parse.y (parser_set_compile_option_flag): introduce pragma to override compile options. * parse.y (magic_comments): new pragma "fronzen-string-literal". [Feature #8976] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: split rb_call_info_t into several structs.ko12015-09-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * rb_call_info (ci) has compiled fixed information. * if ci->flag & VM_CALL_KWARG, then rb_call_info is also rb_call_info_with_kwarg. This technique reduce one word for major rb_call_info data. * rb_calling_info has temporary data (argc, blockptr, recv). for each method dispatch. This data is allocated only on machine stack. * rb_call_cache is for inline method cache. Before this patch, only rb_call_info_t data is passed. After this patch, above three structs are passed. This patch improves: * data locarity (rb_call_info is now read-only data). * reduce memory consumption (rb_call_info_with_kwarg, rb_calling_info). * compile.c: use above data. * insns.def: ditto. * iseq.c: ditto. * vm_args.c: ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. * vm_insnhelper.h: ditto. * iseq.h: add iseq_compile_data::ci_index and iseq_compile_data::ci_kw_indx. * tool/instruction.rb: introduce TS_CALLCACHE operand type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.h: rb_iseq_tnobu2015-09-191-0/+5
| | | | | | | | | * iseq.h (rb_iseq_t): also should be defined here for prototype declarations arguments. * method.h (rb_iseq_t): get rid of redefinition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.h, method.h: fix include guards [ci skip]nobu2015-09-191-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_opts.h, iseq.c, iseq.h: add compile option to force frozenko12015-08-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | string literals. [Feature #11473] This addition is not specification change, but to try frozen string literal world discussed on [Feature #11473]. You can try frozen string literal world using this magical line: RubyVM::InstructionSequence.compile_option = {frozen_string_literal: true} Note that this is a global compilation option, so that you need to compile another script like that: p 'foo'.frozen? #=> false RubyVM::InstructionSequence.compile_option = {frozen_string_literal: true} p 'foo'.frozen? #=> false, because this line is already compiled. p eval("'foo'.frozen?") #=> true Details: * String literals are deduped by rb_fstring(). * Dynamic string literals ("...#{xyz}...") is now only frozen, not deduped. Maybe you have other ideas. Now, please do not use this option on your productions :) Of course, current specification can be changed. * compile.c: ditto. * test/ruby/test_iseq.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h (rb_call_info_kw_arg_bytes): move the definitionko12015-08-131-0/+6
| | | | | | | | to iseq.h because this function is shared with iseq.c and compile.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: size should be unsigned.ko12015-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | * rb_call_info_t::index * rb_iseq_constant_body::stack_max * rb_iseq_constant_body::local_size * rb_iseq_constant_body::param::size * rb_iseq_constant_body::local_table_size * rb_iseq_constant_body::is_size * rb_iseq_constant_body::callinfo_size * iseq.h: same for iseq_catch_table::size. * compile.c: catch up these fix. * iseq.c: ditto. * proc.c: ditto. * vm.c: ditto. * vm_args.c: ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * make rb_iseq_t T_IMEMO object (type is imemo_iseq).ko12015-07-211-10/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All contents of previous rb_iseq_t is in rb_iseq_t::body. Remove rb_iseq_t::self because rb_iseq_t is an object. RubyVM::InstructionSequence is wrapper object points T_IMEMO/iseq. So RubyVM::ISeq.of(something) method returns different wrapper objects but they point the same T_IMEMO/iseq object. This patch is big, but most of difference is replacement of iseq->xxx to iseq->body->xxx. (previous) rb_iseq_t::compile_data is also located to rb_iseq_t::compile_data. It was moved from rb_iseq_body::compile_data. Now rb_iseq_t has empty two pointers. I will split rb_iseq_body data into static data and dynamic data. * compile.c: rename some functions/macros. Now, we don't need to separate iseq and iseqval (only VALUE). * eval.c (ruby_exec_internal): `n' is rb_iseq_t (T_IMEMO/iseq). * ext/objspace/objspace.c (count_imemo_objects): count T_IMEMO/iseq. * gc.c: check T_IMEMO/iseq. * internal.h: add imemo_type::imemo_iseq. * iseq.c: define RubyVM::InstructionSequnce as T_OBJECT. Methods are implemented by functions named iseqw_.... * load.c (rb_load_internal0): rb_iseq_new_top() returns rb_iseq_t (T_IMEMO/iesq). * method.h (rb_add_method_iseq): accept rb_iseq_t (T_IMEMO/iseq). * vm_core.h (GetISeqPtr): removed because it is not T_DATA now. * vm_core.h (struct rb_iseq_body): remove padding for [Bug #10037][ruby-core:63721]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c: constify the first parameter (iseq).ko12015-07-211-1/+1
| | | | | | | | | | * iseq_add_mark_object() * iseq_add_mark_object_compile_time() * iseq.c, iseq.h (rb_iseq_add_mark_object): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.c: constify.ko12015-05-211-2/+2
| | | | | | | | | | | * iseq.h: ditto. * method.h: ditto. * proc.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* commit miss. iseq.h should be commit with last commit.ko12015-05-211-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: define vm_svar_index.ko12015-02-271-2/+0
| | | | | | | | | | * vm_insnhelper.c, vm.c, compile.c: use vm_svar_index names. * iseq.h: remove DEFAULT_SPECIAL_VAR_COUNT. use VM_SVAR_FLIPFLOP_START instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mostly fix rb_iseq_loadnormal2014-12-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* compile: translate iseq in-placenormal2014-09-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* struct iseq_compile_data_storage: 16 bytes (from 32) overheadnormal2014-07-261-3/+7
| | | | | | | | | | | 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
* iseq.h: check rangenobu2014-07-171-2/+6
| | | | | | | * iseq.h (iseq_catch_table_bytes): check range and suppress a warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.h (struct iseq_catch_table_entry): shrink to 32 bytes on 64-bitnormal2014-07-141-4/+4
| | | | | | | | | | | | * iseq.h (struct iseq_catch_table_entry): shrink to 32 bytes on 64-bit This drops a few minor page faults on my system at startup. Using 64-bit start, end, cont, and sp fields are unnecessary as label_get_position and label_get_sp only return int values. label_get_position and label_get_sp should probably return unsigned, but that is a future change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (struct rb_iseq_struct): reduce to 296 bytes on 64-bitnormal2014-07-141-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * include/ruby/ruby.h (struct rb_data_type_struct), gc.c: addko12013-06-191-2/+2
| | | | | | | | | | | | | rb_data_type_struct::flags. Now, this flags is passed at T_DATA object creation. You can specify FL_WB_PROTECTED on this flag. * iseq.c: making non-shady iseq objects. * class.c, compile.c, proc.c, vm.c: add WB for iseq objects. * vm_core.h, iseq.h: constify fields to detect WB insertion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq: reduce array allocations for simple sequencestmm12013-04-171-0/+1
| | | | | | | | | | | | | | | | | * compile.c (iseq_add_mark_object): Use new rb_iseq_add_mark_object(). * insns.def (setinlinecache): Ditto. * iseq.c (rb_iseq_add_mark_object): New function to allocate iseq->mark_ary on demand. [Bug #8142] * iseq.h (rb_iseq_add_mark_object): Ditto. * iseq.c (prepare_iseq_build): Avoid allocating mark_ary until needed. * iseq.c (rb_iseq_build_for_ruby2cext): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* defines.h: RUBY_SYMBOL_EXPORT_{BEGIN,END}nobu2013-04-051-6/+2
| | | | | | | * include/ruby/defines.h (RUBY_SYMBOL_EXPORT_{BEGIN,END}): visibility control macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h: flip_cnt in rb_iseq_tnobu2013-01-081-1/+0
| | | | | | | | | * vm_core.h (rb_iseq_t): move flip_cnt from struct iseq_compile_data, because it has same life span as enclosing iseq. [Bug #7671] [ruby-core:51296] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c, vm_insnhelper.c: flip-flop without hidden string keynobu2012-12-101-0/+2
| | | | | | | | | | | * compile.c (iseq_compile_each): count flip-flop state in local iseq not in each iseqs, so that the keys can be other than hidden strings. [ruby-core:47253] [Bug #6899] * vm_insnhelper.c (lep_svar_get, lep_svar_set, vm_getspecial): store flip-flop states in an array instead of a hash. * iseq.c (set_relation): main iseq also can has local scope. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.h: iseq_catch_table_entry::catch_type should beko12012-12-031-6/+6
| | | | | | | | | | Fixnum because they are pushed into Array in a compiler. [Bug #7502] * test/ruby/test_objectspace.rb: add a test of this issue. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [EXPERIMENTAL]ko12012-11-301-0/+4
| | | | | | | | | | | | | | | | | * iseq.c: add following two methods. * ISeq#line_trace_all returns all line traces (line numbers) * ISeq#line_trace_specify(pos, set) set `pos'th line event to specified_line event (if set is true). These features are introduced for debuggers (mainly to make breakpoint). * iseq.h: add decl. of C APIs. * test/ruby/test_iseq.rb: add tests. * vm_trace.c: add `specified_line' event. * include/ruby/ruby.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Feature #7035nobu2012-09-241-3/+12
| | | | | | | | * compile.c (defined_expr), insns.def (defined): share single frozen strings. [EXPERIMENTAL] [ruby-core:47558][Feature #7035] * iseq.c (rb_iseq_defined_string): make expression strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.h, iseq.c, compile.c: Change the line number data structureko12011-08-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | | to solve an issue reported at [ruby-dev:44413] [Ruby 1.9 - Bug #5217]. Before this fix, each instruction has an information including line number (iseq::iseq_insn_info_table). Instead of this data structure, recording only line number changing places (iseq::iseq_line_info_table). The order of entries in iseq_line_info_table is ascending order of iseq_line_info_table_entry::position. You can get a line number by an iseq and a program counter with this data structure. This fix reduces memory consumption of iseq (bytecode). On my measurement, a rails application consumes 21.8MB for iseq with this fix on the 32bit CPU. Without this fix, it consumes 24.7MB for iseq [ruby-dev:44415]. * proc.c: ditto. * vm_insnhelper.c: ditto. * vm_method.c: ditto. * vm.c (rb_vm_get_sourceline): change to use rb_iseq_line_no(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h, internal.h iseq.h: declare internal functions.akr2011-06-181-0/+1
| | | | | | | | | | | | | | | | | | * compile.c, eval.c, iseq.c, object.c, parse.y, proc.c, process.c, thread.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c: don't declare internal functions. Note that rb_method_entry_eq() is defined in vm_method.c but there was a declaration in proc.c with different const-ness. Now it is declared in method.h with same const-ness to the definition. * object.c (rb_mod_module_exec): don't declare functions declared in include/ruby/intern.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: declare more internal functions.akr2011-06-181-0/+3
| | | | | | | | | | | | | | * iseq.h (rb_method_get_iseq): declared. * compile.c, eval.c, eval_error.c, iseq.c, parse.y, proc.c, range.c, ruby.c, time.c, util.c, vm.c: don't declare internal functions. * eval.c, parse.y, thread_pthread.c: non-existing function declarations removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: declare internal functions here.akr2011-06-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * node.h: declare NODE dependent internal functions here. * iseq.h: declare rb_iseq_t dependent internal functions here. * vm_core.h: declare rb_thread_t dependent internal functions here. * bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c, enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c, iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y, proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c, thread.c, time.c, transcode.c, variable.c, vm.c, tool/compile_prelude.rb: don't declare internal functions declared in above headers. include above headers if required. Note that rb_thread_mark() was declared as void rb_thread_mark(rb_thread_t *th) in cont.c but defined as void rb_thread_mark(void *ptr) in vm.c. Now it is declared as the later in internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (iseq_compile_each): fix for __goto__ and __label__nobu2010-12-121-0/+3
| | | | | | where were totally broken. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove a comma at end of enumerator list.kazu2010-12-101-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: some refactoring.ko12010-10-311-27/+32
| | | | | | | | | | | | | | | | | | | | - move decl. of rb_compile_option_struct to iseq.h. - define enum iseq_type. - define enum vm_special_object_type. * compile.c: some refactoring. - apply above changes. - (struct iseq_link_element): change value of type. - remove unused decl. - fix comment. - rename iseq_build_body and iseq_build_exception to iseq_build_from_ary_body and iseq_build_from_ary_exception. * iseq.h: define enum catch_type and enum defined_type. * insns.def: apply above changes. * iseq.c: define ISEQ_MAJOR_VERSION and ISEQ_MINOR_VERSION. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * configure.in (XCFLAGS): use -fvisibility=hidden if possible.nobu2010-07-211-0/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (ADD_TRACE): fire coverage event in ensure clause.mame2009-10-081-0/+1
| | | | | | | | [ruby-dev:39303] * iseq.h, iseq.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,nobu2009-09-211-7/+7
| | | | | | | | | thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c, vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl, tool/instruction.rb: fixed types. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e