Commit Graph

1225 Commits

Author SHA1 Message Date
thomasspriggs b77b5b09d4
Merge pull request #4571 from thomasspriggs/tas/java_synthetic
Parse and convert the synthetic flag of java methods
2019-04-26 16:51:09 +01:00
Thomas Spriggs d706767983 Parse and convert the synthetic flag of java methods
For use in a downstream repository. This is used to indicate whether a
method was synthesized by the java compiler, as opposed to being a
method which has corresponding user written java code.
2019-04-26 15:35:39 +01:00
Jeannie Moulton edccf7c82f Add getter/setter for ID_enumeration in java_class_typet
Adding getter/setter to avoid direct irept access
2019-04-26 14:14:59 +01:00
Daniel Kroening 385a27cf24 use static_members in Java frontend
An instance of static fields for Java classes.  The Java-specific extension
enables tracking static fields that are final.
2019-04-25 08:08:38 +01:00
Romain Brenguier 262cc351dd show_goto_functions takes a ui_message_handler
This removes the need for passing a seperate ui argument.
2019-04-17 14:37:29 +01:00
Romain Brenguier 747e13b33b Show properties take a ui_message_handlert
This is more precise on the type of message handler we are expecting and
makes the ui argument redundant.
2019-04-17 14:36:57 +01:00
Romain Brenguier edd2c654e2 Replace log.get_message_handler() calls
The calls will always return a reference to the field ui_message_handler
which can be accessed directly instead.
2019-04-17 14:36:21 +01:00
Romain Brenguier 436274f911 Make parse_options_baset the owner of message_handler
The message handler field was owned by the classes inheriting from
parse_options_baset which lead to strange patterns where the handler
reference was initialized using a reference to a field which was not
constructed yet.
This is cleaner and avoid some reference duplications.
2019-04-17 14:18:18 +01:00
Romain Brenguier 4268bee456 Remove redundant get_ui() method
ui_message_handler.get_ui() already does the same thing, and is more
explicit.
2019-04-17 14:18:18 +01:00
Peter Schrammel f96818d017 Use macros of exit codes in JBMC 2019-04-17 09:56:44 +01:00
Peter Schrammel 028aadd681 Remove obsolete bmc.cpp and all_properties.cpp
These have now been entirely replaced by goto-checker.
2019-04-17 09:56:44 +01:00
Peter Schrammel 4072e8b857 Remove unnecessary block scope
reduces indentation
2019-04-17 09:56:43 +01:00
Peter Schrammel 8cc0c35006 Symex-driven lazy loading uses goto-checker
goes now through goto-checker classes instead of
bmct/all_propertiest.
2019-04-17 09:56:43 +01:00
Peter Schrammel 400c354d34 Use options instead of cmdline
Only use options after cmdline has been parsed into options.
2019-04-17 09:56:43 +01:00
Peter Schrammel b02de78024 Fix typo 2019-04-17 09:56:23 +01:00
Peter Schrammel 807451df9d Fallback to old bmct is unnecessary
is unreachable
2019-04-17 09:56:23 +01:00
Peter Schrammel f08a238c71 Generalize get_goto_model for symex-driven lazy loading
reduces code duplication
2019-04-17 09:56:13 +01:00
Peter Schrammel 014b9daff6 Clean up set_properties helper method
set_properties has no return value.
2019-04-17 09:55:12 +01:00
Peter Schrammel ffc971075a Remove unnecessary block scopes
removes indent
2019-04-17 09:55:03 +01:00
Peter Schrammel 4b4f2d1cf9 Deduplicate show_loaded_X
reduces code duplication
2019-04-17 09:50:42 +01:00
Michael Tautschnig abbafd2589
Merge pull request #4525 from antlechner/antonia/array-index-arithmetic
Refactor element access of pointer arrays into a separate function
2019-04-17 11:00:09 +03:00
Antonia Lechner 2088544ca4 Refactor array access into a separate function
This does not save many lines of code, but the way we access arrays
using pointer arithmetic can be a bit confusing and it makes sense to
abstract it away and keep the documentation of why we do things this way
in one place.
2019-04-16 18:41:18 +01:00
Chris Smowton d5df938726
Merge pull request #4534 from smowton/smowton/fix/character-tochars
Remove Character.toChars, highSurrogate, lowSurrogate models
2019-04-16 16:52:37 +01:00
Chris Smowton c6c9368a00 Remove Character.toChars, highSurrogate, lowSurrogate models
Character.toChars was malformed (it tried to address a java::array[char] * like it was
a raw char[], and tried to return an if_exprt of two arrays of differing type), and there
is already an implementation in the models library with a perfectly good implementation.

