-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Before this patch, an assignment a = b, where a and b are two arrays, was allowed only if b was fully valid, and a was marked as fully valid too. After this patch, b does not need to be fully valid, and a is marked as having the same validity as b.
- Loading branch information
Showing
6 changed files
with
345 additions
and
196 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
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,22 @@ | ||
export fn test () -> reg u64 { | ||
stack u64[2] s; | ||
reg ptr u64[2] r1 r2; | ||
|
||
s[0] = 0; | ||
s[1] = 1; | ||
|
||
r1 = s; | ||
r1[0] = 2; | ||
|
||
r2 = s; // we copy s while it is not fully valid | ||
r2[1] = 3; | ||
|
||
s[0:1] = r1[0:1]; | ||
s[1:1] = r2[1:1]; | ||
|
||
reg u64 res; | ||
res = s[0]; | ||
res += s[1]; | ||
|
||
return res; | ||
} |
19 changes: 19 additions & 0 deletions
19
compiler/tests/success/subarrays/x86-64/spill_partial.jazz
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,19 @@ | ||
fn f (reg ptr u64[2] r) -> reg ptr u64[2] { | ||
r[0] = 1; | ||
return r; | ||
} | ||
|
||
export fn test (reg ptr u64[4] r) -> reg ptr u64[4], reg u64 { | ||
reg ptr u64[2] r2; | ||
|
||
r2 = r[1:2]; | ||
() = #spill(r); | ||
r2 = f(r2); | ||
() = #unspill(r); // we unspill r, while it is not fully valid | ||
r[1:2] = r2; | ||
|
||
reg u64 res; | ||
res = r[1]; | ||
|
||
return r, res; | ||
} |
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,25 @@ | ||
export fn test () -> reg u64 { | ||
stack u64[2] s; | ||
reg ptr u64[2] r1 r2; | ||
|
||
s[0] = 0; | ||
s[1] = 1; | ||
|
||
r1 = s; | ||
r1[0] = 2; | ||
|
||
r2 = s; // we copy s while it is not fully valid | ||
r2[1] = 3; | ||
|
||
// we swap two arrays that are both not full valid | ||
(r1, r2) = #swap(r1, r2); | ||
|
||
s[0:1] = r2[0:1]; | ||
s[1:1] = r1[1:1]; | ||
|
||
reg u64 res; | ||
res = 0; | ||
res += s[1]; | ||
|
||
return res; | ||
} |
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
Oops, something went wrong.