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

319 Коммитов

Автор SHA1 Сообщение Дата
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 c4bc9b5758 * iseq.c, vm_eval.c: set th->base_block properly.
th->base_block is information for (a) parsing, (b) compiling
  and (c) setting up the frame to execute the program passed by
  `eval' method.  For example, (1) parser need to know up-level
  variables to detect it is variable or method without paren.
  Befor (a), (b) and (c), VM set th->base_block by passed bindng
  (or previous frame information).  After execute (a), (b) and (c),
  VM should clear th->base_block.  However, if (a), (b) or (c)
  raises an exception, then th->base_block is not cleared.
  Problem is that the uncleared value th->balo_block is used for
  irrelevant iseq compilation.  It causes SEGV or critical error.
  I tried to solve this problem: to clear them before exception,
  but finally I found out that it is difficult to do it (Ruby
  program can be run in many places).
  Because of this background, I set th->base_block before
  compiling iseq and restore it after compiling.
  Basically, th->base_block is dirty hack (similar to global
  variable) and this patch is also dirty.
* bootstraptest/test_eval.rb: add a test for above.
* internal.h: remove unused decl.
* iseq.c (rb_iseq_compile_with_option): add base_block parameter.
  set th->base_block before compation and restore it after
  compilation.
* ruby.c (require_libraries): pass 0 as base_block instead of
  setting th->base_block
* tool/compile_prelude.rb (prelude_eval): apply above changes.
* vm.c, vm_eval.c: ditto.
* vm_core.h: add comments.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22 09:32:56 +00:00
kazu 7193f4ae28 fix typos [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-15 12:01:41 +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
ko1 bac9f65f70 * vm_core.h (rb_location_t): fix type and field name.
(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
2012-06-04 02:49:37 +00:00
ko1 b57c81ae3e * common.mk: fix to build vm_backtrace.c only itself (vm_backtrace.c
is no longer included from vm.c).  I hope this separation reduce
  compile time of vm.c.
* internal.h: ditto.
* vm.c, vm_core.h, vm_dump.c, vm_eval.c: ditto.
* vm_eval.c: some functions (callee, etc) moved to vm_backtrace.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-02 15:59:37 +00:00
ko1 681d73a923 * vm_backtrace.c: added. Separate backtrace related functions to
this file.
* vm.c, common.mk: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-02 15:23:37 +00:00
nobu 2ab7c5306d vm.c: UNREACHABLE to suppress warnings
* vm.c (frame_info_{line_no,name,basename,filename,filepath}): add
  UNREACHABLE to suppress warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-31 06:50:22 +00:00
ko1 ec187ff847 * vm.c (backtrace_*): change type of lev and n from size_t to int.
Also set type of rb_backtrace_t#backtrace_size to int.
  A patch from nobu.
* vm_eval.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-26 08:08:16 +00:00
ko1 4f54d4710e * vm.c (RubyVM::FrameInfo): add a class to access each frame
information.  You don't need to parse strings from caller().
  FrameInfo has the following methods:
  FrameInfo#name: method name, class name, etc with decorations.
  FrameInfo#basename: name without decorations.
  FrameInfo#line_no: line number.
  FrameInfo#filename: file name.
  FrameInfo#filepath: full filepath.
  FrameInfo#iseq: iseq if it is iseq frame (defined by ruby script)
  FrameInfo#to_s: return caller() method style string.
  RubyVM::FrameInfoFrameInfo.caller(n, lev) returns array of
  FrameInfo objects.  The name "RubyVM::FrameInfoFrameInfo.caller"
  is long and ambiguous (same as caller() method), we need to change
  the name before Ruby 2.0 release.
  Good names or comments are welcome.
* test/ruby/test_backtrace.rb: add a test for above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-26 04:49:23 +00:00
ko1 fbf531c4a2 * vm.c (frame_info_to_str): add `break'.
* vm.c (backtrace_object): remove lev and n parameter.
  backtrace_object always returns all of backtrace information.
