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-apply-func.h jit/jit...


From: Aleksey Demakov
Subject: [dotgnu-pnet-commits] libjit ./ChangeLog jit/jit-apply-func.h jit/jit...
Date: Thu, 06 Apr 2006 23:42:31 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    libjit
Branch:         
Changes by:     Aleksey Demakov <address@hidden>        06/04/06 23:42:31

Modified files:
        .              : ChangeLog 
        jit            : jit-apply-func.h jit-apply-x86.c 
                         jit-apply-x86.h jit-function.c jit-insn.c 
                         jit-internal.h 

Log message:
        Added function entry point indirector. Fixed tail call bug.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/libjit/ChangeLog.diff?tr1=1.211&tr2=1.212&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/libjit/jit/jit-apply-func.h.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/libjit/jit/jit-apply-x86.c.diff?tr1=1.1.1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/libjit/jit/jit-apply-x86.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/libjit/jit/jit-function.c.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/libjit/jit/jit-insn.c.diff?tr1=1.43&tr2=1.44&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/libjit/jit/jit-internal.h.diff?tr1=1.21&tr2=1.22&r1=text&r2=text

Patches:
Index: libjit/ChangeLog
diff -u libjit/ChangeLog:1.211 libjit/ChangeLog:1.212
--- libjit/ChangeLog:1.211      Mon Apr  3 05:10:35 2006
+++ libjit/ChangeLog    Thu Apr  6 23:42:31 2006
@@ -1,3 +1,17 @@
+2006-04-07  Klaus Treichel  <address@hidden>
+
+       * jit/jit-internal.h (struct _jit_function): add indirector field.
+       * jit/jit-function.c (jit_function_compile, jit_function_create):
+         use indirector.
+       * jit/jit-apply-x86.h: define jit_indirector_size.
+       * jit/jit-apply-func.h, jit/jit-apply-x86.c (_jit_create_indirector):
+         add function that emits indirector code.
+
+2006-04-07  Aleksey Demakov  <address@hidden>
+
+       * jit/jit-insn.c (create_call_setup_insns): zero struct_return
+       in case of tail calls (the problem was found by Klaus).
+
 2006-04-03  Aleksey Demakov  <address@hidden>
 
        * tools/gen-rules-scanner.l:
Index: libjit/jit/jit-apply-func.h
diff -u libjit/jit/jit-apply-func.h:1.2 libjit/jit/jit-apply-func.h:1.3
--- libjit/jit/jit-apply-func.h:1.2     Fri Jun 25 06:24:40 2004
+++ libjit/jit/jit-apply-func.h Thu Apr  6 23:42:31 2006
@@ -78,6 +78,12 @@
 void *_jit_create_redirector(unsigned char *buf, void *func,
                                                         void *user_data, int 
abi);
 
+
+/*
+ * Create the indirector for the function.
+ */
+void *_jit_create_indirector(unsigned char *buf, void **entry);
+
 /*
  * Pad a buffer with NOP instructions.  Used to align code.
  * This will only be called if "jit_should_pad" is defined.
Index: libjit/jit/jit-apply-x86.c
diff -u libjit/jit/jit-apply-x86.c:1.1.1.1 libjit/jit/jit-apply-x86.c:1.2
--- libjit/jit/jit-apply-x86.c:1.1.1.1  Fri Apr 30 23:29:55 2004
+++ libjit/jit/jit-apply-x86.c  Thu Apr  6 23:42:31 2006
@@ -211,6 +211,16 @@
        return start;
 }
 
+void *_jit_create_indirector(unsigned char *buf, void **entry)
+{
+       void *start = (void *)buf;
+
+       /* Jump to the entry point. */
+       x86_jump_mem(buf, entry);
+
+       return start;
+}
+
 void _jit_pad_buffer(unsigned char *buf, int len)
 {
        while(len >= 6)
Index: libjit/jit/jit-apply-x86.h
diff -u libjit/jit/jit-apply-x86.h:1.3 libjit/jit/jit-apply-x86.h:1.4
--- libjit/jit/jit-apply-x86.h:1.3      Sun Jan  8 04:25:24 2006
+++ libjit/jit/jit-apply-x86.h  Thu Apr  6 23:42:31 2006
@@ -349,6 +349,12 @@
 #define        jit_redirector_size             32
 
 /*
+ * The number of bytes that are needed for a indirector stub.
+ * This includes any extra bytes that are needed for alignment.
+ */
+#define        jit_indirector_size             8
+
+/*
  * We should pad unused code space with NOP's.
  */
 #define        jit_should_pad                  1
Index: libjit/jit/jit-function.c
diff -u libjit/jit/jit-function.c:1.17 libjit/jit/jit-function.c:1.18
--- libjit/jit/jit-function.c:1.17      Tue Jan 10 21:03:44 2006
+++ libjit/jit/jit-function.c   Thu Apr  6 23:42:31 2006
@@ -65,7 +65,12 @@
        func->entry_point = _jit_create_redirector
                (func->redirector, (void *)_jit_function_compile_on_demand,
                 func, jit_type_get_abi(signature));
+# if defined(jit_indirector_size)
+       func->closure_entry = _jit_create_indirector
+               (func->indirector, (void**) &(func->entry_point));
+# else
        func->closure_entry = func->entry_point;
+# endif
 #endif
 
        /* Add the function to the context list */
@@ -571,7 +576,9 @@
        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;
@@ -691,12 +698,14 @@
                }
 #endif
 
+#if !defined(jit_redirector_size) || !defined(jit_indirector_size) || 
defined(JIT_BACKEND_INTERP)
                /* If the function is recompilable, then we need an extra entry
                   point to properly redirect previous references to the 
function */
                if(func->is_recompilable)
                {
                        recompilable_start = _jit_gen_redirector(&gen, func);
                }
+#endif
 
                /* End the function's output process */
                result = _jit_cache_end_method(&(gen.posn));
@@ -747,11 +756,19 @@
 
        /* 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;
        }
Index: libjit/jit/jit-insn.c
diff -u libjit/jit/jit-insn.c:1.43 libjit/jit/jit-insn.c:1.44
--- libjit/jit/jit-insn.c:1.43  Sun Mar 12 20:04:39 2006
+++ libjit/jit/jit-insn.c       Thu Apr  6 23:42:31 2006
@@ -5213,6 +5213,7 @@
                                return 0;
                        }
                }
+               *struct_return = 0;
                return 1;
        }
 
Index: libjit/jit/jit-internal.h
diff -u libjit/jit/jit-internal.h:1.21 libjit/jit/jit-internal.h:1.22
--- libjit/jit/jit-internal.h:1.21      Mon Feb 13 09:26:18 2006
+++ libjit/jit/jit-internal.h   Thu Apr  6 23:42:31 2006
@@ -394,6 +394,12 @@
           Redirectors are used to support on-demand compilation */
        unsigned char           redirector[jit_redirector_size];
 #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. */
+       unsigned char           indirector[jit_indirector_size];
+#endif
 };
 
 /*




reply via email to

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