diff options
| author | Drahflow <drahflow@gmx.de> | 2015-06-16 12:34:17 +0200 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2015-06-16 12:34:17 +0200 |
| commit | 48033d4d5d654af91a4ba965aa30d64f047a9848 (patch) | |
| tree | abeb09e8206d39668f2e8151c0dc7762f1fe84cc | |
| parent | bb1350d1d6c02b5b58fee760420ad7d132524ab9 (diff) | |
FIXME resolved
| -rw-r--r-- | compiler/elymasGlobalSysAsm.ey | 16 | ||||
| -rw-r--r-- | compiler/standardClient.ey | 5 | ||||
| -rw-r--r-- | elymas/lib/sys/so.ey | 4 |
3 files changed, 19 insertions, 6 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 diff --git a/elymas/lib/sys/so.ey b/elymas/lib/sys/so.ey index caac9c0..0203f18 100644 --- a/elymas/lib/sys/so.ey +++ b/elymas/lib/sys/so.ey @@ -656,7 +656,7 @@ } /resolveFunction deffd { ==filename # ==f (left on the stack a while and executed from sys .asm .programStart) - sys .asm .patchProgramStart ==frozenAllocationCount + sys .asm .patchProgramStart ==frozenAllocationCount ==heapSize { 8 { _ 256 mod -01 256 div } rep -- } /uint64 deffd { _ 0 lt { 4294967296 add } rep 4294967295 band 4 { _ 256 mod -01 256 div } rep -- } /uint32 deffd @@ -1034,7 +1034,7 @@ ==f - sys .asm .patchProgramStart frozenAllocationCount neq { + sys .asm .patchProgramStart -- heapSize neq { "freezing allocated new memory chunks, retrying..." dump f filename sys .so .freeze } rep |