* vm.c (rb_backtrace_to_str_ary): fix to use backtrace_object().
  This change improve performance of caller(lev, n).
* benchmark/bm_vm3_backtrace.rb: added to check above improvement.
  FYI: measurement on my laptop, 1.9.3p229 needs 5.125 sec,
  and current trunk only needs 0.299sec.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-26 03:25:15 +00:00
ko1 6d597718cf * vm.c (rb_frame_info_t): keep previous ISEQ frame info for CFUNC
frame info.  And fix to cache a calculated line_no of ISEQ frame
  info.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-26 02:10:37 +00:00
nobu 655a20ea9d vm.c: adjust argument types
* vm.c (backtrace_each, bt_init, oldbt_init): adjust argument types.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-25 12:14:48 +00:00
ko1 a5f190615e * vm.c (oldbt_init, vm_backtrace_str_ary): arg->data should
be initialized before calling `backtrace_each()'.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-25 08:07:16 +00:00
ko1 1f3142a447 * vm.c: refactoring backtrace related funcitons.
(1) unify similar functions (rb_backtrace_each() and
  backtrace_object()).  backtrace_each() is a unified function.
  variation:
  a) backtrace_object(): create backtrace object.
  b) vm_backtrace_str_ary(): create bt as an array of string.
  c) vm_backtrace_print(): print backtrace to specified file.
  d) rb_backtrace_print_as_bugreport(): print backtrace on
  bugreport style.
  (2) remove rb_backtrace_each().  Use backtrace_each() instead.
  (3) chang the type of lev parameter to size_t.
  a) lev == 0 means current frame (exception, etc use it).
  b) lev == 1 means upper frame (caller(0) use it).
* vm_core.h, vm_dump.c, vm_eval.c: ditto.
* vm.c (backtrace_object(), vm_backtrace_str_ary()): fix to return a
  correct size of caller(lev) array.
  Let n be a "caller(0).size" then ln as caller(lev).size should be
  (n - lev).  However, the previous implementation returns a wrong
  size array (ln > n - lev).  [ruby-dev:45673]
* test/ruby/test_backtrace.rb: add tests for backtrace.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-25 04:50:10 +00:00
nobu 60e8cd2e68 vm.c: marshal compatibility
* vm.c (Init_VM): fix marshal compatibility of backtrace.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 14:01:41 +00:00
nobu ab42fe2a41 vm.c: fix typo
* vm.c (Init_VM): fix typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 14:01:39 +00:00
nobu e1c652bbaf vm.c: rb_typeddata_is_kind_of
* vm.c (rb_backtrace_p): use rb_typeddata_is_kind_of().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 14:01:37 +00:00
nobu a4a922e9bc vm_eval.c: fix types
* vm_eval.c (rb_backtrace_struct, backtreace_collect): use size_t
  instead of int to get rid of overflow.

* vm_eval.c (backtrace_object, vm_backtrace_each): ditto, use
  ptrdiff_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 14:01:34 +00:00
nobu 04a03b34c3 vm.c: suppress 64-to-32 warnings
* vm.c (backtrace_object): suppress 64-to-32 warnings.  should adjust
  types.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 09:51:20 +00:00
ko1 3dcebce523 * vm.c: add RubyVM::Backtrace object (btobj).
Backtrace information contains an array consists of location
  information for each frames by string.
  RubyVM::Backtrace object is lightweight backtrace information,
  which contains complete information to generate traditional style
  backtrace (an array of strings) with faster generation.
  If someone accesses to backtrace information via
  Exception#backtrace, then convert a RubyVM::Backtrace object to
  traditonal style backtrace.
  This change causes incompatibility on marshal dumpped binary
  of Exception.  If you have any trouble on it, please tell us
  before Ruby 2.0 release.
  Note that RubyVM::Backtrace object should not expose Ruby level.
* error.c, eval.c, vm_eval.c: ditto.
* internal.h: ditto.
* eval_error.c: fix to skip "set_backtrace" method invocation in
  creating an exception object if it call a normal set_backtrace
  method (defined by core).
* test/ruby/test_settracefunc.rb: fix for above change.
* vm_method.c (rb_method_defined_by): added.  This function
  checks that the given object responds with the given method
  by the given cfunc.
* benchmark/bm_vm2_raise1.rb, benchmark/bm_vm2_raise2.rb:
  add to measure exception creation speed. raise1 create
  exception objects from shallow stack frame.  raise2 create
  exception objects from deep stack frame.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 06:09:23 +00:00
ko1 8bcf7fc402 * vm_core.h: add a data type rb_location_t to store iseq location
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
2012-05-22 08:31:38 +00:00
nobu 3380974143 * parse.y (assoc, parser_yylex): add syntax to splat keyword hash.
[ruby-core:44591][Feature #6353]
* compile.c (compile_array_): generate keyword splat insns.
* vm.c (m_core_hash_merge_kwd): merge keyword hash into intermediate
  hash.  leftward argument is prior currently.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-28 21:12:05 +00:00
ko1 ee7f8d4805 * compile.c (compile_array, compile_array_):
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
2012-04-12 01:33:34 +00:00
nagachika 2910f6736e * cont.c (rb_fiber_reset_root_local_storage): add a new function to
restore rb_thread_t::local_storage.

* cont.c (rb_obj_is_fiber): add a new function to tell finalizer to
  prevent fibers from destroy.

* gc.c (rb_objspace_call_finalizer): don't sweep fibers at finalizing
  objspace.

* internal.h (rb_fiber_reset_root_local_storage, rb_obj_is_fiber):
  add prototypes.

* vm.c (ruby_vm_destruct): reset main thread's local_storage before
  free main thread. rb_thread_t::local_storage is replaced by fiber's
  local storage when forked from fiber, and it should be already freed
  when the fiber was destroyed.

* test/ruby/test_fiber.rb (test_fork_from_fiber): add test for fork
  from fiber.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-15 14:00:11 +00:00
nobu 04726dd749 * vm.c (rb_iter_break_value): new function to break a block with
the value.  [ruby-dev:45132] [Feature #5895]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-24 05:20:48 +00:00
naruse 587135e994 * vm.c (vm_exec): remove workaround for LLVM because r34278 fixes it.
* vm_insnhelper.c (vm_call_cfunc): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-20 08:39:24 +00:00
nobu 1aa408971f * test/ruby/test_enumerator.rb (test_nested_iteration): fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-10 07:13:04 +00:00
naruse 37b8092c3b * vm.c (vm_exec): refix r34162; suppress warning and add description.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-10 06:43:13 +00:00
naruse 56dc6f5acc * gc.c (ruby_mimmalloc): defined for objects need not rb_objspace,
but should return pointer suitable for ruby_xfree;
  main vm and main thread.
  patched by Sokolov Yura. https://github.com/ruby/ruby/pull/79

* internal.h: ditto.

* vm.c (Init_BareVM): use ruby_mimmalloc.

* ext/dl/cfunc.c: #include <ruby/util.h>.

* ext/syslog/syslog.c: use xfree because it is allocated by
  ruby_strdup.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-10 03:49:10 +00:00
naruse 88b16cebc8 * gc.c (rb_objspace_free): global_List is allocated with xmalloc.
patched by Sokolov Yura.  https://github.com/ruby/ruby/pull/78

* dln_find.c: remove useless replacement of free.

* ext/readline/readline.c (readline_attempted_completion_function):
  strings for readline must allocated with malloc.

* process.c (run_exec_dup2): use free; see also r20950.

* re.c (onig_new_with_source): use malloc for oniguruma.

* vm.c (ruby_vm_destruct): use free for VMs.

* vm.c (thread_free): use free for threads.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-08 21:02:08 +00:00
ktsj 519187a259 * vm.c: fix comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-02 08:28:05 +00:00
naruse 035e4949c5 * vm.c (vm_exec): add guard to prevent optimization for LLVM clang.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-30 22:25:13 +00:00
ngoto 8457bea9ab * vm.c (vm_define_method): improve guard of iseq from GC. Fix
failure or segmentation fault in test_singleton_method(TestGc)
  on sparc Solaris10 compiled with Oracle Solaris Studio 12.2.
  [Bug #5762] [ruby-dev:45000] [Bug #4178]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-18 09:58:31 +00:00
nobu 054dbe2a43 * vm.c (vm_set_top_stack, vm_set_eval_stack): check for stack
overflow with stack_max before push new frame. [ruby-core:41520]
  [Bug #5720]
* vm.c (vm_set_main_stack): no stack overflow chances after
  vm_set_eval_stack().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-07 09:56:01 +00:00
nobu b526738c3b * bignum.c (big_rshift), compile.c (validate_label,
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-12-05 09:57:00 +00:00
ktsj bc07265ceb * vm.c (rb_thread_mark), cont.c (cont_mark): self pointer should not
be marked by itself. Patch by Koichi Sasada.
  [ruby-dev:44567] [Bug #5386]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-01 23:48:48 +00:00
ktsj 91e190dbc2 * vm.c (rb_thread_mark): rb_thread_t needs self to be marked.
[ruby-dev:44566] [Bug #5386]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-01 15:47:42 +00:00
nobu 7db23668b0 * vm.c (rb_vm_get_sourceline): fix indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-15 02:40:39 +00:00
nobu bc2a1f2a98 * variable.c (rb_const_set): show the previous definition
location.  [EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-03 15:11:53 +00:00
ktsj 0971109e3d * vm.c (rb_vm_rewrite_dfp_in_errinfo): change return type
to suppress a warning.

* vm_core.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27 11:51:02 +00:00
ktsj a09e7139a3 * proc.c (proc_new): force to rewrite errinfo when calling Proc.new in ensure.
[Bug #5234] [ruby-core:39125]
  This code will be removed after changing throw mechanism (see r33064).

* vm.c (rb_vm_rewrite_dfp_in_errinfo): new function.

* vm.c (vm_make_env_each): changed accordingly.

* vm_core.h: ditto.

* bootstraptest/test_flow.rb: add tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27 09:59:48 +00:00
ko1 ef039de560 * vm.c (vm_make_env_each): work around to solve Bug #2729.
fixes: Bug #2729
  a patch from Kazuki Tsujimoto <kazuki@callcc.net>
  This problem is caused by changing dfp (dynamic env pointer)
  from saved dfp.  Saved dfp is pointed env in VM stack.  However,
  the dfp can be moved because VM copies env from VM stack to
  the heap.  At this copying, dfp was also changed.  To solve this
  problem, I'll try to change throw mechanism (not save target dfp,
  but save target cfp).
* bootstraptest/test_flow.rb: add a test for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-24 23:37:56 +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 7049d9c80d * iseq.h, iseq.c, compile.c: Change the line number data structure
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-08-24 06:31:15 +00:00
nobu 0dee7247a7 * vm.c (ruby_threadptr_data_type): rename to hide.
[ruby-core:38972]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-16 09:56:56 +00:00
naruse 027a15e958 * gc.c (init_heap): allocate sigaltstack after heaps are allocated.
[ruby-dev:44315] [Bug #5139]

* vm.c (thread_free): use free because objspace is not ready.

* vm.c (th_init): use malloc because objspace is not ready.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 13:08:45 +00:00
ktsj 3441301d7d * vm.c (check_env): print debug messages to stderr.
[Feature #4871] [ruby-dev:43743]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-31 14:11:37 +00:00
ktsj 172ac007f8 * vm.c (vm_make_env_each): don't save prev env value.
It is no longer used. [Feature #4871] [ruby-dev:43743]

* vm.c (check_env): changed accordingly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-31 14:00:57 +00:00