Commit graph

962 commits

Author SHA1 Message Date
matz
0007c24a5c * eval.c (THREAD_SAVE_CONTEXT): remove unnecessary
FLUSH_REGISTER_WINDOWS before calling setjmp().  [ruby-core:16285]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-24 08:07:42 +00:00
knu
afc2d9e389 * eval.c (bind_eval): Add Binding#eval, a shorthand method for
eval(str, binding, ..); backported from 1.9.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-23 06:44:56 +00:00
akr
168e2a279d * eval.c (error_print): show full stack grace except SystemStackError.
backport from 1.9.  [ruby-dev:31014]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-22 15:44:40 +00:00
knu
bc3ce4588d * eval.c (rb_proc_new, YIELD_FUNC_LAMBDA): Add a new nd_state
YIELD_FUNC_LAMBDA which avoids automatic `avalue' conversion for
  arguments.  This fixes a bug where [1,[2,3]].map(&:object_id)
  fails.

* intern.h, object.c: Hide rb_proc_new() from intern.h.  It should
  not be considered an official API function yet.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-22 13:51:44 +00:00
knu
a2b186bee4 * eval.c (rb_proc_new): Turn the BLOCK_LAMBDA flag on.
* object.c (sym_to_proc), test/ruby/test_symbol.rb: Add back
  Symbol#to_proc, now that it passes the tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-22 12:42:57 +00:00
knu
5391877f53 * eval.c (rb_f_method_name): New gloval function: __method__;
backported from matzruby / 1.9.

* eval.c (rb_frame_this_func), intern.h: New internal function.

* intern.h (RETURN_ENUMERATOR): Use rb_frame_this_func() instead
  of rb_frame_last_func(), to accommodate the behavior to that of
  1.9.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-21 08:20:52 +00:00
knu
932ac5d35d * eval.c (rb_exec_recursive): New internal function to help
perform recursive operation; backported from 1.9.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-19 10:29:59 +00:00
kazu
3be6ebc5ce * eval.c (method_receiver, method_name, method_owner): New
methods; backported from 1.9. bug#19007


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-15 10:07:59 +00:00
knu
badb865567 * enumerator.c (rb_eStopIteration), eval.c (rb_f_loop), ruby.h:
Add a new exception class StopIteration, which breaks Kernel#loop
  iteration when raised; backported from 1.9.

* enumerator.c (enumerator_next, enumerator_rewind): Implement
  #next and #rewind using the "generator" library.

* lib/generator.rb: Implement Enumerable::Enumerator#next and
  #rewind.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-10 10:52:50 +00:00
knu
e6de1a384e * eval.c (rb_obj_method, rb_proc_call), intern.h: Export.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-09 10:47:13 +00:00
matz
7bd34cdb70 * eval.c (EXEC_TAG): remove unnecessary FLUSH_REGISTER_WINDOWS for
better performance on SPARC.  [ruby-core:16159]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-08 02:13:25 +00:00
nobu
ba570c7378 * configure.in (RUBY_SETJMP, RUBY_LONGJMP, RUBY_JMP_BUF): prefers
__builtin_setjmp, _setjmp over setjmp and sigsetjmp.
  [ruby-core:16023], [ruby-core:16086]

* configure.in (--with-setjmp-type): new option to override the
  default rule in the above.

* eval.c (ruby_setjmp, ruby_longjmp), gc.c (rb_setjmp),
  node.h (rb_jmpbuf_t): use RUBY_SETJMP, RUBY_LONGJMP and
  RUBY_JMP_BUF.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-31 17:58:14 +00:00
knu
058c981311 * eval.c (rb_eval): Call trace hook for if expression after the
condition has been evaluated, not before; submitted by Rocky
  Bernstein in #18722.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-24 11:09:51 +00:00
nobu
6017f19422 * eval.c (rb_call0): yields the last executed node line number at
return event.  [ruby-core:15855]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-12 15:37:22 +00:00
nobu
9041dfdefc * eval.c, gc.c (setjmp): sigsetjmp is a macro on cygwin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-21 03:50:14 +00:00
nobu
475449aa18 * configure.in (sigsetjmp): check if available.
* eval.c, gc.c (setjmp): do not use _setjmp if sigsetjmp is available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-19 02:21:55 +00:00
nobu
5dd6a853ed * eval.c (eval): check if backtrace is empty. [ruby-core:15040]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-14 18:41:44 +00:00
nobu
0d7451ba82 * eval.c (rb_define_alloc_func, rb_undef_alloc_func): should
define/undef on a signleton class.  [ruby-core:09959]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-12 09:27:48 +00:00
nobu
a953db445d * eval.c (error_print): put newline unless multiple line message ends
with a newline.  [ruby-dev:32429]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@14086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-02 13:43:47 +00:00
nobu
58721916bc * eval.c (rb_alias): do not call hook functions until initialization
finishes.  [ruby-talk:279538]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-18 05:03:50 +00:00
matz
ac7497416d * eval.c (remove_method): should not remove undef place holder.
[ruby-dev:31817]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-01 13:44:21 +00:00
nobu
02da16b167 * eval.c, intern.h, ext/thread/thread.c: should not free queue while
any live threads are waiting.  [ruby-dev:30653]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-20 18:05:40 +00:00
matz
9a19613e43 * eval.c (mnew): should preserve noex as safe_level.
* eval.c (rb_call0): tighten security check condition..

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-20 08:28:04 +00:00
nobu
f47618f89b * eval_error.ci (get_backtrace): check the result more.
[ruby-dev:31261] [ruby-bugs-12398]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-19 10:24:17 +00:00
nobu
b6ddf55de9 * eval.c (rb_interrupt): suppress a gcc's officious warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-06 06:22:59 +00:00
nobu
2edae81a18 * eval.c (ruby_cleanup): return EXIT_FAILURE if any exceptions occured
in at_exit blocks.  [ruby-core:11263]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-18 04:52:59 +00:00
nobu
93e93af5c0 * eval.c (rb_kill_thread): renamed in order to get rid of conflict
with a BeOS system function.  [ruby-core:10830]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-12 20:46:23 +00:00
nobu
22b9c0a4db * eval.c (rb_eval): get rid of SEGV at ZSUPER in a block
[ruby-dev:30836]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-29 20:16:35 +00:00
nobu
390d25f0f5 * eval.c (thread_timer): timer thread should not receive any signals.
submitted by Sylvain Joyeux.  [ruby-core:08546]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-29 19:28:25 +00:00
nobu
d6836ad5e1 * eval.c (rb_eval_cmd): just return if no exceptions.
[ruby-dev:30820]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-29 19:17:18 +00:00
nobu
73909f8e6d * eval.c (rb_thread_priority): rdoc fix; the initial value is
inherited from the creating thread.  [ruby-core:10607]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-10 01:13:11 +00:00
nobu
47807a7b44 * eval.c (ruby_cleanup): inversed the order of errinfos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-20 03:16:21 +00:00
matz
874a344ed6 * eval.c (rb_yield_0): should not clear state on TAG_NEXT when
it's invoked from within lambda body.  [ruby-talk:248136]

* eval.c (proc_invoke): handle TAG_NEXT which would be caused by
  next in the lambda body as well.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-17 07:47:59 +00:00
nobu
d33cc535c3 * node.h (struct rb_thread.locals): explicit as struct.
[ruby-core:10585]

* eval.c, node.h (enum rb_thread_status, struct rb_thread,
  rb_curr_thread, rb_main_thread): prefixed.  [ruby-core:10586]

* file.c (chompdirsep): made an unprefixed name static.

* io.c (io_fread): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-24 14:40:08 +00:00
nobu
2898d5c5a8 * eval.c (ruby_cleanup): exit by SystemExit and SignalException in END
block.  [ruby-core:10609]

* test/ruby/test_beginendblock.rb (test_should_propagate_exit_code):
  test for exit in END block.  [ruby-core:10760]

* test/ruby/test_beginendblock.rb (test_should_propagate_signaled):
  test for signal in END block.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-23 16:53:42 +00:00
nobu
a8ba0adb5c * eval.c (rb_provided): check for extension library if SOEXT is
explicitly given.  [ruby-dev:30657]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-22 14:12:56 +00:00
nobu
409be50fe1 * eval.c (error_handle): no message when exiting by signal.
* eval.c (ruby_cleanup): re-send signal.  [ruby-dev:30516]

* eval.c (rb_thread_interrupt): instantiate SignalException.

* eval.c (rb_thread_signal_raise): now takes signal number instead
  of signal name.

* intern.h (rb_thread_signal_raise, ruby_default_signal): prototypes.

* signal.c (esignal_init): takes a signal number and an optional
  signal name.

* signal.c (interrupt_init): pass SIGINT always.

* signal.c (ruby_default_signal): invoke system default signal
  handler.

* signal.c (rb_signal_exec, trap): handle SIGTERM.  [ruby-dev:30505]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-11 03:09:30 +00:00
knu
44a1d06e1a * eval.c (stack_check): Unset inline to fix build with GCC 3.4.6;
submitted by: NISHIMATSU Takeshi <t_nissie AT yahoo.co.jp> in
  [ruby-list:43218].
  cf. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24556


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-03 12:40:29 +00:00
knu
deeafa0e17 * env.h (SCOPE_CLONE): Introduce a new scope flag to prevent a
local_tbl region from getting freed many times; submitted by
  Chikanaga Tomoyuki <chikanag AT nippon-control-system.co.jp> in
  [ruby-dev:30460].

* eval.c (proc_invoke): Ditto.

* gc.c (obj_free): Ditto.

* parse.y (top_local_setup_gen): Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-03 07:28:54 +00:00
nobu
51f9355bd6 * eval.c (rb_feature_p): fix possible buffer overrun.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-28 23:55:34 +00:00
nobu
5093a9eff1 * eval.c (rb_feature_p): check loading_tbl if the given ext is
empty.  [ruby-dev:30452]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-28 23:53:02 +00:00
nobu
d8ecc168f1 * eval.c (rb_provided): return true only for features loaded from
.rb files, and not search actual library type.  [ruby-dev:30414]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-28 15:09:37 +00:00
knu
e7b39d9d4f * configure.in, defines.h, eval.c (rb_feature_p, rb_provided,
load_wait, search_required, rb_require_safe), ext/extmk.rb: Fix
  a bug where a statically linked extension cannot be autoloaded.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-19 09:27:12 +00:00
matz
ff46ec3a43 * eval.c (rb_iterate): need to PUSH_ITER in proper order.
[ruby-core:10125]

* test/ruby/test_iterator.rb (TestIterator::test_block_given_within_iterator):
  add new test.  [ruby-core:10125]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-31 05:59:23 +00:00
matz
e43d14725f * parse.y (dyna_var_lookup): should not alter dvar->val not to
destroy living value.  [ruby-core:10076]

* parse.y (dyna_init): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-27 14:25:02 +00:00
nobu
bb949fd267 * eval.c (ruby_cleanup): keep the exception till after END blocks.
[ruby-core:09675]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-09 12:40:17 +00:00
matz
61634cee5f * eval.c (rb_mod_define_method): set implicit visibility only when
it's called for the target class (ruby_cbase).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-11-24 01:23:50 +00:00
matz
3a77579adc * eval.c (BEGIN_CALLARGS): ruby_block may be NULL even when
ITER_PRE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-11-08 18:17:46 +00:00
usa
8c61368971 * eval.c (rb_call0): fixed bug of zsuper with both of opt and rest.
fixed: [ruby-list:42928]

* test/ruby/test_super.rb: add tests to check above bug.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-31 16:10:22 +00:00
matz
0d4f83264f * eval.c (rb_call): check protected visibility based on real self,
not ruby_frame->self.  [ruby-talk:217822]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-04 08:38:23 +00:00