mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-02-18 16:30:51 +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) -> {
|
getProgram(), (programValue, currentStmt, stmtIt, currentBlock) -> {
|
||||||
if(programValue.get() instanceof StructMemberRef) {
|
if(programValue.get() instanceof StructMemberRef) {
|
||||||
StructMemberRef structMemberRef = (StructMemberRef) programValue.get();
|
StructMemberRef structMemberRef = (StructMemberRef) programValue.get();
|
||||||
StructUnwinding.StructMemberUnwinding memberVariables = getStructMemberUnwinding(structMemberRef.getStruct(), currentStmt, stmtIt, currentBlock);
|
if(structMemberRef.getStruct() instanceof VariableRef) {
|
||||||
if(memberVariables != null && memberVariables != POSTPONE_UNWINDING) {
|
StructUnwinding.StructMemberUnwinding memberVariables = getStructMemberUnwinding(structMemberRef.getStruct(), currentStmt, stmtIt, currentBlock);
|
||||||
VariableRef structMemberVariable = (VariableRef) memberVariables.getMemberUnwinding(structMemberRef.getMemberName());
|
if(memberVariables != null && memberVariables != POSTPONE_UNWINDING) {
|
||||||
getLog().append("Replacing struct member reference " + structMemberRef.toString(getProgram()) + " with member unwinding reference " + structMemberVariable.toString(getProgram()));
|
LValue structMemberVariable = memberVariables.getMemberUnwinding(structMemberRef.getMemberName());
|
||||||
programValue.set(structMemberVariable);
|
getLog().append("Replacing struct member reference " + structMemberRef.toString(getProgram()) + " with member unwinding reference " + structMemberVariable.toString(getProgram()));
|
||||||
modified.set(true);
|
programValue.set(structMemberVariable);
|
||||||
|
modified.set(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -84,7 +84,11 @@ public class Pass5FixLongBranches extends Pass5AsmOptimization {
|
|||||||
try {
|
try {
|
||||||
asmRes = KickAssembler.main2(new String[]{asmFile.getAbsolutePath(), "-o", asmPrgFile.getAbsolutePath()});
|
asmRes = KickAssembler.main2(new String[]{asmFile.getAbsolutePath(), "-o", asmPrgFile.getAbsolutePath()});
|
||||||
} catch(Throwable e) {
|
} 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 {
|
} finally {
|
||||||
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
|
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
|
||||||
}
|
}
|
||||||
|
@ -75,45 +75,6 @@ public class TestPrograms {
|
|||||||
compileAndCompare("sieve");
|
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
|
@Test
|
||||||
public void testTrueTypeSplines() throws IOException, URISyntaxException {
|
public void testTrueTypeSplines() throws IOException, URISyntaxException {
|
||||||
compileAndCompare("complex/splines/truetype-splines");
|
compileAndCompare("complex/splines/truetype-splines");
|
||||||
@ -372,6 +333,40 @@ public class TestPrograms {
|
|||||||
compileAndCompare("textbox");
|
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
|
@Test
|
||||||
public void testStructPtr15() throws IOException, URISyntaxException {
|
public void testStructPtr15() throws IOException, URISyntaxException {
|
||||||
compileAndCompare("struct-ptr-15");
|
compileAndCompare("struct-ptr-15");
|
||||||
@ -487,6 +482,11 @@ public class TestPrograms {
|
|||||||
assertError("struct-err-0", "Unknown struct type");
|
assertError("struct-err-0", "Unknown struct type");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStruct10() throws IOException, URISyntaxException {
|
||||||
|
compileAndCompare("struct-10");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStruct9() throws IOException, URISyntaxException {
|
public void testStruct9() throws IOException, URISyntaxException {
|
||||||
compileAndCompare("struct-9");
|
compileAndCompare("struct-9");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user