[前][次][番号順一覧][スレッド一覧][生データ]

yarv-diff:67

From: ko1 atdot.net
Date: 8 Aug 2005 08:21:03 -0000
Subject: [yarv-diff:67] r222 - in trunk: . rb

Author: ko1
Date: 2005-08-08 17:21:02 +0900 (Mon, 08 Aug 2005)
New Revision: 222

Modified:
   trunk/ChangeLog
   trunk/compile.c
   trunk/extconf.rb
   trunk/insnhelper.h
   trunk/insns.def
   trunk/rb/insns2vm.rb
   trunk/test.rb
   trunk/version.h
   trunk/vm.c
   trunk/vm.h
   trunk/vm_dump.c
   trunk/vm_evalbody.h
   trunk/vm_macro.def
   trunk/yarvcore.c
   trunk/yarvcore.h
Log:
	* vm.h, vm.c, insns.def, yarvcore.h, yarvcore.c :
	remove yarv_iseq_t#iseq_dt and add yarv_iseq_t#encoded.
	use yarv_iseq_t#encoded anytime

	* vm_evalbody.h, vm.h, extconf.rb, version.h :
	support call threaded code (incomplete)



Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/ChangeLog	2005-08-08 08:21:02 UTC (rev 222)
@@ -4,6 +4,16 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2005-08-08(Mon) 17:17:50 +0900  Koichi Sasada  <ko1 atdot.net>
+
+	* vm.h, vm.c, insns.def, yarvcore.h, yarvcore.c :
+	remove yarv_iseq_t#iseq_dt and add yarv_iseq_t#encoded.
+	use yarv_iseq_t#encoded anytime
+
+	* vm_evalbody.h, vm.h, extconf.rb, version.h :
+	support call threaded code (incomplete)
+
+
 2005-08-01(Mon) 05:26:12 +0900  Koichi Sasada  <ko1 atdot.net>
 
 	* yarvcore.c : support yield with multiple values

Modified: trunk/compile.c
===================================================================
--- trunk/compile.c	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/compile.c	2005-08-08 08:21:02 UTC (rev 222)
@@ -245,21 +245,28 @@
 
 
 VALUE th_eval(void *);
