aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2013-08-04 11:34:10 +0200
committerDrahflow <drahflow@gmx.de>2013-08-04 11:34:10 +0200
commit7c6ad5673f860754637f62187e69c84f150de441 (patch)
treeb58f8d82b41b57ebfb6513f8d1b8fd0d288e54ea /compiler
parentff63946ecb886b867531576eae30ad8e0ede3fd5 (diff)
Correctly freeze allocation list fill state
Diffstat (limited to 'compiler')
-rw-r--r--compiler/elymasAsmLib.ey2
-rw-r--r--compiler/elymasGlobalSysAsm.ey18
-rw-r--r--compiler/standardClient.ey4
3 files changed, 21 insertions, 3 deletions
diff --git a/compiler/elymasAsmLib.ey b/compiler/elymasAsmLib.ey
index d224300..5330199 100644
--- a/compiler/elymasAsmLib.ey
+++ b/compiler/elymasAsmLib.ey
@@ -96,7 +96,7 @@
[ %00 %00 %00 %00 %00 %00 %00 %00 ] ==currentQuoted
# global allocation list
- [ :globalAllocations .base :imm64 ] ==globalAllocationList
+ [ :globalAllocations .base :imm64 ] ==globalAllocationList # FIXME what is this for? directly use :globalAllocations
> { defv }' allocateOffsetStruct
{ _ =*array len _ 4 div ==largeMoves
diff --git a/compiler/elymasGlobalSysAsm.ey b/compiler/elymasGlobalSysAsm.ey
index cd92b32..1c1ae0f 100644
--- a/compiler/elymasGlobalSysAsm.ey
+++ b/compiler/elymasGlobalSysAsm.ey
@@ -222,6 +222,9 @@
::currentScope /rax :movqImmReg # 76
/rbx :movqImmOOBReg %EE %EE %EE %EE %EE %EE %EE %EE # 86
/rbx /rax :movqRegMem # 89
+ :globalAllocations .base /rax :movqImmReg # 99
+ /rbx :movqImmOOBReg %EE %EE %EE %EE %EE %EE %EE %EE # 109
+ /rbx /rax :movqRegMem # 112
# empty encoding buffer to ensure the GC does not follow residue from freeze into unallocated memory
:quoteEncodingBuffer /rdi :movqImmReg
@@ -242,6 +245,7 @@
# 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
[[
/rbx :popqReg
@@ -260,6 +264,20 @@
/rdx /rdx :movqMemReg
16 /rdx /rdx :movqMemDisp8Reg # unwind one scope
/rdx 78 /rax :movqRegMemDisp8
+ :globalAllocations .base /rdx :movqImmReg
+ /rdx /rdx :movqMemReg
+ /rdx :pushqReg # store allocation count for later return value
+ /rdx 101 /rax :movqRegMemDisp8
+
+ 16 /rdi :movqImmReg
+ ::internalAllocate /rax :movqImmReg
+ /rax :callqReg
+ # type zero does not need to be changed
+ /rdx :popqReg
+ 4 /rdx :shrqImm8Reg
+ /rdx :decqReg
+ /rdx 8 /rax :movqRegMemDisp8 # store value
+ /rax :pushqReg
/rbx :pushqReg
:retn
diff --git a/compiler/standardClient.ey b/compiler/standardClient.ey
index 89f777e..86dba92 100644
--- a/compiler/standardClient.ey
+++ b/compiler/standardClient.ey
@@ -741,7 +741,7 @@
{ enregex * } /regex deff
{ ==filename # ==f (left on the stack and executed from sys .asm .programStart)
- sys .asm .patchProgramStart
+ sys .asm .patchProgramStart ==frozenAllocationCount
# hex decoding
{ ==strNumber
@@ -789,7 +789,7 @@
] ==metaSections
[
- 0 sys .asm .globalAllocCount 1 sub range { ==i
+ 0 frozenAllocationCount 1 sub range { ==i
<
".-=#=-" ==name
0 ==nameOffset { =nameOffset } /setNameOffset deff