summaryrefslogtreecommitdiff
path: root/chapter21/src/test/java
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2025-03-19 09:54:38 -0700
committerCliff Click <cliffc@acm.org>2025-03-19 09:54:38 -0700
commit352c6927252137a252ab942c83695890fb332004 (patch)
treecf36c8a487fc7d05d487531f565ce3015a8f9493 /chapter21/src/test/java
parent0328057dc9e5a7b4bcee4b9fe9260c91a59d5b5e (diff)
downloadSimple-352c6927252137a252ab942c83695890fb332004.tar.gz
Simple-352c6927252137a252ab942c83695890fb332004.zip
ELF exporting takes a target file
Diffstat (limited to 'chapter21/src/test/java')
-rw-r--r--chapter21/src/test/java/com/seaofnodes/simple/Chapter21Test.java28
1 files changed, 17 insertions, 11 deletions
diff --git a/chapter21/src/test/java/com/seaofnodes/simple/Chapter21Test.java b/chapter21/src/test/java/com/seaofnodes/simple/Chapter21Test.java
index f652fa97..431d0627 100644
--- a/chapter21/src/test/java/com/seaofnodes/simple/Chapter21Test.java
+++ b/chapter21/src/test/java/com/seaofnodes/simple/Chapter21Test.java
@@ -2,9 +2,10 @@ package com.seaofnodes.simple;
import com.seaofnodes.simple.codegen.CodeGen;
import com.seaofnodes.simple.print.ASMPrinter;
-import java.nio.file.Files;
import java.io.IOException;
+import java.nio.file.Files;
import java.nio.file.Path;
+import org.junit.Ignore;
import org.junit.Test;
import static com.seaofnodes.simple.Main.PORTS;
import static org.junit.Assert.*;
@@ -22,6 +23,7 @@ public class Chapter21Test {
static void testCPU( String src, String cpu, String os, int spills, String stop ) {
CodeGen code = new CodeGen(src);
code.parse().opto().typeCheck().instSelect(PORTS,cpu,os).GCM().localSched().regAlloc().encode();
+ code.asm();
int delta = spills>>3;
if( delta==0 ) delta = 1;
assertEquals("Expect spills:",spills,code._regAlloc._spillScaled,delta);
@@ -82,19 +84,23 @@ return ary[1] * 1000 + ary[3]; // 1 * 1000 + 6
}
- // Read test case from disk
@Test
- public void testPersons() throws IOException {
- String src = Files.readString(Path.of("src/test/java/com/seaofnodes/simple/progs/Person.smp"));
- testCPU(src,"x86_64_v2", "Win64" ,3,null);
- testCPU(src,"riscv" , "SystemV",1,null);
- testCPU(src,"arm" , "SystemV",1,null);
+ public void testExport() throws IOException {
+ CodeGen code = new CodeGen(newton);
+ code.parse().opto().typeCheck().instSelect(PORTS, "x86_64_v2", "SystemV").GCM().localSched().regAlloc().encode().exportELF("build/objs/newton.o");
}
- @Test
- public void testExport() {
- CodeGen code = new CodeGen(newton);
- code.parse().opto().typeCheck().instSelect(PORTS, "x86_64_v2", "SystemV").GCM().localSched().regAlloc().encode().exportELF();
+ // Read test case from disk.
+ // TODO: exportELF not handling external calls yet
+ @Ignore @Test
+ public void testPersons() throws IOException {
+ String src = Files.readString(Path.of("src/test/java/com/seaofnodes/simple/progs/Person.smp"));
+ CodeGen code = new CodeGen(src);
+ code.parse().opto().typeCheck().instSelect(PORTS, "x86_64_v2", "SystemV").GCM().localSched().regAlloc().encode().exportELF("build/objs/Persons.o");
+ //testCPU(src,"x86_64_v2", "Win64" ,3,null);
+ //testCPU(src,"riscv" , "SystemV",1,null);
+ //testCPU(src,"arm" , "SystemV",1,null);
}
+
}