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

1183 Коммитов

Автор SHA1 Сообщение Дата
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
shugo 3dd941b234 * include/ruby/ruby.h, eval.c, vm_insnhelper.c: fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-06 05:55:19 +00:00
ktsj ede1223028 * eval.c (rb_mod_refine): fix documentation.
Module#refine does not return self, but module.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-02 14:38:48 +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
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
yugui 64ef091a64 Reverts a half of r36079. As we discussed on ruby-dev@ and IRC,
we do not need to disclose intermediate representation of program.
The program embedding CRuby should use rb_eval_string family.
* include/ruby/ruby.h (ruby_opaque_t): removed.
  (ruby_compile_main_from_file, ruby_compile_main_from_string,
   ruby_eval_main): removed.

* eval.c (ruby_eval_main_internal): became ruby_exec_internal() again.
  (ruby_eval_main): removed.

* ruby.c (PREPARE_PARSE_MAIN) reverted.
  (parse_and_compile_main, ruby_compile_main_from_file,
   ruby_compile_main_from_string): removed

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-11 03:25:16 +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
nobu 8ddbbb3324 Module#prepend
* class.c (rb_prepend_module): prepend module into another module.
* eval.c (rb_mod_prepend): new method Module#prepend.  [Feature #1102]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-27 07:48:50 +00:00
nobu 82a408fb9d Revert r31873 Module#mix
* class.c (rb_mix_module): revert Module#mix.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-25 08:49:32 +00:00
drbrain 62df750a4b * eval.c (ruby_cleanup): Fixed typo. Patch by Trever Dawe.
Fixes #131 (github).  [ruby-trunk - Bug #6619]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21 20:56:23 +00:00
nobu 07784c78b9 eval.c: move running
* eval.c (ruby_setup): set running state in the normal case before
  popping a tag.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-16 09:31:50 +00:00
nobu 207c58b518 eval.c: set nil if nothing done
* eval.c (ruby_eval_main_internal): set nil to the result if nothing
  executed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-14 03:03:52 +00:00
nobu 073297789a fix r36079
* include/ruby/ruby.h: public symbols must have default visibility.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-14 03:03:48 +00:00
yugui 8c9a453f2d Embedding CRuby interpreter without internal headers has been difficult
for few years because:
* NODE is no longer accessible.
* rb_iseq_eval_main crashes without preparing with rb_thread_t.
* some existing APIs calls exit(3) without giving the opportunity to
  finalize or handle errors to the client.
* No general-purpose function to compile a source to an iseq are
  published in the public headers.

This commit solves the problems.

	* include/ruby/ruby.h: Grouped APIs for embedding CRuby interpreter.
	  (ruby_setup, ruby_compile_main_from_file,
	  ruby_compile_main_from_string, ruby_eval_main,
	  ruby_set_script_name): new APIs to embed CRuby.
	  (ruby_opaque_t) Opaque pointer to an internal data, to NODE or iseq
	  in particular.

	* eval.c (ruby_setup): Similar to ruby_init but returns an error code
	  instead of exit(3) on error.
	  (ruby_eval_main): Similar to ruby_exec_node but returns the
	  evaluation result.
	  (ruby_eval_main_internal): renamed from ruby_exec_internal.

	* ruby.c (toplevel_context): new helper function.
	  (PREPARE_EVAL_MAIN): moved.
	  (process_options): refactored with new functions.
	  (parse_and_compile_main) new helper funciton.
	  (ruby_compile_main_from_file, ruby_compile_main_from_string) new API
	  (ruby_set_script_name): new API.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-14 02:22:08 +00:00
yugui f8601bd903 * eval.c: Add doxygen comments.
* ruby.c: ditto.

* thread_pthread.c: ditto

* version.c: ditto.

