diff options
| author | Cliff Click <cliffc@acm.org> | 2026-10-01 15:47:15 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-10-01 15:47:15 -0700 |
| commit | bd0ef17d0f9563ed9579fe060b785211e8378006 (patch) | |
| tree | d8f45cdfd6e7ee295997d11ff948ca4950153721 /chapter25/src/test/java | |
| parent | 5dd5b7a2d03885cb767bbf2b609d56f8ef897301 (diff) | |
| download | Simple-bd0ef17d0f9563ed9579fe060b785211e8378006.tar.gz Simple-bd0ef17d0f9563ed9579fe060b785211e8378006.zip | |
Restore missing anti-dependence walk
Diffstat (limited to 'chapter25/src/test/java')
| -rw-r--r-- | chapter25/src/test/java/com/seaofnodes/simple/Chapter21Test.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chapter25/src/test/java/com/seaofnodes/simple/Chapter21Test.java b/chapter25/src/test/java/com/seaofnodes/simple/Chapter21Test.java index c3d93188..93a9e63f 100644 --- a/chapter25/src/test/java/com/seaofnodes/simple/Chapter21Test.java +++ b/chapter25/src/test/java/com/seaofnodes/simple/Chapter21Test.java @@ -15,6 +15,24 @@ import static org.junit.Assert.*; public class Chapter21Test { + @Test public void testReadBeforeConditionalStore() { + var code = new CodeGen(""" + struct S { int x; }; S !a=new S; S !b=new S; + a.x=10; b.x=20; S !p=a; if(arg&1) p=b; + int sum=0; + for(int i=0; i<6; i++) { + sum+=a.x; + if(i==2) p.x=30; + else if(i==4) b.x=40; + } + return sum; + """).parse().opto(); + // The i==2 read still sees 10: three reads of 10, then three of 30. + assertEquals("120",Eval2.eval(code,0)); + assertEquals("60",Eval2.eval(code,1)); + } + + @Test public void testArmBitfieldExtracts() { // Independent SXT/UXT instruction words, plus ASR, LSR and LSL aliases. int[] ops = {0x93401c20,0xd3401c20,0x93403c20,0xd3403c20, |
