mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-09-08 17:54:40 +00:00
Restructured fragment tests to use less memory.
This commit is contained in:
parent
980fc0aeb5
commit
6bc35f6c34
@ -57,6 +57,14 @@ public class AsmFragmentTemplateSynthesizer {
|
||||
*/
|
||||
private Map<String, AsmFragmentSynthesis> synthesisGraph;
|
||||
|
||||
/**
|
||||
* Get information about the size of the synthesizer data structures
|
||||
* @return String with size information
|
||||
*/
|
||||
public static String getSizes() {
|
||||
return "graph: "+ SYNTHESIZER.synthesisGraph.size();
|
||||
}
|
||||
|
||||
public static AsmFragmentInstance getFragmentInstance(AsmFragmentInstanceSpec instanceSpec, CompileLog log) {
|
||||
String signature = instanceSpec.getSignature();
|
||||
AsmFragmentTemplate fragmentTemplate = SYNTHESIZER.getFragmentTemplate(signature, log);
|
||||
@ -367,6 +375,9 @@ public class AsmFragmentTemplateSynthesizer {
|
||||
return synthesisGraph.get(signature);
|
||||
}
|
||||
|
||||
/** Number of synthesis created
|
||||
private long synthesisCount = 0;
|
||||
|
||||
/**
|
||||
* Get (or create) the synthesis used to synthesize a fragment template.
|
||||
* If the synthesis does not already exist in the synthesis graph it is created - along with any sub-synthesis recursively usable for creating it.
|
||||
|
@ -10,7 +10,6 @@ import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.*;
|
||||
|
||||
import static junit.framework.TestCase.fail;
|
||||
@ -41,15 +40,101 @@ public class TestFragments {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryBu() throws IOException {
|
||||
testFragments("fragments-assignment-binary", assignmentsBinaryBu());
|
||||
public void testAssignmentsBinaryVbuaa() throws IOException {
|
||||
testAssignmentsBinary(new Value("vbuaa"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryVbuxx() throws IOException {
|
||||
testAssignmentsBinary(new Value("vbuxx"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryVbuyy() throws IOException {
|
||||
testAssignmentsBinary(new Value("vbuyy"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryVbuz1() throws IOException {
|
||||
testAssignmentsBinary(new Value("vbuz1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryDerefVbuz1() throws IOException {
|
||||
testAssignmentsBinary(new Value("_deref_pbuz1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryDerefVbuc1() throws IOException {
|
||||
testAssignmentsBinary(new Value("_deref_pbuc1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryPbuz1DerefidxVbuaa() throws IOException {
|
||||
testAssignmentsBinary(new Value("pbuz1_derefidx_vbuaa"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryPbuz1DerefidxVbuxx() throws IOException {
|
||||
testAssignmentsBinary(new Value("pbuz1_derefidx_vbuxx"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryPbuz1DerefidxVbuyy() throws IOException {
|
||||
testAssignmentsBinary(new Value("pbuz1_derefidx_vbuyy"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryPbuz1DerefidxVbuz1() throws IOException {
|
||||
testAssignmentsBinary(new Value("pbuz1_derefidx_vbuz1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryPbuz1DerefidxVbuz2() throws IOException {
|
||||
testAssignmentsBinary(new Value("pbuz1_derefidx_vbuz2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryPbuz1DerefidxVbuc1() throws IOException {
|
||||
testAssignmentsBinary(new Value("pbuz1_derefidx_vbuc1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryPbuc1DerefidxVbuaa() throws IOException {
|
||||
testAssignmentsBinary(new Value("pbuc1_derefidx_vbuaa"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryPbuc1DerefidxVbuxx() throws IOException {
|
||||
testAssignmentsBinary(new Value("pbuc1_derefidx_vbuxx"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryPbuc1DerefidxVbuyy() throws IOException {
|
||||
testAssignmentsBinary(new Value("pbuc1_derefidx_vbuyy"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignmentsBinaryPbuc1DerefidxVbuz1() throws IOException {
|
||||
testAssignmentsBinary(new Value("pbuc1_derefidx_vbuz1"));
|
||||
}
|
||||
|
||||
private void testAssignmentsBinary(Value lVal) throws IOException {
|
||||
testFragments("fragments-assignment-binary-" + lVal.getSignature(), assignmentsBinaryBu(lVal));
|
||||
}
|
||||
|
||||
private void testFragments(String fileName, Collection<String> signatures) throws IOException {
|
||||
AsmFragmentTemplateSynthesizer.initialize("src/main/fragment/");
|
||||
System.gc();
|
||||
CompileLog log = new CompileLog();
|
||||
int cnt = 0;
|
||||
for(String signature : signatures) {
|
||||
if(++cnt % 1000 == 0) System.out.println(""+cnt+"/"+signatures.size());
|
||||
if(++cnt % 1000 == 0) {
|
||||
System.gc();
|
||||
Runtime rt = Runtime.getRuntime();
|
||||
long usedMB = (rt.totalMemory() - rt.freeMemory()) / 1024 / 1024;
|
||||
System.out.println(""+cnt+"/"+signatures.size() + " - "+AsmFragmentTemplateSynthesizer.getSizes()+" mem: "+usedMB );
|
||||
}
|
||||
List<AsmFragmentTemplate> templates =
|
||||
new ArrayList<>(AsmFragmentTemplateSynthesizer.getFragmentTemplates(signature, log));
|
||||
Collections.sort(templates, Comparator.comparing(AsmFragmentTemplate::getClobber));
|
||||
@ -97,10 +182,8 @@ public class TestFragments {
|
||||
return signatures;
|
||||
}
|
||||
|
||||
private Collection<String> assignmentsBinaryBu() {
|
||||
private Collection<String> assignmentsBinaryBu(Value lValue) {
|
||||
ArrayList<String> signatures = new ArrayList<>();
|
||||
Collection<Value> lVals = lValuesBu(new ArrayList<>());
|
||||
for(Value lValue : lVals) {
|
||||
Collection<Value> rVal1s = rValuesBu(lValue.getAllValues());
|
||||
for(Value rVal1 : rVal1s) {
|
||||
ArrayList<Value> used = new ArrayList<>();
|
||||
@ -113,7 +196,6 @@ public class TestFragments {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return signatures;
|
||||
}
|
||||
|
||||
|
20427
src/test/ref/fragments-assignment-binary-_deref_pbuc1.log
Normal file
20427
src/test/ref/fragments-assignment-binary-_deref_pbuc1.log
Normal file
File diff suppressed because it is too large
Load Diff
16239
src/test/ref/fragments-assignment-binary-_deref_pbuz1.log
Normal file
16239
src/test/ref/fragments-assignment-binary-_deref_pbuz1.log
Normal file
File diff suppressed because it is too large
Load Diff
18903
src/test/ref/fragments-assignment-binary-pbuc1_derefidx_vbuaa.log
Normal file
18903
src/test/ref/fragments-assignment-binary-pbuc1_derefidx_vbuaa.log
Normal file
File diff suppressed because it is too large
Load Diff
13555
src/test/ref/fragments-assignment-binary-pbuc1_derefidx_vbuxx.log
Normal file
13555
src/test/ref/fragments-assignment-binary-pbuc1_derefidx_vbuxx.log
Normal file
File diff suppressed because it is too large
Load Diff
16695
src/test/ref/fragments-assignment-binary-pbuc1_derefidx_vbuyy.log
Normal file
16695
src/test/ref/fragments-assignment-binary-pbuc1_derefidx_vbuyy.log
Normal file
File diff suppressed because it is too large
Load Diff
46041
src/test/ref/fragments-assignment-binary-pbuc1_derefidx_vbuz1.log
Normal file
46041
src/test/ref/fragments-assignment-binary-pbuc1_derefidx_vbuz1.log
Normal file
File diff suppressed because it is too large
Load Diff
18411
src/test/ref/fragments-assignment-binary-pbuz1_derefidx_vbuaa.log
Normal file
18411
src/test/ref/fragments-assignment-binary-pbuz1_derefidx_vbuaa.log
Normal file
File diff suppressed because it is too large
Load Diff
10405
src/test/ref/fragments-assignment-binary-pbuz1_derefidx_vbuc1.log
Normal file
10405
src/test/ref/fragments-assignment-binary-pbuz1_derefidx_vbuc1.log
Normal file
File diff suppressed because it is too large
Load Diff
17445
src/test/ref/fragments-assignment-binary-pbuz1_derefidx_vbuxx.log
Normal file
17445
src/test/ref/fragments-assignment-binary-pbuz1_derefidx_vbuxx.log
Normal file
File diff suppressed because it is too large
Load Diff
20546
src/test/ref/fragments-assignment-binary-pbuz1_derefidx_vbuyy.log
Normal file
20546
src/test/ref/fragments-assignment-binary-pbuz1_derefidx_vbuyy.log
Normal file
File diff suppressed because it is too large
Load Diff
21185
src/test/ref/fragments-assignment-binary-pbuz1_derefidx_vbuz1.log
Normal file
21185
src/test/ref/fragments-assignment-binary-pbuz1_derefidx_vbuz1.log
Normal file
File diff suppressed because it is too large
Load Diff
27844
src/test/ref/fragments-assignment-binary-pbuz1_derefidx_vbuz2.log
Normal file
27844
src/test/ref/fragments-assignment-binary-pbuz1_derefidx_vbuz2.log
Normal file
File diff suppressed because it is too large
Load Diff
7532
src/test/ref/fragments-assignment-binary-vbuaa.log
Normal file
7532
src/test/ref/fragments-assignment-binary-vbuaa.log
Normal file
File diff suppressed because it is too large
Load Diff
7538
src/test/ref/fragments-assignment-binary-vbuxx.log
Normal file
7538
src/test/ref/fragments-assignment-binary-vbuxx.log
Normal file
File diff suppressed because it is too large
Load Diff
7530
src/test/ref/fragments-assignment-binary-vbuyy.log
Normal file
7530
src/test/ref/fragments-assignment-binary-vbuyy.log
Normal file
File diff suppressed because it is too large
Load Diff
16731
src/test/ref/fragments-assignment-binary-vbuz1.log
Normal file
16731
src/test/ref/fragments-assignment-binary-vbuz1.log
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user