-
Notifications
You must be signed in to change notification settings - Fork 35
Improve Debug Logs #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Debug Logs #224
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| import liquidjava.rj_language.ast.BinaryExpression; | ||
| import liquidjava.rj_language.ast.Expression; | ||
| import liquidjava.rj_language.ast.GroupExpression; | ||
| import liquidjava.smt.Counterexample; | ||
| import liquidjava.utils.Utils; | ||
| import spoon.reflect.cu.SourcePosition; | ||
| import spoon.reflect.reference.CtTypeReference; | ||
|
|
@@ -123,6 +124,23 @@ public static void smtStart(VCImplication chain, Predicate extraPremise, Predica | |
| System.out.println(SMT_TAG + " " + formatConclusion(conclusion)); | ||
| } | ||
|
|
||
| public static void simplificationInput(Predicate predicate) { | ||
| if (!enabled()) { | ||
| return; | ||
| } | ||
| System.out.println(SMT_TAG + " unsimplified: " + predicate); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dont use the smt_tag for simplification, create a SIM or SPL tag with another color to indicate what phase we are showing. Also use Unsimplified with uppercase |
||
| } | ||
|
|
||
| public static void counterexampleAssignments(Counterexample counterexample) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. javadoc |
||
| if (!enabled() || counterexample == null || counterexample.assignments().isEmpty()) { | ||
| return; | ||
| } | ||
| System.out.println(SMT_TAG + " unfiltered counterexample assignments:"); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
| for (var assignment : counterexample.assignments()) { | ||
| System.out.println(SMT_TAG + " " + assignment.first() + " = " + assignment.second()); | ||
| } | ||
| } | ||
|
|
||
| private static String plainLabel(VCImplication node) { | ||
| return node.getName() + " : " + simpleType(node.getType()); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| import java.util.Map; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import liquidjava.api.CommandLineLauncher; | ||
| import liquidjava.diagnostics.DebugLog; | ||
| import liquidjava.diagnostics.errors.LJError; | ||
| import liquidjava.diagnostics.errors.NotFoundError; | ||
| import liquidjava.processor.context.AliasWrapper; | ||
|
|
@@ -252,14 +252,13 @@ public Expression getExpression() { | |
| } | ||
|
|
||
| public ValDerivationNode simplify(Context context) { | ||
| DebugLog.simplificationInput(this); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should print both unsimplified and simplified predicates one next to the other so its easier to see the changes in the debug info |
||
|
|
||
| // collect aliases from context | ||
| Map<String, AliasDTO> aliases = new HashMap<>(); | ||
| for (AliasWrapper aw : context.getAliases()) { | ||
| aliases.put(aw.getName(), aw.createAliasDTO()); | ||
| } | ||
| if (CommandLineLauncher.cmdArgs.debugMode) { | ||
| return new ValDerivationNode(exp.clone(), null); | ||
| } | ||
| // simplify expression | ||
| return ExpressionSimplifier.simplify(exp.clone(), aliases); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
javadoc? also change the function name, since this is printing the unsimplified version it makes little sense to call it simplificationInput in this file - i get it from where it comes from but its not very meaningful