* vm_core.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-14 02:21:51 +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 06513cc1cf * vm_insnhelper.h: remove magical code "lfp[0] & 0x02".
Current VM doesn't use this bit.
* vm_core.h (RUBY_VM_GET_BLOCK_PTR): added.
* eval.c (rb_block_given_p): use RUBY_VM_GET_BLOCK_PTR().
* vm_eval.c (rb_f_block_given_p): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 07:24:44 +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
nobu b0dd250dc9 use RB_TYPE_P() instead of comparison of TYPE()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-23 07:13:21 +00:00
drbrain e95f7ea80d * variable.c (trace_ev): Removed "not reached" comment as this line is
reached.
* variable.c (rb_obj_remove_instance_variable):  Replaced "not reached"
  comment with the UNREACHABLE macro.
* variable.c (rb_mod_const_missing):  ditto.
* variable.c (rb_mod_remove_cvar):  ditto.
* enum.c (first_i):  ditto.
* string.c (rb_str_aref):  ditto.
* string.c (str_byte_aref):  ditto.
* string.c (rb_to_id):  ditto.
* io.c (rb_io_fmode_modestr):  ditto.
* io.c (rb_io_oflags_modestr):  ditto.
* pack.c (num2i32):  ditto.
* vm_eval.c (rb_method_missing):  ditto.
* vm_eval.c (rb_f_throw):  ditto.
* dir.c (dir_read):  ditto.
* win32/win32.c (child_result):  ditto.
* struct.c (rb_struct_getmember):  ditto.
* struct.c (rb_struct_set):  ditto.
* struct.c (rb_struct_aref_id):  ditto.
* eval.c (rb_f_raise):  ditto.
* process.c (rb_f_exit_bang):  ditto.
* process.c (rb_f_exit):  ditto.
* process.c (rb_f_abort):  ditto.
* ext/-test-/iter/break.c (iter_break_value):  ditto.
* ext/pty/pty.c (pty_check):  ditto.
* ext/openssl/ossl_pkey.c (ossl_pkey_new):  ditto.
* ext/readline/readline.c (rb_remove_history):  ditto.
* ext/stringio/stringio.c (strio_unimpl):  ditto.
* numeric.c (num_sadded):  ditto.
* numeric.c (num_init_copy):  ditto.
* numeric.c (rb_num2ll):  ditto.
* numeric.c (rb_num2ull):  ditto.
* vm_insnhelper.c (call_cfunc):  ditto.
* ruby.c (opt_W_getter):  ditto.
* bignum.c (rb_big_coerce):  ditto.
* file.c (rb_f_test):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14 00:36:26 +00:00
marcandre 7316302483 * include/ruby/intern.h: Add rb_check_arity, rb_error_arity [#6085]
* 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 21:10:34 +00:00
marcandre dea6efb5de * eval.c: Improve rdoc for Module.constants [issue #5887]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-12 16:37:03 +00:00
nobu 8e6e8e6288 * use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:07:45 +00:00
kosaki 74b339e938 * thread_pthread.c (rb_thread_create_timer_thread): removed
rb_disable_interrupt()/rb_enable_interrupt().
* vm_core.h: ditto.
* process.c (static void before_exec): ditto.
* process.c (static void after_exec): ditto.
  [Bug #4765] [ruby-dev:43571]

* eval_intern.h: removed rb_trap_restore_mask().
* vm_eval.c (rb_throw_obj): ditto.
* eval.c (setup_exception): ditto.

* signal.c: removed trap_last_mask.
* signal.c (trap_restore_mask): removed.
* signal.c (init_sigchld): comment clarification why signal block
  is needed. and removed trap_last_mask operation.
* signal.c (trap_ensure): removed trap_last_mask operation.

* signal.c (rb_disable_interrupt, rb_enable_interrupt): made
  static and removed sigdelset(SIGVTALARM) and sigdelset(SIGSEGV).

* process.c (rb_syswait): removed implicit signal handler change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-10 17:04:40 +00:00
kosaki 8741274529 * thread.c (thread_unlock_all_locking_mutexes): rename to
rb_threadptr_unlock_all_locking_mutexes and remove static.
* vm_core.h: add rb_threadptr_unlock_all_locking_mutexes declaration.
* thread.c (thread_start_func_2): adjust the above rename.

* eval.c (ruby_cleanup): call rb_threadptr_unlock_all_locking_mutexes
  again after finalizer. [Bug #4988] [ruby-dev:44049]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-08 04:40:01 +00:00
ko1 d1d5d5e798 * thread_pthread.c: Stop polling in the timer thread when there are
no waiting thread.  If there are 2 or more runnable threads,
  the timer thread does polling.  Avoid polling makes power save
  for several computers (0.2W per a Ruby process, when I measured).
  If outside-event such as signal or Thread#kill was occuerred
  when the timer thread does not do polling, then wake-up
  the timer thread using communication-pipe (the timer thread
  waits this communication-pipe with select(2)).
  The discussion about this modification can be found from the post
  [ruby-core:33456] and other related posts.
  Note that Eric Wong and KOSAKI Motohiro give us the huge
  contributions for this modification.  Thanks.
* thread_pthread.c (rb_thread_wakeup_timer_thread): add a function.
  This function wakes up the timer thread using communication-pipe.
* thread.c (rb_thread_stop_timer_thread): add a parameter which
  specify closing communication-pipe or not.
* thread.c (rb_thread_terminate_all): do not stop timer thread here
  (ruby_cleanup() terminate timer thread).
* signal.c: wake up timer thread using
  rb_thread_wakeup_timer_thread() from signal handler.
* eval.c (ruby_cleanup): use rb_thread_stop_timer_thread(1).
* process.c: use rb_thread_stop_timer_thread(0)
  (reuse communication-pipe).
* thread_win32.c (rb_thread_wakeup_timer_thread): add a dummy
  function.
* vm_core.h: add and fix decl. of functions.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-27 00:30:41 +00:00
akr 5ed8c08aa0 * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
declare internal functions.

* internal.h, vm_core.h: declare internal functions.

* array.c: include internal.h.

* common.mk: update dependency for array.o.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 08:26:19 +00:00
akr 7da3ea811e * method.h, internal.h iseq.h: declare internal functions.
* 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-18 03:49:33 +00:00
akr afd7e4668f * internal.h: declare more internal functions.
* iseq.h (rb_method_get_iseq): declared.

* compile.c, eval.c, eval_error.c, iseq.c, parse.y, proc.c, range.c,
  ruby.c, time.c, util.c, vm.c: don't declare internal functions.

* eval.c, parse.y, thread_pthread.c: non-existing function declarations
  removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 01:54:57 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

* iseq.h: declare rb_iseq_t dependent internal functions here.

* vm_core.h: declare rb_thread_t dependent internal functions here.

* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
  iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
  proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
  thread.c, time.c, transcode.c, variable.c, vm.c,
  tool/compile_prelude.rb: don't declare internal functions declared
  in above headers.  include above headers if required.

  Note that rb_thread_mark() was declared as
  void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
  void rb_thread_mark(void *ptr) in vm.c.  Now it is declared as
  the later in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
kosaki ecaf7975cd * eval.c: remove rb_thread_stop_timer_thread function declaration.
Instead, include vm_core.h.
* process.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-05 14:35:09 +00:00
nobu 604fe33b44 * class.c (rb_mix_module): implement Module#mix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-31 16:16:06 +00:00
nobu 2082417a48 * eval.c (setup_exception): internal exception should be hidden
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 13:36:46 +00:00
nagachika 6410a4ae27 * eval.c (frame_func_id): store result of method_entry_of_iseq() to
cfp->me because method_entry_of_iseq() might become expensive.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-05 08:39:22 +00:00
nagachika 5358a5c016 * eval.c (frame_func_id): __method__ return different name from
methods defined by Module#define_method with a same block.
    [ruby-core:35386] fixes #4606
  * eval (method_entry_of_iseq): new helper function. search control
    frame stack for a method entry which has given iseq.
  * test/ruby/test_method.rb: add tests for #4696

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-05 06:32:37 +00:00
shugo e3d7e34e7e * eval.c (rb_mod_s_constants): should ignore crefs with
the NODE_FL_CREF_PUSHED_BY_EVAL flag.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-31 05:54:34 +00:00
nobu 4acc61313f * vm.c (ruby_vm_destruct): run vm exit hooks after all objects are
destructed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-24 13:51:59 +00:00
nobu 96c078c340 * eval.c (ruby_cleanup): use rb_ary_free to free internal object.
* gc.h (RUBY_FREE_UNLESS_NULL): get rid of double free.
  [ruby-core:35192]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-11 10:45:34 +00:00
nobu cd13326a62 * eval.c (ruby_cleanup): fix type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 21:45:49 +00:00
shyouhei 7911d42f1b * NEWS: entry for ruby_vm_at_exit().
* eval.c (ruby_cleanup): bug fix around at_exit (1) timing was
  wrong. (2) execution order was opposite.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 14:58:41 +00:00
shyouhei 51da92ea12 * vm.c (ruby_vm_at_exit): new API. This enables extension libs to
hook a VM termination.  Right now, because the VM we have is
	  process global, most extensions do not deallocate resources and
	  leave them to Operating System's reaping userland processes.  But
	  in a future we plan to have multiple VMs to run simultaneously in
	  a single process (MVM project).  At that stage we can no longer
	  rely on OSes and have to manage every resources to be reclaimed
	  properly.  So it is.  For a forward-compatibility reason this API
	  is introduced now, encouraging you to be as gentle as you can for
	  your resources; that is, tidy up your room.

	* include/ruby/vm.h: ditto.

	* vm_core.h (rb_vm_struct): new field.

	* vm.c (vm_init2): initialize above new field.

	* eval.c (ruby_cleanup): trigger those hooks.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 11:06:32 +00:00
nobu a2c4b890be * eval.c (ruby_cleanup): free current VM and its objspace even
when exiting by SystemExit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-31 13:24:19 +00:00
nobu 0f36e8fc03 * eval.c (frame_func_id), vm_eval.c (rb_iterate),
vm_insnhelper.c (vm_yield_with_cfunc): as the name of a C-level
  block, use the current method ID at the creation point.
  [ruby-dev:41852]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-14 11:23:10 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
mame 0ee8d28e9e * eval.c (setup_exception): let SystemStackError#backtrace return an
single element array instead of string itself.  [ruby-core:30196]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-16 13:20:58 +00:00
marcandre 478c3e080b * eval.c (make_exception, rb_obj_extend): Fix error messages in case of wrong
number of arguments

* file.c (rb_f_test, rb_file_s_umask): ditto

* numeric.c (int_chr, num_step): ditto

* process.c (rb_f_sleep): ditto

* re.c (rb_reg_initialize_m): ditto

* signal.c (rb_f_kill, sig_trap): ditto

* string.c (rb_str_aref_m, rb_str_aset_m, rb_str_count, rb_str_delete_bang,
  rb_str_slice_bang, rb_str_sub_bang, str_gsub): ditto

* proc.c (curry): rdoc fix

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 02:40:57 +00:00
mame f93e39261c * eval.c (ruby_cleanup): add exception guard around code running
signal handler (of r27513).  Absence of the guard made
  bootstraptest/test_thread.rb fail sometimes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-27 15:00:41 +00:00
mame 4af243a8af * eval.c (ruby_cleanup): before cleanup, check signal buffer and run
handler if any.  [ruby-core:20970]

* thread.c (rb_threadptr_check_signal): separeted from
  timer_thread_function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-27 12:27:13 +00:00
mame 6bec06674c * eval.c (setup_exception): avoid line number 0 when setting
$DEBUG=true.  [ruby-dev:39116]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-04 13:54:13 +00:00
mame f53d825447 * cont.c, vm_core.h, eval.c: because rb_protect must not be jumped by
callcc, revert r26407.  And rename trap_tag to protect_tag and
  change exception message (across trap -> across stack rewinding
  barrier).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-25 18:22:58 +00:00