From 86613d4fc636ad9314b84e4d9be9c5c92a0a5318 Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 28 Jul 2016 11:02:30 +0000 Subject: * vm_core.h: revisit the structure of frame, block and env. [Bug #12628] This patch introduce many changes. * Introduce concept of "Block Handler (BH)" to represent passed blocks. * move rb_control_frame_t::flag to ep[0] (as a special local variable). This flags represents not only frame type, but also env flags such as escaped. * rename `rb_block_t` to `struct rb_block`. * Make Proc, Binding and RubyVM::Env objects wb-protected. Check [Bug #12628] for more details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_insnhelper.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'vm_insnhelper.h') diff --git a/vm_insnhelper.h b/vm_insnhelper.h index 69eaaacf2e..18fabde187 100644 --- a/vm_insnhelper.h +++ b/vm_insnhelper.h @@ -104,7 +104,7 @@ enum vm_regan_acttype { /* deal with variables */ /**********************************************************/ -#define GET_PREV_EP(ep) ((VALUE *)((ep)[0] & ~0x03)) +#define GET_PREV_EP(ep) ((VALUE *)((ep)[VM_ENV_DATA_INDEX_SPECVAL] & ~0x03)) #define GET_GLOBAL(entry) rb_gvar_get((struct rb_global_entry*)(entry)) #define SET_GLOBAL(entry, val) rb_gvar_set((struct rb_global_entry*)(entry), (val)) @@ -148,7 +148,7 @@ enum vm_regan_acttype { #define CI_SET_FASTPATH(ci, func, enabled) /* do nothing */ #endif -#define GET_BLOCK_PTR() ((rb_block_t *)(GC_GUARDED_PTR_REF(GET_LEP()[0]))) +#define GET_BLOCK_HANDLER() (GET_LEP()[VM_ENV_DATA_INDEX_SPECVAL]) /**********************************************************/ /* deal with control flow 3: exception */ @@ -173,7 +173,7 @@ enum vm_regan_acttype { #define CALL_SIMPLE_METHOD(recv_) do { \ struct rb_calling_info calling; \ - calling.blockptr = NULL; \ + calling.block_handler = VM_BLOCK_HANDLER_NONE; \ calling.argc = ci->orig_argc; \ vm_search_method(ci, cc, calling.recv = (recv_)); \ CALL_METHOD(&calling, ci, cc); \ @@ -189,7 +189,7 @@ static VALUE make_no_method_exception(VALUE exc, VALUE format, VALUE obj, int argc, const VALUE *argv, int priv); static inline struct vm_throw_data * -THROW_DATA_NEW(VALUE val, rb_control_frame_t *cf, VALUE st) +THROW_DATA_NEW(VALUE val, const rb_control_frame_t *cf, VALUE st) { return (struct vm_throw_data *)rb_imemo_new(imemo_throw_data, val, (VALUE)cf, st, 0); } -- cgit v1.2.3