+static int iseq_translate_direct_threaded_code(yarv_iseq_t *iseq){
+#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
 
-static int iseq_translate_direct_threaded_code(yarv_iseq_t *iseqobj){
-#ifdef OPT_DIRECT_THREADED_CODE
+#if OPT_DIRECT_THREADED_CODE
   void **table = (void **)th_eval(0);
+#else
+  extern void **insns_address_table();
+  void **table = get_insns_address_table();
+#endif
   int i;
   
-  iseqobj->iseq_dt = ALLOC_N(VALUE, iseqobj->size);
-  MEMCPY(iseqobj->iseq_dt, iseqobj->iseq, VALUE, iseqobj->size);
-  
-  for(i=0; i<iseqobj->size; /* */){
-    int insn = iseqobj->iseq_dt[i];
+  iseq->iseq_encoded = ALLOC_N(VALUE, iseq->size);
+  MEMCPY(iseq->iseq_encoded, iseq->iseq, VALUE, iseq->size);
+
+  for(i=0; i<iseq->size; /* */){
+    int insn = iseq->iseq_encoded[i];
     int len  = insn_len(insn);
-    iseqobj->iseq_dt[i] = (VALUE)table[insn];
+    iseq->iseq_encoded[i] = (VALUE)table[insn];
     i += len;
   }
+#else
+  iseq->iseq_encoded = iseq->iseq;
 #endif
   return COMPILE_OK;
 }

Modified: trunk/extconf.rb
===================================================================
--- trunk/extconf.rb	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/extconf.rb	2005-08-08 08:21:02 UTC (rev 222)
@@ -20,7 +20,8 @@
   * opt-unify-all-combination
 
   others (default disable):
-  * opt-indirect-threaded-code
+  * opt-token-threaded-code
+  * opt-call-threaded-code
   * collect-usage-analysis
   * opt-jit-compile          (experimental, support only few insns)
   * test-aot-compile         (experimental)
@@ -53,22 +54,27 @@
   end
 end
 
+
+default_flag = true
+if arg_config('--disable-opts')
+  default_flag = false
+end
+
+
 # optimizer
-check_arg('opt-direct-threaded-code', true)
-check_arg('opt-indirect-threaded-code', false)
-check_arg('opt-basic-operations', true)
-check_arg('opt-operands-unification', true)
-check_arg('opt-instructions-unification', true)
-check_arg('opt-inline-method-cache', true)
-check_arg('opt-stack-caching'   , true)
-check_arg('opt-unify-all-combination', true)
+check_arg('opt-direct-threaded-code', default_flag)
+check_arg('opt-token-threaded-code', false)
+check_arg('opt-call-threaded-code', false)
 
+check_arg('opt-basic-operations', default_flag)
+check_arg('opt-operands-unification', default_flag)
+check_arg('opt-instructions-unification', default_flag)
+check_arg('opt-inline-method-cache', default_flag)
+check_arg('opt-stack-caching'   , default_flag)
+check_arg('opt-unify-all-combination', default_flag)
+
 check_arg('opt-jit-compile', false)
 
-if arg_config('--disable-opts')
-  $opt_defs.clear
-end
-
 check_arg('collect-usage-analysis', false)
 
 # danger

Modified: trunk/insnhelper.h
===================================================================
--- trunk/insnhelper.h	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/insnhelper.h	2005-08-08 08:21:02 UTC (rev 222)
@@ -81,7 +81,7 @@
 #define GET_OPERAND(n)     (GET_PC()[(n)])
 #define ADD_PC(n)          (SET_PC(REG_PC + (n)))
 
-#define GET_PC_COUNT()        (REG_PC - GET_ISEQ()->ISEQ_MEMBER)
+#define GET_PC_COUNT()        (REG_PC - GET_ISEQ()->iseq_encoded)
 
 #define JUMP(dst)          (REG_PC += (dst))
 

Modified: trunk/insns.def
===================================================================
--- trunk/insns.def	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/insns.def	2005-08-08 08:21:02 UTC (rev 222)
@@ -952,7 +952,7 @@
   GetISeqVal(klass_iseqval, klass_iseq);
   th_set_env(th, klass_iseq,
              FRAME_MAGIC_CLASS, klass, (VALUE)GET_DFP(),
-             klass_iseq->ISEQ_MEMBER, GET_SP(), 0,
+             klass_iseq->iseq_encoded, GET_SP(), 0,
              klass_iseq->local_size, 0, 0);
   RESTORE_REGS();
   
@@ -1014,7 +1014,7 @@
   GetISeqVal(module_iseqval, module_iseq);
   th_set_env(th, module_iseq,
              FRAME_MAGIC_CLASS, module, (VALUE)GET_DFP(),
-             module_iseq->ISEQ_MEMBER, GET_SP(), 0,
+             module_iseq->iseq_encoded, GET_SP(), 0,
              module_iseq->local_size, 0, 0);
   RESTORE_REGS();
   
@@ -1066,6 +1066,7 @@
   mn = eval_method_search(id, klass, ic);
 
 #if CURRENT_INSN_send || CURRENT_INSN_send_SC_xx_ax
+#if !YARV_AOT_COMPILED
   if(0){
     if(0){
       LABEL_IS_SC(start_init_in_send_for_opt_0):
@@ -1144,6 +1145,7 @@
     }
   }
 #endif
+#endif
   macro_eval_invoke_method(recv, klass, id, num, mn, blockptr);
 }
 
@@ -1158,10 +1160,14 @@
 (...)
 (VALUE val)
 {
+  /* TODO */
+#if YARV_AOT_COMPILED
+  rb_bug("...");
+#else
   /* expand flag */
   tmp_id = (ID)num;
   goto LABEL_IS_SC(start_init_in_super);
-  /* TODO */
+#endif
 }
 
 /**
@@ -1175,8 +1181,11 @@
 (...)
 (VALUE val)
 {
+#if YARV_AOT_COMPILED
+#else
   // TODO
   goto LABEL_IS_SC(start_init_in_zsuper);
+#endif
 }
 
 /**
@@ -1210,7 +1219,7 @@
     }
     th_set_env(th, iseq,
                FRAME_MAGIC_BLOCK, block->self, (VALUE)block->dfp,
-               iseq->ISEQ_MEMBER, GET_SP(), block->lfp,
+               iseq->iseq_encoded, GET_SP(), block->lfp,
                iseq->local_size - argc, 0, 0);
     reg_cfp->sp -= argc;
     RESTORE_REGS();
@@ -1235,13 +1244,8 @@
 (VALUE val)
 (VALUE val)
 {
-#ifdef YARV_AOT_COMPILED
-  throwed = val;
-#else
-  // ORPHAN_ENV(GET_DFP());
   POP_CONTROL_STACK_FRAME(th);
   RESTORE_REGS();
-#endif
 }
 
 /**

Modified: trunk/rb/insns2vm.rb
===================================================================
--- trunk/rb/insns2vm.rb	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/rb/insns2vm.rb	2005-08-08 08:21:02 UTC (rev 222)
@@ -728,7 +728,6 @@
     vm_body = ''
 
     @insns.each{|insn|
-    # insns.sort.each{|insn|
       vm_body << "\n"
       vm_body << make_insn_def(insn)
     }
@@ -745,10 +744,10 @@
     insns_end_table = ''
     
     @insns.each{|insn|
-      insns_table << "  &&LABEL(#{insn.name}),\n"
+      insns_table << "  LABEL_PTR(#{insn.name}),\n"
     }
     @insns.each{|insn|
-      insns_end_table << "  &&ELABEL(#{insn.name}),\n"
+      insns_end_table << "  ELABEL_PTR(#{insn.name}),\n"
     }
     
     ERB.new(File.read($srcdir + '/tmpl/vmtc.inc.tmpl')).result(binding)

Modified: trunk/test.rb
===================================================================
--- trunk/test.rb	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/test.rb	2005-08-08 08:21:02 UTC (rev 222)
@@ -7,7 +7,17 @@
 $line = __LINE__ + 3
 ###########################################################
 $prog =<<'__EOP__'
+def fib n
+  if n < 2
+    1
+  else
+    fib(n-1) + fib(n-2)
+  end
+end
 
+fib(30)
+
+__END__
 def iter
   yield :x, :y, :z
 end

Modified: trunk/version.h
===================================================================
--- trunk/version.h	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/version.h	2005-08-08 08:21:02 UTC (rev 222)
@@ -19,28 +19,35 @@
 /* gcc ver. check */
 #if defined(__GNUC__) && __GNUC__ >= 2
 
-#ifdef OPT_INDIRECT_THREADED_CODE
+#ifdef OPT_TOKEN_THREADED_CODE
 #ifdef OPT_DIRECT_THREADED_CODE
 #undef OPT_DIRECT_THREADED_CODE
 #endif
 #endif
 
-#if defined(OPT_DIRECT_THREADED_CODE) || defined(OPT_INDIRECT_THREADED_CODE)
-#define OPT_THREADED_CODE 1
-#endif
-
 #else
 
 /* disable threaded code options */
 #ifdef OPT_DIRECT_THREADED_CODE
 #undef OPT_DIRECT_THREADED_CODE
 #endif
-#ifdef OPT_INDIRECT_THREADED_CODE
-#undef OPT_INDIRECT_THREADED_CODE
+#ifdef OPT_TOKEN_THREADED_CODE
+#undef OPT_TOKEN_THREADED_CODE
 #endif
 #endif
 
+/* call threaded code */
+#ifdef OPT_CALL_THREADED_CODE
+#ifdef OPT_DIRECT_THREADED_CODE
+#undef OPT_DIRECT_THREADED_CODE
+#endif
+#ifdef OPT_STACK_CACHING
+#undef OPT_STACK_CACHING
+#endif
+#define YARV_AOT_COMPILED 1
+#endif
 
+/* likely */
 #ifdef __GCC__
 #define LIKELY(x)   (__builtin_expect(x, 1))
 #define UNLIKELY(x) (__builtin_expect(x, 0))

Modified: trunk/vm.c
===================================================================
--- trunk/vm.c	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/vm.c	2005-08-08 08:21:02 UTC (rev 222)
@@ -26,8 +26,10 @@
 
 VALUE th_eval_body(yarv_thread_t *th);
 
-#ifdef OPT_STACK_CACHING
+#if OPT_STACK_CACHING
 static VALUE yarv_finish_insn_seq[1] = {BIN(finish_SC_ax_ax)};
+#elif OPT_CALL_THREADED_CODE
+static VALUE const yarv_finish_insn_seq[1] = {0};
 #else
 static VALUE yarv_finish_insn_seq[1] = {BIN(finish)};
 #endif
@@ -104,7 +106,6 @@
              FRAME_MAGIC_FINISH, Qnil, 0,
              0, th->cfp->sp, 0,
              0, 0, 0);
