Skip to content

Commit 1d92431

Browse files
jmp is not safe to use in if statements
1 parent a8ad7a9 commit 1d92431

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lambda_mountain"
3-
version = "1.11.87"
3+
version = "1.11.88"
44
authors = ["Andrew <andrew@subarctic.org>"]
55
license = "MIT"
66
description = "Lambda Mountain"

STDLIB/default-stdlib.lm

+6-8
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,15 @@ print := λ(: x I8). (: (tail(
194194
(label start )
195195
(mov( R8 0u64 c1 ))
196196
(mov( R9 0u64 c2 ))
197-
(if (==( c1 c2 )) () (jmp end-false))
198-
(if (==( c1 0u8 )) () (jmp end-true))
197+
(if (==( c1 c2 )) (mov( 1u64 RAX )) (mov( 0u64 RAX )) )
198+
(cmp( 0u64 RAX ))
199+
(je end)
200+
(if (==( c1 0u8 )) (mov( 1u64 RAX )) (mov( 0u64 RAX )) )
201+
(cmp( 1u64 RAX ))
202+
(je end)
199203
(inc R8)
200204
(inc R9)
201205
(jmp start)
202-
(label end-true)
203-
(mov( 1u64 RAX ))
204-
(jmp( end ))
205-
(label end-false)
206-
(mov( 0u64 RAX ))
207-
(jmp( end ))
208206
(label end)
209207
(as RAX U64)
210208
)) U64);

tests/strict/match7.lm

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ import STDLIB/default-stdlib.lm;
66

77
import STRICT/utility.lm;
88

9-
config-preprocess := 1u8;
9+
config-preprocess := 2u8;
1010

1111
main := λ(: argc U64)(: argv U8[][]).(tail(
12+
(print( (==( '--macro_s '--macro_s )) ))
13+
(print( (==( '--macro_s '--nomacro_s )) ))
14+
(print( (==( '--nomacro_s '--macro_s )) ))
15+
(print( (==( '--nomacro_s '--nomacro_s )) ))
1216
(match '--nomacro_s (
1317
()
1418
('--macro_s (set config-preprocess 1u8))

0 commit comments

Comments
 (0)