summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-11 10:53:48 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-11 10:53:48 +0000
commit8c6c9c46d8aecccfa66e9e34a76e7768025671b1 (patch)
tree364a8dfe2aa1075f4e0471ec176efe15e3290fb7 /vm.c
parentc653db51b0b32bea9a8469dbc236538b011cc0b1 (diff)
* vm.c (rb_vm_register_special_exception): make new function to
make and register special exceptions. * vm.c (rb_vm_mark): do not need to mark special exceptions because they are registerd by rb_gc_register_mark_object(). * eval.c (Init_eval): use rb_vm_register_special_exception(). * gc.c (Init_GC): ditto. * proc.c (Init_Proc): ditto. * thread.c (Init_Thread): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index aeac7ee09d..c1d54b14de 100644
--- a/vm.c
+++ b/vm.c
@@ -1751,7 +1751,6 @@ rb_vm_mark(void *ptr)
RUBY_MARK_UNLESS_NULL(vm->top_self);
RUBY_MARK_UNLESS_NULL(vm->coverages);
RUBY_MARK_UNLESS_NULL(vm->defined_module_hash);
- rb_gc_mark_locations(vm->special_exceptions, vm->special_exceptions + ruby_special_error_count);
if (vm->loading_table) {
rb_mark_tbl(vm->loading_table);
@@ -1768,6 +1767,16 @@ rb_vm_mark(void *ptr)
RUBY_MARK_LEAVE("vm");
}
+void
+rb_vm_register_special_exception(enum ruby_special_exceptions sp, VALUE cls, const char *mesg)
+{
+ rb_vm_t *vm = GET_VM();
+ VALUE exc = rb_exc_new3(cls, rb_obj_freeze(rb_str_new2(mesg)));
+ OBJ_TAINT(exc);
+ OBJ_FREEZE(exc);
+ ((VALUE *)vm->special_exceptions)[sp] = exc;
+ rb_gc_register_mark_object(exc);
+}
int
rb_vm_add_root_module(ID id, VALUE module)