aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2013-07-10 08:21:22 +0200
committerDrahflow <drahflow@gmx.de>2013-07-10 08:21:22 +0200
commitdafcb981e2e62a7d74fa7f8682626afc133e2350 (patch)
treea21e53dca74210d17917ed67583f12cc2701073c
parentc00f3850d8bb3ac3feb1dca7c700af3e83e26948 (diff)
Removed quadratic runtime from allocator
-rw-r--r--compiler/elymasAsmLib.ey15
1 files changed, 12 insertions, 3 deletions
diff --git a/compiler/elymasAsmLib.ey b/compiler/elymasAsmLib.ey
index eec08e5..334d656 100644
--- a/compiler/elymasAsmLib.ey
+++ b/compiler/elymasAsmLib.ey
@@ -166,7 +166,9 @@
4 /rbp :shrqImm8Reg
# rbp now holds number of 16 byte cells in heap
- /rbx /rbx :xorqRegReg
+ unusedHeapStart /rbx :movqImmReg
+ /rbx /rbx :movqMemReg
+ # /rbx /rbx :xorqRegReg
# rbx == index of cell currently tested
@startFreeBlockScan
@@ -215,6 +217,9 @@
# rdi == size of block to allocate
# rbx == last cell of free block of sufficient size
+ unusedHeapStart /rax :movqImmReg
+ /rbx /rax :movqRegMem
+
# split block if necessary
/rbx :incqReg
/rbx /rbp :cmpqRegReg
@@ -296,6 +301,12 @@
:retn
@markPhase
+ /rdi :pushqReg
+
+ unusedHeapStart /rax :movqImmReg
+ /rbx /rbx :xorqRegReg
+ /rbx /rax :movqRegMem
+
# start from stack and mark all reachable blocks
# perform bitmap magic to free blocks
@@ -303,8 +314,6 @@
# retry running through block bitmap and find a zero run
# allocate next chunk of memory from the operating system
- /rdi :pushqReg
-
heapEnd /rax :movqImmReg
/rax /rdi :movqMemReg
ALLOCCHUNKSIZE /rsi :movqImmReg # size of new block