summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-28 04:05:36 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-28 04:05:36 +0000
commitd50483df23383caf098c23c25c133f4eefca5917 (patch)
treed2e94e5ec61e548687a0b67d06a0662063650a31 /vm_core.h
parent8124d67988ea5aa995f1721446c229a83a8b356d (diff)
* vm_core.h: remove rb_control_frame_t::bp (bp: base pointer).
`bp' can be calculate by `sp' (stack pointer) of previous frame. Now, `bp_check' field is remained for debug. You can eliminate this field by setting VM_DEBUG_BP_CHECK as 0. * vm_insnhelper.c (vm_base_ptr): add `vm_base_ptr(cfp). This function calculates base pointer from cfp. * vm_insnhelper.c (vm_setup_method): push `recv' value on top of value stack (before method parameters). This change is for keeping consistency with normal method dispatch. * insns.def: fix to use vm_base_ptr(). * vm.c (vm_exec): ditto. * vm_dump.c: remove `bp' related dumps. * cont.c (fiber_init): fix to check VM_DEBUG_BP_CHECK. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/vm_core.h b/vm_core.h
index d890c1619b..51af4770e1 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -353,18 +353,25 @@ typedef struct rb_vm_struct {
VALUE *defined_strings;
} rb_vm_t;
+#ifndef VM_DEBUG_BP_CHECK
+#define VM_DEBUG_BP_CHECK 0
+#endif
+
typedef struct {
VALUE *pc; /* cfp[0] */
VALUE *sp; /* cfp[1] */
- VALUE *bp; /* cfp[2] */
- rb_iseq_t *iseq; /* cfp[3] */
- VALUE flag; /* cfp[4] */
- VALUE self; /* cfp[5] / block[0] */
- VALUE klass; /* cfp[6] / block[1] */
- VALUE *ep; /* cfp[7] / block[2] */
- rb_iseq_t *block_iseq; /* cfp[8] / block[3] */
- VALUE proc; /* cfp[9] / block[4] */
- const rb_method_entry_t *me;/* cfp[10] */
+ rb_iseq_t *iseq; /* cfp[2] */
+ VALUE flag; /* cfp[3] */
+ VALUE self; /* cfp[4] / block[0] */
+ VALUE klass; /* cfp[5] / block[1] */
+ VALUE *ep; /* cfp[6] / block[2] */
+ rb_iseq_t *block_iseq; /* cfp[7] / block[3] */
+ VALUE proc; /* cfp[8] / block[4] */
+ const rb_method_entry_t *me;/* cfp[9] */
+
+#if VM_DEBUG_BP_CHECK
+ VALUE *bp_check; /* cfp[10] */
+#endif
} rb_control_frame_t;
typedef struct rb_block_struct {
@@ -707,7 +714,8 @@ rb_block_t *rb_vm_control_frame_block_ptr(rb_control_frame_t *cfp);
#define RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp) ((rb_block_t *)(&(cfp)->self))
#define RUBY_VM_GET_CFP_FROM_BLOCK_PTR(b) \
- ((rb_control_frame_t *)((VALUE *)(b) - 5))
+ ((rb_control_frame_t *)((VALUE *)(b) - 4))
+/* magic number `4' is depend on rb_control_frame_t layout. */
/* VM related object allocate functions */
VALUE rb_thread_alloc(VALUE klass);