Skip to content
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

Exception exit support #91

Open
wants to merge 43 commits into
base: master
Choose a base branch
from

Conversation

markro49
Copy link
Contributor

I have completed an upstream merge of Philipp Hirch's changes to add exception exit ppts to chicory output files. I think there might be a little more common code in chicory/Instrument and dcomp/DCIstrument that can be merged, but that can wait until latter.

@markro49
Copy link
Contributor Author

Should have mentioned that this subsumes #56. That pull request will be deleted/closed as part of this work.

@markro49
Copy link
Contributor Author

still need to update doc files

@markro49
Copy link
Contributor Author

markro49 commented Aug 2, 2017

As we discussed, I have completed this work and it is ready for review.

@mernst
Copy link
Member

mernst commented Aug 3, 2017

A few high-level questions:

foo():::ENTER is the point at the entry to procedure foo(). The invariants at that point are the preconditions for the foo() method, properties that are always true when the procedure is invoked.

Are these normal preconditions or overall preconditions?

Is there a way to determine exceptional preconditions for a given :::EXCEPTION program point?
A user may want to know, what are the preconditions (the properties upon entry to the routine) that lead to this particular exception.

The Daikon manual (section 5.2) doesn't mention EXCEPTIONUNCAUGHT program points, but it should.

points. Typically, @code{orig()} variables do not appear in the trace,
but are automatically created by Daikon when it matches up
@code{:::ENTER} and @code{:::EXIT@var{nn}} program points.
of @code{x}). These variables appear only at @code{:::EXIT} and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't refill paragraphs (that is, don't remove line breaks). It makes the diffs bigger and harder to read.

Copy link
Member

@mernst mernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some initial comments. Could you address these, and then I will do another round of code review?

One comment is that there seem to be some changes that are not directly related to handling exceptional exits. It would be nice to separate those into a second pull request, so that I can review the two pull requests separately.
Thanks!

* @return the exception name suffix for Daikon
*/
private static String exceptionSuffix(int lineNum) {
return lineNum < 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be lineNum == -1? That seems clearer to me.

@@ -4405,6 +4405,19 @@ public boolean is_exit() {
}
}

// UNDONE: this doesn't look right
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does "UNDONE" mean "TODO"? I think the "UNDONE" comments should be clarified or removed, throughout.

