summaryrefslogtreecommitdiff
path: root/eval_intern.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-28 11:02:30 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-28 11:02:30 (GMT)
commit9f60791a0412cae804f13ed3e746a634c7a0731b (patch)
tree49b3f9ff4924a622e13fbdfc9478d34717d19378 /eval_intern.h
parent683eafd973e4db60756f6ee12e1b066e316f026f (diff)
* 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
Diffstat (limited to 'eval_intern.h')
-rw-r--r--eval_intern.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/eval_intern.h b/eval_intern.h
index bb4b93b..9db0fd1 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -5,13 +5,23 @@
#include "vm_core.h"
static inline void
-pass_passed_block(rb_thread_t *th)
+vm_passed_block_handler_set(rb_thread_t *th, VALUE block_handler)
{
- th->passed_block = rb_vm_control_frame_block_ptr(th->cfp);
- th->cfp->flag |= VM_FRAME_FLAG_PASSED;
+ VM_ASSERT(vm_block_handler_verify(block_handler));
+ th->passed_block_handler = block_handler;
}
-#define PASS_PASSED_BLOCK_TH(th) pass_passed_block(th)
-#define PASS_PASSED_BLOCK() pass_passed_block(GET_THREAD())
+
+static inline void
+pass_passed_block_handler(rb_thread_t *th)
+{
+ VALUE block_handler = rb_vm_frame_block_handler(th->cfp);
+ VM_ASSERT(vm_block_handler_verify(block_handler));
+ vm_passed_block_handler_set(th, block_handler);
+ VM_ENV_FLAGS_SET(th->cfp->ep, VM_FRAME_FLAG_PASSED);
+}
+
+#define PASS_PASSED_BLOCK_HANDLER_TH(th) pass_passed_block_handler(th)
+#define PASS_PASSED_BLOCK_HANDLER() pass_passed_block_handler(GET_THREAD())
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -277,7 +287,7 @@ NORETURN(void rb_raise_method_missing(rb_thread_t *th, int argc, const VALUE *ar
VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
rb_cref_t *rb_vm_cref(void);
rb_cref_t *rb_vm_cref_replace_with_duplicated_cref(void);
-VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_block_t *blockptr, VALUE filename);
+VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, VALUE block_handler, VALUE filename);
void rb_vm_set_progname(VALUE filename);
void rb_thread_terminate_all(void);
VALUE rb_vm_cbase(void);