aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2013-09-27 22:41:44 +0200
committerDrahflow <drahflow@gmx.de>2013-09-27 22:41:44 +0200
commit7bac36eb5770408963b97f183dd8214c698f41a8 (patch)
tree15a4aeb35d1a80a8133d1fba69f4b95a005b2ef2
parentf6af44d6742d96ecf002eb24475ecc23bf3d2d72 (diff)
Direct static access by offset /r14 :pushqMemDisp8
-rw-r--r--compiler/elymasAsmLib.ey2
-rw-r--r--elymas/lib/sys/opt.ey45
2 files changed, 37 insertions, 10 deletions
diff --git a/compiler/elymasAsmLib.ey b/compiler/elymasAsmLib.ey
index f08c643..96d2a1a 100644
--- a/compiler/elymasAsmLib.ey
+++ b/compiler/elymasAsmLib.ey
@@ -81,7 +81,7 @@
{ %00 %00 %00 %00 %00 %50 %00 %00 } /BLOCKBASE deff
{ %00 %00 %00 %00 %00 %40 %00 %00 } /MARKBASE deff
# 4096 16 mul 8 mul ==ALLOCCHUNKSIZE # minimum ALLOCCHUNKSIZE
- 4096 16 mul 8 mul 16 mul ==ALLOCCHUNKSIZE # FIXME: there is still some wonkyness with freezing
+ 4096 16 mul 8 mul 64 mul ==ALLOCCHUNKSIZE # FIXME: there is still some wonkyness with freezing
<
# current end of heap memory (grows upwards)
diff --git a/elymas/lib/sys/opt.ey b/elymas/lib/sys/opt.ey
index c693f7f..28faa9b 100644
--- a/elymas/lib/sys/opt.ey
+++ b/elymas/lib/sys/opt.ey
@@ -106,6 +106,16 @@
[
8 /r15 :subqImm8Reg
/r15 :popqMem
+ 0 /rax :movqImmReg
+ /rax :pushqReg
+ /r15 :pushqMem
+ 8 /r15 :addqImm8Reg
+ :retn
+ ] ==:customFunctionConstantPassivePattern
+
+ [
+ 8 /r15 :subqImm8Reg
+ /r15 :popqMem
] ==:customFunctionHeaderPattern
/NOP ==:NOP
@@ -409,6 +419,12 @@
] conds
}
+ { customFunctionConstantPassivePattern callTargetMatch }' {
+ [ calledAddress 9 add _ 8 add range peek each ] 256 math .unbase ==pushedConstant
+
+ [ PUSH pushedConstant ] emitLogic
+ }
+
{ customFunctionHeaderPattern callTargetMatch }' {
[ CALL calledAddress ] emitLogic
}
@@ -504,16 +520,27 @@
{ action [ STATIC STATICTYPED ] streq any }' {
[
- /r14 /rax :movqRegReg
- 2 entry { 16 /rax /rax :movqMemDisp8Reg } rep
-
- 3 entry {
- 24 /rax /rcx :movqMemDisp8Reg # load extension area pointer
- /rax /edx :movlMemReg # load scope length
- /rdx :negqReg # prepare for substraction # TODO the length calculation could be done beforehand
- 1 entry 1 /rdx /rcx :pushqMemIndexScaleDisp32 # push loaded entry to stack
+ 2 entry {
+ 16 /r14 /rax :movqMemDisp8Reg
+ 2 entry 1 sub { 16 /rax /rax :movqMemDisp8Reg } rep
+
+ 3 entry {
+ 24 /rax /rcx :movqMemDisp8Reg # load extension area pointer
+ /rax /edx :movlMemReg # load scope length
+ /rdx :negqReg # prepare for substraction # TODO the length calculation could be done beforehand
+ 1 entry 1 /rdx /rcx :pushqMemIndexScaleDisp32 # push loaded entry to stack
+ } {
+ 1 entry /rax :pushqMemDisp32
+ } ? *
} {
- 1 entry /rax :pushqMemDisp32
+ 3 entry {
+ 24 /r14 /rcx :movqMemDisp8Reg # load extension area pointer
+ /r14 /edx :movlMemReg # load scope length
+ /rdx :negqReg # prepare for substraction # TODO the length calculation could be done beforehand
+ 1 entry 1 /rdx /rcx :pushqMemIndexScaleDisp32 # push loaded entry to stack
+ } {
+ 1 entry /r14 :pushqMemDisp32
+ } ? *
} ? *
] emitOpcodes
}