From dbaa5c7ba8935cf87ceb40a4054f9842929e9a51 Mon Sep 17 00:00:00 2001 From: Orion Hodson Date: Thu, 10 May 2018 08:22:46 +0100 Subject: ART: Compiler support for const-method-handle Implemented as a runtime call. Bug: 66890674 Test: art/test.py --target -r -t 979 Test: art/test.py --target --64 -r -t 979 Test: art/test.py --host -r -t 979 Change-Id: I67f461c819a7d528d7455afda8b4a59e9aed381c --- compiler/optimizing/instruction_builder.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'compiler/optimizing/instruction_builder.cc') diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index 61730a8128..35a39456a2 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -1896,6 +1896,13 @@ bool HInstructionBuilder::LoadClassNeedsAccessCheck(Handle klass) } } +void HInstructionBuilder::BuildLoadMethodHandle(uint16_t proto_idx, uint32_t dex_pc) { + const DexFile& dex_file = *dex_compilation_unit_->GetDexFile(); + HLoadMethodHandle* load_method_handle = + new (allocator_) HLoadMethodHandle(graph_->GetCurrentMethod(), proto_idx, dex_file, dex_pc); + AppendInstruction(load_method_handle); +} + void HInstructionBuilder::BuildLoadMethodType(uint16_t proto_idx, uint32_t dex_pc) { const DexFile& dex_file = *dex_compilation_unit_->GetDexFile(); HLoadMethodType* load_method_type = @@ -2934,6 +2941,13 @@ bool HInstructionBuilder::ProcessDexInstruction(const Instruction& instruction, break; } + case Instruction::CONST_METHOD_HANDLE: { + uint16_t method_handle_idx = instruction.VRegB_21c(); + BuildLoadMethodHandle(method_handle_idx, dex_pc); + UpdateLocal(instruction.VRegA_21c(), current_block_->GetLastInstruction()); + break; + } + case Instruction::CONST_METHOD_TYPE: { uint16_t proto_idx = instruction.VRegB_21c(); BuildLoadMethodType(proto_idx, dex_pc); -- cgit v1.2.3-59-g8ed1b