Skip to content

Commit

Permalink
Use optionalt instead of safe_pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanJPhillips committed Dec 5, 2017
1 parent c69b00d commit 4b245f8
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 88 deletions.
14 changes: 6 additions & 8 deletions src/java_bytecode/ci_lazy_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <java_bytecode/java_entry_point.h>
#include <java_bytecode/java_class_loader.h>
#include <java_bytecode/java_utils.h>
#include <util/safe_pointer.h>
#include <util/suffix.h>
#include <java_bytecode/java_string_library_preprocess.h>

Expand Down Expand Up @@ -68,7 +67,7 @@ ci_lazy_methodst::ci_lazy_methodst(
bool ci_lazy_methodst::operator()(
symbol_tablet &symbol_table,
method_bytecodet &method_bytecode,
method_convertert method_converter)
const method_convertert &method_converter)
{
std::vector<irep_idt> method_worklist1;
std::vector<irep_idt> method_worklist2;
Expand Down Expand Up @@ -149,13 +148,12 @@ bool ci_lazy_methodst::operator()(
}
debug() << "CI lazy methods: elaborate " << mname << eom;
const auto &parsed_method=findit->second;
// Note this wraps *references* to method_worklist2, needed_classes:
ci_lazy_methods_neededt new_lazy_methods(
method_worklist2,
needed_classes,
symbol_table);
method_converter(
*parsed_method.first, *parsed_method.second, new_lazy_methods);
*parsed_method.first,
*parsed_method.second,
// Note this wraps *references* to method_worklist2 & needed_classes
ci_lazy_methods_neededt(
method_worklist2, needed_classes, symbol_table));
gather_virtual_callsites(
symbol_table.lookup_ref(mname).value,
virtual_callsites);
Expand Down
2 changes: 1 addition & 1 deletion src/java_bytecode/ci_lazy_methods.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ci_lazy_methodst:public messaget
bool operator()(
symbol_tablet &symbol_table,
method_bytecodet &method_bytecode,
method_convertert method_converter);
const method_convertert &method_converter);

private:
void resolve_method_names(
Expand Down
2 changes: 1 addition & 1 deletion src/java_bytecode/java_bytecode_convert_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2850,7 +2850,7 @@ void java_bytecode_convert_method(
symbol_tablet &symbol_table,
message_handlert &message_handler,
size_t max_array_length,
safe_pointer<ci_lazy_methods_neededt> needed_lazy_methods,
optionalt<ci_lazy_methods_neededt> needed_lazy_methods,
java_string_library_preprocesst &string_preprocess)
{
static const std::unordered_set<std::string> methods_to_ignore
Expand Down
5 changes: 2 additions & 3 deletions src/java_bytecode/java_bytecode_convert_method.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Author: Daniel Kroening, [email protected]

#include <util/symbol_table.h>
#include <util/message.h>
#include <util/safe_pointer.h>
#include "java_string_library_preprocess.h"

#include "java_bytecode_parse_tree.h"
Expand All @@ -28,7 +27,7 @@ void java_bytecode_convert_method(
symbol_tablet &symbol_table,
message_handlert &message_handler,
size_t max_array_length,
safe_pointer<ci_lazy_methods_neededt> needed_lazy_methods,
optionalt<ci_lazy_methods_neededt> needed_lazy_methods,
java_string_library_preprocesst &string_preprocess);

inline void java_bytecode_convert_method(
Expand All @@ -45,7 +44,7 @@ inline void java_bytecode_convert_method(
symbol_table,
message_handler,
max_array_length,
safe_pointer<ci_lazy_methods_neededt>::create_null(),
optionalt<ci_lazy_methods_neededt>(),
string_preprocess);
}

Expand Down
7 changes: 3 additions & 4 deletions src/java_bytecode/java_bytecode_convert_method_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Author: Daniel Kroening, [email protected]
#include <util/message.h>
#include <util/std_types.h>
#include <util/std_expr.h>
#include <util/safe_pointer.h>
#include <analyses/cfg_dominators.h>
#include "java_bytecode_parse_tree.h"
#include "java_bytecode_convert_class.h"
Expand All @@ -35,12 +34,12 @@ class java_bytecode_convert_methodt:public messaget
symbol_tablet &_symbol_table,
message_handlert &_message_handler,
size_t _max_array_length,
safe_pointer<ci_lazy_methods_neededt> needed_lazy_methods,
optionalt<ci_lazy_methods_neededt> needed_lazy_methods,
java_string_library_preprocesst &_string_preprocess)
: messaget(_message_handler),
symbol_table(_symbol_table),
max_array_length(_max_array_length),
needed_lazy_methods(needed_lazy_methods),
needed_lazy_methods(std::move(needed_lazy_methods)),
string_preprocess(_string_preprocess),
slots_for_parameters(0),
method_has_this(false)
Expand All @@ -61,7 +60,7 @@ class java_bytecode_convert_methodt:public messaget
protected:
symbol_tablet &symbol_table;
const size_t max_array_length;
safe_pointer<ci_lazy_methods_neededt> needed_lazy_methods;
optionalt<ci_lazy_methods_neededt> needed_lazy_methods;

/// Fully qualified name of the method under translation.
/// Initialized by `convert`.
Expand Down
7 changes: 3 additions & 4 deletions src/java_bytecode/java_bytecode_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,18 +310,17 @@ bool java_bytecode_languaget::do_ci_lazy_method_conversion(
symbol_tablet &symbol_table,
method_bytecodet &method_bytecode)
{
const auto method_converter=[&](
const auto method_converter = [&](
const symbolt &symbol,
const java_bytecode_parse_treet::methodt &method,
ci_lazy_methods_neededt new_lazy_methods)
{
ci_lazy_methods_neededt new_lazy_methods) {
java_bytecode_convert_method(
symbol,
method,
symbol_table,
get_message_handler(),
max_user_array_length,
safe_pointer<ci_lazy_methods_neededt>::create_non_null(&new_lazy_methods),
std::move(new_lazy_methods),
string_preprocess);
};

Expand Down
67 changes: 0 additions & 67 deletions src/util/safe_pointer.h

This file was deleted.

0 comments on commit 4b245f8

Please sign in to comment.