dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] libjit ChangeLog jit/jit-internal.h jit/jit-fun...


From: Aleksey Demakov
Subject: [dotgnu-pnet-commits] libjit ChangeLog jit/jit-internal.h jit/jit-fun...
Date: Tue, 23 Jan 2007 06:42:33 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    libjit
Changes by:     Aleksey Demakov <avd>   07/01/23 06:42:33

Modified files:
        .              : ChangeLog 
        jit            : jit-internal.h jit-function.c jit-rules-x86.ins 
                         jit-rules-alpha.ins 

Log message:
        remove the closure_entry field from jit_function_t

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libjit/ChangeLog?cvsroot=dotgnu-pnet&r1=1.294&r2=1.295
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-internal.h?cvsroot=dotgnu-pnet&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-function.c?cvsroot=dotgnu-pnet&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-rules-x86.ins?cvsroot=dotgnu-pnet&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-rules-alpha.ins?cvsroot=dotgnu-pnet&r1=1.7&r2=1.8

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/ChangeLog,v
retrieving revision 1.294
retrieving revision 1.295
diff -u -b -r1.294 -r1.295
--- ChangeLog   17 Jan 2007 07:38:47 -0000      1.294
+++ ChangeLog   23 Jan 2007 06:42:33 -0000      1.295
@@ -1,3 +1,13 @@
+2007-01-23  Aleksey Demakov  <address@hidden>
+
+       * jit/jit-internal.h, jit/jit-function.c: remove the closure_entry
+       field from jit_function_t. Find this value on the fly in
+       jit_function_to_closure() and jit_function_to_vtable_pointer()
+       to be equal either to entry_point or indirector fields.
+
+       * jit/jit-rules-alpha.ins, jit/jit-rules-x86.ins: use
+       jit_function_to_closure() instead of the closure_entry field.
+
 2007-01-17  Aleksey Demakov  <address@hidden>
 
        * jit/jit-reg-alloc.h, jit/jit-reg-alloc.c: complete special x87

Index: jit/jit-internal.h
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-internal.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- jit/jit-internal.h  26 Nov 2006 20:42:01 -0000      1.26
+++ jit/jit-internal.h  23 Jan 2007 06:42:33 -0000      1.27
@@ -395,9 +395,6 @@
        /* The entry point for the function's compiled code */
        void * volatile         entry_point;
 
-       /* The closure/vtable entry point for the function's compiled code */
-       void * volatile         closure_entry;
-
        /* The function to call to perform on-demand compilation */
        jit_on_demand_func      on_demand;
 
@@ -406,12 +403,12 @@
           Redirectors are used to support on-demand compilation */
        unsigned char           *redirector;
 #endif
-#ifdef jit_indirector_size
+
        /* Buffer that contains the indirector for this function.
-          The indirector is used to jump either to the function
-          redirector or the compiled function itself. */
+          The indirector jumps to the address that is currently
+          stored in the entry_point field. Indirectors are used
+          to support recompilation and on-demand compilation. */
        unsigned char           *indirector;
-#endif
 };
 
 /*

Index: jit/jit-function.c
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-function.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- jit/jit-function.c  12 Jan 2007 07:54:25 -0000      1.25
+++ jit/jit-function.c  23 Jan 2007 06:42:33 -0000      1.26
@@ -24,6 +24,9 @@
 #include "jit-reg-alloc.h"
 #include "jit-apply-func.h"
 #include "jit-setjmp.h"
+#ifdef _JIT_COMPILE_DEBUG
+#include <stdio.h>
+#endif
 
 /*@
  * @deftypefun jit_function_t jit_function_create (jit_context_t context, 
jit_type_t signature)
@@ -109,12 +112,10 @@
                (func->redirector, (void *)_jit_function_compile_on_demand,
                 func, jit_type_get_abi(signature));
        jit_flush_exec(func->redirector, jit_redirector_size);
+
 # if defined(jit_indirector_size)
-       func->closure_entry = _jit_create_indirector
-               (func->indirector, (void**) &(func->entry_point));
+       _jit_create_indirector(func->indirector, (void**) &(func->entry_point));
        jit_flush_exec(func->indirector, jit_indirector_size);
-# else
-       func->closure_entry = func->entry_point;
 # endif
 #endif
 
@@ -496,7 +497,7 @@
        jit_insn_t insn;
 
 #ifdef _JIT_COMPILE_DEBUG
-       printf("Block: %d\n", func->builder->block_count++);
+       printf("Block #%d: %d\n", func->builder->block_count++, block->label);
 #endif
 
        /* Iterate over all blocks in the function */
