Граф коммитов

248 Коммитов

Автор SHA1 Сообщение Дата
ko1 08c8605de9 * insns.def (getlocal, setlocal): remove old getlocal/setlocal
instructions and rename getdaynmic/setdynamic instructions
  to getlocal/setlocal.
* compile.c: ditto.
* iseq.c: remove TS_DINDEX.
* vm_exec.h (dindex_t): remove type definition of `dindex_t'.
* tool/instruction.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04 13:52:20 +00:00
ko1 e3990633cb * insns.def (opt_checkenv): remove unused instruction `opt_checkenv'.
* compile.c (iseq_compile_each): ditto.
* node.h: remove unused node `NODE_OPTBLOCK'.
* ext/objspace/objspace.c, gc.c (gc_mark_children): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-28 06:44:24 +00:00
ko1 d50483df23 * vm_core.h: remove rb_control_frame_t::bp (bp: base pointer).
`bp' can be calculate by `sp' (stack pointer) of previous frame.
  Now, `bp_check' field is remained for debug.  You can eliminate
  this field by setting  VM_DEBUG_BP_CHECK as 0.
* vm_insnhelper.c (vm_base_ptr): add `vm_base_ptr(cfp).
  This function calculates base pointer from cfp.
* vm_insnhelper.c (vm_setup_method): push `recv' value on top of
  value stack (before method parameters).
  This change is for keeping consistency with normal method dispatch.
* insns.def: fix to use vm_base_ptr().
* vm.c (vm_exec): ditto.
* vm_dump.c: remove `bp' related dumps.
* cont.c (fiber_init): fix to check VM_DEBUG_BP_CHECK.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-28 04:05:36 +00:00
ko1 1bebb22ce1 * insns.def: add new instruction `opt_empty_p' for optimize `empty?'
method.  Apply a patch proposed at [ruby-dev:46120]
  [ruby-trunk - Feature #6972] by Glass_saga (Masaki Matsushita).
* compile.c (iseq_specialized_instruction), vm.c, vm_insnhelper.h:
  ditto.
* id.c, template/id.h.tmpl: ditto.
* test/ruby/test_optimization.rb: test for this changes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-26 09:34:46 +00:00
nobu 1e56548995 insns.def: super from at_exit
* insns.def (invokesuper): klass in cfp is not valid in at_exit and
  END blocks.  [ruby-core:47680] [Bug #7064]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-25 00:59:29 +00:00
nobu 2314b80d4c Feature #7035
* 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
2012-09-24 08:36:53 +00:00
nobu cb6fc579f4 insns.def: duplicated code
* insns.def (checkmatch): remove duplicated code.  [ruby-core:47339]
  [Bug #6930]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-28 16:57:50 +00:00
nagachika 43b8ae4631 * insns.def (checkmatch): suppress warnings. [ruby-core:47339]
[Bug #6930]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-28 14:05:52 +00:00
nobu 68f3ece33f suppress warnings
* insns.def (checkmatch): suppress warnings.  [ruby-core:47310]
  [Bug #6930]
* vm_core.h (VM_FRAME_TYPE_FINISH_P): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-26 07:53:21 +00:00
ko1 b3b5e626ad * include/ruby/ruby.h: introduce flonum technique for
64bit CPU environment (sizeof(double) == sizeof(VALUE)).
  flonum technique enables to avoid double object creation
  if the double value d is in range about between
  1.72723e-77 < |d| <= 1.15792e+77 or 0.0.
  flonum Float value is immediate and their lowest two bits
  are b10.
  If flonum is activated, then USE_FLONUM macro is 1.
  I'll write detailed in this technique on
  https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/Flonum_tech
* benchmark/bmx_temp.rb: add an benchmark for simple
  Float calculation.
* gc.c (id2ref, rb_obj_id): add flonum Float support.
* include/ruby/intern.h: move decl of rb_float_new(double)
  to include/ruby/ruby.h.
* insns.def, vm.c, vm_insnhelper.c: add flonum optimization
  and simplify source code.
* vm_insnhelper.h (FLONUM_2_P): added.
* marshal.c: support flonum output.
* numeric.c (rb_float_new_in_heap): added.
* parse.y: support flonum.
* random.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23 07:22:40 +00:00
shugo 55cf24d378 * insns.def (invokesuper): reverted r36640 partially to make super
in a thread work correctly. [ruby-core:47284] [Bug #6907]

* test/ruby/test_super.rb: related test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23 04:00:25 +00:00
tenderlove 51a41dd056 * insns.def: search up the cf stack for an object that is an instance
of the recipient class.  Fixes [ruby-core:47186]

* test/ruby/test_super.rb: related test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-22 16:51:08 +00:00
ko1 93b6f8d619 * compile.c, insns.def (checkmatch):
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
2012-08-08 07:52:19 +00:00
ko1 0d1a905edb * vm_exec.c, insns.def (leave): solve problems on
OPT_CALL_THREADED_CODE.
  Catch up finish frame structure on OPT_CALL_THREADED_CODE.
* vm_core.h: add rb_thread_t#retval for temporary space on
  OPT_CALL_THREADED_CODE.
* vm.c (th_init): clear rb_thread_t#retval as Qundef.
* vm_dump.c (rb_vmdebug_debug_print_pre): fix debug print format.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-07 11:13:57 +00:00
shugo 9537e8ffe5 * internal.h, class.c, eval.c, insns.def: find the appropriate
receiver for super called in instance_eval.  If such a receiver is
  not found, raise NoMethodError. [ruby-dev:39772] [Bug #2402]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-06 07:00:19 +00:00
nobu cc48423ead insns.def: use klass in cfp
* insns.def (defined): now should use klass in the current control
  frame to search superclass, not me->klass.  reported by naruse.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-06 02:34:36 +00:00
nobu 260d02d91d vm_insnhelper.c: no recv
* vm_insnhelper.c (vm_search_normal_superclass): no longer needs
  receiver, klass is always unique in the ancestors now.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-03 16:56:08 +00:00
shugo 9bef3f0519 * insns.def (invokesuper): reverted r36612 so that super in an
aliased method will not call the same method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-03 16:32:52 +00:00
shugo 2d3d84155d * insns.def (invokesuper): don't skip the same class. instead, use
rb_method_entry_get_with_omod() to avoid infinite loop when
  super is used with refinements. [ruby-core:30450] [Bug #3351]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-03 10:27:21 +00:00
shugo 19ddfc2483 * eval.c (rb_mod_using): new method Module#using. [experimental]
* eval.c (rb_mod_refine): new method Module#refine. [experimental]

* eval.c (f_using): new method Kernel#using. [experimental]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-02 11:34:19 +00:00
shugo 319088e9c7 * class.c, insns.def, method.h, proc.c, vm.c, vm_core.h, vm_eval.c,
vm_insnhelper.c, vm_insnhelper.h, vm_method.c: add klass to
  rb_control_frame_t to implement super correctly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-02 11:08:44 +00:00
nobu c1ef657b39 insns.def: RB_TYPE_P
* insns.def (checkincludearray, defineclass, opt_regexpmatch2): use RB_TYPE_P().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-28 02:15:48 +00:00
nobu 1ea6c81762 remove garbage spaces
* insns.def, parse.y: remove garbage spaces.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-20 07:27:28 +00:00
ko1 f4a8db647a * thread.c (rb_thread_s_control_interrupt,
rb_thread_s_check_interrupt): added for
  Thread.control_intgerrupt and Thread.check_interrupt.
  See details on rdoc.
  I'll make an ticket for this feature.
* test/ruby/test_thread.rb: add a test for Thread.control_intgerrupt.
* thread.c (rb_threadptr_raise): make a new exception object
  even if argc is 0.
* thread.c (rb_thread_kill): kill thread immediately if target thread
  is current thread.
* vm_core.h (RUBY_VM_CHECK_INTS_BLOCKING): added.
  CHECK_INTS while/after blocking operation.
* vm_core.h (RUBY_VM_CHECK_INTS): require rb_thread_t ptr.
* cont.c (fiber_switch): use replaced RUBY_VM_CHECK_INTS().
* eval.c (ruby_cleanup): ditto.
* insns.def: ditto.
* process.c (rb_waitpid): ditto.
* vm_eval.c (vm_call0): ditto.
* vm_insnhelper.c (vm_call_method): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-19 14:19:40 +00:00
nobu 35784d1019 defined: me in cfp
* insns.def (defined): use method entry and id in cfp for proper
  superclass, since klass in iseq is shared by dynamically defined
  methods from the same block.  [ruby-core:45831][Bug #6644]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-11 20:11:45 +00:00
nobu a7e1820a9f __callee__ fix
* eval.c (rb_frame_callee, rb_f_callee_name): fix to return the called
  id.
* vm_insnhelper.c (vm_push_frame): set proper method entry.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-04 02:11:37 +00:00
ko1 745c23b2d9 * vm_core.h: remove VM_FRAME_MAGIC_FINISH (finish frame type).
Before this commit:
  `finish frame' was place holder which indicates that VM loop
  needs to return function.
  If a C method calls a Ruby methods (a method written by Ruby),
  then VM loop will be (re-)invoked.  When the Ruby method returns,
  then also VM loop should be escaped.  `finish frame' has only
  one instruction `finish', which returns VM loop function.
  VM loop function executes `finish' instruction, then VM loop
  function returns itself.
  With such mechanism, `leave' instruction (which returns one
  frame from current scope) doesn't need to check that this `leave'
  should also return from VM loop function.
  Strictly, one branch can be removed from `leave' instructon.
  Consideration:
  However, pushing the `finish frame' needs costs because
  it needs several memory accesses.  The number of pushing
  `finish frame' is greater than I had assumed.  Of course,
  pushing `finish frame' consumes additional control frame.
  Moreover, recent processors has good branch prediction,
  with which we can ignore such trivial checking.
  After this commit:
  Finally, I decide to remove `finish frame' and `finish'
  instruction.  Some parts of VM depend on `finish frame',
  so the new frame flag VM_FRAME_FLAG_FINISH is introduced.
  If this frame should escape from VM function loop, then
  the result of VM_FRAME_TYPE_FINISH_P(cfp) is true.
  `leave' instruction checks this flag every time.
  I measured performance on it.  However on my environments,
  it improves some benchmarks and slows some benchmarks down.
  Maybe it is because of C compiler optimization parameters.
  I'll re-visit here if this cause problems.
* insns.def (leave, finish): remove finish instruction.
* vm.c, vm_eval.c, vm_exec.c, vm_backtrace.c, vm_dump.c:
  apply above changes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-15 10:22:34 +00:00
ko1 0a71db8a74 * vm_core.h: remove lfp (local frame pointer) and rename
dfp (dynamic frame pointer) to ep (environment pointer).
  This change make VM `normal' (similar to other interpreters).
  Before this commit:
  Each frame has two env pointers lfp and dfp.  lfp points
  local environment which is method/class/toplevel frame.
  lfp[0] is block pointer.
  dfp is block local frame. dfp[0] points previous (parent)
  environment pointer.
  lfp == dfp when frame is method/class/toplevel.
  You can get lfp from dfp by traversing previous environment
  pointers.
  After this commit:
  Each frame has only `ep' to point respective enviornoment.
  If there is parent environment, then ep[0] points parent
  envioenment (as dfp).  If there are no more environment,
  then ep[0] points block pointer (as lfp).  We call such ep
  as `LEP' (local EP).  We add some macros to get LEP and to
  detect LEP or not.
  In short, we replace dfp and lfp with ep and LEP.
  rb_block_t and rb_binding_t member `lfp' and `dfp' are removed
  and member `ep' is added.
  rename rb_thread_t's member `local_lfp' and `local_svar' to
  `root_lep' and `root_svar'.
  (VM_EP_PREV_EP(ep)): get previous environment pointer.  This macro
  assume that ep is not LEP.
  (VM_EP_BLOCK_PTR(ep)): get block pointer.  This macro assume
  that ep is LEP.
  (VM_EP_LEP_P(ep)): detect ep is LEP or not.
  (VM_ENVVAL_BLOCK_PTR(ptr)): make block pointer.
  (VM_ENVVAL_BLOCK_PTR_P(v)): detect v is block pointer.
  (VM_ENVVAL_PREV_EP_PTR(ptr)): make prev environment pointer.
  (VM_ENVVAL_PREV_EP_PTR_P(v)): detect v is prev env pointer.
* vm.c: apply above changes.
  (VM_EP_LEP(ep)): get LEP.
  (VM_CF_LEP(cfp)): get LEP of cfp->ep.
  (VM_CF_PREV_EP(cfp)): utility function VM_EP_PREV_EP(cfp->ep).
  (VM_CF_BLOCK_PTR(cfp)): utility function VM_EP_BLOCK_PTR(cfp->ep).
* vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, insns.def:
  apply above changes.
* cont.c: ditto.
* eval.c, eval_intern.h: ditto.
* proc.c: ditto.
* thread.c: ditto.
* vm_dump.c: ditto.
* vm_exec.h: fix function name (on vm debug mode).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-11 03:14:59 +00:00
nobu e6424f805b * removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 21:36:05 +00:00
marcandre 4c2e2d8bde * numeric.c: fix flodivmod for cornercases [Bug #6044]
add ruby_float_mod

* insns.def (opt_mod): use ruby_float_mod

* internal.h: declare ruby_float_mod

* test/ruby/test_float.rb: tests for above

* test/ruby/envutil.rb: create helper assert_is_minus_zero

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14 06:10:01 +00:00
nobu 6a8d009709 * compile.c (iseq_compile_each): call on special object instead of
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
2012-02-26 02:26:49 +00:00
nobu fde3c421be * insns.def (splatarray): make new array if flag is set.
* 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
2012-02-15 20:41:38 +00:00
nobu 2d14b798c2 * insns.def (pop): suppress self-assign warning of clang.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-27 08:24:19 +00:00
duerst 642562c707 insns.def: Some fixes and tweaks to English explanations
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-05 11:30:51 +00:00
nagachika 4117048c40 * insns.def: change encoding pragma for emacs (shift_jis to utf-8).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-05 12:02:30 +00:00
shyouhei 60c8455253 Change encoding from EUC-JP to UTF-8. [Feature #5128]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-04 12:22:46 +00:00
nobu 7dddaf6807 * vm_insnhelper.c (vm_search_const_defined_class): search
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-02 05:36:49 +00:00
nobu 43284b6bf8 * insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): see
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-09-01 08:31:24 +00:00
ko1 beb26e1b49 * vm_insnhelper.h, vm_insnhelper.c, vm.c, vm_method.c, insns.def:
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 22:02:03 +00:00
ko1 4f03f0cb67 * insns.def (defined): fix to checking class variable.
A patch by Magnus Holm <judofyr@gmail.com>.  Thanks!
* test/ruby/test_variable.rb: add a test for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-24 00:52:04 +00:00
naruse db42bd0448 * insns.def (concatstrings): don't use initial ASCII-8BIT string.
[ruby-core:38635] [Bug #5126]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-01 03:10:02 +00:00
nobu 49c0b143e4 * insns.def: written in Shift_JIS.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-04 06:52:39 +00:00
naruse 13e644cb2a Fix mixed declarations in r31822.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-30 07:28:30 +00:00
naruse 1d5431374d * insns.def (opt_mult): as r31805, volatile it.
Without this, clang -O fails calculation.

* numeric.c (fix_mul): ditto.

* rational.c (f_imul): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-30 06:53:21 +00:00
mame a2ec8666cf * compile.c (NODE_CLASS, NODE_MODULE), insns.def (defineclass): raise
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
2011-01-28 17:57:34 +00:00
nobu f6003894b9 * compile.c (new_child_iseq): adjust argument types.
* iseq.c (prepare_iseq_build, rb_iseq_new),
  (rb_iseq_new_with_bopt_and_opt, rb_iseq_new_with_opt),
  (rb_iseq_new_with_bopt): ditto.
* compile.c (iseq_set_exception_table): suppress warnings.
* insns.def (putspecialobject, defined): ditto.
* iseq.c (iseq_load): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-31 13:11:02 +00:00
ko1 b76fd8283a * vm_core.h: some refactoring.
- 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
2010-10-31 01:42:54 +00:00
ko1 559fd3e439 * insns.def, iseq.c, vm_insnhelper.c: rename variable name
(ip -> iseq).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-14 13:19:30 +00:00
nobu dc647aea2e * insns.def (opt_case_dispatch): use st_data_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 13:51:20 +00:00
nobu 17c48bebf8 * compile.c (iseq_build_body), insns.def (getglobal, setglobal),
iseq.c (iseq_load, iseq_data_to_ary), util.c (valid_filename):
  use VALUE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 14:35:40 +00:00
ko1 86a8b820d6 * insns.def (opt_case_dispatch), vm_insnhelper.c:
execute the procedures of "when" clauses by bytecode
  instead of st_foreach() when the object does not hit
  prepared hash.  [ruby-dev:42304]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-27 14:47:30 +00:00
wanabe 96688ecbab * compile.c (case_when_optimizable_literal): When float value can be
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
2010-09-09 13:40:14 +00:00
nobu a4209572de * insns.def, vm_core.h: fixed typo. reported by Rocky Bernstein
<rockyb AT rubyforge.org> at [ruby-core:31596].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-02 15:53:48 +00:00
nobu 140d43a73f * insns.def (concatarray): removed unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-03 09:40:25 +00:00
matz 276fb7e77b * compile.c (iseq_compile_each): should consider block on stack,
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
2010-06-02 03:05:06 +00:00
matz e0ad353fe0 * insns.def (defined): respond_to_missing? may not be available
(for BasicObject instances).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-30 17:20:15 +00:00
mame b18fcd6a7c * insns.def (invokesuper): check consistency between class of self and
class of method being invoked by super.  This is temporary measure
  for YARV.  See [ruby-core:30313] in detail.  See [ruby-dev:40959]
  [ruby-dev:39772] [ruby-core:27000] [ruby-core:27230]

* vm_insnhelper.c (vm_search_superclass): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-27 15:39:34 +00:00
mame 80f7f8d07e * compile.c (iseq_compile_each), vm_insnhelper.c (vm_invoke_block,
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
2010-05-09 18:21:39 +00:00
mame e59b9d35fc * insns.def (onceinlinecache): add exclusion control for a region
between onceinlinecache and setinlinecache.  [ruby-dev:39768]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-27 14:06:16 +00:00
ko1 9da12c5850 * compile.c (defined_expr), insns.def (defined): fix to pass a Symbol
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
2010-03-09 19:21:37 +00:00
ko1 d3f73f45d8 * insns.def: Change the operand type of setinlinecache
(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
2010-02-24 17:06:15 +00:00
yugui 295bc2fe25 removes the dtrace support. reverts r26239, r26238 and r26235.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-05 05:59:23 +00:00
yugui 72b199940d * trace.h: new file. wraps tracing mechanisms.
* 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
2010-01-03 15:36:17 +00:00
matz beb486d55e * insns.def (defined): should respect #respond_to_missing? as
#respond_to? does.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-04 10:53:21 +00:00
nobu 826aa8c376 * insns.def (defined): adjust indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-04 08:34:16 +00:00
shugo 7dbfe89630 * compile.c (compile_cpath, iseq_compile_each): reverted
constant/class variable lookup in instance_eval etc. to the
  behavior of 1.8.
* eval.c (rb_mod_nesting): ditto.
* insns.def (putspecialobject, defineclass): ditto.
* node.h (NODE_FL_CREF_PUSHED_BY_EVAL): ditto.
* vm_core.h (VM_SPECIAL_OBJECT_CONST_BASE): ditto.
* vm_eval.c (yield_under, eval_under): ditto.
* vm_insnhelper.c (vm_cref_push, vm_get_const_base,
  vm_get_ev_const, vm_get_cvar_base): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-03 18:25:57 +00:00
nobu 9e68d0dc03 * insns.def (opt_case_dispatch): runtime value cannot be used as
an element initializer.

* vm_insnhelper.c (opt_case_dispatch_i): gets rid of type-punning
  calls.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-17 07:26:26 +00:00
nobu fe1ce93f52 * compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
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
2009-09-21 20:58:26 +00:00
ko1 6f817b6dd2 * vm_core.h: change members of iseq_inline_cache_entry.
make cache value members to one union member "ic_value".
* insns.def: ditto.
* vm_insnhelper.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-12 17:16:27 +00:00
ko1 a31c632299 * iseq.c (iseq_mark): no need to mark inline cache entries.
* insns.def (onceinlinecache, setinlinecache): save a value
  to mark cached value.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 02:57:39 +00:00
ko1 b82db5251c * insns.def (opt_*): add IC operands.
* vm_insnhelper.h (CALL_SIMPLE_METHOD): add a version which
  use an inline cache.  USE_IC_FOR_SPECIALIZED_METHOD macro
  switchs the behaviour.  This change also removes
  CALL_SIMPLE_METHOD_IC() macro.
* tool/instruction.rb: fix elimination process to ignore
  variable "ic".



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-06 20:42:50 +00:00
ko1 f1e98086f2 * vm_insnhelper.h (CALL_SIMPLE_METHOD_IC): make a macro
invoke simple method with inline cache entry.
* insns.def (opt_length, opt_size): fix to use inline method cache.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-06 09:16:23 +00:00
ko1 f825d84898 * compile.c (iseq_specialized_instruction), insns.def (opt_size):
optimize #size methods (by specialized instruction).
* id.c, id.h, vm.c, vm_insnhelper.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-06 08:39:57 +00:00
ko1 bd8da69e9b * insns.def (setinstancevariable), vm_insnhelper.c (vm_setivar):
fix to use inline cache (trivial optimization).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-06 07:40:24 +00:00
nobu 72072e6343 * insns.def (opt_case_dispatch): suppressed a warning.
* vm_insnhelper.c (opt_case_dispatch_i): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-13 07:31:23 +00:00
ko1 8e8e34319b * insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h: check
definition of (classes)#=== for case/when optimization.
  Fix Bug #1376 [ruby-core:23190].
* string.c (Init_String), bignum.c (Init_Bignum),
  numeric.c (Init_Numeric): define String#===, Symbol#===,
  Bignum#===, Fixnum#===, Float#=== as same as (classes)#==.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-12 05:55:06 +00:00
nobu b8b083dbd5 * insns.def (defineclass): preserve encoding of class/module
names.  [ruby-core:24600]

* variable.c (rb_set_class_path_string): set class path with a
  string value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-30 07:45:42 +00:00
ko1 94664d6d0c * node.h, vm_core.h, variable.c: rename global_entry to rb_global_entry.
* compile.c, insns.def, iseq.c, vm_insnhelper.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16 00:01:06 +00:00
ko1 c330876d7c * method.h, vm_core.h: add rb_method_entry_t. Remove nodes around
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
2009-07-15 14:59:41 +00:00
ko1 20d9aefccb * vm_core.h, compile.c: declare struct iseq_inline_cache_entry.
Inline cache (IC) entries are no longer GC managed object.
  IC entries are freed when ISeq is freed.
* iseq.c: fix mark, free, memsize functions for above change.
* insns.def: remove rb_gc_write_barrier().
* vm_insnhelper.c (vm_method_search): ditto.
* tool/instruction.rb, template/insns_info.inc.tmpl (insn_iclen):
  added.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-13 09:30:23 +00:00
ko1 0ac93a1a40 * insns.def, vm_insnhelper.c (getinstancevariable):
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
2009-07-13 04:44:20 +00:00
nobu d06f74d736 * insns.def, tool/instruction.rb: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-30 07:46:44 +00:00
nari 57b83a5191 * gc.c: add longlife garbage collection. [ruby-dev:38423]
(NORMAL_HEAPS_USED): new macro.
  (LONGLIFE_ALLOCATE_HEAPS_MIN): ditto.
  (add_longlife_heaps_slot): new function.
  (rb_newobj_from_longlife_heap): ditto.
  (rb_newobj_longlife): ditto.
  (rb_node_newnode_longlife): ditto.
  (rb_gc_write_barrier): ditto.
  (remembered_set_recycle): ditto.
  (rb_gc_mark_remembered_set): ditto.
  (clear_mark_longlife_heaps): ditto.
  (gc_sweep_for_longlife): ditto.
  (assign_heap_slot): new argumnent to longlife heaps slot.
  (add_freelist): ditto.
  (gc_sweep): avoid lonlife heap slot. set longlife_collection
   flag at add heap.
  (rb_gc_force_recycle): avoid mark object and remembered_set
   object.
  (garbage_collect): add longlife collection.
  (rb_gc_start): invoke longlife collection.
  (gc_profile_record_get): for longlife collction profile.
  (gc_profile_result): ditto.

* include/ruby/intern.h (rb_gc_write_barrier): declared.

* include/ruby/ruby.h (FL_REMEMBERED_SET): renamed from FL_RESERVED.

* debug.c (FL_REMEMBERED_SET): ditto.

* insns.def (setinlinecache): insert write barrier.

* vm_insnhelper.c (vm_method_search): ditto.

* set_relation (set_relation): use longlife object.

* vm.c (vm_define_method): ditto.

* vm_core.h (NEW_INLINE_CACHE_ENTRY): ditto.

* vm_method.c (rb_add_method): ditto.

* class.c (rb_add_method): ditto.

* node.h (NEW_NODE_LONGLIFE): new macro.
  (rb_node_newnode_longlife): declared.
					    


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-13 14:08:26 +00:00
nobu 2e54fe9d4d * array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def,
missing/crypt.c, missing/vsnprintf.c, : suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-10 05:43:14 +00:00
usa c691d55bcd * numeric.c (flo_eq, flo_gt, flo_ge, flo_lt, flo_le, flo_eql): revert
isnan() checks for VC++6.

	* insns.def (opt_lt, opt_gt): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-27 05:42:06 +00:00
matz 7019187067 * insns.def (opt_minus): inline float operation.
* insns.def (opt_lt, opt_gt): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-23 16:12:38 +00:00
nobu 1128e61562 * array.c (rb_ary_resurrect), string.c (rb_str_resurrect): new
functions based on [ruby-dev:37983]

* insns.def (putstring, duparray): use rb_{ary,str}_resurrect().

* iseq.c (iseq_data_to_ary): needs to result TS_VALUE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18 05:33:36 +00:00
nobu 6b7dbd3e31 * insns.def (defineclass): try to autoload const to be overridden.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-12 15:48:44 +00:00
nobu e52da91987 * compile.c (compile_array_, defined_expr, iseq_compile_each): hide
and freeze internal literal objects, to prevent from modifying.
  [ruby-dev:37959]

* iseq.c (insn_operand_intern): copy internal literal objects.

* insns.def (putstring, duparray): ditto.

* string.c (rb_str_replace): exported.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-12 10:42:36 +00:00
nobu 66a5fcab3a * insns.def (setspecial, putstring): fixed typos in rdoc.
* insns.def (toregexp): uses rb_ary_tmp_new(), and clears it after
  used.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-11 05:46:17 +00:00
ko1 a3a45fafa3 * vm.c (rb_vm_inc_const_missing_count, ruby_vm_const_missing_count):
added.
* vm_insnhelper.h: ditto.
* variable.c (rb_const_get_0), insns.def: Constants should not be
  cached if const_missing is called.  [ruby-core:21059] [Bug #967]
* bootstraptest/test_class.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 15:31:43 +00:00
ko1 f0da2e1657 * vm_insnhelper.c (vm_call_method): use class of method defined
instead of receiver's class on bmethod.  fixes [ruby-core:20786]
* bootstraptest/test_method.rb: add a test for above.
* vm_insnhelper.c (vm_setup_method): remove unused parameter klass.
* vm_insnhelper.h (CALL_METHOD): ditto.
* insns.def, vm_eval.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-24 11:47:00 +00:00
matz 31b6ea65bb * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.
a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp>
  in [ruby-dev:36102].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05 18:24:21 +00:00
nobu f94f8f351e * configure.in (sizeof ptrdiff_t): check for size of ptrdiff_t.
* include/ruby/ruby.h (PRI?PTRDIFF, PRI?SIZE): printf conversion
  specifiers for ptrdiff_t and size_t/ssize_t.

* insns.def (leave), marshal.c (long_toobig), transcode.c
  (str_transcode), vm_dump.c (control_frame_dump, stack_dump_each),
  (debug_print_register, debug_print_pre): t and z length modifiers
  are C99.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-12 13:17:29 +00:00
mame f08581c7b6 * ext/coverage/coverage.c, ext/coverage/extconf.rb: eliminate
COVERAGE__ and introduce coverage.so instead.  How to measure
  coverage: (1) require "coverage.so", (2) require or load Ruby source
  file, and (3) Coverage.result will return the same hash as COVERAGE__.
  [ruby-dev:35324]

* thread.c (rb_enable_coverages): start coverage measurement by using
  rb_add_event_hook.

* thread.c (rb_get_coverages): returns current results of coverage
  measurement.

* include/ruby/intern.h: add prototype for above two functions.

* vm_core.h, vm.c: add field of coverages to rb_vm_t.

* insns.def (trace): remove special handling for COVERAGE__.

* iseq.c (prepare_iseq_build): switch COVERAGE__ to
  rb_get_coverages().

* parse.y (coverage): ditto.

* thread.c (clear_coverage): ditto.

* lib/coverage.rb: use coverage.so instead of COVERAGE__.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-03 12:55:12 +00:00
ko1 9a61579c16 * compile.h, insns.def: reduce insn operand of "trace".
* include/ruby/ruby.h: add RUBY_EVENT_COVERAGE event.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 18:13:22 +00:00
usa 6d625e4b6e * insns.def (trace): C99ism.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 16:59:20 +00:00
mame 5874de95e8 * Add coverage measurement constant COVERAGE__. This constant is not
for casual use.  Usage: (1) assign {} to COVERAGE__, (2) require or
  load Ruby source file, and (3) COVERAGE__["sourcefilepath"] will
  return an array whose elements represent number of executions per
  line of source code.

* vm_core.h: add field of coverage array to iseq.

* iseq.c (prepare_iseq_build): ditto.

* insns.def (trace): update coverage array.

* parse.y (coverage): create and initialize coverage array.

* compile.h (ADD_TRACE): add trace instruction to update covearge
  array.

* thread.c (clear_coverage): delete coverage array when forking.
  Otherwise, double count of coverage may occur.

* lib/coverage.rb: sample coverage measurement tool.

* error.c: distinguish explicitly between parse_in_eval and
  mild_compile_error.

* load.c: ditto.

* vm_eval.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 16:55:30 +00:00
ko1 807fbd6940 * compile.c, vm.c, insns.def: call FrozenCore.set_postexe method
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
2008-07-01 12:19:00 +00:00
ko1 eb33f91cb7 * compile.c, insns.def, vm.c, vm_core.h: remove some insns
(undef, alias, definemethod).
  Call RubyVM::FrozenCore's singleton method instead.
  Add "putiseq" and "putspecialobject" instructions.
* id.c, id.h: add ids for above.
* tool/parse.rb: "VM" no longer exists.  Use RubyVM instead.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 03:05:58 +00:00