mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-08-09 01:25:00 +00:00
re-arrange a few things
This commit is contained in:
@@ -25,7 +25,7 @@ end
|
|||||||
// JIT compiler entry
|
// JIT compiler entry
|
||||||
//
|
//
|
||||||
def compiler(defptr)#0
|
def compiler(defptr)#0
|
||||||
word codeptr, isdata, addrxlate, bytecode, i, case, dest, VX, VY
|
word codeptr, isdata[], addrxlate, bytecode, i, case, dest, VX, VY
|
||||||
byte opcode, j, A_IS_TOSL
|
byte opcode, j, A_IS_TOSL
|
||||||
|
|
||||||
//puts("JIT compiler invoked for :$"); puth(defptr=>bytecodeaddr); putln
|
//puts("JIT compiler invoked for :$"); puth(defptr=>bytecodeaddr); putln
|
||||||
@@ -38,7 +38,6 @@ def compiler(defptr)#0
|
|||||||
return
|
return
|
||||||
fin
|
fin
|
||||||
addrxlate = heapmark
|
addrxlate = heapmark
|
||||||
memset(addrxlate, 0, 512) // Clear xlate buffer
|
|
||||||
//
|
//
|
||||||
// Copy bytecode def from AUX to heap for compiling
|
// Copy bytecode def from AUX to heap for compiling
|
||||||
//
|
//
|
||||||
@@ -52,19 +51,13 @@ def compiler(defptr)#0
|
|||||||
// All PLASMA ops are even (LSB clear), so this will flag when to fence optimizations
|
// All PLASMA ops are even (LSB clear), so this will flag when to fence optimizations
|
||||||
// During compiling.
|
// During compiling.
|
||||||
//
|
//
|
||||||
isdata = addrxlate // Use this buffer
|
//isdata = addrxlate // Use this buffer
|
||||||
|
memset(isdata, 0, 256) // Clear isdata buffer
|
||||||
i = 0
|
i = 0
|
||||||
while i <= defptr->bytecodesize
|
while i <= defptr->bytecodesize
|
||||||
if not ^(isdata+i)
|
if not ^(isdata+i)
|
||||||
when ^(bytecode+i) & $FE
|
when ^(bytecode+i) & $FE
|
||||||
//
|
//
|
||||||
// Multi-byte operands
|
|
||||||
//
|
|
||||||
is $2E // CS
|
|
||||||
i++
|
|
||||||
i = i + ^(bytecode+i)
|
|
||||||
break
|
|
||||||
//
|
|
||||||
// Double byte operands
|
// Double byte operands
|
||||||
//
|
//
|
||||||
is $26 // LA
|
is $26 // LA
|
||||||
@@ -81,7 +74,13 @@ def compiler(defptr)#0
|
|||||||
is $B6 // ADDAW
|
is $B6 // ADDAW
|
||||||
is $BC // IDXAB
|
is $BC // IDXAB
|
||||||
is $BE // IDXAW
|
is $BE // IDXAW
|
||||||
i++
|
i = i + 2
|
||||||
|
break
|
||||||
|
//
|
||||||
|
// Multi-byte operands
|
||||||
|
//
|
||||||
|
is $2E // CS
|
||||||
|
i = i + ^(bytecode+i+1)
|
||||||
//
|
//
|
||||||
// Single byte operands
|
// Single byte operands
|
||||||
//
|
//
|
||||||
@@ -122,12 +121,9 @@ def compiler(defptr)#0
|
|||||||
is $AC // BRAND
|
is $AC // BRAND
|
||||||
is $AE // BROR
|
is $AE // BROR
|
||||||
i++
|
i++
|
||||||
//
|
|
||||||
// Flag branch destination
|
|
||||||
//
|
|
||||||
dest = i + *(bytecode+i)
|
dest = i + *(bytecode+i)
|
||||||
^(bytecode+dest) = ^(bytecode+dest) | 1
|
|
||||||
i++
|
i++
|
||||||
|
^(bytecode+dest) = ^(bytecode+dest) | 1 // Flag as branch dest
|
||||||
break
|
break
|
||||||
//
|
//
|
||||||
// SELect/caseblock
|
// SELect/caseblock
|
||||||
@@ -153,10 +149,10 @@ def compiler(defptr)#0
|
|||||||
fin
|
fin
|
||||||
i++
|
i++
|
||||||
loop
|
loop
|
||||||
memset(isdata, 0, 256) // Clear part of xlate buffer used for isdata
|
|
||||||
//
|
//
|
||||||
// Compile the bytecodes
|
// Compile the bytecodes
|
||||||
//
|
//
|
||||||
|
memset(addrxlate, 0, 512) // Clear xlate buffer
|
||||||
codeptr = *jitcodeptr
|
codeptr = *jitcodeptr
|
||||||
A_IS_TOSL = FALSE
|
A_IS_TOSL = FALSE
|
||||||
VY = UNKNOWN // Virtual Y register
|
VY = UNKNOWN // Virtual Y register
|
||||||
|
Reference in New Issue
Block a user