deepsh^B^Bjit: w00t, von 2491 (vm.s) -> 1665 (deepjit.s)
authorBernhard Urban <lewurm@gmail.com>
Tue, 21 Dec 2010 18:43:32 +0000 (19:43 +0100)
committerBernhard Urban <lewurm@gmail.com>
Tue, 21 Dec 2010 18:43:32 +0000 (19:43 +0100)
ftw!!!

3_test/deepjit.s
3_test/vm.s [new symlink]

index ae87d687a9732efd0ceec2ce590cc09add53abad..a786bf4c80297dbf013c037d493247958522b62e 100644 (file)
@@ -87,7 +87,7 @@ prog_jmp:
 .ifill ldw r6, 0(r3);0xe7318000
 .ifill cmpi r6,0;0xecb00000
 ;static calced
-.fill 1, 0xbb000103;breq- vm_next
+.fill 1, 0x1b000103;breq- vm_next
 .fill 1, 0xeb000003;br+ CONST
 
 prog_imm:
@@ -125,8 +125,8 @@ main:
        ldih r3, instrtable@hi
 
        ;set address to defer table
-       ldil r9, instrtable@lo
-       ldih r9, instrtable@hi
+       ldil r9, defertable@lo
+       ldih r9, defertable@hi
 
 
        ;call jit compiler
@@ -209,6 +209,7 @@ vm_defer:
 
        ;generate branch
        sub r11, r6, r8
+       lrs r11, r11, 2
        ;set the upper 16 bit 0
        andx r11, 0xFFFF
        ;shift to the position of imm in br
@@ -487,9 +488,9 @@ vm_jmp:
        stx r0, 12(r2)
 
        ;r8 has now the current base
-       ldw r8, 0(r3)
+       ;ldw r8, 0-4(r3)
        ;we add the offset to this instruction
-       addi r8, r8, 12
+       addi r8, r2, 16
 
 
        ;we know calculate the jump destination
@@ -508,15 +509,16 @@ vm_jmp:
        ;r6 is now the 'real' negativ number
        or r6, r6, r7
        ;todo: testing showed (at least once) we are off by 2 instr.
-       addi r6, r6, 2
+       ;addi r6, r6, 2
        ;multiply by to get the offset
        lls r6, r6, 2
        ;generate address in table
        add r6, r3, r6
        ;r0 now has the target address
+       ;todo: 0-4?
        ldw r0, 0(r6)
        ;we calc the offset
-       sub r8, r0, r2
+       sub r8, r0, r8
        ;we shift 2 bits out, because rel. br takes instr.
        ;count and not address amount ...
        lrs r8, r8, 2
@@ -543,7 +545,7 @@ vm_possign:
        stw r8, 4(r9)
 
        ;todo: check if -1 is needed
-       subi r6, r6, 1
+       ;subi r6, r6, 1
        ;multiply with 2 to get offset right
        lls r6, r6, 2
        ;add to current base
diff --git a/3_test/vm.s b/3_test/vm.s
new file mode 120000 (symlink)
index 0000000..15350bc
--- /dev/null
@@ -0,0 +1 @@
+../8_benchs/src/vm.s
\ No newline at end of file