1
0
Fork 0
forked from koniifer/ableos

making a mess

This commit is contained in:
mlokr 2024-09-06 01:17:54 +02:00
parent 3f9b3dc4e2
commit d9e8a777e2
6 changed files with 679 additions and 202 deletions

View file

@ -125,7 +125,7 @@ fib := fn(n: int): int {
stack_reclamation_edge_case := 0
continue
//continue
}
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
```hb
Point := struct {x: int, y: int}

View file

@ -109,9 +109,9 @@ mod log {
}
};
($level:expr, $($arg:expr),*) => {
($level:expr, $($arg:expr),+) => {
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

View 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(())

View file

@ -17,12 +17,12 @@ fib:
0: ADDI64 r2, r32, -1d
JAL r31, r0, :fib
CP r34, r1
ADDI64 r2, r32, -2d
SUB64 r2, r32, r33
JAL r31, r0, :fib
ADD64 r1, r1, r34
1: LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
code size: 219
code size: 212
ret: 55
status: Ok(())

View file