-
Notifications
You must be signed in to change notification settings - Fork 275
Java Bytecode parsing tidy #1796
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
Changes from all 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 |
---|---|---|
|
@@ -45,6 +45,9 @@ Author: Daniel Kroening, [email protected] | |
#include <unordered_set> | ||
#include <regex> | ||
|
||
/// Given a string of the format '?blah?', will return true when compared | ||
/// against a string that matches appart from any characters that are '?' | ||
/// in the original string. Equivalent to doing a regex match on '.blah.' | ||
class patternt | ||
{ | ||
public: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,7 @@ class java_bytecode_parsert:public parsert | |
if(index==0 || index>=constant_pool.size()) | ||
{ | ||
error() << "invalid constant pool index (" << index << ")" << eom; | ||
error() << "constant pool size: " << constant_pool.size() << eom; | ||
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. I think it makes still sense to output the accessed 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 still done on the line above. |
||
throw 0; | ||
} | ||
|
||
|
@@ -946,6 +947,12 @@ void java_bytecode_parsert::rmethod_attribute(methodt &method) | |
{ | ||
u2 start_pc=read_u2(); | ||
u2 end_pc=read_u2(); | ||
|
||
INVARIANT( | ||
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. would you mind adding that this invariant is from the class file format spec ("4.7.3. The Code Attribute" for Java8) |
||
start_pc < end_pc, | ||
"The start_pc must be less than the end_pc as this is the range the " | ||
"exception is active"); | ||
|
||
u2 handler_pc=read_u2(); | ||
u2 catch_type=read_u2(); | ||
method.exception_table[e].start_pc=start_pc; | ||
|
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.
If it doesn't take to long I intend to remove this completely and replace its uses with
std::regex
unless anyone objects to that?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.
Knock up a quick standalone benchmark before you do, as this is obviously a much simpler machine