mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-26 12:49:21 +00:00
Renamed struct tests away from "problem-" name. Postponed struct member unwinding for non-variable members.
This commit is contained in:
parent
f336907efd
commit
07b08e3ed7
@ -76,12 +76,14 @@ public class Pass1UnwindStructValues extends Pass1Base {
|
||||
getProgram(), (programValue, currentStmt, stmtIt, currentBlock) -> {
|
||||
if(programValue.get() instanceof StructMemberRef) {
|
||||
StructMemberRef structMemberRef = (StructMemberRef) programValue.get();
|
||||
StructUnwinding.StructMemberUnwinding memberVariables = getStructMemberUnwinding(structMemberRef.getStruct(), currentStmt, stmtIt, currentBlock);
|
||||
if(memberVariables != null && memberVariables != POSTPONE_UNWINDING) {
|
||||
VariableRef structMemberVariable = (VariableRef) memberVariables.getMemberUnwinding(structMemberRef.getMemberName());
|
||||
getLog().append("Replacing struct member reference " + structMemberRef.toString(getProgram()) + " with member unwinding reference " + structMemberVariable.toString(getProgram()));
|
||||
programValue.set(structMemberVariable);
|
||||
modified.set(true);
|
||||
if(structMemberRef.getStruct() instanceof VariableRef) {
|
||||
StructUnwinding.StructMemberUnwinding memberVariables = getStructMemberUnwinding(structMemberRef.getStruct(), currentStmt, stmtIt, currentBlock);
|
||||
if(memberVariables != null && memberVariables != POSTPONE_UNWINDING) {
|
||||
LValue structMemberVariable = memberVariables.getMemberUnwinding(structMemberRef.getMemberName());
|
||||
getLog().append("Replacing struct member reference " + structMemberRef.toString(getProgram()) + " with member unwinding reference " + structMemberVariable.toString(getProgram()));
|
||||
programValue.set(structMemberVariable);
|
||||
modified.set(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -84,7 +84,11 @@ public class Pass5FixLongBranches extends Pass5AsmOptimization {
|
||||
try {
|
||||
asmRes = KickAssembler.main2(new String[]{asmFile.getAbsolutePath(), "-o", asmPrgFile.getAbsolutePath()});
|
||||
} catch(Throwable e) {
|
||||
throw new CompileError("Error! KickAssembler failed, while trying to fix long branch. " + e);
|
||||
if(e instanceof AssertionError && e.getMessage().contains("Invalid number of bytes in memblock!")) {
|
||||
throw new CompileError("Error! KickAssembler failed due to assertion. Please run java without -ea / -enableassertions.", e);
|
||||
} else {
|
||||
throw new CompileError("Error! KickAssembler failed, while trying to fix long branch. " + e);
|
||||
}
|
||||
} finally {
|
||||
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
|
||||
}
|
||||
|
@ -75,45 +75,6 @@ public class TestPrograms {
|
||||
compileAndCompare("sieve");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProblemPointerInsideStructSizeofRewriting() throws IOException, URISyntaxException {
|
||||
compileAndCompare("problem-pointer-inside-struct-sizeof-rewriting");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProblemStructPointerParam() throws IOException, URISyntaxException {
|
||||
compileAndCompare("problem-struct-pointer-param");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProblemArrayStructParam() throws IOException, URISyntaxException {
|
||||
compileAndCompare("problem-array-struct-param");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProblemStructReturnToPointer() throws IOException, URISyntaxException {
|
||||
compileAndCompare("problem-struct-return-to-pointer");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProblemStructReturnPointerDeref() throws IOException, URISyntaxException {
|
||||
compileAndCompare("problem-struct-return-pointer-deref");
|
||||
}
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void testProblemArrayStructInit() throws IOException, URISyntaxException {
|
||||
compileAndCompare("problem-array-struct-init");
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void testProblemInlineStructReturn() throws IOException, URISyntaxException {
|
||||
compileAndCompare("problem-inline-struct-return", log().verboseCreateSsa());
|
||||
}
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testTrueTypeSplines() throws IOException, URISyntaxException {
|
||||
compileAndCompare("complex/splines/truetype-splines");
|
||||
@ -372,6 +333,40 @@ public class TestPrograms {
|
||||
compileAndCompare("textbox");
|
||||
}
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void testProblemArrayStructInit() throws IOException, URISyntaxException {
|
||||
compileAndCompare("problem-array-struct-init");
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void testProblemInlineStructReturn() throws IOException, URISyntaxException {
|
||||
compileAndCompare("problem-inline-struct-return", log().verboseCreateSsa());
|
||||
}
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testStructPtr19() throws IOException, URISyntaxException {
|
||||
compileAndCompare("struct-ptr-19");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructPtr18() throws IOException, URISyntaxException {
|
||||
compileAndCompare("struct-ptr-18");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructPtr17() throws IOException, URISyntaxException {
|
||||
compileAndCompare("struct-ptr-17");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructPtr16() throws IOException, URISyntaxException {
|
||||
compileAndCompare("struct-ptr-16");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructPtr15() throws IOException, URISyntaxException {
|
||||
compileAndCompare("struct-ptr-15");
|
||||
@ -487,6 +482,11 @@ public class TestPrograms {
|
||||
assertError("struct-err-0", "Unknown struct type");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStruct10() throws IOException, URISyntaxException {
|
||||
compileAndCompare("struct-10");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStruct9() throws IOException, URISyntaxException {
|
||||
compileAndCompare("struct-9");
|
||||
|
Loading…
Reference in New Issue
Block a user