iseq->local_size is calculated, too, along with stack_size and
param.size, meaning there is no need to blindly load values in
the misc hash passed to us.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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.c (iseq_set_arguments): directly set true and false
default values not only nil to keyword arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
iseq_build_from_ary_body indentation was too deep for my little
terminal, so extract it so it is easier to add keyword support.
* compile.c (iseq_build_callinfo_from_hash): hoist out
(iseq_build_from_ary_body): shorten callinfo case
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
is required for memory access. Currently, the padding is enabled
only when the CPU is 32-bit SPARC and the compiler is GCC.
[Bug #9681] [ruby-core:61715]
* compile.c (STRICT_ALIGNMENT): defined if strict alignment is required
* compile.c (ALIGNMENT_SIZE, ALIGNMENT_SIZE_MASK, PADDING_SIZE_MAX):
new macros for alignemnt word size, bit mask, max size of padding.
* compile.c (calc_padding): new function to calculate padding size.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`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
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:🎏: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
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
* compile.c (iseq_build_from_ary_exception): move RB_GC_GUARD
(iseq_build_from_ary_body): use PRIsVALUE instead of RB_GC_GUARD
Currently unused functions, but we should set good examples for
using RB_GC_GUARD (and favoring PRIsVALUE in format strings).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_set_arguments): store local variable IDs in
temporary list as Symbols. previously these are stored as
Fixnums to prevent from GC, but IDs of dynamic symbols can
exceed Fixnum range and cause RangeError at inverting from
Fixnum. [ruby-dev:48564] [Bug #10266]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This keeps ci->flag and ci->aux.index consistent across 32-bit
and 64-bit platforms.
ci->flag: VM_CALL_* flags only use 9 bits, currently
ci->aux.index: 2 billion ivars per class should be enough for anybody
This saves around 50K allocations on "valgrind ruby -e exit" on x86-64
before:
total heap usage: 48,122 allocs, 19,253 frees, 8,099,197 bytes allocated
after:
total heap usage: 48,069 allocs, 19,214 frees, 8,047,266 bytes allocated
* vm_core.h (rb_call_info_t): ci->flag becomes 32-bit unsigned int
ci->index becomes a 32-bit signed int (from signed long).
Reorder for better packing on 64-bit, giving an 8 byte reduction
from 104 to 96 bytes for each ci.
* compile.c (new_callinfo, setup_args, iseq_compile_each,
iseq_build_from_ary_body): adjust for type changes
* vm_insnhelper.c (vm_getivar): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Needless conversions made the code harder to follow.
[misc #10207]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_set_sequence): assigned in REALLOC_N, no further
assignment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (compile_data_alloc): cast to suppress a warning by
apple gcc-4.2. it doesn't cause an error but a warning in spite
of -Werror=shorten-64-to-32 option, for some reason.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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_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
* compile.c (defined_expr): make the condition if the receiver
is explicit or implicit cleaner. [fix GH-681]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each): set FCALL flag on AREF call at
private aref op_assign. [ruby-core:63817] [Bug #10060]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
* compile.c (new_insn_body): use enum instead of bare int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.h (NODE_PRIVATE_RECV): name a magic number, `self` as the
receiver of a setter method call.
* compile.c (private_recv_p), parse.y (attr_receiver): use the
named macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (compile_array_): make copy a first hash not to modify
the argument itself. keyword splat should be non-destructive.
[ruby-core:62161] [Bug #9776]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_build_from_ary_body): Use :blockptr instead of :block
as hash key when loading serialized instruction sequences from arrays.
[Bug #9455] [ruby-core:60146]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each): result of assignment should be
its rhs instead of returned value from a method.
[ruby-core:60071] [Bug #9448]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* insns.def (opt_aref_with): new instruction to optimize Hash#[],
removing any allocation overhead when used with a string literal
key. Patch by normalperson (Eric Wong). [ruby-core:59640] [Bug #9382]
* insns.def (opt_aset_with): new instruction to optimize Hash#[]=
* compile.c (iseq_compile_each): compiler shortcuts for new
instructions
* hash.c (static VALUE rb_hash_compare_by_id_p): fix documentation for
Hash#compare_by_identity to reflect frozen string sharing
* test/ruby/test_hash.rb (class TestHash): test for new behavior
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_set_arguments): get rid of error by clang,
implicit conversion to shorter integer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
* compile.c (iseq_specialized_instruction): emit opt_aset instruction
to optimize Hash#[]= and Array#[]= when called with Fixnum argument.
[Bug #9227] [ruby-core:58956]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Rename method_serial
to global_method_state and constant_serial to global_constant_state
after discussion with ko1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_inspect denies a hidden object. So, insert rapper that creates
the unhidden one.
adjust->label is null sometimes.
insn_data_line_no makes no sense at all.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
method is called on a static string literal with no arguments.
* defs/id.def (firstline): add freeze so idFreeze is available
* insns.def (opt_str_freeze): add opt_str_freeze instruction which
pushes a frozen string literal without allocating a new object if
String#freeze is not overriden
* string.c (Init_String): define String#freeze
* vm.c (vm_init_redefined_flag): define BOP_FREEZE on String class as
a basic operation
* vm_insnhelper.h: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ruby_vm_global_state_version into two separate counters - one for the
global method state and one for the global constant state. This means
changes to constants do not affect method caches, and changes to
methods do not affect constant caches. In particular, this means
inclusions of modules containing constants no longer globally
invalidate the method cache.
* class.c, eval.c, include/ruby/intern.h, insns.def, vm.c, vm_method.c:
rename rb_clear_cache_by_class to rb_clear_method_cache_by_class
* class.c, include/ruby/intern.h, variable.c, vm_method.c: add
rb_clear_constant_cache
* compile.c, vm_core.h, vm_insnhelper.c: rename vmstat field in
rb_call_info_struct to method_state
* vm_method.c: rename vmstat field in struct cache_entry to method_state
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (compile_array_): no hash to merge if it is empty.
* vm.c (m_core_hash_merge_kwd): just check keys if only one argument
is given, without merging.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RARRAY_RAWPTR(ary) returns (const VALUE *) type pointer and
usecase of this macro is not acquire raw pointer, but acquire
read-only pointer. So we rename to better name.
RSTRUCT_RAWPTR() is also renamed to RSTRUCT_CONST_PTR()
(I expect that nobody use it).
* array.c, compile.c, cont.c, enumerator.c, gc.c, proc.c, random.c,
string.c, struct.c, thread.c, vm_eval.c, vm_insnhelper.c:
catch up this change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* insns.def (opt_regexpmatch2): use CALL_SIMPLE_METHOD to call =~ if
the receiver is not a T_STRING [Bug #8847] [ruby-core:56916]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
custom compilation.
* compile.c (NODE_POSTEXE): compile to
"ONCE{ VMFrozenCore::core#set_postexe{...} }" with a new custom
compiler `build_postexe_iseq()'.
* vm.c (m_core_set_postexe): remove parameters (passed by a block).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RARRAY_PTR() because there is no new reference.
* compile.c (iseq_set_exception_table): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
parameter `slot'. You don't need to write a cast (VALUE *) any more.
* class.c, compile.c, hash.c, iseq.c, proc.c, re.c, variable.c,
vm.c, vm_method.c: remove cast expressions for OBJ_WRITE().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
* compile.c (iseq_set_arguments): not a simple single argument if any
keyword arguments exist. [ruby-core:55203] [Bug #8463]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RBASIC_CLASS(obj) macro which returns a class of `obj'.
This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
This function reveal interal (hidden) object by rb_obj_hide().
Note that do not change class before and after hiding.
Only permitted example is:
klass = RBASIC_CLASS(obj);
rb_obj_hide(obj);
....
rb_obj_reveal(obj, klass);
TODO: API design. rb_obj_reveal() should be replaced with others.
TODO: modify constified variables using cast may be harmful for
compiler's analysis and optimizaton.
Any idea to prohibt inserting RBasic::klass directly?
If rename RBasic::klass and force to use RBASIC_CLASS(obj),
then all codes such as `RBASIC(obj)->klass' will be
compilation error. Is it acceptable? (We have similar
experience at Ruby 1.9,
for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each): keep nd_line(node) in a local
variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each): calculate argc as int, not as Fixnum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
instruction. for example, at the following script
def m()
p:xyzzy
1
2
end
compiler ignores `1' because there is no effect. However,
`trace(line)' instruction remains in bytecode.
This modification removes such redundant trace(line) instruction.
* test/ruby/test_iseq.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_set_arguments): no keyword check if any keyword rest
argument exists, even unnamed. [ruby-core:52744] [Bug #7922]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
A script "[print(1)]; print(2)" should output "12".
However, the compiler had eliminted "[print(1)]" expression
because it is void expression (unused array).
Of course, side-effect should be remained.
This issue is reported by Masaya Tarui.
* bootstraptest/test_literal.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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 (ADD_TRACE): putting a semicolon at the last of a macro
let do/while make no sense.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
compile.c (iseq_compile_each), insns.def (defineclass): change the
meaning of the third operand of defineclass as follows:
lower 3bits: the type of the defineclass
0 = class, 1 = singleton class, 2 = module
4th bit: a flag represents whether the defineclass is scoped
0 = not scoped (e.g., class Foo)
1 = scoped (e.g., class Bar::Baz)
5th bit: a flag represents whether the superclass is specified
0 = not specified (e.g., class Foo)
1 = specified (e.g., class Bar < Foo)
If the superclass is specified and is not a class, a TypeError
should be raised. [ruby-dev:46747] [Bug #7572]
* test/ruby/test_class.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
change condition of using `opt_send_simple'.
More method invocations can be simple.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
on Windows 8. Without cast, 0 might be non zero value at higher bits
in rb_ary_new3().
[ruby-core:50258] [Bug #7456]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
it is true only if type == COMPILE_ARRAY_TYPE_HASH.
[ruby-dev:46658] [Bug #7466]
* vm.c (m_core_hash_from_ary): add assertion instead of above.
* vm.c (m_core_hash_merge_ary): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (compile_array_): hash elements must be paired even for
literal elements. [ruby-dev:46658] [Bug #7466]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c (empty_ary_alloc, ary_new): added array create DTrace probe.
* compile.c (rb_insns_name): allowing DTrace probes to access
instruction sequence name.
* Makefile.in: translate probes.d file to appropriate header file.
* common.mk: declare dependencies on the DTrace header.
* configure.in: add a test for existence of DTrace.
* eval.c (setup_exception): add a probe for when an exception is
raised.
* gc.c: Add DTrace probes for mark begin and end, and sweep begin and
end.
* hash.c (empty_hash_alloc): Add a probe for hash allocation.
* insns.def: Add probes for function entry and return.
* internal.h: function declaration for compile.c change.
* load.c (rb_f_load): add probes for `load` entry and exit, require
entry and exit, and wrapping search_required for load path search.
* object.c (rb_obj_alloc): added a probe for general object creation.
* parse.y (yycompile0): added a probe around parse and compile phase.
* string.c (empty_str_alloc, str_new): DTrace probes for string
allocation.
* test/dtrace/*: tests for DTrace probes.
* vm.c (vm_invoke_proc): add probes for function return on exception
raise, hash create, and instruction sequence execution.
* vm_core.h: add probe declarations for function entry and exit.
* vm_dump.c: add probes header file.
* vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on
function entry and return.
* vm_exec.c: expose instruction number to instruction name function.
* vm_insnshelper.c: add function entry and exit probes for cfunc
methods.
* vm_insnhelper.h: vm usage information is always collected, so
uncomment the functions.
12 19:14:50 2012 Akinori MUSHA <knu@iDaemons.org>
* configure.in (isinf, isnan): isinf() and isnan() are macros on
DragonFly which cannot be found by AC_REPLACE_FUNCS(). This
workaround enforces the fact that they exist on DragonFly.
12 15:59:38 2012 Shugo Maeda <shugo@ruby-lang.org>
* vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo),
vm_insnhelper.c (vm_search_method): revert r37616 because it's too
slow. [ruby-dev:46477]
* test/ruby/test_refinement.rb (test_inline_method_cache): skip
the test until the bug is fixed efficiently.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vm_insnhelper.c (vm_search_method): revert r37616 because it's too
slow. [ruby-dev:46477]
* test/ruby/test_refinement.rb (test_inline_method_cache): skip
the test until the bug is fixed efficiently.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
add a new field for inline method cache.
* vm_insnhelper.c (vm_search_method): check rb_call_info_t::refinements
not to confuse inline method cache when module_eval is used with
refinements.
* test/ruby/test_refinement.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
when no need to care about block and splat.
* compile.c: use the `opt_send_simple' instruction.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(used in `iseq_set_sequence()') to rb_call_info_t::aux::index.
rb_call_info_t::argc is initialiesed by same value of
rb_call_info_t::orig_argc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`putstring' for all of strings used by NODE_DSTR because
ruby users can not grab this string.
For example, the string object of "baz" in "foo#{bar}baz"
is located by `putobject' (users can not touch "baz" object
directly). This change reduces GC pressure.
This improvement is suggested by Aaron Patterson.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
use only a `ci' (rb_call_info_t) parameter instead of using
parameters such as `op_id', 'op_argc', `blockiseq' and flag.
These information are stored in rb_call_info_t at the compile
time.
This technique simplifies parameter passings at related
function calls (~10% speedups for simple mehtod invocation at
my machine).
`rb_call_info_t' also has new function pointer variable `call'.
This `call' variable enables to customize method (block)
invocation process for each place. However, it always call
`vm_call_general()' at this changes.
`rb_call_info_t' also has temporary variables for method
(block) invocation.
* vm_core.h, compile.c, insns.def: introduce VM_CALL_ARGS_SKIP_SETUP
VM_CALL macro. This flag indicates that this call can skip
caller_setup (block arg and splat arg).
* compile.c: catch up above changes.
* iseq.c: catch up above changes (especially for TS_CALLINFO).
* tool/instruction.rb: catch up above chagnes.
* vm_insnhelper.c, vm_insnhelper.h: ditto. Macros and functions
parameters are changed.
* vm_eval.c (vm_call0): ditto (it will be rewriten soon).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This data structure contains information including inline method
cache. After that, `struct iseq_inline_cache_entry' does not
need to contain inline cache for method invocation.
Other information will be added to this data structure.
* vm_core.h (rb_iseq_t): add `callinfo_entries' and `callinfo_size'
members to `rb_iseq_t'.
* insns.def, compile.c: Use CALL_INFO instead of IC.
* tool/instruction.rb: support CALL_INFO as operand type.
* vm_insnhelper.c, vm_insnhelper.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
remove checkincludearray instruction and
add new instruction checkmatch.
This change is to solve
[Bug #4438] "rescue args type check omitted".
* iseq.c: increment ISEQ_MAJOR_VERSION because removal of
checkincludearray instruction.
* vm_core.h: add several definitions for
the checkmatch instruction.
* vm_insnhelper.c (check_match): added.
* bootstraptest/test_exception.rb: add a test.
* test/ruby/test_exception.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
aggregate type is a C99ism.
* compile.c (enum compile_array_type_t): comma at the end of enum
list is a C99ism.
* vm_backtrace.c (enum LOCATION_TYPE): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(1) rename rb_location_t to rb_iseq_location_t.
(2) rename field names of rb_iseq_location_t to adjust
RubyVM::Backtrace::Location methods.
(2-1) filename -> path
(2-2) filepath -> absolute_path
(2-3) basename -> base_label
(2-4) name -> label
(3) rename filed name rb_iseq_location_t#line_no to
rb_iseq_location_t#first_lineno to clear purpose of this field.
(4) The field names rb_binding_t#(filename|line_no) are also renamed
to rb_binding_t#(path|first_lineno).
* compile.c: apply above changes.
* iseq.c: ditto.
* proc.c: ditto.
* vm*.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
information.
rb_location_t#filename, filepath, name and line_no was moved from
rb_iseq_t. rb_location_t#basename is a new field which is
similar to `name' field without any decoration.
`name' field contains some decoration such as `block in foo'.
`basename' only contains `foo'.
rb_iseq_t contains memory object of rb_location_t.
* iseq.c: setup rb_location_t for each rb_iseq_t memory objects.
* compile.c, proc.c, vm.c, vm_dump.c, vm_eval.c, vm_insnhelper.c,
vm_method.c: support about it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
are available as a condition of same case clause.
And remove infomation ('#n') because we can find duplicated
condition with explicit line numbers.
[ruby-core:38343] [Ruby 1.9 - Bug #5068]
* test/ruby/test_syntax.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Divide big array (or hash) literals into several blocks and
concatetene them. There was a problem that a big array (hash)
literal causes SystemStackError exception (stack overflow)
because VM push all contents of the literal onto VM stack to
make an array (or hash). To solve this issue, we make several
arrays (hashes) and concatenate them to make a big array (hash)
object.
??
* compile.c (iseq_compile_each, setup_args): use modified
compile_array.
* vm.c (m_core_hash_from_ary, m_core_hash_merge_ary,
m_core_hash_merge_ptr): added for above change.
* id.c (Init_id), parse.y: add core method ids.
* bootstraptest/test_literal.rb: add simple tests.
* bootstraptest/test_eval.rb: remove rescue clause to catch
SystemStackError exception.
* test/ruby/test_literal.rb: add tests to check no stack overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
of if-else with switch for special instructions. based on a
patch by Vasfed. https://github.com/ruby/ruby/pull/105
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
self. since stabby lambda is a syntax, so it should not be
affected by the context. [ruby-core:42349][Bug #5966]
* insns.def (send): no special deal for FCALL. self should be put
on TOS instead.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each): make new array with
splat. [ruby-core:21901][Feature #1125]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
clause, skip string creation to make it faster. [ruby-dev:44068]
[Feature #5000]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
RSTRING_PTR() for function calls since it evaluates the argument
a couple of times.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
an exception when "class Foo::Bar" is evaluated and Foo::Bar is
private. To implement this, define_type of "defineclass" is added
so that the instruction can distinguish whether the class definition
is scoped (class Foo::Bar) or not (class Bar).
* test/ruby/test_class.rb (test_redefine_private_class),
test/ruby/test_module.rb
(test_define_module_under_private_constant): add tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vm_insnhelper.c (caller_setup_args): reverted r30241 and r30243
except for the test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_iseq_build_from_ary): fix type inconsistency (which is benign
because sizeof(ID) == sizeof(ID*), though). Coverity Scan found
these bugs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
treated as integer, add to table hash of case that way.
based on a patch from Ikuo KOBORI. [ruby-dev:42038]
* insnf.def (opt_case_dispatch): ditto.
* test/ruby/test_case.rb: add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
results when poped is true. [ruby-dev:41933], [Bug #3658]
This is retry of r28870 and r28873 which were reverted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
which involuntarily changed semantics of type conversion.
I'll re-commit a correct patch.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
if block argument is passed. [ruby-core:30534]
* parse.c (arg_concat_gen): should append to nd_head, not to
nd_iter for NODE_BLOCK_PASS.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
consistency. [ruby-core:30293]
Now, lfinish[0] of defined_expr seems not to be used. Refactoring
may be needed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vm_throw): allow "return" and "yield" even in singleton class
definition. based on a patch from wanabe <s.wanabe AT gmail.com>
for "return". [ruby-core:21379] [ruby-dev:40975]
* insns.def (defineclass): ditto (straightforwardly push block ptr,
instead of dfp ptr with special flag).
* vm_core.h (RUBY_VM_CLASS_SPECIAL_P): ditto (no longer needed).
* proc.c (proc_new): ditto (remove handling for special flag).
* bootstraptest/test_jump.rb: add tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
fix stack consistency error. [ruby-core:28172]
* bootstraptest/test_jump.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
path field into rb_iseq_t. The field contains a string representing
a path to corresponding source file. or nil when the iseq is created
from -e, stdin, eval, etc. This field is used for require_relative.
[ruby-dev:40004]
* load.c (rb_f_require_relative): add C implementation of
require_relative.
* prelude.rb (require_relative): get rid of Ruby implementation of
require_relative.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
object such as :$foo for the "defined?($foo)" expression
on defined instruction. This patch fixes ISeq#to_a/load.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(OFFSET to IC). This IC must be same as corresponding
getinlinecache instruction's IC operand.
This change is for a little performance improvement
(getting IC directly) and is for the AOT compilation development.
* compile.c, iseq.c, insns.def: Change the approach to handling inline
cahce (IC) type operand to enable the above change.
This change also affects ISeq#to_a method. The inline cache operand
will be dumped by fixnum, the index of inline cache, in other words,
inline cache identity.
* template/insns_info.inc.tmpl, tool/instruction.rb: No need to count
inline cache size (insn_iclen()).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_method.c (rb_add_method_cfunc): invalid initializer for C89
* compile.c (iseq_insns_unification): int might be smaller than int*
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* defs/dtrace.d: new file. defined a dtrace provider "ruby".
* include/ruby/ruby.h (LIKELY): moved from vm.c.
(UNLIKELY): ditto.
(OBJSETUP): probe "object-create".
(RUBY_EVENT_RESCUE): new event.
* vm_exec.c (DEBUG_ENTER_INSN): embeded a probe insn-entry into it.
(DEBUG_END_INSN): insn-return.
* vm.c (LIKELY): moved into ruby.h.
(UNLIKELY): ditto.
(Init_BareVM): embeded a probe "raise" into it.
* variable.c (rb_class2name_without_alloc): new utility function.
* tool/rbinstall.rb (install?(:ext, :arch, :'ext-arch')): installs
dtrace.d if necessary.
* thread_pthread.c (add_signal_thread_list): probe "raise".
(rb_thread_create_timer_thread): ditto.
* thread.c (rb_thread_schedule_rec): probes "thread-enter" and
"thread-leave",
(thread_start_func_2): ditto.
(thread_cleanup_func): probe "thread-term"
* lib/mkmf.rb: supports dtrace postprocessor on making an extension.
* iseq.c (rb_vm_insn_name): new utility function.
(rb_vm_insn_len): ditto.
* insns.def (hook): probes "method-etnry", "method-return", "line",
and "rescue".
* compile.c (iseq_compile_each): adds a trace op for "rescue" probe.
* gc.c (garbage_collect): probes "gc-begin" and "gc-end".
(obj_free): probe "object-free"
(garbage_collect_with_gvl): probe "raise"
(negative_size_allocation_error): ditto.
(rb_memerror): ditto.
* eval.c (rb_rescue2): probe "rescue"
(rb_longjmp): probe "raise"
* ext/probe/probe.c: new extension for application defined probes.
* ext/probe/extconf.rb: ditto.
* configure.in (--with-tracing-model): new option to choose a tracing
mechanism.
(DTRACE): new substitution. name of dtrace(1).
(RUBY_TRACING_MODEL): new substitution.
(DTRACE_OBJ): ditto.
(MINIDTRACE_OBJ): ditto.
(GOLFDTRACE_OBJ): ditto.
(LIBRUBY_DTRACE_OBJ): ditto.
(RUBY_DTRACE_POSTPROCESS): new macro. checks whether the dtrace on
the system needs postprocessing.
(RUBY_DTRACE_BSD_BROKEN): new macro. checks whether the dtrace
supports USDT.
* Makefile.in:
(DTRACE): new variable. name of dtrace(1).
(TRACING_MODEL): new variable. name of the chosen tracing mechanism.
(DTRACE_OBJ): same as the one in configure.in.
(MINIDTRACE_OBJ): ditto.
(GOLFDTRACE_OBJ): ditto.
(LIBRUBY_DTRACE_OBJ): ditto.
(CPPOUTFILE): new substitution. necessary for generating dtrace.d
(trace_none.h): new target for TRACING_MODEL=none
(RUBY_H_INCLUDES): appended a header for tracing.
(distclean-local): also removes preprocessed version of dtrace.d
($(LIBRUBY_A)): needs $(LIBRUBY_DTRACE_OBJ) if dtrace needs
postprocessing.
($(PROGRAM)): ditto.
(golf): ditto.
(miniruby): ditto.
($(arch_hdrdir)/ruby/dtrace.d): new target. preprocessed verson
of defs/dtrace.d. generated if necessary.
($(arch_hdrdir)/ruby/trace_dtrace.h): new target.
definition of probes.
($(LIBRUBY_DTRACE_OBJ)): new target. generated if dtrace needs
postprocessing.
($(DTRACE_OBJ)): ditto.
($(MINIDTRACE_OBJ)): ditto.
($(GOLFDTRACE_OBJ)): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
represents line number from which the original code of the iseq
starts. [ruby-dev:38698]
* iseq.c, compile.c: ditto.
* parse.y: line number hack (for Proc#source_location) is no longer
needed.
* test/ruby/test_settracefunc.rb: line number of set_trace_func is now
compatible with 1.8's.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (xstring, regexp, dsym, literal_concat, evstr2dstr):
literal at the top of dstr is no longer needed if it is empty,
since concatstrings and toregexp always create new strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
method management. This change affect some VM control stack structure.
* vm.c, vm_insnhelper.c, vm_method.c, vm_eval.c: ditto. and make some
refactoring.
* insns.def, class.c, eval.c, proc.c, vm_dump.c : ditto.
* vm_core.h, compile.c (iseq_specialized_instruction): remove
VM_CALL_SEND_BIT. use another optimization tech for Kernel#send.
* node.h: remove unused node types.
* ext/objspace/objspace.c (count_nodes): ditto.
* gc.c: add mark/free functions for method entry.
* include/ruby/intern.h: remove decl of
rb_define_notimplement_method_id(). nobody can use it
because noex is not opend.
* iseq.c (iseq_mark): fix to check ic_method is available.
* iseq.c (rb_iseq_disasm): fix to use rb_method_get_iseq().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
fix to use inline cache.
* compile.c: fix to skip inline cache entry (IC). IC is added
automatically by compiler.
* insns.def, vm_insnhelper.h: fix IC positions.
* iseq.c: increment minor_version of ISeq because of above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
main. [ruby-dev:38382]
* parse.y (program): inherits dvars in eval or main.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
methods of the argument of case, to keep the semantics of
case/when. [ruby-dev:38079]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
from nagachika <nagachika00 AT gmail.com> at [ruby-dev:37977].
* compile.c (insn_set_sc_state): fixed typoe.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(),
vm_stack_to_heap(), vm_make_proc(), vm_invoke_proc(),
vm_get_sourceline(), vm_cref(), vm_localjump_error(),
vm_make_jump_tag_but_local_jump(), vm_jump_tag_but_local_jump().
This changes may affect only core because most of renamed functions
require a pointer of not-exposed struct such as rb_thread_t or NODE.
In short, they are core functions.
* cont.c, eval.c, eval_intern.h, load.c, proc.c, thread.c,
vm_core.h, vm_dump.c, vm_eval.c, vm_exec.c, vm_insnhelper.c:
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
parsing main or normal eval script.
* compile.c (rb_parse_in_main): return 1 if parsing main script.
(if parse_in_eval is negative value, it means main script)
* parse.y (yycompile0): check rb_parse_in_main() to accumulate
script text. Bug #848 [ruby-core:20450]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c (vm_set_main_stack, rb_iseq_eval_main): added.
* parse.y (rb_parser_compile_file): fix to check parse_in_eval flag.
* eval.c (ruby_exec_node): use rb_iseq_eval_main()
instead of rb_iseq_eval().
* iseq.c (rb_iseq_new_main), vm_core.h: added.
main script (specified by -e or script name) should be run
under TOPLEVEL_BINDING using Kernel#eval. Above changes
simulate Kernel#eval behaviour. [ruby-dev:37240]
* compile.c (make_name_for_block): skip iseq except block type.
this fix is needed for [ruby-dev:37240], and also fixes
[ruby-dev:35392].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This change stop to install node.h beacuase of saving ABI
(node.h will be changed. Extensions should not depends on
this file).
* blockinlining.c, class.c, compile.c, debug.h, enum.c,
gc.c, iseq.c, parse.y, ruby.c, signal.c, variable.c,
vm.c, vm_core.h, vm_dump.c: ditto.
* ext/ripper/depend: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
"expression" without evaluating the expression. [ruby-dev:35967]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
instead to use "postexe" insn.
* id.c, id.h: add a prepared id for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
by "vm.c".
* vm_eval.c: added. Some codes are moved from "eval.c"
* common.mk: fix for above changes.
* compile.c: make a vm_eval(0)
* eval.c, eval_error.c, eval_intern.h, eval_jump.c, proc.c, vm.c,
id.c, id.h, vm_core.h, vm_dump.c, vm_evalbody.c, vm_insnhelper.c,
blockinlining.c: fix for above changes. and do some refactoring.
this changes improve rb_yield() performance.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e