* eval_intern.h (PUSH_TAG): no argument now.

* eval.c, eval_error.h, eval_jump.h, eval_load.c, proc.c, thread.c:
  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-04-25 01:35:13 +00:00
parent 4134a542ba
commit 354844be45
8 changed files with 36 additions and 45 deletions

View File

@ -1,4 +1,9 @@
Wed Apr 25 10:33:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
Wed Apr 25 10:36:03 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval_intern.h (PUSH_TAG): no argument now.
* eval.c, eval_error.h, eval_jump.h, eval_load.c, proc.c, thread.c:
ditto.
* thread.c (alloc_event_fook, rb_thread_remove_event_hook): should
return value.

38
eval.c
View File

@ -84,7 +84,7 @@ ruby_init(void)
Init_yarv();
Init_heap();
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
rb_call_inits();
@ -112,7 +112,7 @@ ruby_options(int argc, char **argv)
int state;
Init_stack((void *)&state);
PUSH_THREAD_TAG();
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
ruby_process_options(argc, argv);
}
@ -120,13 +120,13 @@ ruby_options(int argc, char **argv)
rb_clear_trace_func();
exit(error_handle(state));
}
POP_THREAD_TAG();
POP_TAG();
}
static void
ruby_finalize_0(void)
{
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if (EXEC_TAG() == 0) {
rb_trap_exit();
}
@ -164,7 +164,7 @@ ruby_cleanup(int ex)
Init_stack((void *)&state);
ruby_finalize_0();
errs[0] = th->errinfo;
PUSH_THREAD_TAG();
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
rb_thread_terminate_all();
}
@ -174,7 +174,7 @@ ruby_cleanup(int ex)
th->errinfo = errs[1];
ex = error_handle(ex);
ruby_finalize_1();
POP_THREAD_TAG();
POP_TAG();
rb_thread_stop_timer_thread();
for (nerr = 0; nerr < sizeof(errs) / sizeof(errs[0]); ++nerr) {
@ -204,7 +204,7 @@ ruby_exec_internal(void)
{
int state;
VALUE val;
PUSH_TAG(0);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
GET_THREAD()->base_block = 0;
val = yarvcore_eval_parsed(ruby_eval_tree,
@ -306,7 +306,7 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int level)
}
if (TYPE(cmd) != T_STRING) {
PUSH_TAG(PROT_NONE);
PUSH_TAG();
rb_set_safe_level_force(level);
if ((state = EXEC_TAG()) == 0) {
val =
@ -322,7 +322,7 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int level)
return val;
}
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
val = eval(ruby_top_self, cmd, Qnil, 0, 0);
}
@ -687,7 +687,7 @@ rb_longjmp(int tag, VALUE mesg)
VALUE e = GET_THREAD()->errinfo;
int status;
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
e = rb_obj_as_string(e);
warn_printf("Exception `%s' at %s:%d - %s\n",
@ -1097,7 +1097,7 @@ rb_rescue2(VALUE (*b_proc) (ANYARGS), VALUE data1, VALUE (*r_proc) (ANYARGS),
volatile VALUE e_info = th->errinfo;
va_list args;
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
retry_entry:
result = (*b_proc) (data1);
@ -1120,7 +1120,7 @@ rb_rescue2(VALUE (*b_proc) (ANYARGS), VALUE data1, VALUE (*r_proc) (ANYARGS),
if (handle) {
if (r_proc) {
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
result = (*r_proc) (data2, th->errinfo);
}
@ -1163,11 +1163,11 @@ rb_protect(VALUE (*proc) (VALUE), VALUE data, int *state)
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
PUSH_THREAD_TAG();
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
result = (*proc) (data);
}
POP_THREAD_TAG();
POP_TAG();
if (state) {
*state = status;
@ -1186,7 +1186,7 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE
int state;
volatile VALUE result = Qnil;
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
result = (*b_proc) (data1);
}
@ -1210,7 +1210,7 @@ rb_with_disable_interrupt(VALUE (*proc)(ANYARGS), VALUE data)
int thr_critical = rb_thread_critical;
rb_thread_critical = Qtrue;
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
result = (*proc) (data);
}
@ -1232,7 +1232,7 @@ stack_check(void)
if (!overflowing && ruby_stack_check()) {
int state;
overflowing = 1;
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
rb_exc_raise(sysstack_error);
}
@ -1695,7 +1695,7 @@ eval(VALUE self, VALUE src, VALUE scope, char *file, int line)
line = ruby_sourceline;
}
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
rb_iseq_t *iseq;
VALUE iseqval;
@ -1861,7 +1861,7 @@ exec_under(VALUE (*func) (VALUE), VALUE under, VALUE self, VALUE args)
stored_cref = *pcref;
*pcref = th_cref_push(th, under, NOEX_PUBLIC);
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
val = (*func) (args);
}

