From: Bernhard Urban Date: Tue, 21 Dec 2010 18:43:32 +0000 (+0100) Subject: deepsh^B^Bjit: w00t, von 2491 (vm.s) -> 1665 (deepjit.s) X-Git-Tag: bootrom_v1~49 X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=calu.git;a=commitdiff_plain;h=d90308659c1e3009cd0ca673a0fdb13f0499bc21 deepsh^B^Bjit: w00t, von 2491 (vm.s) -> 1665 (deepjit.s) ftw!!! --- diff --git a/3_test/deepjit.s b/3_test/deepjit.s index ae87d68..a786bf4 100644 --- a/3_test/deepjit.s +++ b/3_test/deepjit.s @@ -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 index 0000000..15350bc --- /dev/null +++ b/3_test/vm.s @@ -0,0 +1 @@ +../8_benchs/src/vm.s \ No newline at end of file