@@ -2095,15 +2095,15 @@ exprt::operandst &java_bytecode_convert_methodt::convert_const(
2095
2095
void java_bytecode_convert_methodt::convert_invoke (
2096
2096
source_locationt location,
2097
2097
const irep_idt &statement,
2098
- exprt &arg0 ,
2098
+ exprt &invoke_statement ,
2099
2099
codet &c,
2100
2100
exprt::operandst &results)
2101
2101
{
2102
2102
const bool use_this (statement != " invokestatic" );
2103
2103
const bool is_virtual (
2104
2104
statement == " invokevirtual" || statement == " invokeinterface" );
2105
2105
2106
- code_typet &code_type = to_code_type (arg0 .type ());
2106
+ code_typet &code_type = to_code_type (invoke_statement .type ());
2107
2107
code_typet::parameterst ¶meters (code_type.parameters ());
2108
2108
2109
2109
const std::string full_method_name = id2string (method_id);
@@ -2116,22 +2116,18 @@ void java_bytecode_convert_methodt::convert_invoke(
2116
2116
std::string class_type_name = calling_class_name.substr (6 );
2117
2117
std::replace (class_type_name.begin (), class_type_name.end (), ' .' , ' /' );
2118
2118
const auto &enum_clone_symbol = symbol_table.lookup_ref (calling_class_name);
2119
- const bool is_enum_values_clone_call =
2120
- enum_clone_symbol.type .get_bool (ID_enumeration) &&
2121
- (full_method_name ==
2122
- (calling_class_name + " .values:()[L" + class_type_name + " ;" ));
2123
2119
2124
2120
if (use_this)
2125
2121
{
2126
2122
if (parameters.empty () || !parameters[0 ].get_this ())
2127
2123
{
2128
- irep_idt classname = arg0 .get (ID_C_class);
2124
+ irep_idt classname = invoke_statement .get (ID_C_class);
2129
2125
typet thistype = symbol_typet (classname);
2130
2126
// Note invokespecial is used for super-method calls as well as
2131
2127
// constructors.
2132
2128
if (statement == " invokespecial" )
2133
2129
{
2134
- if (is_constructor (arg0 .get (ID_identifier)))
2130
+ if (is_constructor (invoke_statement .get (ID_identifier)))
2135
2131
{
2136
2132
if (needed_lazy_methods)
2137
2133
needed_lazy_methods->add_needed_class (classname);
@@ -2194,7 +2190,7 @@ void java_bytecode_convert_methodt::convert_invoke(
2194
2190
results[0 ] = promoted;
2195
2191
}
2196
2192
2197
- assert (arg0 .id () == ID_virtual_function);
2193
+ assert (invoke_statement .id () == ID_virtual_function);
2198
2194
2199
2195
// If we don't have a definition for the called symbol, and we won't
2200
2196
// inherit a definition from a super-class, we create a new symbol and
@@ -2212,18 +2208,19 @@ void java_bytecode_convert_methodt::convert_invoke(
2212
2208
// generate code that may wrongly assume that such a method is
2213
2209
// accessible if we assume that its access attribute is "more
2214
2210
// accessible" than it actually is.
2215
- const irep_idt id = arg0 .get (ID_identifier);
2211
+ const irep_idt & id = invoke_statement .get (ID_identifier);
2216
2212
if (
2217
2213
symbol_table.symbols .find (id) == symbol_table.symbols .end () &&
2218
- !(is_virtual &&
2219
- is_method_inherited (arg0.get (ID_C_class), arg0.get (ID_component_name))))
2214
+ !(is_virtual && is_method_inherited (
2215
+ invoke_statement.get (ID_C_class),
2216
+ invoke_statement.get (ID_component_name))))
2220
2217
{
2221
2218
symbolt symbol;
2222
2219
symbol.name = id;
2223
- symbol.base_name = arg0 .get (ID_C_base_name);
2224
- symbol.pretty_name = id2string (arg0 .get (ID_C_class)).substr (6 ) + " . " +
2225
- id2string (symbol.base_name ) + " ()" ;
2226
- symbol.type = arg0 .type ();
2220
+ symbol.base_name = invoke_statement .get (ID_C_base_name);
2221
+ symbol.pretty_name = id2string (invoke_statement .get (ID_C_class)).substr (6 ) +
2222
+ " . " + id2string (symbol.base_name ) + " ()" ;
2223
+ symbol.type = invoke_statement .type ();
2227
2224
symbol.type .set (ID_access, ID_public);
2228
2225
symbol.value .make_nil ();
2229
2226
symbol.mode = ID_java;
@@ -2235,30 +2232,37 @@ void java_bytecode_convert_methodt::convert_invoke(
2235
2232
symbol_table.add (symbol);
2236
2233
}
2237
2234
2235
+ const bool is_enum_values_clone_call =
2236
+ enum_clone_symbol.type .get_bool (ID_enumeration) &&
2237
+ (full_method_name ==
2238
+ (calling_class_name + " .values:()[L" + class_type_name + " ;" ));
2239
+
2238
2240
if (is_enum_values_clone_call)
2239
2241
{
2240
- const std::string clone_name =
2241
- " java::array[" + calling_class_name + " ].clone:()Ljava/lang/Object;" ;
2242
- call.function () = symbol_exprt (clone_name, arg0 .type ());
2242
+ const irep_idt clone_name =
2243
+ " java::array[" + class_type_name + " ].clone:()Ljava/lang/Object;" ;
2244
+ call.function () = symbol_exprt (clone_name, invoke_statement .type ());
2243
2245
}
2244
2246
else if (is_virtual)
2245
2247
{
2246
2248
// dynamic binding
2247
2249
assert (use_this);
2248
2250
assert (!call.arguments ().empty ());
2249
- call.function () = arg0 ;
2251
+ call.function () = invoke_statement ;
2250
2252
// Populate needed methods later,
2251
2253
// once we know what object types can exist.
2252
2254
}
2253
2255
else
2254
2256
{
2255
2257
// static binding
2256
- call.function () = symbol_exprt (arg0.get (ID_identifier), arg0.type ());
2258
+ call.function () = symbol_exprt (
2259
+ invoke_statement.get (ID_identifier), invoke_statement.type ());
2257
2260
if (needed_lazy_methods)
2258
2261
{
2259
- needed_lazy_methods->add_needed_method (arg0.get (ID_identifier));
2262
+ needed_lazy_methods->add_needed_method (
2263
+ invoke_statement.get (ID_identifier));
2260
2264
// Calling a static method causes static initialization:
2261
- needed_lazy_methods->add_needed_class (arg0 .get (ID_C_class));
2265
+ needed_lazy_methods->add_needed_class (invoke_statement .get (ID_C_class));
2262
2266
}
2263
2267
}
2264
2268
@@ -2270,7 +2274,7 @@ void java_bytecode_convert_methodt::convert_invoke(
2270
2274
2271
2275
if (!use_this)
2272
2276
{
2273
- codet clinit_call = get_clinit_call (arg0 .get (ID_C_class));
2277
+ codet clinit_call = get_clinit_call (invoke_statement .get (ID_C_class));
2274
2278
if (clinit_call.get_statement () != ID_skip)
2275
2279
{
2276
2280
code_blockt ret_block;
0 commit comments