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-rules-alpha.c jit/jit-...


From: Thomas Cort
Subject: [dotgnu-pnet-commits] libjit ChangeLog jit/jit-rules-alpha.c jit/jit-...
Date: Sat, 12 Aug 2006 01:37:00 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    libjit
Changes by:     Thomas Cort <tcort>     06/08/12 01:37:00

Modified files:
        .              : ChangeLog 
        jit            : jit-rules-alpha.c jit-rules-alpha.ins 

Log message:
        Properly handle fixups on alpha. Implement JIT_OP_CALL_EXTERNAL.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libjit/ChangeLog?cvsroot=dotgnu-pnet&r1=1.246&r2=1.247
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-rules-alpha.c?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-rules-alpha.ins?cvsroot=dotgnu-pnet&r1=1.2&r2=1.3

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/ChangeLog,v
retrieving revision 1.246
retrieving revision 1.247
diff -u -b -r1.246 -r1.247
--- ChangeLog   29 Jul 2006 15:11:47 -0000      1.246
+++ ChangeLog   12 Aug 2006 01:36:59 -0000      1.247
@@ -1,3 +1,8 @@
+2006-08-11  Thomas Cort  <address@hidden>
+
+       * jit/jit-rules-alpha.c jit/jit-rules-alpha.ins Properly handle
+       fixups on alpha. Implement JIT_OP_CALL_EXTERNAL for alpha.
+
 2006-07-29  Aleksey Demakov  <address@hidden>
 
        * jit/jit-reg-alloc.c (use_cheapest_register): allow a register that

Index: jit/jit-rules-alpha.c
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-rules-alpha.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- jit/jit-rules-alpha.c       23 Jul 2006 04:45:36 -0000      1.4
+++ jit/jit-rules-alpha.c       12 Aug 2006 01:37:00 -0000      1.5
@@ -195,8 +195,12 @@
        /* Perform fixups on any blocks that jump to the epilog */
        fixup = (void **)(gen->epilog_fixup);
        while (fixup) {
+               alpha_inst code = (alpha_inst) fixup;
                next     = (void **)(fixup[0]);
-               fixup[0] = (void*) ((jit_nint) inst - (jit_nint) fixup - 4);
+
+               _alpha_li64(code,ALPHA_AT,inst);
+               alpha_jmp(code,ALPHA_ZERO,ALPHA_AT,1);
+
                fixup    = next;
        }
 
@@ -420,8 +424,12 @@
        fixup = (void **)(block->fixup_list);
 
        while (fixup) {
+               alpha_inst code = (alpha_inst) fixup;
                next     = (void **)(fixup[0]);
-               fixup[0] = (void*) ((jit_nint) block->address - (jit_nint) 
fixup - 4);
+
+               _alpha_li64(code,ALPHA_AT,(gen->posn.ptr));
+               alpha_jmp(code,ALPHA_ZERO,ALPHA_AT,1);
+
                fixup    = next;
        }
 
@@ -584,28 +592,28 @@
  */
 void alpha_output_branch(jit_function_t func, alpha_inst inst, int opcode, 
jit_insn_t insn, int reg) {
        jit_block_t block;
-       short int offset;
 
        if (!(block = jit_block_from_label(func, (jit_label_t)(insn->dest))))
                return;
 
        if (block->address) {
                /* We already know the address of the block */
-
-               offset = ((unsigned long) block->address - (unsigned long) 
inst);
+               short offset = ((unsigned long) block->address - (unsigned 
long) inst);
                alpha_encode_branch(inst,opcode,reg,offset);
 
        } else {
+               long *addr = (void*) inst;
+
                /* Output a placeholder and record on the block's fixup list */
+               *addr = (long) block->fixup_list;
+               inst++; inst++;
 
-               if(block->fixup_list) {
-                       offset = (short int) ((unsigned long int) inst - 
(unsigned long int) block->fixup_list);
-               } else {
-                       offset = 0;
-               }
-
-               alpha_encode_branch(inst,opcode,reg,offset);
-               block->fixup_list = inst - 4;
+               alpha_nop(inst);
+               alpha_nop(inst);
+               alpha_nop(inst);
+               alpha_nop(inst);
+               alpha_nop(inst);
+               alpha_nop(inst);
        }
 }
 
@@ -613,7 +621,7 @@
  * Jump to the current function's epilog.
  */
 void jump_to_epilog(jit_gencode_t gen, alpha_inst inst, jit_block_t block) {
-       short int offset;
+       long *addr = (void*) inst;
 
        /*
         * If the epilog is the next thing that we will output,
@@ -628,15 +636,30 @@
        if (!block)
                return;
 
+       /*
+        * fixups are slightly strange for the alpha port. On alpha you 
+        * cannot use an address stored in memory for jumps. The address 
+        * has to stored in a register.
+        *
+        * The fixups need the address stored in memory so that they can
+        * be 'fixed up' later. So what we do here is output the address
+        * and some nops. When it gets 'fixed up' we replace the address
+        * and 4 no-ops with opcodes to load the address into a register.
+        * Then we overwrite the last no-op with a jump opcode.
+        */
+
        /* Output a placeholder for the jump and add it to the fixup list */
-       if (gen->epilog_fixup) {
-               offset = (short int) ((unsigned long int) inst - (unsigned long 
int) gen->epilog_fixup);
-       } else {
-               offset = 0;
-       }
+       *addr = (long) gen->epilog_fixup;
+       inst++; inst++;
+
+       alpha_nop(inst);
+       alpha_nop(inst);
+       alpha_nop(inst);
+       alpha_nop(inst);
+       alpha_nop(inst);
+       alpha_nop(inst);        /* to be overwritten later with jmp */
 
-       alpha_br(inst, ALPHA_ZERO, offset);
-       gen->epilog_fixup = inst - 4;
+       (gen)->posn.ptr = (char*) inst;
 }
 
 #endif /* JIT_BACKEND_ALPHA */

Index: jit/jit-rules-alpha.ins
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-rules-alpha.ins,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- jit/jit-rules-alpha.ins     23 Jul 2006 04:45:36 -0000      1.2
+++ jit/jit-rules-alpha.ins     12 Aug 2006 01:37:00 -0000      1.3
@@ -396,3 +396,9 @@
        }
 
 /* TODO: JIT_OP_RETURN_FLOAT32 JIT_OP_RETURN_FLOAT64 JIT_OP_RETURN_NFLOAT */
+
+JIT_OP_CALL_EXTERNAL:
+       [] -> {
+               alpha_call(inst, (insn->dest));
+       }
+




reply via email to

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