diff options
| author | Drahflow <drahflow@gmx.de> | 2013-08-18 21:45:23 +0200 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2013-08-18 21:45:23 +0200 |
| commit | d4f9862052970e93af092229b12315aabd524f24 (patch) | |
| tree | 715fcb56dcf3b86a985091f96d1541d75b919c28 | |
| parent | 1e74b3b5ee7d61416d82b8dd9338ce7957dfc393 (diff) | |
Further optimizations
| -rw-r--r-- | compiler/elymasAsmLib.ey | 45 | ||||
| -rw-r--r-- | compiler/standardClient.ey | 16 |
2 files changed, 35 insertions, 26 deletions
diff --git a/compiler/elymasAsmLib.ey b/compiler/elymasAsmLib.ey index b6c9a78..0996f41 100644 --- a/compiler/elymasAsmLib.ey +++ b/compiler/elymasAsmLib.ey @@ -380,15 +380,24 @@ # run through global state and mark reachable objects @markAndSweep + /r8 :pushqReg + /r9 :pushqReg + /r10 :pushqReg + /r11 :pushqReg + + /r8 :movqImmOOBReg HEAPBASE # constant through mark + /r9 :movqImmOOBReg BLOCKBASE # constant through mark + /r10 :movqImmOOBReg MARKBASE # constant through mark + heapEnd /r11 :movqImmReg + /r11 /r11 :movqMemReg # constant through mark + unusedHeapStart /rax :movqImmReg /rbx /rbx :xorqRegReg /rbx /rax :movqRegMem # zero mark bitmap - /rax :movqImmOOBReg HEAPBASE - heapEnd /rcx :movqImmReg - /rcx /rcx :movqMemReg - /rax /rcx :subqRegReg + /r11 /rcx :movqRegReg + /r8 /rcx :subqRegReg # rcx now holds number of bytes in heap 10 /rcx :shrqImm8Reg /noResetNecessary :jzLbl8 @@ -396,8 +405,8 @@ # (16 bytes per cell -> shift by 4 # 8 cells per byte -> shift by 3 # 8 bytes per quadword -> shift by 3) - /rsi :movqImmOOBReg BLOCKBASE - /rdi :movqImmOOBReg MARKBASE + /r9 /rsi :movqRegReg + /r10 /rdi :movqRegReg @resetMarkLoop /rsi /rax :movqMemReg /rax :notqReg @@ -446,10 +455,8 @@ /loopThroughEncodingBuffer :loopLbl8 # free unmarked blocks - /rax :movqImmOOBReg HEAPBASE - heapEnd /rcx :movqImmReg - /rcx /rcx :movqMemReg - /rax /rcx :subqRegReg + /r11 /rcx :movqRegReg + /r8 /rcx :subqRegReg # rcx now holds number of bytes in heap 10 /rcx :shrqImm8Reg # rcx now holds number of quadwords in mark bitmap @@ -457,8 +464,8 @@ # 8 cells per byte -> shift by 3 # 8 bytes per quadword -> shift by 3) /noFreeNecessary :jzLbl8 - /rdi :movqImmOOBReg BLOCKBASE - /rsi :movqImmOOBReg MARKBASE + /r9 /rdi :movqRegReg + /r10 /rsi :movqRegReg @freeLoop /rsi /rax :movqMemReg /rdi /rbx :movqMemReg @@ -468,6 +475,11 @@ 8 /rdi :addqImm8Reg /freeLoop :loopLbl8 @noFreeNecessary + + /r11 :popqReg + /r10 :popqReg + /r9 :popqReg + /r8 :popqReg :retn @markObjectDone @@ -476,18 +488,15 @@ # recursively mark this object reachable @markObject # rdi == address of a reachable object or some other random bits - heapEnd /rax :movqImmReg - /rax /rax :movqMemReg - /rbx :movqImmOOBReg HEAPBASE - /rdi /rax :cmpqRegReg + /rdi /r11 :cmpqRegReg /markObjectDone :jbeLbl32 # pointing above the heap - /rdi /rbx :cmpqRegReg + /rdi /r8 :cmpqRegReg /markObjectDone :jaLbl32 # pointing below the heap 15 /dil :testbImmReg /markObjectDone :jnzLbl32 # pointing to unaligned address /rdi /rdx :movqRegReg - /rbx /rdx :subqRegReg + /r8 /rdx :subqRegReg # rdx == byte offset relative to heap begin 4 /rdx :shrqImm8Reg # rdx == cell index of first 16-byte cell of object diff --git a/compiler/standardClient.ey b/compiler/standardClient.ey index 96eda33..a05999f 100644 --- a/compiler/standardClient.ey +++ b/compiler/standardClient.ey @@ -573,7 +573,7 @@ { # "(chars) re: " -101 cat dump ^] { tail chars2 =*s - { _ s -01 0 "]" * eq or } ==?set + { _ s -01 0 "]" * eq or }' ==?set }' { chars2 ==?set }' ? * @@ -583,7 +583,7 @@ { # "(chars2) re: " -101 cat dump ^- { tail chars2 =*s - { _ s -01 0 "-" * eq or } ==?set + { _ s -01 0 "-" * eq or }' ==?set }' { charsR ==?set }' ? * @@ -595,7 +595,7 @@ { ^] not } { set =*s1 charsN =*s2 - { _ s1 -01 s2 or } =set + { _ s1 -01 s2 or }' =set } loop set } /charsR deffst @@ -627,9 +627,9 @@ } ifthenelse ifthenelse * } rep tail - { _ start ge -01 end le and } ==?set + { _ start ge -01 end le and }' ==?set }' { - { start eq } ==?set + { start eq }' ==?set }' ? * set } /charsN deffst @@ -655,8 +655,8 @@ # TODO think about implementation efficiency { < ==maxSize 0 ==size - [ maxSize { 0 }' rep ] =*get - [ maxSize { 1 }' rep ] =*pcFree + [ maxSize { 0 }" rep ] =*get + [ maxSize { 1 }" rep ] =*pcFree { # ==thread _ threadGetPC pcFree { @@ -668,7 +668,7 @@ { 0 =size - [ maxSize { 1 }' rep ] =pcFree + [ maxSize { 1 }" rep ] =pcFree }' /clear deffst > } /threadList deffd |
