aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2013-09-26 15:05:46 +0200
committerDrahflow <drahflow@gmx.de>2013-09-26 15:05:46 +0200
commitfdc87623e8e0394e5b9ffe6019489b60f5c98561 (patch)
treeaad0b8d2ca76e1218bf889b9638431a6e49c59bc
parentf56f0db5a95ee732925ab380c4fca0c0297116ae (diff)
Further performance improvements
-rw-r--r--compiler/elymasAsm.ey11
-rw-r--r--compiler/elymasAsmLib.ey30
-rw-r--r--compiler/elymasGlobal.ey14
3 files changed, 34 insertions, 21 deletions
diff --git a/compiler/elymasAsm.ey b/compiler/elymasAsm.ey
index 15ed57b..25a52c1 100644
--- a/compiler/elymasAsm.ey
+++ b/compiler/elymasAsm.ey
@@ -1106,6 +1106,17 @@
src dst modrm11
} /testqRegReg deff
+ { ==mem ==idx ==scale ==reg
+ reg bit64assert
+ mem bit64assert
+ idx bit64assert
+
+ 1 reg idx mem rex
+ %85
+ reg /sib modrm00
+ scale idx mem sib
+ } /testqRegMemIndexScale deff
+
{
%0F
%0B
diff --git a/compiler/elymasAsmLib.ey b/compiler/elymasAsmLib.ey
index 1fac364..8d940bb 100644
--- a/compiler/elymasAsmLib.ey
+++ b/compiler/elymasAsmLib.ey
@@ -123,24 +123,6 @@
# internal functions, ABI follows SysV standards
- # compare two strings
- # rdi -> address of first string
- # rsi -> address of second string
- # rax <- 1 if both strings are equal, 0 otherwise
- [
- /rax /rax :xorqRegReg
- :cmpsq # ignore memory length header
- :cmpsq # ignore hash
- /rsi /rdx :movqMemReg # load exact length
- :cmpsq # same exact length
- /fail :jnzLbl8
- /rdx /rcx :movqRegReg
- :repz :cmpsb
- /fail :jnzLbl8
- /rax :incqReg
- @fail
- ] :labelResolve /internalStringEqualsCode defv
-
<
# dump string to stderr for internal error reporting
# rdi -> address of string on heap
@@ -158,7 +140,17 @@
# rsi -> address of second string
# rax <- 1 if both strings are equal, 0 otherwise
[
- internalStringEqualsCode _ len dearray
+ /rax /rax :xorqRegReg
+ :cmpsq # ignore memory length header
+ :cmpsq # ignore hash
+ /rsi /rdx :movqMemReg # load exact length
+ :cmpsq # same exact length
+ /fail :jnzLbl8
+ /rdx /rcx :movqRegReg
+ :repz :cmpsb
+ /fail :jnzLbl8
+ /rax :incqReg
+ @fail
:retn
] /internalStringEquals defv
> { defv }' allocateOffsetStruct
diff --git a/compiler/elymasGlobal.ey b/compiler/elymasGlobal.ey
index 1b36b1b..8feb719 100644
--- a/compiler/elymasGlobal.ey
+++ b/compiler/elymasGlobal.ey
@@ -138,12 +138,22 @@
/rdx /rsi :cmpqRegReg
/nameUndefined :jbeLbl8
- /rdx :pushqReg
+ /rdx :pushqReg # TODO code does not seem optimal here
/rsi :pushqReg
/rdi :pushqReg
/rcx :pushqReg
/rdx /rsi :movqMemReg
- ::internalStringEqualsCode _ len dearray
+ /rax /rax :xorqRegReg
+ :cmpsq # ignore memory length header
+ :cmpsq # ignore hash
+ /rsi /rdx :movqMemReg # load exact length
+ :cmpsq # same exact length
+ /fail :jnzLbl8
+ /rdx /rcx :movqRegReg
+ :repz :cmpsb
+ /fail :jnzLbl8
+ /rax :incqReg
+ @fail
/rcx :popqReg
/rdi :popqReg
/rsi :popqReg