-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor * add benchmark * a simpler test * lame fix (#47) * use an index to mark the return cont * refactor and nicify things * further refactor * rename file --------- Co-authored-by: ahuoguo <ahuoguo@gmail.com> Co-authored-by: ahuoguo <52595524+ahuoguo@users.noreply.github.com>
- Loading branch information
1 parent
cc32b0d
commit f0e2046
Showing
6 changed files
with
166 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#[no_mangle] | ||
#[inline(never)] | ||
fn is_even(n: u32) -> bool { | ||
if n == 0 { true } | ||
else { is_odd(n - 1) } | ||
} | ||
|
||
#[no_mangle] | ||
#[inline(never)] | ||
fn is_odd(n: u32) -> bool { | ||
if n == 0 { false } | ||
else { is_even(n - 1) } | ||
} | ||
|
||
#[no_mangle] | ||
fn real_main() -> bool { | ||
is_even(12) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
(module | ||
(type (;0;) (func (param i32) (result i32))) | ||
(type (;1;) (func (result i32))) | ||
(func (;0;) (type 0) (param i32) (result i32) | ||
block ;; label = @1 | ||
local.get 0 | ||
br_if 0 (;@1;) | ||
i32.const 1 | ||
return | ||
end | ||
local.get 0 | ||
i32.const -1 | ||
i32.add | ||
call 1) | ||
(func (;1;) (type 0) (param i32) (result i32) | ||
block ;; label = @1 | ||
local.get 0 | ||
br_if 0 (;@1;) | ||
i32.const 0 | ||
return | ||
end | ||
local.get 0 | ||
i32.const -1 | ||
i32.add | ||
call 0) | ||
(func (;2;) (type 1) (result i32) | ||
i32.const 13 | ||
call 1) | ||
(start 2) | ||
(memory (;0;) 16) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
(module | ||
(type (;0;) (func)) | ||
(func (;0;) (type 0) | ||
block ;; label = @1 | ||
return | ||
end | ||
unreachable | ||
) | ||
(func (;1;) (type 0) | ||
call 0 | ||
) | ||
(start 1) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.