From aa31b718eb0643bd0aaec3487384c396f9ebe975 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Fri, 3 Jul 2026 14:14:43 -0700 Subject: Series of minor fixes --- chapter24/README.md | 2 +- chapter24/pom.xml | 4 +-- .../java/com/seaofnodes/simple/Chapter22Test.java | 37 +++++++++++----------- .../test/java/com/seaofnodes/simple/Simple.java | 7 ++-- 4 files changed, 25 insertions(+), 25 deletions(-) (limited to 'chapter24') diff --git a/chapter24/README.md b/chapter24/README.md index cd5693d4..22fda399 100644 --- a/chapter24/README.md +++ b/chapter24/README.md @@ -7,7 +7,7 @@ We also present an Interprocedural Sparse Conditional Constant Propagation algorithm. -You can also read [this chapter](https://github.com/SeaOfNodes/Simple/tree/linear-chapter23) in a linear Git revision history on the [linear](https://github.com/SeaOfNodes/Simple/tree/linear) branch and [compare](https://github.com/SeaOfNodes/Simple/compare/linear-chapter22...linear-chapter23) it to the previous chapter. +You can also read [this chapter](https://github.com/SeaOfNodes/Simple/tree/linear-chapter24) in a linear Git revision history on the [linear](https://github.com/SeaOfNodes/Simple/tree/linear) branch and [compare](https://github.com/SeaOfNodes/Simple/compare/linear-chapter23...linear-chapter24) it to the previous chapter. ## Chaining Relational Tests diff --git a/chapter24/pom.xml b/chapter24/pom.xml index 6a59188f..4f0f80b1 100644 --- a/chapter24/pom.xml +++ b/chapter24/pom.xml @@ -8,7 +8,7 @@ simple 1.0 - chapter23 + chapter24 jar - Chapter 23 + Chapter 24 diff --git a/chapter24/src/test/java/com/seaofnodes/simple/Chapter22Test.java b/chapter24/src/test/java/com/seaofnodes/simple/Chapter22Test.java index 9e230bcd..78b9e7a1 100644 --- a/chapter24/src/test/java/com/seaofnodes/simple/Chapter22Test.java +++ b/chapter24/src/test/java/com/seaofnodes/simple/Chapter22Test.java @@ -16,24 +16,23 @@ public class Chapter22Test { @Test public void testJig() throws IOException { String src = - """ - struct s0 { - bool v1; - i16 v2; - int v3; - i8 v4; - byte v5; - }; - while(new s0.v3) - while(new s0.v5< + int temp=0; + int f1=1; + int f2=1; + int i=n; + while( i>1 ){ + temp = f1+f2; + f1=f2; + f2=temp; + i=i-1; + } + return f2; +}; + +fib(10); +"""; testCPU(src,"x86_64_v2", "Win64" ,-1,null); testCPU(src,"riscv" , "SystemV",-1,null); testCPU(src,"arm" , "SystemV",-1,null); @@ -138,7 +137,7 @@ struct Person { val fcn = { Person?[] ps, int x -> if( ps[x] ) ps[x].age++; -}; +}; """; String person = "6\n"; TestC.run(src, "person", null, person, 0); diff --git a/chapter24/src/test/java/com/seaofnodes/simple/Simple.java b/chapter24/src/test/java/com/seaofnodes/simple/Simple.java index 8b275389..be582a64 100644 --- a/chapter24/src/test/java/com/seaofnodes/simple/Simple.java +++ b/chapter24/src/test/java/com/seaofnodes/simple/Simple.java @@ -143,9 +143,10 @@ Options: System.out.printf( "TOTAL COMPILATION TIME: %.3f sec%n", total); } - static String getInput() { - BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); - return reader.lines().collect(Collectors.joining("\n")); + static String getInput() throws IOException { + try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) { + return reader.lines().collect(Collectors.joining("\n")); + } } public static void main(String[] args) throws Exception { -- cgit v1.2.3