-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved IR for blocks of IL instructions (#1133)
Technical: - Better representation for IR blocks (closes #1131)
- Loading branch information
Showing
95 changed files
with
1,194 additions
and
652 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 |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
] | ||
}, | ||
"ghul.compiler": { | ||
"version": "0.8.24", | ||
"version": "0.8.25", | ||
"commands": [ | ||
"ghul-compiler" | ||
] | ||
|
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
23 changes: 23 additions & 0 deletions
23
integration-tests/execution/anon-function-recursion-1/.vscode/tasks.json
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,23 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Run test", | ||
"command": "dotnet ghul-test \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "test", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"label": "Capture test expectation", | ||
"command": "../../../tasks/capture.sh \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
Empty file.
6 changes: 6 additions & 0 deletions
6
integration-tests/execution/anon-function-recursion-1/ghul.json
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,6 @@ | ||
{ | ||
"compiler": "../../../bin/Release/net8.0/ghul", | ||
"source": [ | ||
"." | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
integration-tests/execution/anon-function-recursion-1/ghulflags
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 @@ | ||
--dotnet |
Empty file.
1 change: 1 addition & 0 deletions
1
integration-tests/execution/anon-function-recursion-1/run.expected
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 @@ | ||
fibonacci function is System.Func`2[System.Int32,System.Int32] |
17 changes: 17 additions & 0 deletions
17
integration-tests/execution/anon-function-recursion-1/test.ghul
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,17 @@ | ||
use IO.Std.write_line; | ||
|
||
entry() is | ||
test_create_function(); | ||
si | ||
|
||
test_create_function() is | ||
let fibonacci = (i: int) rec => | ||
if i < 2 then | ||
i | ||
else | ||
rec(i - 1) + rec(i - 2) | ||
fi; | ||
|
||
write_line("fibonacci function is {fibonacci}"); | ||
si | ||
|
Empty file.
23 changes: 23 additions & 0 deletions
23
integration-tests/execution/anon-function-recursion-2/.vscode/tasks.json
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,23 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Run test", | ||
"command": "dotnet ghul-test \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "test", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"label": "Capture test expectation", | ||
"command": "../../../tasks/capture.sh \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
Empty file.
6 changes: 6 additions & 0 deletions
6
integration-tests/execution/anon-function-recursion-2/ghul.json
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,6 @@ | ||
{ | ||
"compiler": "../../../bin/Release/net8.0/ghul", | ||
"source": [ | ||
"." | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
integration-tests/execution/anon-function-recursion-2/ghulflags
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 @@ | ||
--dotnet |
Empty file.
10 changes: 10 additions & 0 deletions
10
integration-tests/execution/anon-function-recursion-2/run.expected
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,10 @@ | ||
fibonacci(0) is 0 | ||
fibonacci(1) is 1 | ||
fibonacci(2) is 1 | ||
fibonacci(3) is 2 | ||
fibonacci(4) is 3 | ||
fibonacci(5) is 5 | ||
fibonacci(6) is 8 | ||
fibonacci(7) is 13 | ||
fibonacci(8) is 21 | ||
fibonacci(9) is 34 |
18 changes: 18 additions & 0 deletions
18
integration-tests/execution/anon-function-recursion-2/test.ghul
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 @@ | ||
use IO.Std.write_line; | ||
|
||
entry() is | ||
test_call_function(); | ||
si | ||
|
||
test_call_function() is | ||
let fibonacci = (i: int) rec => | ||
if i < 2 then | ||
i | ||
else | ||
rec(i - 1) + rec(i - 2) | ||
fi; | ||
|
||
for i in 0..10 do | ||
write_line("fibonacci({i}) is {fibonacci(i)}"); | ||
od | ||
si |
Empty file.
23 changes: 23 additions & 0 deletions
23
integration-tests/execution/anon-function-recursion-3/.vscode/tasks.json
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,23 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Run test", | ||
"command": "dotnet ghul-test \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "test", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"label": "Capture test expectation", | ||
"command": "../../../tasks/capture.sh \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
Empty file.
6 changes: 6 additions & 0 deletions
6
integration-tests/execution/anon-function-recursion-3/ghul.json
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,6 @@ | ||
{ | ||
"compiler": "dotnet ../../../publish/ghul.dll", | ||
"source": [ | ||
"." | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
integration-tests/execution/anon-function-recursion-3/ghulflags
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 @@ | ||
--dotnet --keep-out-il |
Empty file.
10 changes: 10 additions & 0 deletions
10
integration-tests/execution/anon-function-recursion-3/run.expected
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,10 @@ | ||
fibonacci(0) is 0 | ||
fibonacci(1) is 1 | ||
fibonacci(2) is 1 | ||
fibonacci(3) is 2 | ||
fibonacci(4) is 3 | ||
fibonacci(5) is 5 | ||
fibonacci(6) is 8 | ||
fibonacci(7) is 13 | ||
fibonacci(8) is 21 | ||
fibonacci(9) is 34 |
21 changes: 21 additions & 0 deletions
21
integration-tests/execution/anon-function-recursion-3/test.ghul
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,21 @@ | ||
use IO.Std.write_line; | ||
|
||
entry() is | ||
test_call_function(); | ||
si | ||
|
||
apply[T,R](f: (T) -> R, i: T) -> R => | ||
f(i); | ||
|
||
test_call_function() is | ||
let fibonacci = (i: int) rec => | ||
if i < 2 then | ||
i | ||
else | ||
apply(rec, i - 1) + apply(rec, i - 2) | ||
fi; | ||
|
||
for i in 0..10 do | ||
write_line("fibonacci({i}) is {fibonacci(i)}"); | ||
od | ||
si |
Empty file.
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 |
---|---|---|
|
@@ -3,8 +3,6 @@ namespace Test is | |
|
||
class Main is | ||
entry() static is | ||
|
||
|
||
let capture_1 = 1; | ||
let capture_2 = 2; | ||
|
||
|
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
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 |
---|---|---|
@@ -1,13 +1,2 @@ | ||
simple_expression_body(5) = 10 | ||
simple_expression_body((5, 6)) = 11 | ||
fib(0) = 0 | ||
fib(1) = 1 | ||
fib(2) = 1 | ||
fib(3) = 2 | ||
fib(4) = 3 | ||
fib(5) = 5 | ||
if_expression_condition_1(5) = 5 * 2 more than 10 | ||
if_expression_condition_2(5, 6) = 5 * 2 and 6 * 2 more than 10 | ||
generator_1().take(5).to_list() = 0, 1, 2, 3, 4 | ||
generator_fibonacci().take(5).to_list() = 0, 1, 1, 2, 3 | ||
generator_factorial().take(5).to_list() = 1, 2, 6, 24, 120 |
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
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,23 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Run test", | ||
"command": "dotnet ghul-test \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "test", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"label": "Capture test expectation", | ||
"command": "../../../tasks/capture.sh \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
Empty file.
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,6 @@ | ||
{ | ||
"compiler": "../../../bin/Release/net8.0/ghul", | ||
"source": [ | ||
"." | ||
] | ||
} |
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 @@ | ||
--dotnet |
Empty file.
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,10 @@ | ||
fib(0) => 0 | ||
fib(1) => 1 | ||
fib(2) => 1 | ||
fib(3) => 2 | ||
fib(4) => 3 | ||
fib(5) => 5 | ||
fib(6) => 8 | ||
fib(7) => 13 | ||
fib(8) => 21 | ||
fib(9) => 34 |
Oops, something went wrong.