-
Notifications
You must be signed in to change notification settings - Fork 274
Java frontend: treat CProver stubbed methods more like normal stubs #4258
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
Java frontend: treat CProver stubbed methods more like normal stubs #4258
Conversation
^SIGNAL=0$ | ||
-- | ||
-- | ||
This calls to CProver.startThread, which are special-cased by the Java front-end (which omits the method's body |
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-pick: s/are/is/
-- | ||
-- | ||
This calls to CProver.startThread, which are special-cased by the Java front-end (which omits the method's body | ||
in hope of the front-end handling it like a stub), but which don't get their parameter names assigned by the usual |
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.
s/don't/doesn't/ s/their/its/
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.
I mean fine, but this seems like a messy approach and I don't fully understand it. Why not just not load these methods (however it is they are inviting the front ends to ignore them?)
@@ -406,8 +415,9 @@ void java_bytecode_convert_methodt::convert( | |||
// (e.g. "my.package.ClassName.myMethodName:(II)I") and query the symbol table | |||
// to retrieve the symbol (constructed by java_bytecode_convert_method_lazy) | |||
// associated to the method | |||
const irep_idt method_identifier= | |||
id2string(class_symbol.name)+"."+id2string(m.name)+":"+m.descriptor; | |||
const irep_idt method_identifier = |
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.
I mean not your code, but why do we have a local variable method_identifier
that then is immediately assigned into method_id
, perhaps just directly assign?
73a2c88
to
1681dfa
Compare
@tautschnig @thk123 that solution didn't work for symex-driven-lazy-loading, so I completely changed my approach; see updated description. |
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.
Orders of magnitude better I'd say 🎉
static irep_idt org_cprover_CProver_name = "org.cprover.CProver"; | ||
return | ||
(class_name == org_cprover_CProver_name && | ||
cprover_methods_to_ignore.count(id2string(method.name))) || |
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-pick: Visual Studio would like to have an explicit != 0
with .count(...)
.
We already tried to ignore org.cprover.CProver methods such as nondetInt, relying upon the front-end to supply stub bodies if desired based on their type. However, by creating symbols for them as for normal (non-stub) methods, but then refusing to provide a body or advertise them as normal methods, we failed to set up their type properly (specifically the parameter names), as they were neither set like a stub (upon symbol creation, upon discovery by a caller) or like a normal method (during java_bytecode_convert_method). By refusing to create the symbol at all, this treats the special CProver methods more like normal stubs: their symbols are now created on demand. It is also no longer necessary for java_bytecode_languaget::methods_provided to special case them, as they are not added to method_bytecodet either, again matching "real" stub methods more closely.
1681dfa
to
4c724de
Compare
We already tried to ignore org.cprover.CProver methods such as nondetInt, relying upon
the front-end to supply stub bodies if desired based on their type. However, by creating
symbols for them as for normal (non-stub) methods, but then refusing to provide a body or
advertise them as normal methods, we failed to set up their type properly (specifically
the parameter names), as they were neither set like a stub (upon symbol creation, upon
discovery by a caller) or like a normal method (during java_bytecode_convert_method). By
refusing to create the symbol at all, this treats the special CProver methods more like
normal stubs: their symbols are now created on demand.
It is also no longer necessary for java_bytecode_languaget::methods_provided to special
case them, as they are not added to method_bytecodet either, again matching "real" stub
methods more closely.