1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* cont.c: check across trap violation.

* eval.c, yarvcore.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-05-24 03:08:13 +00:00
parent 7d200b94f9
commit e4aa7208e5
4 changed files with 19 additions and 2 deletions

View file

@ -1,3 +1,9 @@
Thu May 24 12:07:27 2007 Koichi Sasada <ko1@atdot.net>
* cont.c: check across trap violation.
* eval.c, yarvcore.h: ditto.
Thu May 24 11:46:55 2007 Koichi Sasada <ko1@atdot.net>
* gc.c, yarvcore.c: fix to mark VM structure on startup.

5
cont.c
View file

@ -270,8 +270,9 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
if (cont->saved_thread.value != th->value) {
rb_raise(rb_eRuntimeError, "continuation called across threads");
}
/* TODO: check "continuation called across trap" */
printf("--> %p\n", cont);
if (cont->saved_thread.trap_tag != th->trap_tag) {
rb_raise(rb_eRuntimeError, "continuation called across trap");
}
switch(argc) {
case 0:

5
eval.c
View file

@ -1162,11 +1162,16 @@ rb_protect(VALUE (*proc) (VALUE), VALUE data, int *state)
int status;
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
struct rb_vm_trap_tag trap_tag = {
th->trap_tag,
};
PUSH_TAG();
th->trap_tag = &trap_tag;
if ((status = EXEC_TAG()) == 0) {
result = (*proc) (data);
}
th->trap_tag = trap_tag.prev;
POP_TAG();
if (state) {

View file

@ -410,6 +410,10 @@ struct rb_vm_tag {
struct rb_vm_tag *prev;
};
struct rb_vm_trap_tag {
struct rb_vm_trap_tag *prev;
};
#define RUBY_VM_VALUE_CACHE_SIZE 0x1000
#define USE_VALUE_CACHE 0
@ -460,6 +464,7 @@ struct rb_thread_struct
rb_thread_lock_t interrupt_lock;
struct rb_vm_tag *tag;
struct rb_vm_trap_tag *trap_tag;
int parse_in_eval;