forked from AbleOS/ableos
making a mess
This commit is contained in:
parent
3f9b3dc4e2
commit
d9e8a777e2
|
@ -125,7 +125,7 @@ fib := fn(n: int): int {
|
||||||
|
|
||||||
stack_reclamation_edge_case := 0
|
stack_reclamation_edge_case := 0
|
||||||
|
|
||||||
continue
|
//continue
|
||||||
}
|
}
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
@ -638,6 +638,20 @@ main := fn(arg: int): int {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### branch_assignments
|
||||||
|
```hb
|
||||||
|
main := fn(arg: int): int {
|
||||||
|
if arg == 1 {
|
||||||
|
arg = 1
|
||||||
|
} else if arg == 0 {
|
||||||
|
arg = 2
|
||||||
|
} else {
|
||||||
|
arg = 3
|
||||||
|
}
|
||||||
|
return arg
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### inline_test
|
#### inline_test
|
||||||
```hb
|
```hb
|
||||||
Point := struct {x: int, y: int}
|
Point := struct {x: int, y: int}
|
||||||
|
|
|
@ -109,9 +109,9 @@ mod log {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
($level:expr, $($arg:expr),*) => {
|
($level:expr, $($arg:expr),+) => {
|
||||||
if $level <= $crate::log::LOG_LEVEL {
|
if $level <= $crate::log::LOG_LEVEL {
|
||||||
$(eprintln!("[{}{}{}][{:?}]: {} = {:?}", line!(), column!(), file!(), $level, stringify!($arg), $arg);)*
|
$(eprintln!("[{}:{}:{}][{:?}]: {} = {:?}", line!(), column!(), file!(), $level, stringify!($arg), $arg);)*
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
21
hblang/tests/son_tests_branch_assignments.txt
Normal file
21
hblang/tests/son_tests_branch_assignments.txt
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
main:
|
||||||
|
ADDI64 r254, r254, -32d
|
||||||
|
ST r31, r254, 0a, 32h
|
||||||
|
CP r32, r2
|
||||||
|
LI64 r33, 1d
|
||||||
|
JNE r32, r33, :0
|
||||||
|
JMP :1
|
||||||
|
0: LI64 r34, 0d
|
||||||
|
JNE r32, r34, :2
|
||||||
|
LI64 r34, 2d
|
||||||
|
JMP :3
|
||||||
|
2: LI64 r32, 3d
|
||||||
|
CP r34, r32
|
||||||
|
3: CP r33, r34
|
||||||
|
1: CP r1, r33
|
||||||
|
LD r31, r254, 0a, 32h
|
||||||
|
ADDI64 r254, r254, 32d
|
||||||
|
JALA r0, r31, 0a
|
||||||
|
code size: 139
|
||||||
|
ret: 2
|
||||||
|
status: Ok(())
|
|
@ -17,12 +17,12 @@ fib:
|
||||||
0: ADDI64 r2, r32, -1d
|
0: ADDI64 r2, r32, -1d
|
||||||
JAL r31, r0, :fib
|
JAL r31, r0, :fib
|
||||||
CP r34, r1
|
CP r34, r1
|
||||||
ADDI64 r2, r32, -2d
|
SUB64 r2, r32, r33
|
||||||
JAL r31, r0, :fib
|
JAL r31, r0, :fib
|
||||||
ADD64 r1, r1, r34
|
ADD64 r1, r1, r34
|
||||||
1: LD r31, r254, 0a, 32h
|
1: LD r31, r254, 0a, 32h
|
||||||
ADDI64 r254, r254, 32d
|
ADDI64 r254, r254, 32d
|
||||||
JALA r0, r31, 0a
|
JALA r0, r31, 0a
|
||||||
code size: 219
|
code size: 212
|
||||||
ret: 55
|
ret: 55
|
||||||
status: Ok(())
|
status: Ok(())
|
||||||
|
|
0
hblang/tests/son_tests_loops.txt
Normal file
0
hblang/tests/son_tests_loops.txt
Normal file
Loading…
Reference in a new issue