aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2015-06-16 10:18:09 +0200
committerDrahflow <drahflow@gmx.de>2015-06-16 10:18:09 +0200
commitbb1350d1d6c02b5b58fee760420ad7d132524ab9 (patch)
treee955e2dfb42daa0df4f21823145b9ce7c3317459 /compiler
parenta30775351c5fa08293e087fdf650237c6c5e182a (diff)
Reduce number of program headers
... and evade a sanity check in Linux 4 (as if there is anything sane about this project).
Diffstat (limited to 'compiler')
-rw-r--r--compiler/elymasAsmLib.ey24
-rw-r--r--compiler/standardClient.ey1
2 files changed, 24 insertions, 1 deletions
diff --git a/compiler/elymasAsmLib.ey b/compiler/elymasAsmLib.ey
index 0a327de..e193111 100644
--- a/compiler/elymasAsmLib.ey
+++ b/compiler/elymasAsmLib.ey
@@ -1245,7 +1245,28 @@
# rdi == target address
# rsi == size in bytes
- # record new block in global allocation list
+ # record new block in global allocation list (or enlarge existing block if some exists)
+ :globalAllocations .base /rax :movqImmReg
+
+ # search existing block
+ /rax /rbp :movqRegReg
+ /rax /rbp :addqMemReg # rbp == address after last block entry
+ @searchAllocBlockLoop
+ 16 /rax :addqImm8Reg
+ /rax /rbp :cmpqRegReg
+ /createNewBlock :jbeLbl8
+
+ /rax /rcx :movqMemReg # rcx == start of existing block
+ 8 /rax /rcx :addqMemDisp8Reg # rcx == end of existing block
+ /rcx /rdi :cmpqRegReg
+ /enlargeExistingBlock :jzLbl8
+ /searchAllocBlockLoop :jmpLbl8
+
+ @enlargeExistingBlock
+ /rsi 8 /rax :addqRegMemDisp8 # enlarge the block
+ /makeMmapCall :jmpLbl8
+
+ @createNewBlock
:globalAllocations .base /rax :movqImmReg
16 /rax :addqImm8Mem
/rax /rax :addqMemReg
@@ -1253,6 +1274,7 @@
/rdi /rax :movqRegMem
/rsi 8 /rax :movqRegMemDisp8
+ @makeMmapCall
SYSCALL .mmap /rax :movqImmReg
# /rdi already fine
# /rsi already fine
diff --git a/compiler/standardClient.ey b/compiler/standardClient.ey
index dcbb0e8..010e203 100644
--- a/compiler/standardClient.ey
+++ b/compiler/standardClient.ey
@@ -980,6 +980,7 @@
> -- /dump deffd
# TODO: why do we save section information, exactly?
+# FIXME: think real hard whether we can ignore the possibility of new allocations during freeze
{ ==filename # ==f (left on the stack a while and executed from sys .asm .programStart)
sys .asm .patchProgramStart ==frozenAllocationCount