aboutsummaryrefslogtreecommitdiff
path: root/elymas/lib
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2015-05-13 13:23:45 +0200
committerDrahflow <drahflow@gmx.de>2015-05-13 13:24:42 +0200
commit505524b45f59263fb29057e829b9a39ef86e0e99 (patch)
treee0d0b859c7e9d317fe3f544dc824177001a2aa7b /elymas/lib
parenta50ac40758fe485807035e88f5e203c93f267dbc (diff)
Use nametable templating
Diffstat (limited to 'elymas/lib')
-rw-r--r--elymas/lib/sys/opt.ey42
1 files changed, 41 insertions, 1 deletions
diff --git a/elymas/lib/sys/opt.ey b/elymas/lib/sys/opt.ey
index 506e0d1..0adef46 100644
--- a/elymas/lib/sys/opt.ey
+++ b/elymas/lib/sys/opt.ey
@@ -19,6 +19,8 @@
} ":" defq
sys .asm "::" via
sys .asm .|peek ==:peek
+ { [ -01 _ 4 add range peek each ] 256 math .unbase } =*:peeku32
+ { [ -01 _ 8 add range peek each ] 256 math .unbase } =*:peeku64
[
8 /r15 :subqImm8Reg
@@ -218,6 +220,35 @@
} each
} /testAllocatedScopeEscape deffst
+ 0 ==templateNametable
+ {
+ 1 ==templatable
+ executingScope ::rawAddress 8 add peeku64 ==nameTableAddress
+ nameTableAddress {
+ nameTableAddress peeku32 ==nameTableLength
+ 0 nameTableLength 16 sub 16 div range 16 mul nameTableAddress 16 add add { ==entryAddr
+ entryAddr peeku64 ==keyAddr
+ keyAddr {
+ entryAddr 8 add peeku32 %10 band not {
+ 0 =templatable
+ "NOT templatable because" dump
+ nameTableAddress dump
+ keyAddr ::rawObject dump
+ } rep
+ } { } ? *
+ } each
+ } {
+ 0 =templatable
+ } ? *
+
+ templatable {
+ nameTableAddress =templateNametable
+ "Setting template bit on " dump
+ nameTableAddress dump
+ nameTableAddress 7 add _ sys .asm .peek %04 bor -01 sys .asm .poke # set template bit
+ } rep
+ } /testNametableTemplatability deffst
+
{ ==logic
[ NOP ] ==last
[ logic { ==entry 0 entry * ==action
@@ -757,8 +788,8 @@
# [ :ud2 ] emitOpcodes # enable for further development
-
newLogic
+ testNametableTemplatability
testScopeModifications
containsScopeModifications not {
rewriteConstantPipe
@@ -806,6 +837,15 @@
/r15 /r14 :movqRegReg
] emitOpcodes
}" ? *
+
+ templateNametable {
+ [
+ templateNametable /rax :movqImmReg
+ /rax 8 /r14 :movqRegMemDisp8
+ ] emitOpcodes
+
+ templateNametable emitReference
+ } { } ? *
}" {
[
8 /r15 :subqImm8Reg