aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2015-06-16 12:34:17 +0200
committerDrahflow <drahflow@gmx.de>2015-06-16 12:34:17 +0200
commit48033d4d5d654af91a4ba965aa30d64f047a9848 (patch)
treeabeb09e8206d39668f2e8151c0dc7762f1fe84cc /compiler
parentbb1350d1d6c02b5b58fee760420ad7d132524ab9 (diff)
FIXME resolved
Diffstat (limited to 'compiler')
-rw-r--r--compiler/elymasGlobalSysAsm.ey16
-rw-r--r--compiler/standardClient.ey5
2 files changed, 17 insertions, 4 deletions
diff --git a/compiler/elymasGlobalSysAsm.ey b/compiler/elymasGlobalSysAsm.ey
index e131e3e..e31ab74 100644
--- a/compiler/elymasGlobalSysAsm.ey
+++ b/compiler/elymasGlobalSysAsm.ey
@@ -580,7 +580,9 @@
# correct number of things from the stack to make the sys .freeze execution transparent
# TODO: actually do this (e.g. by recoding the freeze startup in assembly)
# TODO: ... for now just flush the call stack on freeze
- # returns the number of allocations according to frozen alloc list fill state
+ # returns
+ # 0 <- the number of allocations according to frozen alloc list fill state
+ # 1 <- the current heap size (to detect re-allocs during freeze)
[[
/rbx :popqReg
@@ -612,6 +614,18 @@
/rdx 101 /rax :movqRegMemDisp8
/r13 114 /rax :movqRegMemDisp8
+ ::heapSize /rdx :movqImmReg
+ /rdx /rdx :movqMemReg
+ /rdx :pushqReg # store heap size for later return value
+
+ ::internalAllocateInteger /rax :movqImmReg
+ /rax :callqReg
+ 8 /rax :popqMemDisp8 # save heap size to return integer
+
+ /rdx :popqReg
+ /rax :pushqReg
+ /rdx :pushqReg # shuffle stack to access alloc count
+
::internalAllocateInteger /rax :movqImmReg
/rax :callqReg
# type zero does not need to be changed
diff --git a/compiler/standardClient.ey b/compiler/standardClient.ey
index 010e203..c8f2823 100644
--- a/compiler/standardClient.ey
+++ b/compiler/standardClient.ey
@@ -980,9 +980,8 @@
> -- /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
+ sys .asm .patchProgramStart ==frozenAllocationCount ==heapSize
# hex decoding
{ ==strNumber
@@ -1180,7 +1179,7 @@
==f
- sys .asm .patchProgramStart frozenAllocationCount neq {
+ sys .asm .patchProgramStart -- heapSize neq {
"freezing allocated new memory chunks, retrying..." dump
f filename sys .freeze
} rep