Character.highSurrogate and lowSurrogate were type unsound (creating additions of mixed type).
Again, they add nothing on top of the shipped models library.
2019-04-16 15:19:50 +01:00
Chris Smowton 9577be9b35 Use `..` and `[[]]` for SSA expression field separator
This makes it easier to read the difference between an atomic symbol and
a field of a composite.
2019-04-16 11:55:44 +00:00
Michael Tautschnig 6e514deeeb Field-sensitive level-2 SSA renaming
Struct member and array index expressions are replaced by new SSA
symbols such that updates to individual fields of structs or arrays do
not affect the SSA index of the remaining object. This enables more
fine-grained constant propagation, which should be particularly
beneficial to Java (where structs/classes prevail).
2019-04-16 11:55:44 +00:00
Michael Tautschnig 18459efcad
Merge pull request #4532 from tautschnig/4524-follow-up
Java bytecode conversion: inline or move temporaries
2019-04-15 15:31:27 +03:00
Daniel Kroening 627afcf88a move decision_procedure.h to src/solvers
The new API has no dependency on or connection with anything in prop.
2019-04-14 13:17:46 +01:00
Daniel Kroening 22e71cdd53 use new handle interface in cover_goals
The literal-based interface is more specific, and cover_goals doesn't
require anything beyond what decision_proceduret offers.
2019-04-14 12:08:48 +01:00
Michael Tautschnig 1e9d135175 Use code_blockt::add(code, source_location)
This simplifies the code and helps getting rid of some more temporaries.
2019-04-13 23:49:59 +00:00
Michael Tautschnig cc7eff6d54 Java bytecode conversion: inline or move temporaries
This avoids constructing short-lived temporary objects where their names
don't add value either.
2019-04-13 23:49:56 +00:00
Michael Tautschnig cec08692c3 Do not take a reference to a temporary
symbolt::symbol_expr returns and expression by value.
2019-04-13 15:50:58 +00:00
Antonia Lechner cdb013351f Use plus_exprt constructor that does not take a type
The type of the plus_exprt is the type of the lhs by default. This is
always the case in the code base.
2019-04-12 18:16:21 +01:00
Antonia Lechner fda5ca0ef6 Use single-parameter dereference_exprt constructor if possible
I came across a few places where the single-parameter constructor was
not used yet and the information about the type of the expression was
duplicated, so I tidied up all occurrences of this that I could find.
2019-04-12 18:16:19 +01:00
Chris Smowton cb25f82cb7
Merge pull request #4523 from smowton/smowton/feature/use-temporary-to-init-multidimensional-array
Use temporary variable to initialise array cells
2019-04-12 17:17:12 +01:00
antlechner 157f567433
Merge pull request #4509 from antlechner/antonia/refactor-constant-string-symbol
Add a version of get_or_create_string_literal_symbol that takes a string parameter
2019-04-12 15:07:10 +01:00
Chris Smowton 703e7c1f68 Use temporary variable to initialise array cells
Previously when dealing with multidimensional arrays we could end up generating expressions
such as array[idx] = ALLOCATE Something; array[idx]->field1 = x; array[idx]->field2 = y;
This was a struggle for symex, as every reference to array[idx] could be a bad dereference,
and so symex::invalid_object (or perhaps some_symbol$object) references were created to account
for this possiblity. By using a temporary (generating code like
`t = ALLOCATE Something; t->field1 = x; t->field2 = y; array[idx] = t;`) it is much clearer
that the pointer dereferences must refer to the newly allocated object, and so the problematic
case is avoided.
2019-04-12 14:23:22 +01:00
Antonia Lechner 9e499d53db Create java_string_literal_exprt class
With this new class, we can avoid directly accessing named
subexpressions of exprts with id() == ID_java_string_literal.
2019-04-12 13:52:53 +01:00
Antonia Lechner c08a6fb7c1 Add string symbol creation function that takes a string
This simplifies the code in a few places, since we don't have to repeat
the same lines of constructing the string literal exprt every time.
2019-04-12 13:52:52 +01:00
Romain Brenguier d585426b67 jbmc_parse_options is not a messaget
This already inherits from a class with a log field for handling messages.
2019-04-12 11:43:06 +01:00
Romain Brenguier 0ae525539a
Merge pull request #4515 from romainbrenguier/clean-up/parse-options-messaget
Clean up usage of messaget in *_parse_options classes
2019-04-11 13:39:05 +01:00
Joel Allred 97fd283dd0
Merge pull request #4503 from allredj/tests-assume-inputs-non-null
Add tests for --java-assume-inputs-non-null
2019-04-11 13:38:30 +01:00
Romain Brenguier 0f6897152d
Merge pull request #4513 from romainbrenguier/bugfix/get-class
Replace Object.getClass preprocessing by a CProver.classIdentifier method
2019-04-11 13:34:28 +01:00
antlechner 1622bf81a2
Merge pull request #4508 from antlechner/antonia/refactor-is-string-type
Refactor logic that checks if a given type represents a Java string
2019-04-11 13:18:23 +01:00
Romain Brenguier d841712683 Add test for CProver.classIdentifier
This tests that the new builtin cprover function is working.
2019-04-11 11:43:18 +01:00
Romain Brenguier 984bf19939 Replace getClass preprocess by CProver.classIdentifier
This simplifies the preprocessing and leave it to the model to handle
the complexity, which is less error-prone (writing safe java program is
easier than write c++ that generates safe goto-program).
2019-04-11 11:43:18 +01:00
Romain Brenguier e440311966 Update for diffblue/java-models-library#21 (getClass)
Update the models for a version of getClass which uses
CProver.classIdentifier.
This is necessary for getting rid of the preprocessing of getClass which
is error-prone.
https://github.com/diffblue/java-models-library/pull/21
2019-04-11 11:43:18 +01:00
Romain Brenguier af222704e8 jdiff_parse_options is not a message
In addition the class already inherits a log field of type messaget.
2019-04-11 11:07:04 +01:00
Romain Brenguier 1e8f5b1603 janalyzer_parse_options is not a message
In addition this class already inherits a messaget object of type messaget.
2019-04-11 11:07:03 +01:00
Antonia Lechner a6a0bec790 Remove meaningless precondition in object factory
The id() of struct_typets is always ID_struct.
2019-04-11 11:01:55 +01:00