aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2014-01-06 23:13:21 +0100
committerDrahflow <drahflow@gmx.de>2014-01-06 23:13:21 +0100
commit90d664bc9e77530113c9a65bd02bae4667a2c25c (patch)
tree289e69b262ef72e09816981817e48d24aeec9a31 /compiler
parentdef28d4cbac907f45ad083f01a34aca5f1c78fe8 (diff)
streq -> eq
Diffstat (limited to 'compiler')
-rw-r--r--compiler/elymasAsm.ey2
-rw-r--r--compiler/elymasAsmOps.ey21
-rw-r--r--compiler/elymasGlobal.ey139
-rw-r--r--compiler/elymasLexer.ey4
-rw-r--r--compiler/elymasTokenize.ey2
-rw-r--r--compiler/standardClient.ey6
6 files changed, 100 insertions, 74 deletions
diff --git a/compiler/elymasAsm.ey b/compiler/elymasAsm.ey
index 1fcdd35..b5099ac 100644
--- a/compiler/elymasAsm.ey
+++ b/compiler/elymasAsm.ey
@@ -7,7 +7,7 @@
# hex decoding
{
"(.)(.)" regex { } { "not a valid hex-string" die } ? *
- { { streq }_ [ "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F" ] -01 index }
+ { { eq }_ [ "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F" ] -01 index }
-20*10* 16 mul add
} "%" defq
diff --git a/compiler/elymasAsmOps.ey b/compiler/elymasAsmOps.ey
index ed02242..f5de4b9 100644
--- a/compiler/elymasAsmOps.ey
+++ b/compiler/elymasAsmOps.ey
@@ -52,7 +52,7 @@
} /rex deff
{ ==mem ==reg
- mem [ /spl /sp /esp /rsp /bpl /bp /ebp /rbp ] streq any {
+ mem [ /spl /sp /esp /rsp /bpl /bp /ebp /rbp ] eq any {
"modrm00 not possible on rsp / rbp and their partial registers" die
} rep
@@ -62,7 +62,7 @@
} /modrm00 deff
{ ==mem ==reg
- mem [ /spl /sp /esp /rsp ] streq any {
+ mem [ /spl /sp /esp /rsp ] eq any {
# actually encode sib with rsp index register (to get it ignored)
%40
/sib regno %07 band add
@@ -80,7 +80,7 @@
} /modrm01 deff
{ ==mem ==reg
- mem [ /spl /sp /esp /rsp ] streq any {
+ mem [ /spl /sp /esp /rsp ] eq any {
# actually encode sib with rsp index register (to get it ignored)
%80
/sib regno %07 band add
@@ -104,8 +104,8 @@
} /modrm11 deff
{ ==base ==idx ==scale
- idx [ /spl /sp /esp /rsp ] streq any { "sib cannot encode rsp as index" die } rep
- base [ /bpl /bp /ebp /rbp ] streq any { "sib cannot encode rbp as base" die } rep
+ idx [ /spl /sp /esp /rsp ] eq any { "sib cannot encode rsp as index" die } rep
+ base [ /bpl /bp /ebp /rbp ] eq any { "sib cannot encode rbp as base" die } rep
scale _ 0 gt not { "invalid scale chosen for sib" die } rep
8 le not { "invalid scale chosen for sib" die } rep
@@ -1207,6 +1207,17 @@ memoryAddressingVariants keys { ==variant memoryAddressingVariants variant . =*p
i imm8
} /testbImmReg deff
+memoryAddressingVariants keys { ==variant memoryAddressingVariants variant . =*parse
+ { parse ==mem ==i
+ i 256 lt not { "Imm8 too large" die } rep
+
+ mem .base regno %07 gt mem .idx regno %07 gt or { 0 /none mem .idx mem .base rex } rep
+ %F6
+ /zero mem .encode
+ i imm8
+ } /testbImm variant defOp
+} each
+
{ ==dst ==src
dst bit64assert
src bit64assert
diff --git a/compiler/elymasGlobal.ey b/compiler/elymasGlobal.ey
index 2e5e098..01db3b8 100644
--- a/compiler/elymasGlobal.ey
+++ b/compiler/elymasGlobal.ey
@@ -506,10 +506,10 @@
/rbp /rsi :cmovcqRegReg
60 /rsi :shrqImm8Reg # sil = type of concrete argument
- /al /sil :cmpbRegReg
- /typedNonCommon :jnzLbl8 # non-equal types
+ %0E /sil :testbImmReg
+ /typedNonCommon :jnzLbl8 # non-scalar concrete type
%0E /al :testbImmReg
- /typedNonCommon :jnzLbl8 # non-trivial types
+ /typedNonCommon :jnzLbl8 # non-scalar abstract type
8 /rdi :addqImm8Reg
8 /rbx :addqImm8Reg
@@ -2543,24 +2543,83 @@
%01 %00 %00 %00 %00 %00 %00 %80 # unboxed 1
] /t11t1 defv
- [
- %20 %00 %00 %00 %00 %00 %00 %10
- %00 %00 %00 %00 %00 %00 %00 %00
- %01 %00 %00 %00 %00 %00 %00 %00
- %61 %00 %00 %00 %00 %00 %00 %00
- ] /ta defv
-
- [
- %30 %00 %00 %00 %00 %00 %00 %80
- %02 %00 %00 %00 %00 %00 %00 %00
- /taat1 /ta ::linkAbs64
- /taat1 /ta ::linkAbs64
- %01 %00 %00 %00 %00 %00 %00 %00
- %01 %00 %00 %00 %00 %00 %00 %80 # unboxed 1
- ] /taat1 defv
+ # [
+ # %20 %00 %00 %00 %00 %00 %00 %10
+ # %00 %00 %00 %00 %00 %00 %00 %00
+ # %01 %00 %00 %00 %00 %00 %00 %00
+ # %61 %00 %00 %00 %00 %00 %00 %00
+ # ] /ta defv
+
+ # [
+ # %30 %00 %00 %00 %00 %00 %00 %80
+ # %02 %00 %00 %00 %00 %00 %00 %00
+ # /taat1 /ta ::linkAbs64
+ # /taat1 /ta ::linkAbs64
+ # %01 %00 %00 %00 %00 %00 %00 %00
+ # %01 %00 %00 %00 %00 %00 %00 %80 # unboxed 1
+ # ] /taat1 defv
> _ =globalTypes { defv }' ::allocateOffsetStruct
<
+ # equality on ints and strings
+ [[
+ /rbx :popqReg
+
+ /rdx :popqReg
+ /rdi :popqReg
+ 63 /rdx :btqImm8Reg
+ /intCase :jcLbl8
+ 63 /rdi :btqImm8Reg
+ /intCase :jcLbl8
+ %F0 7 /rdx :testbImmMemDisp8
+ /intCase :jzLbl8
+ %F0 7 /rdi :testbImmMemDisp8
+ /intCase :jzLbl8
+
+ 16 /rdx /rsi :movqMemDisp8Reg
+ 16 /rdi /rcx :movqMemDisp8Reg
+
+ /rsi /rcx :cmpqRegReg
+ /nonEqualStr :jneLbl8
+
+ 24 /rdx /rsi :leaqMemDisp8Reg
+ 24 /rdi /rdi :leaqMemDisp8Reg
+
+ :repz :cmpsb
+ /nonEqualStr :jneLbl8
+
+ /rdx /rdx :xorqRegReg
+ /rdx :incqReg
+ /done :jmpLbl8
+
+ @nonEqualStr
+ /rdx /rdx :xorqRegReg
+
+ @done
+ 63 /rdx :btsqImm8Reg
+ /rdx :pushqReg
+
+ /rbx :pushqReg
+ :retn
+
+ @intCase
+
+ /rdi ::unboxInteger
+ /rdx ::unboxInteger
+
+ /rax /rax :xorqRegReg
+ /rdi /rdx :cmpqRegReg
+ /nonEqual :jnzLbl8
+ /rax :incqReg
+ @nonEqual
+
+ 63 /rax :btsqImm8Reg
+ /rax :pushqReg
+
+ /rbx :pushqReg
+ :retn
+ ]] /eyeq defv
+
# arithmetic functions on ints
[ /rcx /rdx :addqRegReg ] makeArith /eyadd defv
[ /rcx /rdx :subqRegReg ] makeArith /eysub defv
@@ -2573,13 +2632,6 @@
1 /rsi :movqImmReg
/rdx /rcx :cmpqRegReg
/rsi /rdx :movqRegReg
- /rdi /rdx :cmovnzqRegReg
- ] makeArith /eyeq defv
- [
- /rdi /rdi :xorqRegReg
- 1 /rsi :movqImmReg
- /rdx /rcx :cmpqRegReg
- /rsi /rdx :movqRegReg
/rdi /rdx :cmovzqRegReg
] makeArith /eyneq defv
[
@@ -2661,41 +2713,6 @@
> _ =globalT11t1Functions { defv }' ::allocateOffsetStruct
<
- [[
- /rbx :popqReg
-
- /rdx :popqReg
- /rdi :popqReg
-
- 16 /rdx /rsi :movqMemDisp8Reg
- 16 /rdi /rcx :movqMemDisp8Reg
-
- /rsi /rcx :cmpqRegReg
- /nonEqual :jneLbl8
-
- 24 /rdx /rsi :leaqMemDisp8Reg
- 24 /rdi /rdi :leaqMemDisp8Reg
-
- :repz :cmpsb
- /nonEqual :jneLbl8
-
- /rdx /rdx :xorqRegReg
- /rdx :incqReg
- /done :jmpLbl8
-
- @nonEqual
- /rdx /rdx :xorqRegReg
-
- @done
- 63 /rdx :btsqImm8Reg
- /rdx :pushqReg
-
- /rbx :pushqReg
- :retn
- ]] /eystreq defv
- > _ =globalTaat1Functions { defv }' ::allocateOffsetStruct
-
- <
# 0 -> integer
# 0 <- the bitwise negated integer
[[
@@ -2832,7 +2849,6 @@
globalMacros keys len add
globalT11t1Functions keys len add
globalT1t1Functions keys len add
- globalTaat1Functions keys len add
/rdi :movqImmReg
/rsi /rsi :xorqRegReg
::internalAllocateScope /rax :movqImmReg
@@ -2846,7 +2862,6 @@
globalMacros keys eydefq { | }' createScopeEntries
globalT11t1Functions keys eydeffd t11t1 { | }' createTypedScopeEntries
globalT1t1Functions keys eydeffd t1t1 { | }' createTypedScopeEntries
- globalTaat1Functions keys eydeffd taat1 { | }' createTypedScopeEntries
] :execute
{ ==name
diff --git a/compiler/elymasLexer.ey b/compiler/elymasLexer.ey
index 65df806..4226f06 100644
--- a/compiler/elymasLexer.ey
+++ b/compiler/elymasLexer.ey
@@ -9,7 +9,7 @@
{ 0 ==result
{ "(.)(.*)" regex } {
- { streq }_ digits -01 index result 10 mul add =result
+ { eq }_ digits -01 index result 10 mul add =result
} loop
result
}
@@ -55,7 +55,7 @@
{ /input defv
"" {
4096 input .read cat
- _ "" streq not
+ _ "" eq not
} {
{ _ "([^\\n]*)\\n(.*)" regex } { -102 -- TOKINT TOKSTR TOKID elymas .tokenize {
_ .handle
diff --git a/compiler/elymasTokenize.ey b/compiler/elymasTokenize.ey
index ef938d0..1483b16 100644
--- a/compiler/elymasTokenize.ey
+++ b/compiler/elymasTokenize.ey
@@ -4,7 +4,7 @@
{ ==TOKID ==TOKSTR ==TOKINT
" " cat
{ < /handle deff /value defv > } /token deff
- [ -01 { _ "" streq not } {
+ [ -01 { _ "" eq not } {
0 ==matched { =*f matched { -- } { { 1 =matched f } rxparse } ? * } /parse deffst
{ "^ +(.*)" regex } { } parse
diff --git a/compiler/standardClient.ey b/compiler/standardClient.ey
index 2288159..1fb102f 100644
--- a/compiler/standardClient.ey
+++ b/compiler/standardClient.ey
@@ -443,7 +443,7 @@
{ =*f "" ==buffer
{
buffer 4096 read cat =buffer
- buffer "" streq not
+ buffer "" eq not
} {
buffer "\n" str .split ==lines
0 lines len 1 sub range {
@@ -572,8 +572,8 @@
{ 2 laterType * 1 neg neq }
{ laterType 1 }
- # General integers co-iterate iff their binary and results in non-zero
- { 0 earlierType * 0 laterType * band 0 neq }
+ # General integers co-iterate iff equal
+ { 0 earlierType * 0 laterType * eq }
{ earlierType 1 }
{ 1 }