* 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