X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=progs%2Fdeepjit.s;fp=progs%2Fdeepjit.s;h=cbef6eab23ed6657b1e7996a72184832b83d74de;hb=36d08272f76ae5df1682abcc71c394c958ad0778;hp=0ee92ceee9a4abea1880828b01ec1f81e28f4238;hpb=1008cb9007e11df5bbc5e447d11f9990ca14aa9b;p=calu.git diff --git a/progs/deepjit.s b/progs/deepjit.s index 0ee92ce..cbef6ea 100644 --- a/progs/deepjit.s +++ b/progs/deepjit.s @@ -31,11 +31,11 @@ instrtable: .fill 42, 0 prog_eof: -.ifill pop r0 +.ifill pop r7 +.ifill mov r0, r6 .ifill ret+ prog_mul: -.ifill pop r6 .ifill pop r7 .ifill ldis r8, 0;0xed400004 .ifill mov r0, r7;0xe1038000 @@ -48,60 +48,52 @@ prog_mul: .ifill adddnz r8, r8, r6;0x00443001 .ifill subi r7, r7, 2;0xe1bb8010 .fill 0x0b7ffe83;brnz+ loop -.ifill push r8 +.ifill mov r6, r8 prog_consts: -.fill 0xed300004;ldis r6, CONST .ifill push r6 +.fill 0xed300004;ldis r6, CONST prog_add: -.ifill pop r6 .ifill pop r7 -.ifill add r7, r7, r6;0xe03bb000 -.ifill push r7 +.ifill add r6, r7, r6;0xe03bb000 prog_sub: -.ifill pop r6 .ifill pop r7 .ifill sub r7, r7, r6;0xe0bbb000 -.ifill push r7 +.ifill mov r6, r7 prog_lessthan: -.ifill pop r6 .ifill pop r7 .ifill cmp r7, r6;0xec3b0000 -.ifill pushlt r14 -.ifill pushge r15 +.ifill movdlt r6, r14 +.ifill movge r6, r15 prog_dup: -.ifill fetch r6 .ifill push r6 prog_jmp: -.ifill pop r6 .ifill cmpi r6,0;0xecb00000 +.ifill pop r6 ;static calced .fill 1, 0x1b000103;breq- vm_next .fill 1, 0xeb000003;br+ CONST prog_imm: +.ifill push r6 .fill 1, 0xed300000;ldil r6, CONST .fill 1, 0xed300002;ldih r6, CONST -.ifill push r6 prog_pop: -.ifill disc +.ifill pop r6 prog_xch: -.ifill pop r6 .ifill pop r7 .ifill push r6 -.ifill push r7 +.ifill mov r6, r7 prog_not: -.ifill pop r6 .ifill not r6;0xe4b7fffa -.ifill push r6 .text .org 0 @@ -204,7 +196,6 @@ jit: ;backup defer table address mov r10, r9 - ;decrement address to input by 1 br+ vm_loop_1 vm_default: @@ -235,6 +226,8 @@ vm_eof: stw r0, PDATA(r13) ldw r0, 4(r4) stw r0, PDATA(r13) + ldw r0, 8(r4) + stw r0, PDATA(r13) ;end of program ;now it is time to clear up the defer table @@ -302,11 +295,9 @@ vm_mul: PROGINSTR ldw r0, 44(r14) PROGINSTR - ldw r0, 48(r14) - PROGINSTR ;increment address - addi r2, r2, 13 + addi r2, r2, 12 br+ vm_loop @@ -322,13 +313,9 @@ vm_add: PROGINSTR ldw r0, 4(r4) PROGINSTR - ldw r0, 8(r4) - PROGINSTR - ldw r0, 12(r4) - PROGINSTR ;increment address - addi r2, r2, 4 + addi r2, r2, 2 br+ vm_loop @@ -346,11 +333,9 @@ vm_sub: PROGINSTR ldw r0, 8(r4) PROGINSTR - ldw r0, 12(r4) - PROGINSTR ;increment address - addi r2, r2, 4 + addi r2, r2, 3 br+ vm_loop @@ -359,6 +344,8 @@ vm_sub: vm_consts: ;program instruction (3) ldw r0, 0(r15) + PROGINSTR + ldw r0, 4(r15) ;the first instr. loads r6 with the number ;thus we shall emulate this @@ -372,8 +359,6 @@ vm_consts: ;store this 'dynamic' instruction PROGINSTR - ldw r0, 4(r15) - PROGINSTR ;increment address addi r2, r2, 2 @@ -396,11 +381,9 @@ vm_lessthan: PROGINSTR ldw r0, 12(r4) PROGINSTR - ldw r0, 16(r4) - PROGINSTR ;increment address - addi r2, r2, 5 + addi r2, r2, 4 br+ vm_loop @@ -413,11 +396,9 @@ vm_dup: ;program instruction (3) ldw r0, 0(r4) PROGINSTR - ldw r0, 4(r4) - PROGINSTR ;increment address - addi r2, r2, 2 + addi r2, r2, 1 br+ vm_loop @@ -453,29 +434,26 @@ vm_imm: ldil r4, prog_imm@lo ldih r4, prog_imm@hi + ldw r0, 0(r4) + PROGINSTR + ;save r6 to r7 mov r7, r6 ;generate 1st instr - ldw r0, 0(r4) + ldw r0, 4(r4) andx r6, 0xFFFF lls r6, r6, 3 or r0, r0, r6 PROGINSTR ;generate 2nd instr - ldw r0, 4(r4) + ldw r0, 8(r4) andxh r7, 0xFFFF lrs r7, r7, 13 or r0, r0, r7 PROGINSTR - ;now we program the instructions that will save the - ;immediate onto the stack and increment the later - - ldw r0, 8(r4) - PROGINSTR - ;increment address addi r2, r2, 3 @@ -495,13 +473,13 @@ vm_jmp: ldil r4, prog_jmp@lo ldih r4, prog_jmp@hi - ;program instruction (2) - ;pop r6 + ;compare to 0 + ;cmpi r6,0 ldw r0, 0(r4) PROGINSTR - ;compare to 0 - ;cmpi r6,0 + ;program instruction (2) + ;pop r6 ldw r0, 4(r4) PROGINSTR @@ -612,11 +590,9 @@ vm_xch: PROGINSTR ldw r0, 8(r4) PROGINSTR - ldw r0, 12(r4) - PROGINSTR ;increment address - addi r2, r2, 4 + addi r2, r2, 3 br+ vm_loop @@ -630,13 +606,9 @@ vm_not: ;program instruction (3) ldw r0, 0(r4) PROGINSTR - ldw r0, 4(r4) - PROGINSTR - ldw r0, 8(r4) - PROGINSTR ;increment address - addi r2, r2, 3 + addi r2, r2, 1 br+ vm_loop