-  
   th->cfp->pc = &yarv_finish_insn_seq[0];
   return Qtrue;
 }
@@ -124,7 +125,7 @@
   
   return th_set_env(th, iseq, 
                     FRAME_MAGIC_TOP, ruby_top_self, 0,
-                    iseq->ISEQ_MEMBER, th->cfp->sp, 0,
+                    iseq->iseq_encoded, th->cfp->sp, 0,
                     iseq->local_size, 0, 0);
 }
 
@@ -371,7 +372,7 @@
       th_set_finish_env(th);
       th_set_env(th, block->iseq, FRAME_MAGIC_BLOCK,
                  block->self, GC_GUARDED_PTR(block->dfp),
-                 block->iseq->ISEQ_MEMBER, th->cfp->sp, block->lfp,
+                 block->iseq->iseq_encoded, th->cfp->sp, block->lfp,
                  block->iseq->local_size, argc, argv);
       //SDR2(th->cfp);
       val = th_eval_body(th);
@@ -410,11 +411,11 @@
 
       th_set_env(th, block->iseq, FRAME_MAGIC_BLOCK,
                  block->self, GC_GUARDED_PTR(block->dfp),
-                 block->iseq->ISEQ_MEMBER, th->cfp->sp, block->lfp,
+                 block->iseq->iseq_encoded, th->cfp->sp, block->lfp,
                  local_size, argc, argv);
 
       data->local_size = block->iseq->local_size;
