Skip to content

Commit

Permalink
final commit
Browse files Browse the repository at this point in the history
add some comment and delete unused comment
  • Loading branch information
maasaid committed Aug 30, 2024
1 parent 4a3392d commit 476d8d5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 40 deletions.
39 changes: 3 additions & 36 deletions test/hotspot/jtreg/compiler/lib/test_generator/CodeSegment.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,66 +22,33 @@
*/

package compiler.lib.test_generator;

public class CodeSegment {
private final String statics;
//private String calls;
private StringBuilder calls = new StringBuilder();
private StringBuilder methods = new StringBuilder();
//private String methods;
private final String imports;

public CodeSegment(String statics, String calls, String methods, String imports) {
this.statics = statics;
//this.calls = calls;
this.calls = new StringBuilder(calls);
//this.methods = methods;
this.methods = new StringBuilder(methods);
this.imports = imports;
}

public String getStatics() {
return statics;
}
/*
public String getCalls() {
return calls;
}
public void appendCall(String call) {
this.calls += call;
}
*/
public void appendCall(String calls) {
this.calls.append(calls);
}

public String getCalls() {
return calls.toString();
}
/*
public String getMethods() {
return methods;
}
public void appendMethods(String method) {
this.methods += method;
}
*/


public void appendMethods(String method) {
this.methods.append(method);
}

public String getMethods() {
return methods.toString();
}




public String getImports() {return imports;}
public String getImports() {
return imports;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public static String getUniqueId() {
return String.valueOf(System.nanoTime());
}
public static Integer[] getIntegerValues(int size) {

HashSet<Integer> integers = new HashSet<>(size);
while (integers.size() < size) {
int number = RAND.nextInt(Integer.MAX_VALUE - 1) + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ static class A {
}
}
""";


return new CodeSegment(statics, call, method,imports);
}
@Override
Expand Down Expand Up @@ -114,6 +112,6 @@ public int getNumberOfTests(){
}
@Override
public int getNumberOfTestMethods() {
return 1000;
return 1;
}
}
5 changes: 5 additions & 0 deletions test/hotspot/jtreg/compiler/lib/test_generator/Template.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
public abstract class Template {
public Template() {}
static int variableNumber = 1;
/*
* This method processes a given template string to avoid variable name conflicts by appending a unique identifier.
* It searches for placeholders within the string, identified by a '$' followed by a word (variable name),
* and replaces each placeholder with the variable name concatenated with a unique number.
*/
public static String avoidConflict(String temp){
StringBuilder result = new StringBuilder();
String regex="\\$(\\w+)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ public class TemplateGenerator {
static final int MAX_TASKS_IN_QUEUE = NUM_THREADS * 330;
static String[] TEMPLATE_FILES = {
"InputTemplate1.java",
"InputTemplate2.java",
"InputTemplate3.java",
"InputTemplate4.java",
"InputTemplate5.java",
"InputTemplate6.java",
"InputTemplate7.java",
"InputTemplate8.java",
"InputTemplate9.java",
"InputTemplate10.java",
"InputTemplate11.java",
"InputTemplate12.java",
"InputTemplate13.java",
"InputTemplate14.java",
"InputTemplate15.java",
"InputTemplate16.java",
"InputTemplate17.java",

};
private static long testId = 0L;
public static long getID() {
Expand Down

0 comments on commit 476d8d5

Please sign in to comment.