зеркало из https://github.com/github/ruby.git
mark_end_proc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
ebab487fcd
Коммит
2b49047143
22
eval.c
22
eval.c
|
@ -5232,10 +5232,20 @@ rb_set_end_proc(func, data)
|
|||
link->next = end_proc_data;
|
||||
link->func = func;
|
||||
link->data = data;
|
||||
rb_global_variable(&link->data);
|
||||
end_proc_data = link;
|
||||
}
|
||||
|
||||
void
|
||||
rb_mark_end_proc()
|
||||
{
|
||||
struct end_proc_data *link = end_proc_data;
|
||||
|
||||
while (link) {
|
||||
rb_gc_mark(link->data);
|
||||
link = link->next;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
call_end_proc(data)
|
||||
VALUE data;
|
||||
|
@ -5266,17 +5276,15 @@ rb_f_at_exit()
|
|||
void
|
||||
rb_exec_end_proc()
|
||||
{
|
||||
struct end_proc_data *link = end_proc_data;
|
||||
struct end_proc_data *tmp;
|
||||
struct end_proc_data *link;
|
||||
int status;
|
||||
|
||||
while (link) {
|
||||
while (end_proc_data) {
|
||||
link = end_proc_data;
|
||||
end_proc_data = link->next;
|
||||
rb_protect((VALUE(*)())link->func, link->data, &status);
|
||||
tmp = link->next;
|
||||
free(link);
|
||||
link = tmp;
|
||||
}
|
||||
end_proc_data = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
17
gc.c
17
gc.c
|
@ -893,6 +893,10 @@ rb_gc()
|
|||
jmp_buf save_regs_gc_mark;
|
||||
#ifdef C_ALLOCA
|
||||
VALUE stack_end;
|
||||
alloca(0);
|
||||
# define STACK_END (&stack_end)
|
||||
#else
|
||||
# define STACK_END alloca(1)
|
||||
#endif
|
||||
|
||||
alloc_objects = 0;
|
||||
|
@ -901,10 +905,6 @@ rb_gc()
|
|||
if (during_gc) return;
|
||||
during_gc++;
|
||||
|
||||
#ifdef C_ALLOCA
|
||||
alloca(0);
|
||||
#endif
|
||||
|
||||
/* mark frame stack */
|
||||
for (frame = ruby_frame; frame; frame = frame->prev) {
|
||||
rb_gc_mark_frame(frame);
|
||||
|
@ -924,18 +924,14 @@ rb_gc()
|
|||
/* This assumes that all registers are saved into the jmp_buf */
|
||||
setjmp(save_regs_gc_mark);
|
||||
mark_locations_array((VALUE*)save_regs_gc_mark, sizeof(save_regs_gc_mark) / sizeof(VALUE *));
|
||||
#ifdef C_ALLOCA
|
||||
rb_gc_mark_locations(rb_gc_stack_start, (VALUE*)&stack_end);
|
||||
#else
|
||||
rb_gc_mark_locations(rb_gc_stack_start, (VALUE*)alloca(1));
|
||||
#endif
|
||||
rb_gc_mark_locations(rb_gc_stack_start, (VALUE*)STACK_END);
|
||||
#if defined(THINK_C) || defined(__human68k__)
|
||||
#ifndef __human68k__
|
||||
mark_locations_array((VALUE*)((char*)save_regs_gc_mark+2),
|
||||
sizeof(save_regs_gc_mark) / sizeof(VALUE *));
|
||||
#endif
|
||||
rb_gc_mark_locations((VALUE*)((char*)rb_gc_stack_start + 2),
|
||||
(VALUE*)((char*)&stack_end + 2));
|
||||
(VALUE*)((char*)STACK_END + 2));
|
||||
#endif
|
||||
rb_gc_mark_threads();
|
||||
|
||||
|
@ -943,6 +939,7 @@ rb_gc()
|
|||
for (list = Global_List; list; list = list->next) {
|
||||
rb_gc_mark(*list->varptr);
|
||||
}
|
||||
rb_mark_end_proc();
|
||||
rb_gc_mark_global_tbl();
|
||||
|
||||
rb_mark_tbl(rb_class_tbl);
|
||||
|
|
1
intern.h
1
intern.h
|
@ -121,6 +121,7 @@ VALUE rb_f_lambda _((void));
|
|||
VALUE rb_protect _((VALUE (*)(), VALUE, int*));
|
||||
void rb_set_end_proc _((void (*)(), VALUE));
|
||||
void rb_exec_end_proc _((void));
|
||||
void rb_mark_end_proc _((void));
|
||||
void rb_gc_mark_threads _((void));
|
||||
void rb_thread_start_timer _((void));
|
||||
void rb_thread_stop_timer _((void));
|
||||
|
|
|
@ -663,7 +663,6 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||
"return"
|
||||
"then"
|
||||
"throw"
|
||||
"self"
|
||||
"super"
|
||||
"unless"
|
||||
"undef"
|
||||
|
@ -675,8 +674,8 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||
"\\)\\>[^_]")
|
||||
2)
|
||||
;; variables
|
||||
'("\\b\\(nil\\|self\\|true\\|false\\)\\b"
|
||||
1 font-lock-variable-name-face)
|
||||
'("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\b[^_]"
|
||||
2 font-lock-variable-name-face)
|
||||
;; variables
|
||||
'("[$@].\\(\\w\\|_\\)*"
|
||||
0 font-lock-variable-name-face)
|
||||
|
|
Загрузка…
Ссылка в новой задаче