Skip to content

Commit 5c3f423

Browse files
author
svorenova
committed
Pass lambda method handles to method instruction conversion cont.
1 parent b5ce8fc commit 5c3f423

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/java_bytecode/java_bytecode_convert_method.cpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -306,22 +306,20 @@ code_typet member_type_lazy(
306306
/// Retrieves the symbol of the lambda method associated with the given
307307
/// lambda method handle (bootstrap method).
308308
/// \param lambda_method_handles Vector of lambda method handles (bootstrap
309-
/// methods) of the class where the lambda is called
309+
/// methods) of the class where the lambda is called
310310
/// \param index Index of the lambda method handle in the vector
311311
/// \return Symbol of the lambda method if the method handle does not have an
312-
/// unknown type
312+
/// unknown type
313313
optionalt<symbolt> java_bytecode_convert_methodt::get_lambda_method_symbol(
314314
const java_class_typet::java_lambda_method_handlest &lambda_method_handles,
315-
const irep_idt &index)
315+
const size_t &index)
316316
{
317-
const symbol_exprt &lambda_method_handle =
318-
lambda_method_handles.at(std::stoi(id2string(index)));
317+
const symbol_exprt &lambda_method_handle = lambda_method_handles.at(index);
319318
// If the lambda method handle has an unknown type, it does not refer to
320319
// any symbol (it is a symbol expression with empty identifier)
321320
if(!lambda_method_handle.get_identifier().empty())
322321
return symbol_table.lookup_ref(lambda_method_handle.get_identifier());
323-
else
324-
return {};
322+
return {};
325323
}
326324

327325
/// This creates a method symbol in the symtab, but doesn't actually perform
@@ -1238,7 +1236,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
12381236

12391237
const optionalt<symbolt> &lambda_method_symbol = get_lambda_method_symbol(
12401238
lambda_method_handles,
1241-
code_type.get(ID_java_lambda_method_handle_index));
1239+
code_type.get_int(ID_java_lambda_method_handle_index));
12421240
if(lambda_method_symbol.has_value())
12431241
debug() << "Converting invokedynamic for lambda: "
12441242
<< lambda_method_symbol.value().name << eom;

src/java_bytecode/java_bytecode_convert_method_class.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class java_bytecode_convert_methodt:public messaget
237237

238238
optionalt<symbolt> get_lambda_method_symbol(
239239
const java_class_typet::java_lambda_method_handlest &lambda_method_handles,
240-
const irep_idt &index);
240+
const size_t &index);
241241

242242
// conversion
243243
void convert(const symbolt &class_symbol, const methodt &);

0 commit comments

Comments
 (0)