Skip to content

Commit

Permalink
made const fold pass kosher
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan12 committed Nov 13, 2018
1 parent 9384f7f commit 6bbe01f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions compiler/src/jlang/JLangScheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,15 @@ public Goal JLangConstFold(Job job) {
ExtensionInfo extInfo = job.extensionInfo();
JLangTypeSystem ts = (JLangTypeSystem) extInfo.typeSystem();
JLangNodeFactory nf = (JLangNodeFactory) extInfo.nodeFactory();
return new VisitorGoal(job, new StringLitFold(ts, nf));

Goal constGoal = new VisitorGoal(job, new StringLitFold(ts, nf));
try {
// ensure all desugaring is done for the file (might generate more constants)
constGoal.addPrerequisiteGoal(LLVMDesugared(job), this);
} catch (CyclicDependencyException e) {
throw new InternalCompilerError(e);
}
// intern goal to remove duplicate objects being created (explicit singleton)
return internGoal(constGoal);
}

@Override
Expand Down

0 comments on commit 6bbe01f

Please sign in to comment.