summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authortarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-15 17:15:31 +0000
committertarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-15 17:15:31 +0000
commit28a1c4f33e3349a98c04b8e068d9c674eb936064 (patch)
tree67534f26a7d3c996c75c558f80151eb28e35dc00 /vm_core.h
parent9e96b1edea5c52fba05a30fc602288bb100acea7 (diff)
* cont.c : Introdule ensure rollback mechanism. Please see below.
* internal.h (ruby_register_rollback_func_for_ensure): catch up above change. Add rollback mechanism API. * vm_core.h (typedef struct rb_vm_struct): catch up above change. Introdule ensure-rollback relation table. * vm_core.h (typedef struct rb_thread_struct): catch up above change. Introdule ensure stack. * eval.c (rb_ensure): catch up above change. Introdule ensure stack. * hash.c : New function for rollback ensure, and register it to ensure-rollback relation table. [ruby-dev:47803] [Bug #9105] Ensure Rollback Mechanism: A rollback's function is a function to rollback a state before ensure's function execution. When the jump of callcc is across the scope of rb_ensure, ensure's functions and rollback's functions are executed appropriately for keeping consistency. Current API is unstable, and only internal use. ruby_register_rollback_func_for_ensure(ensure_func,rollback_func) This API create relation ensure's function to rollback's function. By registered rollback's function, it is executed When jumpping into corresponding rb_ensure scope. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/vm_core.h b/vm_core.h
index 44f871dd6f..94527bbfa6 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -387,6 +387,9 @@ typedef struct rb_vm_struct {
/* hook */
rb_hook_list_t event_hooks;
+ /* relation table of ensure - rollback for callcc */
+ struct st_table *ensure_rollback_table;
+
/* postponed_job */
struct rb_postponed_job_struct *postponed_job_buffer;
int postponed_job_index;
@@ -507,6 +510,17 @@ typedef struct rb_thread_list_struct{
} rb_thread_list_t;
+typedef struct rb_ensure_entry {
+ VALUE marker;
+ VALUE (*e_proc)(ANYARGS);
+ VALUE data2;
+} rb_ensure_entry_t;
+
+typedef struct rb_ensure_list {
+ struct rb_ensure_list *next;
+ struct rb_ensure_entry entry;
+} rb_ensure_list_t;
+
typedef struct rb_thread_struct {
VALUE self;
rb_vm_t *vm;
@@ -626,6 +640,9 @@ typedef struct rb_thread_struct {
VALUE root_fiber;
rb_jmpbuf_t root_jmpbuf;
+ /* ensure & callcc */
+ rb_ensure_list_t *ensure_list;
+
/* misc */
int method_missing_reason;
int abort_on_exception;