summaryrefslogtreecommitdiff
path: root/chapter22/src/test/java
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2025-05-05 11:17:51 -0700
committerCliff Click <cliffc@acm.org>2025-05-05 11:17:51 -0700
commit809e8701e48bd92cf0570ce536dbb74b84fccd9a (patch)
treeaaede913d237391b8e32799643baf811533df746 /chapter22/src/test/java
parentd70aee1171779c6a416a3910426ad034cf687c28 (diff)
downloadSimple-809e8701e48bd92cf0570ce536dbb74b84fccd9a.tar.gz
Simple-809e8701e48bd92cf0570ce536dbb74b84fccd9a.zip
Printing a string
Bug fix big constant ELF numbering cpool writing handles constant arrays casting an array to an int works, gives the array base as int; suitable for passing to FFI. Is not GC stable. Encode `ldi` ptrs. Types have a size, logsize, and alignment. Explicit struct layout
Diffstat (limited to 'chapter22/src/test/java')
-rw-r--r--chapter22/src/test/java/com/seaofnodes/simple/Chapter15Test.java4
-rw-r--r--chapter22/src/test/java/com/seaofnodes/simple/Chapter22Test.java4
-rw-r--r--chapter22/src/test/java/com/seaofnodes/simple/progs/helloWorld.smp4
3 files changed, 7 insertions, 5 deletions
diff --git a/chapter22/src/test/java/com/seaofnodes/simple/Chapter15Test.java b/chapter22/src/test/java/com/seaofnodes/simple/Chapter15Test.java
index cebbf4a0..a98e62d8 100644
--- a/chapter22/src/test/java/com/seaofnodes/simple/Chapter15Test.java
+++ b/chapter22/src/test/java/com/seaofnodes/simple/Chapter15Test.java
@@ -253,10 +253,10 @@ return new flt;
public void testBad1() {
CodeGen code = new CodeGen(
"""
-int is = new int[2];
+flt is = new int[2];
""");
try { code.parse().opto(); fail(); }
- catch( Exception e ) { assertEquals("Type *[int] is not of declared type int",e.getMessage()); }
+ catch( Exception e ) { assertEquals("Type *[int] is not of declared type flt",e.getMessage()); }
}
@Test
diff --git a/chapter22/src/test/java/com/seaofnodes/simple/Chapter22Test.java b/chapter22/src/test/java/com/seaofnodes/simple/Chapter22Test.java
index b99a01a6..de9c35c7 100644
--- a/chapter22/src/test/java/com/seaofnodes/simple/Chapter22Test.java
+++ b/chapter22/src/test/java/com/seaofnodes/simple/Chapter22Test.java
@@ -33,7 +33,7 @@ public class Chapter22Test {
@Test public void testJig1() throws IOException {
- EvalRisc5 R5 = TestRisc5.build("riscv_load", 0, 0, true);
+ EvalRisc5 R5 = TestRisc5.build("riscv_load", 0, 0, false);
int trap = R5.step(100);
assertEquals(0,trap);
// do assertEquals here
@@ -108,7 +108,7 @@ return cc.cz;
@Test @Ignore
public void testHelloWorld() throws IOException {
String src = Files.readString(Path.of("src/test/java/com/seaofnodes/simple/progs/helloWorld.smp"));
- TestC.run(src,TestC.CALL_CONVENTION,null,null,"build/objs/helloWorld","","Hello, World!",13);
+ TestC.run(src,TestC.CALL_CONVENTION,null,null,"build/objs/helloWorld","","Hello, World!",0);
}
diff --git a/chapter22/src/test/java/com/seaofnodes/simple/progs/helloWorld.smp b/chapter22/src/test/java/com/seaofnodes/simple/progs/helloWorld.smp
index 16ef4bc6..b83a055c 100644
--- a/chapter22/src/test/java/com/seaofnodes/simple/progs/helloWorld.smp
+++ b/chapter22/src/test/java/com/seaofnodes/simple/progs/helloWorld.smp
@@ -1,2 +1,4 @@
// -*- mode: java; -*-
-return sys.libc.write(1,"Hello, World!",13);
+i64 buf = "Hello, World!";
+sys.libc.write(1,buf,13);
+return 0;