aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2015-05-27 13:52:35 +0200
committerDrahflow <drahflow@gmx.de>2015-05-27 13:52:35 +0200
commit614575d024fac518357e635723b13cd8b2709b35 (patch)
treecca365b79d218f9a12ac3ca99931e960ef3e5257 /compiler
parent7fa5c2aa98a40475f7b092a6883433f10fa747d6 (diff)
Avoid repeated mark and sweeps at full heap
Diffstat (limited to 'compiler')
-rw-r--r--compiler/elymasAsmLib.ey21
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/elymasAsmLib.ey b/compiler/elymasAsmLib.ey
index 6a0ce06..5625df7 100644
--- a/compiler/elymasAsmLib.ey
+++ b/compiler/elymasAsmLib.ey
@@ -107,6 +107,9 @@
# current parser quote state
[ %00 %00 %00 %00 %00 %00 %00 %00 ] ==currentQuoted
+ # amortized mark and sweep costs
+ [ %00 %00 %00 %00 %00 %00 %00 %00 ] ==markAndSweepCosts
+
# freelists for various sizes
[ FREELISTCOUNT { %00 %00 %00 %00 %00 %00 %00 %00 } rep ] ==freeLists
> { defv }' allocateOffsetStruct
@@ -355,17 +358,35 @@
/takeFromFreelist :callqLbl32
/rax /rax :andqRegReg
/success :jnzLbl32
+
+ markAndSweepCosts /rax :movqImmReg
+ /rax /rdx :movqMemReg
+ /rdx /rdx :testqRegReg
+ /costAlreadyZero :jzLbl8
+ 1 /rax :subqImm8Mem
+ @costAlreadyZero
+
/searchForFreeBlock :callqLbl32
/rax /rax :andqRegReg
/success :jnzLbl32
/markAndSweep :callqLbl32
+ markAndSweepCosts /rax :movqImmReg
+ 4096 /rdx :movqImmReg
+ /rdx /rax :addqRegMem
+
+ 5000 /rdx :movqImmReg
+ /rdx /rax :cmpqRegMem
+ /allocateFromSystemAtLeastOnce :jaeLbl8
+
@allocateFromSystemLoop
/rdi :popqReg
/rdi :pushqReg
/searchForFreeBlock :callqLbl32
/rax /rax :andqRegReg
/success :jnzLbl32
+
+ @allocateFromSystemAtLeastOnce
/allocateFromSystem :callqLbl32
/allocateFromSystemLoop :jmpLbl8