diff options
| author | Drahflow <drahflow@gmx.de> | 2015-06-11 14:38:06 +0200 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2015-06-11 14:38:06 +0200 |
| commit | 291a901b8323bf6b00e8eb8b3faec88f97ad3130 (patch) | |
| tree | 0f51b7be662eaf451d077894f230c73bdee4a02d /compiler | |
| parent | eefcf44946b306122e17216fd984749b56f5be3a (diff) | |
Further optimizations
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/elymasAsmOps.ey | 13 | ||||
| -rw-r--r-- | compiler/elymasGlobal.ey | 37 |
2 files changed, 43 insertions, 7 deletions
diff --git a/compiler/elymasAsmOps.ey b/compiler/elymasAsmOps.ey index d397f73..c029670 100644 --- a/compiler/elymasAsmOps.ey +++ b/compiler/elymasAsmOps.ey @@ -999,6 +999,19 @@ memoryAddressingVariants keys { ==variant memoryAddressingVariants variant . =*p i imm16 } /movwImmMem deff +{ ==mem ==disp ==i + mem bit64assert + disp 128 lt not { "Disp8 out of range" die } rep + i 65536 lt not { "Imm16 too large" die } rep + + width16 + mem regno %07 gt { 0 /none /none mem rex } rep + %C7 + /zero mem modrm01 + disp imm8 + i imm16 +} /movwImmMemDisp8 deff + { ==mem ==i mem bit64assert i 65536 65536 mul lt not { "Imm32 too large" die } rep diff --git a/compiler/elymasGlobal.ey b/compiler/elymasGlobal.ey index 2b7f2c1..a948b53 100644 --- a/compiler/elymasGlobal.ey +++ b/compiler/elymasGlobal.ey @@ -2833,6 +2833,35 @@ ]] /ey! defv > _ ==globalFunctions3 { defv }' ::allocateOffsetStruct + [[ + # the length of the following opcodes needs to fit with the :jmpRel8 below + %48 16 /rdi :cmpbImmMemDisp8 + /nonReplaced :jnzLbl8 + %B8 17 /rdi :cmpbImmMemDisp8 + /nonReplaced :jnzLbl8 + %FF 26 /rdi :cmpbImmMemDisp8 + /nonReplaced :jnzLbl8 + %E0 27 /rdi :cmpbImmMemDisp8 + /nonReplaced :jnzLbl8 + + 18 /rdi /rdi :movqMemDisp8Reg # use jump target instead of jump pad in new function object + 16 /rdi :subqImm8Reg + /grabRip :callqLbl32 # TODO: use rip-relative addressing + @grabRip + /rax :popqReg + /rdi 45 neg /rax :movqRegMemDisp8 # update the function code object we use + [ 46 :jmpRel8 ] _ len 2 neq { "unexpected opcode length" die } rep + 2 dearray 256 mul add + 37 neg /rax :movwImmMemDisp8 # don't do rewrite tests next time + + @nonReplaced + /r14 /rsi :movqRegReg + /rdx /rdx :xorqRegReg + ::internalAllocateFunction /rax :movqImmReg + /rax :callqReg + /rax :pushqReg + ]] ==functionObjectWrapperCode # moved here so [[, ]] work correctly + < # quote construction, push begin marker on stack [ @@ -3024,13 +3053,7 @@ 10 /rdi :addqImm8Reg 8 /rbp :addqImm8Reg - [ - /r14 /rsi :movqRegReg - /rdx /rdx :xorqRegReg - ::internalAllocateFunction /rax :movqImmReg - /rax :callqReg - /rax :pushqReg - ] ::unscopingFunctionFooter cat ::loadToRdi + functionObjectWrapperCode ::unscopingFunctionFooter cat ::loadToRdi } { # create constant function from inner code block /rax /rdi :movqRegReg |