@@ -611,6 +612,7 @@
 #ifdef _JIT_COMPILE_DEBUG
                p2 = gen->posn.ptr;
                printf("Length of binary code: %d\n\n", p2 - p1);
+               fflush(stdout);
 #endif
        }
 }
@@ -648,9 +650,6 @@
        struct jit_gencode gen;
        jit_cache_t cache;
        void *start;
-#if !defined(jit_redirector_size) || !defined(jit_indirector_size) || 
defined(JIT_BACKEND_INTERP)
-       void *recompilable_start = 0;
-#endif
        void *end;
        jit_block_t block;
        int result;
@@ -784,12 +783,14 @@
                }
 #endif
 
-#if !defined(jit_redirector_size) || !defined(jit_indirector_size) || 
defined(JIT_BACKEND_INTERP)
+#if !defined(jit_redirector_size) || !defined(jit_indirector_size)
                /* If the function is recompilable, then we need an extra entry
                   point to properly redirect previous references to the 
function */
-               if(func->is_recompilable)
+               if(func->is_recompilable && !func->indirector)
                {
-                       recompilable_start = _jit_gen_redirector(&gen, func);
+                       /* TODO: use _jit_create_indirector() instead of
+                          _jit_gen_redirector() as both do the same. */
+                       func->indirector = _jit_gen_redirector(&gen, func);
                }
 #endif
 
@@ -842,22 +843,6 @@
 
        /* Record the entry point */
        func->entry_point = start;
-#if !defined(jit_redirector_size) || !defined(jit_indirector_size) || 
defined(JIT_BACKEND_INTERP)
-       if(recompilable_start)
-       {
-               func->closure_entry = recompilable_start;
-       }
-       else
-#else
-       /* If the function is recompilable, then we keep closure_entry
-          point to indirector to properly redirect previous references
-          to the function, otherwise we make it equal to the function
-          start */
-       if(!func->is_recompilable)
-#endif
-       {
-               func->closure_entry = start;
-       }
        func->is_compiled = 1;
 
        /* Free the builder structure, which we no longer require */
@@ -1040,7 +1025,11 @@
                                                          function_closure, 
(void *)func);
 #else
        /* On native platforms, use the closure entry point */
-       return func->closure_entry;
+       if(func->indirector && (!func->is_compiled || func->is_recompilable))
+       {
+               return func->indirector;
+       }
+       return func->entry_point;
 #endif
 }
 
@@ -1127,14 +1116,15 @@
        return func;
 #else
        /* On native platforms, the closure entry point is the vtable pointer */
-       if(func)
+       if(!func)
        {
-               return func->closure_entry;
+               return 0;
        }
-       else
+       if(func->indirector && (!func->is_compiled || func->is_recompilable))
        {
-               return 0;
+               return func->indirector;
        }
+       return func->entry_point;
 #endif
 }
 

Index: jit/jit-rules-x86.ins
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-rules-x86.ins,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- jit/jit-rules-x86.ins       17 Jan 2007 07:38:47 -0000      1.28
+++ jit/jit-rules-x86.ins       23 Jan 2007 06:42:33 -0000      1.29
@@ -1464,7 +1464,7 @@
 JIT_OP_CALL:
        [] -> {
                jit_function_t func = (jit_function_t)(insn->dest);
-               x86_call_code(inst, func->closure_entry);
+               x86_call_code(inst, jit_function_to_closure(func));
        }
 
 JIT_OP_CALL_TAIL:
@@ -1472,7 +1472,7 @@
                jit_function_t func = (jit_function_t)(insn->dest);
                x86_mov_reg_reg(inst, X86_ESP, X86_EBP, sizeof(void *));
                x86_pop_reg(inst, X86_EBP);
-               x86_jump_code(inst, func->closure_entry);
+               x86_jump_code(inst, jit_function_to_closure(func));
        }
 
 JIT_OP_CALL_INDIRECT:

Index: jit/jit-rules-alpha.ins
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-rules-alpha.ins,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- jit/jit-rules-alpha.ins     4 Jan 2007 02:27:04 -0000       1.7
+++ jit/jit-rules-alpha.ins     23 Jan 2007 06:42:33 -0000      1.8
@@ -410,7 +410,7 @@
 JIT_OP_CALL:
        [] -> {
                jit_function_t func = (jit_function_t)(insn->dest);
-               alpha_call(inst, func->closure_entry);
+               alpha_call(inst, jit_function_to_closure(func));
        }
 
 /* TODO: JIT_OP_CALL_TAIL, JIT_OP_CALL_INDIRECT, JIT_OP_CALL_VTABLE_PTR */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]