@@ -1238,34 +1238,12 @@ codet java_bytecode_convert_methodt::convert_instructions(
1238
1238
else if (statement==" invokedynamic" )
1239
1239
{
1240
1240
// not used in Java
1241
- code_typet &code_type = to_code_type (arg0.type ());
1242
-
1243
- const optionalt<symbolt> &lambda_method_symbol = get_lambda_method_symbol (
1244
- lambda_method_handles,
1245
- code_type.get_int (ID_java_lambda_method_handle_index));
1246
- if (lambda_method_symbol.has_value ())
1247
- debug () << " Converting invokedynamic for lambda: "
1248
- << lambda_method_symbol.value ().name << eom;
1249
- else
1250
- debug () << " Converting invokedynamic for lambda with unknown handle "
1251
- " type"
1252
- << eom;
1253
-
1254
- const code_typet::parameterst ¶meters (code_type.parameters ());
1255
-
1256
- pop (parameters.size ());
1257
-
1258
- const typet &return_type=code_type.return_type ();
1259
-
1260
- if (return_type.id ()!=ID_empty)
1241
+ if (
1242
+ const auto res = convert_invoke_dynamic (
1243
+ lambda_method_handles, i_it->source_location , arg0))
1261
1244
{
1262
1245
results.resize (1 );
1263
- results[0 ]=
1264
- zero_initializer (
1265
- return_type,
1266
- i_it->source_location ,
1267
- namespacet (symbol_table),
1268
- get_message_handler ());
1246
+ results[0 ] = *res;
1269
1247
}
1270
1248
}
1271
1249
// replace calls to CProver.assume
@@ -2706,6 +2684,37 @@ codet java_bytecode_convert_methodt::convert_instructions(
2706
2684
return code;
2707
2685
}
2708
2686
2687
+ optionalt<exprt> java_bytecode_convert_methodt::convert_invoke_dynamic (
2688
+ const java_class_typet::java_lambda_method_handlest &lambda_method_handles,
2689
+ const source_locationt &location,
2690
+ const exprt &arg0)
2691
+ {
2692
+ const code_typet &code_type = to_code_type (arg0.type ());
2693
+
2694
+ const optionalt<symbolt> &lambda_method_symbol = get_lambda_method_symbol (
2695
+ lambda_method_handles,
2696
+ code_type.get_int (ID_java_lambda_method_handle_index));
2697
+ if (lambda_method_symbol.has_value ())
2698
+ debug () << " Converting invokedynamic for lambda: "
2699
+ << lambda_method_symbol.value ().name << eom;
2700
+ else
2701
+ debug () << " Converting invokedynamic for lambda with unknown handle "
2702
+ " type"
2703
+ << eom;
2704
+
2705
+ const code_typet::parameterst ¶meters (code_type.parameters ());
2706
+
2707
+ pop (parameters.size ());
2708
+
2709
+ const typet &return_type = code_type.return_type ();
2710
+
2711
+ if (return_type.id () == ID_empty)
2712
+ return {};
2713
+
2714
+ return zero_initializer (
2715
+ return_type, location, namespacet (symbol_table), get_message_handler ());
2716
+ }
2717
+
2709
2718
void java_bytecode_convert_methodt::draw_edges_from_ret_to_jsr (
2710
2719
java_bytecode_convert_methodt::address_mapt &address_map,
2711
2720
const std::vector<unsigned int > &jsr_ret_targets,
0 commit comments