View File

@ -74,7 +74,7 @@ error_print(void)
if (NIL_P(GET_THREAD()->errinfo))
return;
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if (EXEC_TAG() == 0) {
errat = get_backtrace(GET_THREAD()->errinfo);
}

View File

@ -131,24 +131,10 @@ char *strrchr _((const char *, const char));
#define TH_POP_TAG2() \
_th->tag = _tag.prev
#define PUSH_TAG(ptag) TH_PUSH_TAG(GET_THREAD())
#define PUSH_TAG() TH_PUSH_TAG(GET_THREAD())
#define POP_TAG() TH_POP_TAG()
#define POP_TAG_INIT() } while (0)
#define PUSH_THREAD_TAG() \
PUSH_TAG(PROT_THREAD)
#define POP_THREAD_TAG() \
POP_TAG()
#define PROT_NONE Qfalse /* 0 */
#define PROT_THREAD Qtrue /* 2 */
#define PROT_FUNC INT2FIX(0) /* 1 */
#define PROT_LOOP INT2FIX(1) /* 3 */
#define PROT_LAMBDA INT2FIX(2) /* 5 */
#define PROT_YIELD INT2FIX(3) /* 7 */
#define PROT_TOP INT2FIX(4) /* 9 */
#define TH_EXEC_TAG() \
(FLUSH_REGISTER_WINDOWS, ruby_setjmp(_th->tag->buf))

View File

@ -97,7 +97,7 @@ rb_f_catch(VALUE dmy, VALUE tag)
rb_thread_t *th = GET_THREAD();
tag = ID2SYM(rb_to_id(tag));
PUSH_TAG(tag);
PUSH_TAG();
th->tag->tag = tag;
@ -365,7 +365,7 @@ rb_exec_end_proc(void)
tmp_end_procs = link = ephemeral_end_procs;
ephemeral_end_procs = 0;
while (link) {
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
rb_set_safe_level_force(link->safe);
(*link->func) (link->data);
@ -383,7 +383,7 @@ rb_exec_end_proc(void)
tmp_end_procs = link = end_procs;
end_procs = 0;
while (link) {
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
rb_set_safe_level_force(link->safe);
(*link->func) (link->data);

View File

@ -172,7 +172,7 @@ rb_load(VALUE fname, int wrap)
rb_extend_object(th->top_self, th->top_wrapper);
}
PUSH_TAG(PROT_NONE);
PUSH_TAG();
state = EXEC_TAG();
if (state == 0) {
rb_load_internal(RSTRING_PTR(fname));
@ -201,11 +201,11 @@ rb_load_protect(VALUE fname, int wrap, int *state)
{
int status;
PUSH_THREAD_TAG();
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
rb_load(fname, wrap);
}
POP_THREAD_TAG();
POP_TAG();
if (state)
*state = status;
}
@ -384,7 +384,7 @@ rb_require_safe(VALUE fname, int safe)
} volatile saved;
char *volatile ftptr = 0;
PUSH_TAG(PROT_NONE);
PUSH_TAG();
saved.node = ruby_current_node;
saved.safe = rb_safe_level();
if ((state = EXEC_TAG()) == 0) {

2
proc.c
View File

@ -995,7 +995,7 @@ rb_method_call(int argc, VALUE *argv, VALUE method)
if (data->recv == Qundef) {
rb_raise(rb_eTypeError, "can't call unbound method; bind first");
}
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if (OBJ_TAINTED(method)) {
safe = rb_safe_level();
if (rb_safe_level() < 4) {

View File

@ -2375,7 +2375,7 @@ rb_exec_recursive(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE arg)
int state;
recursive_push(obj);
PUSH_TAG(PROT_NONE);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
result = (*func) (obj, arg, Qfalse);
}