@@ -388,7 +407,7 @@ private InstructionList call_initNotify(
* Instrument all the methods in a class. For each method, add instrumentation code at the entry
* and at each return from the method. In addition, changes each return statement to first place
* the value being returned into a local and then return. This allows us to work around the JDI
* deficiency of not being able to query return values.
* deficiency of not being able to query return values. (We now instrument throws as well.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't write comments like this. Years from now, people won't know when this comment was written or why it is relevant. Please describe the code, not the code's history.

* (return__$trace2_val) and then do the return. Also, calls Runtime.exit() immediately before the
* return.
* If this is a return instruction, generate new il to assign the result to a local variable
* (return__$trace2_val) and then call Runtime.exit(). This il wil be inserted immediately before
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusing. It's not java.lang.Runtime.exit(), nor daikon.Runtime. I think it's what is in runtime_classname. Clarifying that would be helpful.

@@ -130,6 +130,9 @@
@Option("Number of calls after which sampling will begin")
public static int sample_start = 0;

@Option("Enable remote debug")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a Javadoc comment, explaining what this does or how to use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added and used by Philipp Hirch. I do not know how to use it. Should I comment out or just delete?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a new change -- it already existed, and he just moved it to be a command-line option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that now and presumably his changes made it work (better?). I get the jist of what this does and I think all the debug arguments are just magic. I will write up something.

if (!name().contains("exception")) {
return ("\\result");
} else {
return ("Exception");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use unnecessary parentheses around return statement values.

@@ -1,3 +1,5 @@
This directory tests Chicory command-line options.
Each test runs Chicory and Daikon on the StackAr program, but each test
uses a different set of command-line options.

The test suite has been augmented to cover the addition of exception exit ppts.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this. It isn't helpful in the code -- it's just a code review comment, and as such it doesn't belong in the code.

/*@ requires \typeof(x) == \type(DataStructures.MyInteger); */
/*@ modifies this.root; */
/*@ ensures this.root != null; */
/*@ ensures \old(x) != null; */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an odd change. I find the original line clearer and more intuitive than the new one.
Do you understand the cause of this change in output? What would it take to restore the behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I do not understand the cause of this change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, we need to understand this before we merge the change.

@@ -3,10 +3,10 @@ misc.Purity:::OBJECT
Variables: this this.value this.shift this.heavy this.list1 this.list1[] this.list1[].getClass().getName() this.list2 this.list2[] this.list2[].getClass().getName() this.list2.getClass().getName() this.getValue() this.getShift() this.isHeavy() this.getNum() this.getNum().getClass().getName() this.getJWrap() this.scale(this.value) this.scale(this.shift) this.scale(this.getValue()) this.scale(this.getShift()) this.sum(this.getNum()) this.sum(this.getJWrap()) this.retrieve(this.list1) this.retrieve(this.list2) size(this.list1[]) size(this.list1[])-1 size(this.list2[]) size(this.list2[])-1 this.list1[this.value] this.list1[this.value-1] this.list1[this.value..] this.list1[this.value+1..] this.list1[0..this.value] this.list1[0..this.value-1] this.list2[this.value] this.list2[this.value-1] this.list2[this.value..] this.list2[this.value+1..] this.list2[0..this.value] this.list2[0..this.value-1] this.list1[this.shift] this.list1[this.shift-1] this.list1[this.shift..] this.list1[this.shift+1..] this.list1[0..this.shift] this.list1[0..this.shift-1] this.list2[this.shift] this.list2[this.shift-1] this.list2[this.shift..] this.list2[this.shift+1..] this.list2[0..this.shift] this.list2[0..this.shift-1] this.list1[this.getValue()] this.list1[this.getValue()-1] this.list1[this.getValue()..] this.list1[this.getValue()+1..] this.list1[0..this.getValue()] this.list1[0..this.getValue()-1] this.list1[this.getShift()] this.list1[this.getShift()-1] this.list1[this.getShift()..] this.list1[this.getShift()+1..] this.list1[0..this.getShift()] this.list1[0..this.getShift()-1] this.list1[this.scale(this.value)] this.list1[this.scale(this.value)-1] this.list1[this.scale(this.value)..] this.list1[this.scale(this.value)+1..] this.list1[0..this.scale(this.value)] this.list1[0..this.scale(this.value)-1] this.list1[this.scale(this.shift)] this.list1[this.scale(this.shift)-1] this.list1[this.scale(this.shift)..] this.list1[this.scale(this.shift)+1..] this.list1[0..this.scale(this.shift)] this.list1[0..this.scale(this.shift)-1] this.list1[this.scale(this.getValue())] this.list1[this.scale(this.getValue())-1] this.list1[this.scale(this.getValue())..] this.list1[this.scale(this.getValue())+1..] this.list1[0..this.scale(this.getValue())] this.list1[0..this.scale(this.getValue())-1] this.list1[this.scale(this.getShift())] this.list1[this.scale(this.getShift())-1] this.list1[this.scale(this.getShift())..] this.list1[this.scale(this.getShift())+1..] this.list1[0..this.scale(this.getShift())] this.list1[0..this.scale(this.getShift())-1] this.list1[this.sum(this.getNum())] this.list1[this.sum(this.getNum())-1] this.list1[this.sum(this.getNum())..] this.list1[this.sum(this.getNum())+1..] this.list1[0..this.sum(this.getNum())] this.list1[0..this.sum(this.getNum())-1] this.list1[this.sum(this.getJWrap())] this.list1[this.sum(this.getJWrap())-1] this.list1[this.sum(this.getJWrap())..] this.list1[this.sum(this.getJWrap())+1..] this.list1[0..this.sum(this.getJWrap())] this.list1[0..this.sum(this.getJWrap())-1] this.list1[this.retrieve(this.list1)] this.list1[this.retrieve(this.list1)-1] this.list1[this.retrieve(this.list1)..] this.list1[this.retrieve(this.list1)+1..] this.list1[0..this.retrieve(this.list1)] this.list1[0..this.retrieve(this.list1)-1] this.list1[this.retrieve(this.list2)] this.list1[this.retrieve(this.list2)-1] this.list1[this.retrieve(this.list2)..] this.list1[this.retrieve(this.list2)+1..] this.list1[0..this.retrieve(this.list2)] this.list1[0..this.retrieve(this.list2)-1] this.list2[this.getValue()] this.list2[this.getValue()-1] this.list2[this.getValue()..] this.list2[this.getValue()+1..] this.list2[0..this.getValue()] this.list2[0..this.getValue()-1] this.list2[this.getShift()] this.list2[this.getShift()-1] this.list2[this.getShift()..] this.list2[this.getShift()+1..] this.list2[0..this.getShift()] this.list2[0..this.getShift()-1] this.list2[this.scale(this.value)] this.list2[this.scale(this.value)-1] this.list2[this.scale(this.value)..] this.list2[this.scale(this.value)+1..] this.list2[0..this.scale(this.value)] this.list2[0..this.scale(this.value)-1] this.list2[this.scale(this.shift)] this.list2[this.scale(this.shift)-1] this.list2[this.scale(this.shift)..] this.list2[this.scale(this.shift)+1..] this.list2[0..this.scale(this.shift)] this.list2[0..this.scale(this.shift)-1] this.list2[this.scale(this.getValue())] this.list2[this.scale(this.getValue())-1] this.list2[this.scale(this.getValue())..] this.list2[this.scale(this.getValue())+1..] this.list2[0..this.scale(this.getValue())] this.list2[0..this.scale(this.getValue())-1] this.list2[this.scale(this.getShift())] this.list2[this.scale(this.getShift())-1] this.list2[this.scale(this.getShift())..] this.list2[this.scale(this.getShift())+1..] this.list2[0..this.scale(this.getShift())] this.list2[0..this.scale(this.getShift())-1] this.list2[this.sum(this.getNum())] this.list2[this.sum(this.getNum())-1] this.list2[this.sum(this.getNum())..] this.list2[this.sum(this.getNum())+1..] this.list2[0..this.sum(this.getNum())] this.list2[0..this.sum(this.getNum())-1] this.list2[this.sum(this.getJWrap())] this.list2[this.sum(this.getJWrap())-1] this.list2[this.sum(this.getJWrap())..] this.list2[this.sum(this.getJWrap())+1..] this.list2[0..this.sum(this.getJWrap())] this.list2[0..this.sum(this.getJWrap())-1] this.list2[this.retrieve(this.list1)] this.list2[this.retrieve(this.list1)-1] this.list2[this.retrieve(this.list1)..] this.list2[this.retrieve(this.list1)+1..] this.list2[0..this.retrieve(this.list1)] this.list2[0..this.retrieve(this.list1)-1] this.list2[this.retrieve(this.list2)] this.list2[this.retrieve(this.list2)-1] this.list2[this.retrieve(this.list2)..] this.list2[this.retrieve(this.list2)+1..] this.list2[0..this.retrieve(this.list2)] this.list2[0..this.retrieve(this.list2)-1]
this.value == this.getValue()
this.shift == this.getShift()
this.shift == this.retrieve()
this.shift == this.retrieve()
this.shift == this.retrieve(this.list1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What caused this change? If it's correct, was this a bug fix unrelated to the exceptional exit support, but in the same pull request? Or was it caused by a previously-committed change, but the goal files were not regenerated since then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the history of this goal file, it appears this is a new change. I do not know what caused it.

@@ -41,12 +41,12 @@ everything-%: quick-% nonquick-%
@echo ${HR}
quick-%: SQD-% polycalc-% special-cases-% siemens-%
@echo ${HR}
nonquick-%: dsaa-% mapquick-% javautil-% 6170-% large-% new-%
nonquick-%: dsaa-% mapquick-% javautil-% 6170-% large-% new-% newRar-%
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this name from the username of the author of the commit? Please use a better name, or eliminate it (and update line 69 below).

@mernst
Copy link
Member

mernst commented Aug 1, 2018

The build is failing, which indicates I broke something. Sorry about that. I'll look into it this evening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants