Commit graph

962 commits

Author SHA1 Message Date
nobu
a1b9ce96e9 * eval.c (rb_eval): checks for interrupt, stack and finalizers too.
[ruby-dev:38208], [Bug #1329]

* eval.c (eval): replaces the message if frozen.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-30 03:12:08 +00:00
nobu
19d95e8982 * eval.c (proc_arity): fixed rdoc. [ruby-core:18708]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-16 06:33:04 +00:00
nobu
3b0bc50873 * eval.c (rb_thread_schedule): suppressed a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-16 06:31:37 +00:00
nobu
7e41cbbb49 * eval.c (stack_extend): suppressed a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-16 06:30:54 +00:00
matz
694d70cace * eval.c (rb_call0): should pass rest argument information even
when it's empty.  [ruby-dev:38117]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-13 16:14:40 +00:00
knu
5f7992aa35 * class.c (rb_singleton_class_clone): Qnil must be used for a null
class reference when we use NIL_P() to check class reference
  validity.  The bug was exposed by the spec test of Sequel.

* eval.c (ruby_init): Use NEW_CREF().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-28 18:12:15 +00:00
nobu
1bcfe8bb74 * eval.c (rb_eval): needs to guard intermediate string objects.
based on a patch from Brent Roman <brent AT mbari.org> at
  [ruby-core:22584].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-28 09:05:59 +00:00
usa
5a31cfc885 * eval.c (rb_thread_schedule): mswin32 doesn't have F_GETFD, so check
with another method.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-25 13:54:02 +00:00
akr
e509fb2c48 * eval.c (rb_thread_schedule): handle EBADF of select as well.
[ruby-core:21264]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 09:58:46 +00:00
knu
c23f894d30 * proc.c (Init_Proc): add '===' operator to use procs in when
clause of the case statement.  inspired by <http://www.aimred.com/news/developers/2008/08/14/unlocking_the_power_of_case_equality_proc/>.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-30 06:45:32 +00:00
nobu
e02ba9dc4a * eval.c (Init_Cont): separated from Init_Thread() since
rb_provide() must be after Init_Array().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-26 09:03:53 +00:00
nobu
2af5d793a8 * eval.c (Init_Thread): provides "continuation.so" for forward
compatibility.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-26 05:15:03 +00:00
nobu
fd73d45833 * eval.c (rb_thread_start_0): must use ruby_longjmp instead of
longjmp.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-12 04:40:48 +00:00
nobu
f1ef169861 * eval.c (TAG_THREAD): to start a new thread.
* eval.c (ruby_init, ruby_options, ruby_cleanup, rb_protect,
  rb_load_protect, rb_thread_start_0): make thread anchor.

* eval.c (proc_alloc): clone proc object if klass is not Proc or
  created in different thread.

* eval.c (rb_block_pass): call a function with a block.  [new]

* eval.c (rb_thread_start_0): restore prot_tag before rewinding.

* eval.c (rb_thread_start_0): update curr_thread before raising
  TAG_THREAD.  [ruby-dev:25712]

* eval.c (rb_thread_start_1): outer block variables wasn't linked to
  threads.  fixed: [ruby-dev:25700]

* eval.c (rb_thread_start_1): initialize newly pushed frame.
  fixed: [ruby-dev:25707]

* node.h (struct rb_thread): added anchor.  backported r7954,
  r7964, r7980, r7992, r8014 from trunk.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-09 06:20:20 +00:00
nobu
65153acec1 * eval.c (stack_extend): streamlined rb_thread_restore_context()
to ensure O(1) time.  based on a patch by Brent Roman <brent AT
  mbari.org>.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-06 09:34:55 +00:00
nobu
1a22daa462 * eval.c (cc_mark): frees the continuation's stack if its thread
is dead to avoid recursive gc that segfaults.  [ruby-core:13889]
  a patch by Brent Roman <brent AT mbari.org>.

* eval.c (rb_cont_check): checks for valid continuation instance.

* eval.c (rb_callcc): assigns th->thread before scope_dup() to
  avoid segfaults if this scope_dup() triggers a gc pass.
  a patch by Brent Roman <brent AT mbari.org>.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-06 04:39:20 +00:00
akr
bfabd0a798 * eval.c (rb_thread_schedule): Don't change status of threads which
don't run next even if select notify readability/writability.
  [ruby-core:20446]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-29 08:05:52 +00:00
nobu
fb34f6652a * eval.c (rb_yield_0): Qundef means no argument. [ruby-Bugs-22525]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-08 04:51:43 +00:00
nobu
e624b63367 * eval.c (yield_under): fixed initialization not being allowed in C90.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-16 01:02:41 +00:00
nobu
cafb29479e * eval.c (load_lock): makes circular require deadlock.
[ruby-core:19821]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-11 18:49:45 +00:00
nobu
0be023cb6e * eval.c (rb_feature_p): returns found feature name if loading.
[ruby-core:19798]

* eval.c (search_required): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-11 14:54:14 +00:00
nobu
37a720e038 * eval.c (rb_mod_modfunc): method undefined in included module
may not have nd_body.  [ruby-core:18738]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@19690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-05 14:06:02 +00:00
matz
98183a08c7 * dln.c: newer BeOS support. a patch from Pete Goodeve
<pete.goodeve at computer.org> in [ruby-core:18712].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@19424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-19 00:32:22 +00:00
knu
6db402c258 * hash.c (rb_hash_set_default_proc): Add Hash#default_proc=;
submitted by Giuseppe Bilotta.  #420

* eval.c (rb_obj_is_proc), intern.h: Export rb_obj_is_proc().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@18580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 09:24:48 +00:00
matz
c27c68b8db * class.c (clone_method): should copy cbase in cref as well.
[ruby-dev:35116]

* node.h (NEW_CREF): new NEW_ macro.

* eval.c (PUSH_CREF): use NEW_CREF().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@18485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-11 05:42:31 +00:00
nobu
363cad3261 * gc.c (STACK_LEVEL_MAX, ruby_stack_length): returns size_t.
[ruby-core:18207]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@18463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-09 23:56:17 +00:00
nobu
22af450ebc * eval.c (timeofday): use monotonic clock. based on a patch
from zimbatm <zimbatm@oree.ch> in [ruby-core:16627].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@18355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-04 06:04:57 +00:00
nobu
42ec1fa621 * eval.c (rb_thread_schedule): runs deferred finalizers.
* gc.c (gc_sweep): sets rb_thread_pending to run deferred finalizers.

* rubysig.h (CHECK_INTS): now checks rb_thread_pending even on
  platforms where setitimer is not available.  [ruby-core:18045]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@18319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-02 07:08:18 +00:00
nobu
db391b5d66 * eval.c (rb_thread_value): missed to change at r17874. [ruby-core:17595]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-05 04:09:49 +00:00
nobu
cdd1d98ef2 * eval.c (rb_thread_join): new API.
* ext/thread/thread.c (wait_mutex, lock_mutex): wait until the locking
  thread exits.  [ruby-dev:34856]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-04 11:31:35 +00:00
nobu
86c58b7813 * error.c (rb_exc_new3): keeps the given string itself.
* eval.c (Init_Proc), gc.c (Init_GC): freeze messages of preallocated
  special exceptions also.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-02 22:03:24 +00:00
nobu
a9d25a31ee * eval.c (rb_longjmp): duplicate the thrown exception to set backtrace
if it was frozen.  clear all raised flags.

* eval.c (stack_check): leave clearing flag to rb_longjmp.

* eval.c (rb_thread_set_raised, rb_thread_reset_raised): use generic
  flags.

* eval.c (Init_Proc), gc.c (Init_GC): freeze preallocated special exceptions.

* gc.c (rb_memerror): use thread raised flag instead of static flag,
  and raise nomem_error without backtrace if failed to make backtrace.
  [ruby-dev:34724]

* gc.c (ruby_xmalloc): increase malloc_increase only if malloc
  succeeds.  failed malloc size can be huge.  it may increase
  malloc_limit too big which cause less GC and memory full.
  (ruby_xrealloc): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-02 21:17:31 +00:00
nobu
bf67d8a89b * eval.c (PUSH_FRAME): suppress warnings.
* eval.c (arg_defined): constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-02 20:11:53 +00:00
akr
d85fc22700 * eval.c (rb_obj_respond_to): use RTEST to test the result of
respond_to? method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-28 15:14:30 +00:00
matz
4bbdc4c4d5 * eval.c (rb_call0): wrong condition to check insecure method.
a patch from Keita Yamaguchi <keita.yamaguchi at gmail.com>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-26 08:50:47 +00:00
knu
2e8b16b48b * eval.c (PUSH_FRAME, PUSH_CLASS): Add volatile to avoid a
possible optimization bug on OS X/PPC.  This at least makes
  build with gcc -O1 and `make test' pass.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-23 11:01:00 +00:00
nobu
397ee1a315 * eval.c (rb_thread_select), string.c (str_gsub): suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 04:40:40 +00:00
nobu
1378795e08 * suppress warnings with -Wwrite-string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 09:28:20 +00:00
knu
266be04a8d * eval.c (rb_mod_module_exec, Init_eval): Add
Module#{module_exec,class_exec}.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 07:03:21 +00:00
knu
42ef66d945 * eval.c (yield_under, yield_under_i, yield_args_under_i)
(specific_eval, rb_obj_instance_exec, Init_eval): Implement
  Object#instance_exec(), a 1.9 feature.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-26 01:13:53 +00:00
knu
258129588f * eval.c (Init_Thread): Initialize recursive_key.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24 18:13:33 +00:00
matz
f513d9ab28 * marshal.c (reentrant_check): check reentrance via callcc.
[ruby-dev:34802]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24 00:26:26 +00:00
knu
be5d23c22a * eval.c (rb_copy_node_scope), node.h: Rename from copy_node_scope
and export.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 15:49:42 +00:00
matz
255341597a * proc.c (proc_dup): should copy safe_level from src proc
properly.  a patch from Keita Yamaguchi
  <keita.yamaguchi at gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-21 20:50:16 +00:00
nobu
0590791d04 * eval.c (rb_get_method_body, rb_alias, rb_eval): should not cache
uninitialized value, since search_method doesn't set origin if the
  method wasn't found.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-21 14:31:47 +00:00
nobu
722ad8f214 * eval.c (search_method, remove_method, error_print, rb_alias)
(rb_eval, rb_rescue2, search_required, Init_eval, rb_thread_create),
  gc.c (rb_source_filename, Init_stack), io.c (rb_io_getline),
  parse.y (rb_id2name, rb_parser_free): suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-21 14:29:55 +00:00
matz
9193324a10 * eval.c (is_defined): add NODE_OP_ASGN_{OR,AND}. "defined?(a||=1)"
should not operate assignment.  [ruby-dev:34645]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-12 05:01:01 +00:00
kazu
5fed7fa349 * eval.c (method_name, method_owner): New methods; backported from 1.9. (UnboundMethod#name, UnboundMethod#owner)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-11 01:38:12 +00:00
knu
5f909db83b * class.c (struct clone_method_data): Add cref.
(clone_method): Properly handle NODE_BMETHOD and NODE_DMETHOD.
  (rb_singleton_class_clone, singleton_class_clone_int): Set a
  proper value to klass and propagate cref. [ruby-core:16238]

* eval.c (rb_block_dup, rb_method_dup), intern.h: Add duplicator
  methods for use from class.c#clone_method().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 10:52:56 +00:00
knu
f2323f8869 * eval.c (rb_yield_0, proc_invoke, proc_arity): allow passing a block
to a Proc.  [ruby-dev:23533]

* parse.y (block_par, block_var): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 10:37:13 +00:00