diff options
| author | Drahflow <drahflow@gmx.de> | 2013-07-10 08:21:22 +0200 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2013-07-10 08:21:22 +0200 |
| commit | dafcb981e2e62a7d74fa7f8682626afc133e2350 (patch) | |
| tree | a21e53dca74210d17917ed67583f12cc2701073c | |
| parent | c00f3850d8bb3ac3feb1dca7c700af3e83e26948 (diff) | |
Removed quadratic runtime from allocator
| -rw-r--r-- | compiler/elymasAsmLib.ey | 15 |
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 |
