summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
AgeCommit message (Collapse)Author
2012-03-16* vm_insnhelper.c (argument_error): use line number at the beginningnobu
of lambda, not the first code ob its body. [ruby-core:43314][Bug #6151] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-15* adjust style.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14* include/ruby/intern.h: Add rb_check_arity, rb_error_arity [#6085]marcandre
* array.c: Use rb_check_arity / rb_error_arity * class.c: ditto * enumerator.c: ditto * eval.c: ditto * file.c: ditto * hash.c: ditto * numeric.c: ditto * proc.c: ditto * process.c: ditto * random.c: ditto * re.c: ditto * signal.c: ditto * string.c: ditto * struct.c: ditto * transcode.c: ditto * vm_eval.c: ditto * vm_insnhelper.c: ditto & implementation of rb_error_arity * test/ruby/test_arity.rb: tests for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14* vm_insnhelper.c: improve number of arguments error in case ofmarcandre
optional parameters (issue #6085) * include/ruby/intern.h: define UNLIMITED_ARGUMENTS * test/ruby/test_arity.rb: test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-13* compile.c (iseq_set_arguments): keyword rest arg without keyword args.nobu
* node.c (dump_node): dump kw_rest_arg too. * parse.y (block_param, f_arg): more kwrest patterns. [ruby-core:42455][Bug #5989] * parse.y (new_args_gen): no extra kw_rest_arg if no keyword rest arg. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-30* vm_eval.c (vm_call0): should pass block to enumerators. patchednobu
by Kazuki Tsujimoto. [ruby-dev:44961][Bug #5731] * vm_eval.c (method_missing), vm_insnhelper.c (vm_call_method): ditto. patched by satoshi shiba. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-20* vm.c (vm_exec): remove workaround for LLVM because r34278 fixes it.naruse
* vm_insnhelper.c (vm_call_cfunc): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-27* vm_insnhelper.c (unknown_keyword_error): add GC guard to preventnagachika
intermediate object from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-26* vm_insnhelper.c (unknown_keyword_error): make it kind a error message when ↵mame
unknown keyword is given. It require more work. See [ruby-core:40518] and [ruby-core:40541] in detail. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-26* vm_core.h (struct rb_iseq_struct), compile.c (iseq_set_arguments), iseq.c ↵mame
(rb_iseq_parameters), vm_insnhelper.c (vm_callee_setup_arg_complex): support Method#parameters for keyword arguments. The provisional spec is what Benoit Daloze proposed. [ruby-core:40518] * test/ruby/test_keyword.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-26* vm_core.h (struct rb_iseq_struct), compile.c (iseq_set_arguments, ↵mame
iseq_compile_each), vm_insnhelper.c (vm_callee_setup_arg_complex): implement keyword arguments. See [ruby-core:40290] The feature is promised to be included in 2.0, but the detail spec is still under discussion; this commit is a springboard for further discussion. Please try it and give us feedback. This commit includes fixes for some problems reported by Benoit Daloze <eregontp AT gmail.com> [ruby-core:40518] and Marc-Andre Lafortune <ruby-core-mailing-list AT marc-andre.ca> [ruby-core:41772]. * iseq.c (iseq_free, prepare_iseq_build): bookkeeping. * test/ruby/test_keyword.rb: add tests for keyword arguments. * test/ripper/dummyparser.rb (class DummyParser): temporal fix for ripper test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-12* vm_insnhelper.c (vm_yield_setup_block_args): splat singlenobu
argument if optinal arguments are defined not only mandatory or post arguments. [ruby-core:41557] [Bug #5730] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-05* bignum.c (big_rshift), compile.c (validate_label,nobu
iseq_build_from_ary_exception), cont.c (cont_capture), dir.c (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open) (rb_io_advise), parse.y (parser_compile_string) (rb_parser_compile_file), proc.c (binding_free), process.c (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core) (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null), signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main), vm_insnhelper.c (vm_expandarray): suppress unused-but-set-variable warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-27* vm_insnhelper.c (vm_call_cfunc): adding back useless hack. For sometenderlove
reason, this fixes CFP errors on OS X 10.7. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06fix typoskazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06* vm_eval.c (make_no_method_execption): extract fromnobu
raise_method_missing(). * vm_eval.c (send_internal): remove inadvertent symbol creation from public_send. based on a patch by Jeremy Evans <code AT jeremyevans.net> in [ruby-core:38576]. [Feature #5112] * vm_insnhelper.c (vm_call_method): remove inadvertent symbol creation from send and __send__, too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-05* vm_insnhelper.c (vm_call_cfunc): remove useless hack.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29* use RB_TYPE_P which is optimized for constant types, instead ofnobu
comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-21* vm_insnhelper.c (vm_call_cfunc): suppress a warning. note thatnobu
`volatile type *var' doesn't make var itself volatile. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-20Avoid cfp consistency error by LLVM.naruse
volatile is not enough. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-20* vm_insnhelper.c (vm_get_cvar_base): reduce duplicated checks andnobu
move a warning outside the loop. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-02* vm_insnhelper.c (vm_search_const_defined_class): searchnobu
ancestors only when global scope. [ruby-core:39227] [Bug #5264] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-01* insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): seenobu
also inherited constants for classes without superclass and modules. [ruby-core:37698] [Bug #3423] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-31* Re-apply r33078, thread-safe autoload which is reverted at r33093.nahi
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-30* vm_insnhelper.c (vm_call_cfunc): revert r33112. RB_GC_GUARD macrousa
protect a VALUE from GC. It's not for general anti-optimizing purpose. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-29Use RB_GC_GUARD.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27* Revert r33078. It caused a Rails application NoMethodError.nahi
/home/nahi/git/emptyApp/ruby/1.9.1/gems/rack-mount-0.6.14/lib/rack/mount/utils.rb:157: warning: toplevel constant ScanError referenced by Regin::Parser::ScanError /home/nahi/git/emptyApp/ruby/1.9.1/gems/rack-mount-0.6.14/lib/rack/mount/vendor/regin/regin/parser.rb:17:in `parse_regexp': undefined method `scan_str' for #<Regin::Parser:0x00000002344548> (NoMethodError) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-26* variable.c: Make autoload thread-safe. See #921.nahi
What's the problem? autoload is thread unsafe. When we define a constant to be autoloaded, we expect the constant construction is invariant. But current autoload implementation allows other threads to access the constant while the first thread is loading a file. What's happening inside? The current implementation uses Qundef as a marker of autoload in Constant table. Once the first thread find Qundef as a value at constant lookup, it starts loading a defined feature. Generally a loaded file overrides the Qundef in Constant table by module/class declaration at very beginning lines of the file, so other threads can see the new Module/Class object before feature loading is finished. It breaks invariant construction. How to solve? To ensure invariant constant construction, we need to override Qundef with defined Object after the feature loading. For keeping Qundef in Constant table, I expanded autoload_data struct in Module to have a slot for keeping the defined object while feature loading. And changed Module's constant lookup/update logic a little so that the slot is only visible from the thread which invokes feature loading. (== the first thread which accessed the autoload constant) Evaluation? All test passes (bootstrap test, test-all and RubySpec) and added 8 tests for threading behavior. Extra logics are executed only when Qundef is found, so no perf drop should happen except autoloading. * variable.c (rb_autoload): Prepare new autoload_data struct. * variable.c (rb_autoload_load): Load feature and update Constant table after feature loading is finished. * variable.c (rb_const_get_0): When the fetched constant is under autoloading, it returns the object only for the thread which starts autoloading. * variable.c (rb_const_defined_0): Ditto. * variable.c (rb_const_set): When the specified constant is under autoloading, it sets the object only for the thread which starts autoloading. Otherwise, simply overrides Qundef with constant override warning. * vm_insnhelper.c (vm_get_ev_const): Apply same change as rb_const_get_0 in variable.c. * test/ruby/test_autoload.rb: Added tests for threading behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-24* vm_insnhelper.h, vm_insnhelper.c, vm.c, vm_method.c, insns.def:ko1
Manage a redefinition of special methods for each classes. A patch from Joel Gouly <joel.gouly@gmail.com>. Thanks! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-24* iseq.h, iseq.c, compile.c: Change the line number data structureko1
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
2011-07-22* vm_insnhelper.c (vm_call_cfunc): added volatile for a workaroundkosaki
of cfp consistency error problem on OS X 10.7 (Lion). It's suspected llvm optimization bug. [Bug #5076] [ruby-dev:44185] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-10* vm_insnhelper.c (vm_throw): check a class frame.ko1
Fixes Bug #4648. The patch is contributed by Kazuki Tsujimoto. * bootstraptest/test_proc.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-30* vm_insnhelper.c (vm_getivar): check vm state versionko1
to invalidate inline chache (ivar index). fixes Bug #4926. * vm_insnhelper.c (vm_setivar): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-30* vm_insnhelper.c (vm_call_bmethod): fix to hook call/return eventko1
for methods defined by define_method(). * thread.c (call_trace_proc): Fix to skip if class is not given (0). Note that ID and Class object are passed for call/return event if the called method was defined by define_method(). If you are author of tracer/profiler/debugger, this may be an important change. You should check passed class as zero or non-zero instead of checking the event type. * test/ruby/test_settracefunc.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-25* vm_insnhelper.c (vm_search_superclass): avoid control framenagachika
stack overrun. currently super() in Proc created in a method defined by Module#define_method raise NoMethodError. [Bug #4881] * test/ruby/test_method.rb t_super_in_proc_from_define_method): add test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-22* cont.c (cont_capture): add volatile.naruse
On clang -O, it is needed to avoid the optimization. With this and llvm/clang's recent fix, clang 3.0 can build ruby-trunk with -O option. * cont.c (cont_capture): use for-loop. * array.c (rb_ary_each): add volatile and use it. * vm_insnhelper.c (vm_call_cfunc): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18* method.h, internal.h iseq.h: declare internal functions.akr
* 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
2011-06-16* thread.c (rb_thread_schedule_rec): fix {UN,}LIKELY macro misuse.kosaki
* gc.c (rb_newobj): ditto. * vm_insnhelper.c (vm_method_search): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18* internal.h: add for internal use only.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-31* vm_insnhelper.c (vm_get_ev_const): should ignore crefs withshugo
the NODE_FL_CREF_PUSHED_BY_EVAL flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-31* vm_insnhelper.c (vm_get_ev_const): search root cref properly.shugo
[ruby-dev:43365] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-24* vm_insnhelper.c (vm_get_ev_const): should not autoload innobu
defined? mode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-20* prevent temporary objects from GC, and should not usenobu
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
2011-02-19 * vm_insnhelper.c (vm_check_if_namespace): guard temporary objectnagachika
from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-29* vm_insnhelper.c (vm_get_ev_const): no-scope reference to toplevelmame
private constant has been prohibited incorrectly. * test/ruby/test_module.rb (test_toplevel_private_constant): add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-28* constant.h, variable.c: to ensure compatibility, rb_const_get_* mustmame
not raise an exception even when the constant is private. Instead, rb_public_const_get_* and rb_public_const_defined_* are introduced, which raise an exception when the referring constant is private. see [ruby-core:32912]. * vm_insnhelper.c (vm_get_ev_const): use rb_public_const_get_* instead of rb_const_get_* to follow the constant visibility when user code refers a constant. * test/ruby/test_marshal.rb (test_marshal_private_class): add a test. This test had failed because of incompatibility of rb_const_get. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-13* vm_insnhelper.c: parenthesize macro arguments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20* compile.c (setup_args), vm.c (invoke_block_from_c),nobu
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
2010-12-18* compile.c (setup_args), vm.c (invoke_block_from_c),nobu
vm_insnhelper.c (caller_setup_args): fix of r30241. lambda block shoud check argument number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-15* iseq.c (set_relation), vm_insnhelper.c (vm_cref_push): nd_filenobu
is always zero-cleared. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e