-
Notifications
You must be signed in to change notification settings - Fork 54
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
Feature exception handling #56
base: master
Are you sure you want to change the base?
Changes from 14 commits
7b10337
ecc06dd
acb8440
9abd847
9af7d51
630bcce
439b2e9
4f89516
f4d3071
cce95a8
bdffdc4
516adde
12c6ed7
d01faa0
bb37a2f
0f26406
e8355f5
351a95a
d7e3d92
4e37beb
f62fa73
7397370
297304e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[![Build Status](https://travis-ci.org/rarworld/daikon.svg?branch=FeatureExceptionHandling)](https://travis-ci.org/rarworld/daikon) | ||
|
||
This is the distribution of a fork of the Daikon invariant detector, | ||
based on Daikon version 5.3.3, released May 2, 2016. | ||
Daikon version 5.3.3.1_rar, released Mai 24, 2016 | ||
|
||
If you are working with a Daikon distribution downloaded from the Daikon | ||
website, then most everything is setup and ready to go. See the 'doc' | ||
subdirectory for additional information, including installation instructions. | ||
You should start out with the file: | ||
doc/index.html | ||
The documentation also appears on the Daikon homepage: | ||
http://plse.cs.washington.edu/daikon/ | ||
|
||
If you are working with source cloned from the source code repository | ||
https://github.com/codespecs/daikon, then please review the file | ||
README.source. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,12 @@ public class Chicory { | |
@Option("Number of calls after which sampling will begin") | ||
public static int sample_start = 0; | ||
|
||
@Option("Should Exception Handling be taken care of?") | ||
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. Please make the documentation of this option more explicit. "taken care of" won't be clear to readers. |
||
public static boolean exception_handling = false; | ||
|
||
@Option("RemoteDebug Test") | ||
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. Rather than creating a variable whose only purpose is to be copied into another variable, I suggest that you put |
||
public static boolean rDebug = false; | ||
|
||
/** | ||
* Daikon port number. Daikon writes this to stdout when it is started | ||
* in online mode. | ||
|
@@ -138,7 +144,7 @@ public class Chicory { | |
/** flag to use if we want to turn on the static initialization checks **/ | ||
public static final boolean checkStaticInit = true; | ||
|
||
private static final boolean RemoteDebug = false; | ||
private static /*final*/ boolean RemoteDebug = false; | ||
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. It's not your fault, but could you give this field a lowercase first letter to conform to the Java standard? Also, remove |
||
|
||
/** Flag to initiate a purity analysis and use results to create add vars **/ | ||
private static boolean purityAnalysis = false; | ||
|
@@ -163,6 +169,7 @@ public static void main(String[] args) { | |
|
||
// Turn on basic logging if the debug was selected | ||
basic.enabled = debug; | ||
RemoteDebug = rDebug; | ||
basic.log("target_args = %s%n", Arrays.toString(target_args)); | ||
|
||
// Start the target. Pass the same options to the premain as | ||
|
@@ -340,7 +347,8 @@ void start_target(String premain_args, String[] target_args) { | |
|
||
if (RemoteDebug) { | ||
//-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4142,suspend=n | ||
cmdlist.add("-Xdebug -Xrunjdwp:server=n,transport=dt_socket,address=8000,suspend=y"); | ||
cmdlist.add("-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=y"); | ||
//cmdlist.add("-Xdebug -Xrunjdwp:server=n,transport=dt_socket,address=8000,suspend=y"); | ||
//cmdlist.add("-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=n,suspend=n,address=8000 -Djava.compiler=NONE"); | ||
} | ||
|
||
|
@@ -465,6 +473,11 @@ public void runDaikon() { | |
dtrace_file); | ||
} | ||
|
||
if (RemoteDebug) { | ||
cmdstr = | ||
cmdstr.replace( | ||
"java", "java -agentlib:jdwp=transport=dt_socket,server=y,address=8001,suspend=y"); | ||
} | ||
//System.out.println("daikon command is " + daikon_cmd); | ||
//System.out.println("daikon command cmdstr " + cmdstr); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,8 +87,8 @@ private Daikon() { | |
|
||
// Don't change the order of the modifiers on these strings as they | ||
// are automatically updated as part of the release process | ||
public final static String release_version = "5.3.3"; | ||
public final static String release_date = "May 2, 2016"; | ||
public final static String release_version = "5.3.3.2_rar"; | ||
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. This change should not be merged into master. |
||
public final static String release_date = "Mai 24, 2016"; | ||
public final static String release_string = | ||
"Daikon version " | ||
+ release_version | ||
|
@@ -1628,7 +1628,12 @@ public static void create_combined_exits(PptMap ppts) { | |
|
||
PptTopLevel exitnn_ppt = ppt; | ||
PptName exitnn_name = exitnn_ppt.ppt_name; | ||
PptName exit_name = ppt.ppt_name.makeExit(); | ||
PptName exit_name; | ||
if (!exitnn_name.isThrowPoint()) { | ||
exit_name = ppt.ppt_name.makeExit(); | ||
} else { | ||
exit_name = ppt.ppt_name.makeThrowExit(); | ||
} | ||
PptTopLevel exit_ppt = exit_ppts.get(exit_name); | ||
|
||
if (debugInit.isLoggable(Level.FINE)) { | ||
|
@@ -1715,7 +1720,7 @@ static List<Invariant> filter_invs(List<Invariant> invs) { | |
* Does nothing if exit_ppt is not an EXIT/EXITnn. | ||
*/ | ||
private static void create_orig_vars(PptTopLevel exit_ppt, PptMap ppts) { | ||
if (!exit_ppt.ppt_name.isExitPoint()) { | ||
if (!exit_ppt.ppt_name.isExitPoint() && !exit_ppt.ppt_name.isExceptionPoint()) { | ||
if (VarInfo.assertionsEnabled()) { | ||
for (VarInfo vi : exit_ppt.var_infos) { | ||
try { | ||
|
@@ -2291,8 +2296,9 @@ public static void setupEquality(PptTopLevel ppt) { | |
// named program points such as :::POINT (used by convertcsv.pl) | ||
// will be treated as leaves. | ||
if (p.ppt_name.isCombinedExitPoint() | ||
|| p.ppt_name.isCombinedThrowPoint() | ||
|| p.ppt_name.isEnterPoint() | ||
|| p.ppt_name.isThrowsPoint() | ||
// || p.ppt_name.isThrowsPoint() | ||
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. Please remove, rather than commenting out, code that is no longer correct. |
||
|| p.ppt_name.isObjectInstanceSynthetic() | ||
|| p.ppt_name.isClassStaticSynthetic()) { | ||
return; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,8 +47,12 @@ private FileIO() { | |
// a number may follow it. | ||
public static final String exit_suffix = "EXIT"; | ||
public static final String exit_tag = ppt_tag_separator + exit_suffix; | ||
public static final String throw_suffix = "THROW"; | ||
public static final String throw_tag = ppt_tag_separator + throw_suffix; | ||
public static final String throws_suffix = "THROWS"; | ||
public static final String throws_tag = ppt_tag_separator + throws_suffix; | ||
public static final String exception_suffix = "THROWSCOMBINED"; | ||
public static final String exception_tag = ppt_tag_separator + exception_suffix; | ||
public static final String object_suffix = "OBJECT"; | ||
public static final String object_tag = ppt_tag_separator + object_suffix; | ||
public static final String class_static_suffix = "CLASS"; | ||
|
@@ -1033,8 +1037,9 @@ private static void warn_if_hierarchy_mismatch(PptMap all_ppts) { | |
for (PptTopLevel ppt_top_level : all_ppts.ppt_all_iterable()) { | ||
boolean is_program_point = | ||
(ppt_top_level.ppt_name.isExitPoint() | ||
|| ppt_top_level.ppt_name.isExceptionPoint() | ||
|| ppt_top_level.ppt_name.isEnterPoint() | ||
|| ppt_top_level.ppt_name.isThrowsPoint() | ||
// || ppt_top_level.ppt_name.isThrowsPoint() | ||
|| ppt_top_level.ppt_name.isObjectInstanceSynthetic() | ||
|| ppt_top_level.ppt_name.isClassStaticSynthetic() | ||
|| ppt_top_level.ppt_name.isGlobalPoint()); | ||
|
@@ -1767,7 +1772,7 @@ public static void process_sample( | |
// will be treated as leaves. | ||
|
||
if (ppt.ppt_name.isEnterPoint() | ||
|| ppt.ppt_name.isThrowsPoint() | ||
// || ppt.ppt_name.isThrowsPoint() /* Throws is a LEAF now, like Exit_nn | ||
|| ppt.ppt_name.isObjectInstanceSynthetic() | ||
|| ppt.ppt_name.isClassStaticSynthetic() | ||
|| ppt.ppt_name.isGlobalPoint()) { | ||
|
@@ -1779,6 +1784,12 @@ public static void process_sample( | |
throw new RuntimeException( | ||
"Bad program point name " + ppt.name + " is a combined exit point name"); | ||
} | ||
|
||
if (ppt.ppt_name.isExceptionPoint() && ppt.ppt_name.isCombinedThrowPoint()) { | ||
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. The lack of parallelism between the names "isExceptionPoint()" and "isCombinedThrowPoint()" is confusing. Please use the same term, either "Exception" or "Throw", in both. |
||
// not Daikon.TerminationMessage; caller has more info (e.g., filename) | ||
throw new RuntimeException( | ||
"Bad program point name " + ppt.name + " is a combined exception point name"); | ||
} | ||
} | ||
|
||
// Add derived variables | ||
|
@@ -2216,7 +2227,7 @@ public static boolean compute_orig_variables( | |
return false; | ||
} | ||
|
||
if (ppt.ppt_name.isExitPoint() || ppt.ppt_name.isThrowsPoint()) { | ||
if (ppt.ppt_name.isExitPoint() || ppt.ppt_name.isExceptionPoint()) { | ||
Invocation invoc; | ||
// Set invoc | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -292,6 +292,14 @@ public int getPointSubscript() { | |
return (point != null) && point.startsWith(FileIO.exit_suffix); | ||
} | ||
|
||
/** | ||
* @return true iff this name refers to an abrupt completion point | ||
**/ | ||
/*@EnsuresNonNullIf(result=true, expression="point")*/ | ||
/*@Pure*/ public boolean isThrowPoint() { | ||
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. Minor style point: the |
||
return (point != null) && point.startsWith(FileIO.throw_suffix); | ||
} | ||
|
||
/** | ||
* @return true iff this name refers to an abrupt completion point | ||
**/ | ||
|
@@ -300,6 +308,24 @@ public int getPointSubscript() { | |
return (point != null) && point.startsWith(FileIO.throws_suffix); | ||
} | ||
|
||
/** | ||
* @return true iff this name refers to a procedure exception point | ||
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. The lack of parallelism in the javadoc ("abrupt completion point" versus "exception point") makes a reader wonder what specific distinction you are trying to highlight. If there isn't one, then use the same term to prevent confusion. |
||
**/ | ||
/*@EnsuresNonNullIf(result=true, expression="point")*/ | ||
/*@Pure*/ public boolean isExceptionPoint() { | ||
return (point != null) | ||
&& (point.startsWith(FileIO.throw_suffix) || point.equals(FileIO.exception_suffix)); | ||
} | ||
|
||
/** | ||
* @return true iff this name refers to a combined (synthetic) procedure | ||
* exception point | ||
**/ | ||
/*@EnsuresNonNullIf(result=true, expression="point")*/ | ||
/*@Pure*/ public boolean isCombinedThrowPoint() { | ||
return (point != null) && point.equals(FileIO.exception_suffix); | ||
} | ||
|
||
/** | ||
* @return true iff this name refers to a combined (synthetic) procedure | ||
* exit point | ||
|
@@ -402,9 +428,9 @@ public PptName makeEnter() { | |
// We may wish to have a different exceptional than non-exceptional | ||
// entry point; in particular, if there was an exception, then perhaps | ||
// the precondition or object invariant was not met. | ||
assert isExitPoint() : fullname; | ||
assert isExitPoint() || isExceptionPoint() : fullname; | ||
|
||
assert isExitPoint() || isThrowsPoint(); | ||
assert isExitPoint() || isExceptionPoint(); | ||
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. This is the same assertion as on line 444. Two copies of it are not necessary. |
||
return new PptName(cls, method, FileIO.enter_suffix); | ||
} | ||
|
||
|
@@ -417,12 +443,21 @@ public PptName makeExit() { | |
return new PptName(cls, method, FileIO.exit_suffix); | ||
} | ||
|
||
/** | ||
* Requires: this.isThrowPoint() || this.isEnterPoint() | ||
* @return a name for the combined exit point | ||
**/ | ||
public PptName makeThrowExit() { | ||
assert isThrowPoint() || isEnterPoint() : fullname; | ||
return new PptName(cls, method, FileIO.exception_suffix); | ||
} | ||
|
||
/** | ||
* Requires: this.isExitPoint() || this.isEnterPoint() | ||
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. This documentation has not been updated to reflect the assertion on line 473. |
||
* @return a name for the corresponding object invariant | ||
**/ | ||
public PptName makeObject() { | ||
assert isExitPoint() || isEnterPoint() : fullname; | ||
assert isExitPoint() || isEnterPoint() || isExceptionPoint() : fullname; | ||
return new PptName(cls, null, FileIO.object_suffix); | ||
} | ||
|
||
|
@@ -431,7 +466,8 @@ public PptName makeObject() { | |
* @return a name for the corresponding class-static invariant | ||
**/ | ||
public PptName makeClassStatic() { | ||
assert isExitPoint() || isEnterPoint() || isObjectInstanceSynthetic() : fullname; | ||
assert isExitPoint() || isEnterPoint() || isObjectInstanceSynthetic() || isExceptionPoint() | ||
: fullname; | ||
return new PptName(cls, null, FileIO.class_static_suffix); | ||
} | ||
|
||
|
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.
Nit: "an throw" should be "a throw".