-      data->pc = block->iseq->ISEQ_MEMBER;
+      data->pc = block->iseq->iseq_encoded;
       data->sp = th->cfp->sp;
       data->argc = argc;
       
@@ -458,7 +459,7 @@
   th_set_finish_env(th);
   th_set_env(th, proc->block.iseq,
              FRAME_MAGIC_PROC, proc->block.self, (VALUE)proc->block.dfp,
-             proc->block.iseq->ISEQ_MEMBER, th->cfp->sp, proc->block.lfp,
+             proc->block.iseq->iseq_encoded, th->cfp->sp, proc->block.lfp,
              proc->block.iseq->local_size, argc, argv);
 
   //proc_dump_raw(proc);
@@ -526,7 +527,7 @@
   if(cfp->iseq != 0){
     if(cfp->pc != 0){
       int i;
-      int pos = cfp->pc - cfp->iseq->ISEQ_MEMBER;
+      int pos = cfp->pc - cfp->iseq->iseq_encoded;
 
       for(i=0; i<cfp->iseq->insn_info_size; i++){
         if(cfp->iseq->insn_info_tbl[i].position == pos){
@@ -1019,7 +1020,7 @@
       th->cfp++;
     }
     cfp = th->cfp;
-    epc = cfp->pc - cfp->iseq->ISEQ_MEMBER;
+    epc = cfp->pc - cfp->iseq->iseq_encoded;
 
     if(state == TAG_BREAK || state == TAG_RETURN){
       escape_dfp = GET_THROWOBJ_CATCH_POINT(err);
@@ -1078,7 +1079,7 @@
             escape_dfp = GET_THROWOBJ_CATCH_POINT(err);
 
             if(cfp->dfp == escape_dfp){
-              cfp->pc = cfp->iseq->ISEQ_MEMBER + entry->cont;
+              cfp->pc = cfp->iseq->iseq_encoded + entry->cont;
               goto vm_loop_start;
             }
           }
@@ -1102,7 +1103,7 @@
             break;
           }
           else if(entry->type == type){
-            cfp->pc = cfp->iseq->ISEQ_MEMBER + entry->cont;
+            cfp->pc = cfp->iseq->iseq_encoded + entry->cont;
             cfp->sp = cfp->bp + entry->sp;
             
             if(state != TAG_REDO && escape_dfp){
@@ -1153,12 +1154,12 @@
 
       /* PUSH(throwed) */
       *cfp->sp++ = err;
-      cfp->pc = cfp->iseq->ISEQ_MEMBER + cont_pc;
+      cfp->pc = cfp->iseq->iseq_encoded + cont_pc;
 
       /* push block frame */
       th_set_env(th, catch_iseq,
                  FRAME_MAGIC_BLOCK, cfp->self, GC_GUARDED_PTR(cfp->dfp),
-                 catch_iseq->ISEQ_MEMBER, cfp->sp, cfp->lfp,
+                 catch_iseq->iseq_encoded, cfp->sp, cfp->lfp,
                  catch_iseq->local_size - 1, 0, 0);
 
       state = 0;

Modified: trunk/vm.h
===================================================================
--- trunk/vm.h	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/vm.h	2005-08-08 08:21:02 UTC (rev 222)
@@ -80,15 +80,41 @@
 
 
 /************************************************/
-#if   defined(DISPATCH_XXX)
+#if   DISPATCH_XXX
 error!
 
 /************************************************/
-#elif defined(OPT_THREADED_CODE)
+#elif OPT_CALL_THREADED_CODE
+
+#if __GCC__
+#define FASTCALL __attribute__ ((fastcall))
+#else
+#define FASTCALL
+#endif
+
+
+#define LABEL(x)  insn_func_##x
+#define ELABEL(x)
+#define LABEL_PTR(x) &LABEL(x)
+
+typedef yarv_control_frame_t *
+(*insn_func_type)(yarv_thread_t *, yarv_control_frame_t *) FASTCALL;
+
+#define INSN_ENTRY(insn) \
+  yarv_control_frame_t * \
+    LABEL(insn)(yarv_thread_t *th, yarv_control_frame_t *reg_cfp) FASTCALL {
+
+#define END_INSN(insn) return reg_cfp;}
+
+#define NEXT_INSN() return reg_cfp;
+
+/************************************************/
+#elif OPT_TOKEN_THREADED_CODE || OPT_DIRECT_THREADED_CODE
 /* threaded code with gcc */
 
 #define LABEL(x)  INSN_LABEL_##x
 #define ELABEL(x) INSN_ELABEL_##x
+#define LABEL_PTR(x) &&LABEL(x)
 
 #define INSN_ENTRY_SIG(insn) \
   asm volatile (  "; #**************************************************\n" \
@@ -118,7 +144,6 @@
 /**********************************/
 #ifdef OPT_DIRECT_THREADED_CODE
 
-
 /* for GCC 3.4.x */
 #define TC_DISPATCH(insn) \
   DISPATCH_ARCH_DEPEND_WAY(GET_CURRENT_INSN()); \
@@ -126,10 +151,8 @@
   goto *GET_CURRENT_INSN(); \
   ;
 
-#define GET_SEQ(iseq) (iseq)->iseq_dt
-
 #else 
-/* indirect threade code */
+/* token threade code */
 
 #define TC_DISPATCH(insn)  \
   DISPATCH_ARCH_DEPEND_WAY(insns_address_table[GET_CURRENT_INSN()]); \
@@ -137,7 +160,6 @@
   goto *insns_address_table[GET_CURRENT_INSN()]; \
   rb_bug("tc error");
 
-#define GET_SEQ(is) (is)->iseq
 
 #endif /* DISPATCH_DIRECT_THREADED_CODE */
 
@@ -160,8 +182,6 @@
 #else /* no threaded code */
 /* most common method */
 
-#define GET_SEQ(is) (is)->iseq
-
 #define INSN_ENTRY(insn) \
 case BIN(insn):
 
@@ -248,10 +268,6 @@
 
 #define SCREG(r) (reg_##r)
 
-#ifdef OPT_DIRECT_THREADED_CODE
-#define ISEQ_MEMBER           iseq_dt
-#else
-#define ISEQ_MEMBER           iseq
-#endif
+#endif	// _VM_H_INCLUDED_
 
-#endif	// _VM_H_INCLUDED_
+

Modified: trunk/vm_dump.c
===================================================================
--- trunk/vm_dump.c	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/vm_dump.c	2005-08-08 08:21:02 UTC (rev 222)
@@ -50,7 +50,7 @@
       iseq_name = rb_id2name(cmi->id);
     }
     else{
-      pc = cfp->pc - cfp->iseq->ISEQ_MEMBER;
+      pc = cfp->pc - cfp->iseq->iseq_encoded;
       iseq_name = "";//RSTRING(cfp->iseq->name)->ptr;
     }
   }
@@ -219,7 +219,7 @@
   int cfpi;
 
   if(cfp->iseq && !CMETHOD_INFO_P(cfp->iseq)){
-    pc = cfp->pc - cfp->iseq->ISEQ_MEMBER;
+    pc = cfp->pc - cfp->iseq->iseq_encoded;
   }
 
   if(lfp < 0 || lfp > th->stack_size) lfp = -1;
@@ -241,7 +241,7 @@
 
   if(iseq != 0 && cfp->magic != FRAME_MAGIC_FINISH){
     VALUE *seq = iseq->iseq;
-    int pc = cfp->pc - iseq->ISEQ_MEMBER;
+    int pc = cfp->pc - iseq->iseq_encoded;
     
     iseq_disasm_insn(0, seq, pc, iseq, 0);
   }

Modified: trunk/vm_evalbody.h
===================================================================
--- trunk/vm_evalbody.h	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/vm_evalbody.h	2005-08-08 08:21:02 UTC (rev 222)
@@ -18,6 +18,8 @@
 #endif
 // #define DECL_SC_REG(r, reg) VALUE reg_##r
 
+
+#if !OPT_CALL_THREADED_CODE
 VALUE th_eval(yarv_thread_t *th, VALUE initial){
   
 #ifdef OPT_STACK_CACHING
@@ -65,11 +67,8 @@
 
   ID tmp_id;
 
-#ifdef OPT_THREADED_CODE
+#if OPT_TOKEN_THREADED_CODE || OPT_DIRECT_THREADED_CODE
 #include "vmtc.inc"
-#endif
-
-#ifdef OPT_THREADED_CODE
   if(th == 0){
 #ifdef OPT_STACK_CACHING
     yarv_finish_insn_seq[0] = (VALUE)&&LABEL(finish_SC_ax_ax);
@@ -99,3 +98,27 @@
   rb_bug("th_eval_iseq: unreachable");
   return Qundef;
 }
+
+#else
+
+#include "vm.inc"
+#include "vmtc.inc"
+
+void **get_insns_address_table(){
+  return (void **)insns_address_table;
+}
+
+VALUE th_eval(yarv_thread_t *th, VALUE initial){
+  register yarv_control_frame_t *reg_cfp = th->cfp;
+  SET_PC(reg_cfp->iseq->iseq_encoded);
+  
+  while(*GET_PC()){
+    reg_cfp = ((insn_func_type)(*GET_PC()))(th, reg_cfp);
+  }
+  {
+    VALUE ret = *--reg_cfp->sp;
+    th->cfp--;
+    return ret;
+  }
+}
+#endif

Modified: trunk/vm_macro.def
===================================================================
--- trunk/vm_macro.def	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/vm_macro.def	2005-08-08 08:21:02 UTC (rev 222)
@@ -178,7 +178,7 @@
       th->cfp++;
       th_set_env(th, niseq,
                  FRAME_MAGIC_METHOD, recv, (VALUE)blockptr,
-                 niseq->ISEQ_MEMBER + opt_pc, sp, 0,
+                 niseq->iseq_encoded + opt_pc, sp, 0,
                  0, 0, 0);
     }
     else if(0 &&
@@ -191,12 +191,12 @@
       *sp++ = (VALUE)blockptr;
       reg_cfp->sp = sp;
       reg_cfp->bp = sp;
-      SET_PC(niseq->ISEQ_MEMBER + opt_pc);
+      SET_PC(niseq->iseq_encoded + opt_pc);
     }
     else{
       th_set_env(th, niseq,
                  FRAME_MAGIC_METHOD, recv, (VALUE)blockptr,
-                 niseq->ISEQ_MEMBER + opt_pc, sp, 0,
+                 niseq->iseq_encoded + opt_pc, sp, 0,
                  0, 0, 0);
       reg_cfp->sp = rsp;
     }

Modified: trunk/yarvcore.c
===================================================================
--- trunk/yarvcore.c	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/yarvcore.c	2005-08-08 08:21:02 UTC (rev 222)
@@ -312,10 +312,12 @@
   if(ptr){
     iseq = ptr;
     GC_INFO("%s\n", RSTRING(iseq->name)->ptr);
+
+    if(iseq->iseq != iseq->iseq_encoded){
+      FREE_UNLESS_NULL(iseq->iseq_encoded);
+    }
     FREE_UNLESS_NULL(iseq->iseq);
-#ifdef OPT_DIRECT_THREADED_CODE
-    FREE_UNLESS_NULL(iseq->iseq_dt);
-#endif
+
     FREE_UNLESS_NULL(iseq->insn_info_tbl);
     FREE_UNLESS_NULL(iseq->local_tbl);
     FREE_UNLESS_NULL(iseq->catch_table);
@@ -689,10 +691,12 @@
 void Init_yarvcore(){
   char opts[] = ""
 
-#if   defined(OPT_DIRECT_THREADED_CODE)
+#if   OPT_DIRECT_THREADED_CODE
     "[direct threaded code] "
-#elif defined(OPT_INDIRECT_THREADED_CODE)
-    "[indirect threaded code] "
+#elif OPT_TOKEN_THREADED_CODE
+    "[token threaded code] "
+#elif OPT_CALL_THREADED_CODE
+    "[call threaded code] "
 #endif
 
 #ifdef FAKE_INLINE_METHOD_CACHE

Modified: trunk/yarvcore.h
===================================================================
--- trunk/yarvcore.h	2005-07-31 20:29:31 UTC (rev 221)
+++ trunk/yarvcore.h	2005-08-08 08:21:02 UTC (rev 222)
@@ -116,13 +116,11 @@
 struct yarv_iseq_struct{
   VALUE  name; /* String: iseq name */
   VALUE *iseq; /* iseq */
+  VALUE *iseq_encoded;
   VALUE  iseq_mark_ary; /* Array: includes operands which should be GC marked */
 
   NODE *node;
   
-#ifdef OPT_DIRECT_THREADED_CODE
-  VALUE *iseq_dt;
-#endif
   
   /* sequence size */
   unsigned long size;


--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]