summaryrefslogtreecommitdiff
path: root/vm_exec.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-07 11:13:57 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-07 11:13:57 (GMT)
commit0d1a905edb43fe9260302b286d04cec66f7c4416 (patch)
treefdb10453a3e6c04d81a535a4439f2f868f2c2fd6 /vm_exec.c
parentfca3c408a72cc11bb065bf253bfe00dde4f92b9e (diff)
* vm_exec.c, insns.def (leave): solve problems on
OPT_CALL_THREADED_CODE. Catch up finish frame structure on OPT_CALL_THREADED_CODE. * vm_core.h: add rb_thread_t#retval for temporary space on OPT_CALL_THREADED_CODE. * vm.c (th_init): clear rb_thread_t#retval as Qundef. * vm_dump.c (rb_vmdebug_debug_print_pre): fix debug print format. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_exec.c')
-rw-r--r--vm_exec.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/vm_exec.c b/vm_exec.c
index 6bd4f4e..7cdd96f 100644
--- a/vm_exec.c
+++ b/vm_exec.c
@@ -105,39 +105,39 @@ rb_vm_get_insns_address_table(void)
return (const void **)vm_exec_core(0, 0);
}
-#else
+#else /* OPT_CALL_THREADED_CODE */
#include "vm.inc"
#include "vmtc.inc"
-const void *const *
+const void **
rb_vm_get_insns_address_table(void)
{
- return insns_address_table;
+ return (const void **)insns_address_table;
}
static VALUE
vm_exec_core(rb_thread_t *th, VALUE initial)
{
register rb_control_frame_t *reg_cfp = th->cfp;
- VALUE ret;
- while (*GET_PC()) {
+ while (1) {
reg_cfp = ((rb_insn_func_t) (*GET_PC()))(th, reg_cfp);
- if (reg_cfp == 0) {
- VALUE err = th->errinfo;
- th->errinfo = Qnil;
- return err;
+ if (UNLIKELY(reg_cfp == 0)) {
+ break;
}
}
- if (VM_FRAME_TYPE_FINISH_P(th->cfp)) {
- rb_bug("cfp consistency error");
+ if (th->retval != Qundef) {
+ VALUE ret = th->retval;
+ th->retval = Qundef;
+ return ret;
+ }
+ else {
+ VALUE err = th->errinfo;
+ th->errinfo = Qnil;
+ return err;
}
-
- ret = *(th->cfp->sp-1); /* pop */
- th->cfp++; /* pop cf */
- return ret;
}
#endif