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

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

[dotgnu-pnet-commits] libjit ChangeLog include/jit/jit-context.h jit/...


From: Aleksey Demakov
Subject: [dotgnu-pnet-commits] libjit ChangeLog include/jit/jit-context.h jit/...
Date: Sun, 26 Nov 2006 20:42:01 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    libjit
Changes by:     Aleksey Demakov <avd>   06/11/26 20:42:01

Modified files:
        .              : ChangeLog 
        include/jit    : jit-context.h 
        jit            : jit-context.c jit-internal.h jit-function.c 
                         jit-rules-x86.ins 

Log message:
        add POSITION_INDEPENDENT context option

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libjit/ChangeLog?cvsroot=dotgnu-pnet&r1=1.282&r2=1.283
http://cvs.savannah.gnu.org/viewcvs/libjit/include/jit/jit-context.h?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-context.c?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-internal.h?cvsroot=dotgnu-pnet&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-function.c?cvsroot=dotgnu-pnet&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-rules-x86.ins?cvsroot=dotgnu-pnet&r1=1.23&r2=1.24

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/ChangeLog,v
retrieving revision 1.282
retrieving revision 1.283
diff -u -b -r1.282 -r1.283
--- ChangeLog   26 Nov 2006 16:34:26 -0000      1.282
+++ ChangeLog   26 Nov 2006 20:42:01 -0000      1.283
@@ -1,3 +1,12 @@
+2006-11-27  Aleksey Demakov  <address@hidden>
+
+       * include/jit/jit-context.h: add JIT_OPTION_POSITION_INDEPENDENT
+       option.
+       * jit/jit-internal.h (struct _jit_builder): add position_independent
+       field.
+       * jit/jit-function.c (_jit_function_ensure_builder): initialize
+       position_independent field.
+
 2006-11-26  Kirill Kononenko  <address@hidden>
 
        * jit/jit-rules-x86.ins: if JIT_USE_SIGNALS is defined do not emit

Index: include/jit/jit-context.h
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/include/jit/jit-context.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- include/jit/jit-context.h   6 Oct 2004 05:43:15 -0000       1.5
+++ include/jit/jit-context.h   26 Nov 2006 20:42:01 -0000      1.6
@@ -49,6 +49,7 @@
 #define        JIT_OPTION_CACHE_PAGE_SIZE      10001
 #define        JIT_OPTION_PRE_COMPILE          10002
 #define        JIT_OPTION_DONT_FOLD            10003
+#define JIT_OPTION_POSITION_INDEPENDENT        10004
 
 #ifdef __cplusplus
 };

Index: jit/jit-context.c
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-context.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- jit/jit-context.c   6 Oct 2004 05:43:15 -0000       1.5
+++ jit/jit-context.c   26 Nov 2006 20:42:01 -0000      1.6
@@ -213,6 +213,12 @@
  * A numeric option that disables constant folding when it is set to a
  * non-zero value.  This is useful for debugging, as it forces @code{libjit} to
  * always execute constant expressions at run time, instead of at compile time.
+ *
+ * @vindex JIT_OPTION_POSITION_INDEPENDENT
+ * @item JIT_OPTION_POSITION_INDEPENDENT
+ * A numeric option that forces generation of position-independent code (PIC)
+ * if it is set to a non-zero value. This may be mainly useful for pre-compiled
+ * contexts.
  * @end table
  *
  * Metadata type values of 10000 or greater are reserved for internal use.

Index: jit/jit-internal.h
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-internal.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- jit/jit-internal.h  22 Aug 2006 20:55:31 -0000      1.25
+++ jit/jit-internal.h  26 Nov 2006 20:42:01 -0000      1.26
@@ -322,6 +322,9 @@
        /* Flag that indicates that the current function contains a tail call */
        int                                     has_tail_call : 1;
 
+       /* Generate position-independent code */
+       int                                     position_independent : 1;
+
        /* List of all instructions in this function */
        jit_insn_t                 *insns;
        int                                     num_insns;

Index: jit/jit-function.c
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-function.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- jit/jit-function.c  30 Aug 2006 13:31:58 -0000      1.22
+++ jit/jit-function.c  26 Nov 2006 20:42:01 -0000      1.23
@@ -180,6 +180,11 @@
                return 0;
        }
 
+       /* Cache the value of the JIT_OPTION_POSITION_INDEPENDENT option */
+       func->builder->position_independent
+               = jit_context_get_meta_numeric(
+                       func->context, JIT_OPTION_POSITION_INDEPENDENT);
+
        /* Initialize the function builder */
        jit_memory_pool_init(&(func->builder->value_pool), struct _jit_value);
        jit_memory_pool_init(&(func->builder->insn_pool), struct _jit_insn);

Index: jit/jit-rules-x86.ins
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-rules-x86.ins,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- jit/jit-rules-x86.ins       26 Nov 2006 16:34:26 -0000      1.23
+++ jit/jit-rules-x86.ins       26 Nov 2006 20:42:01 -0000      1.24
@@ -1700,6 +1700,13 @@
 JIT_OP_ADDRESS_OF_LABEL:
        [=reg] -> {
                block = jit_block_from_label(func, (jit_label_t)(insn->value1));
+               if(func->builder->position_independent)
+               {
+                       /* TODO */
+                       TODO();
+               }
+               else
+               {
                if(block->address)
                {
                        x86_mov_reg_imm(inst, $1, block->address);
@@ -1711,6 +1718,7 @@
                        block->fixup_absolute_list = (void *)(inst - 4);
                }
        }
+       }
 
 /*
  * Data manipulation.
@@ -2395,6 +2403,13 @@
                patch_fall_through = inst;
                x86_branch32(inst, X86_CC_GE, 0, 1);
 
+               if(func->builder->position_independent)
+               {
+                       /* TODO */
+                       TODO();
+               }
+               else
+               {
                patch_jump_table = inst;
                x86_jump_memindex(inst, X86_NOBASEREG, 0, $1, 2);
                while(((jit_nint) inst & (sizeof(void*) - 1)) != 0)
@@ -2404,6 +2419,7 @@
 
                // displacement goes after opcode. ModR/M, and SIB bytes
                *((void **)(patch_jump_table + 3)) = inst;
+               }
 
                for(index = 0; index < num_labels; index++)
                {
@@ -2413,6 +2429,13 @@
                                return;
                        }
 
+                       if(func->builder->position_independent)
+                       {
+                               /* TODO */
+                               TODO();
+                       }
+                       else
+                       {
                        if(block->address)
                        {
                                x86_imm_emit32(inst, block->address);
@@ -2424,6 +2447,7 @@
                                block->fixup_absolute_list = (void *)(inst - 4);
                        }
                }
+               }
 
                x86_patch(patch_fall_through, inst);
        }




reply via email to

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