Path: blob/master/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp
40930 views
/*1* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "asm/macroAssembler.inline.hpp"26#include "c1/c1_Defs.hpp"27#include "c1/c1_LIRAssembler.hpp"28#include "c1/c1_MacroAssembler.hpp"29#include "c1/c1_Runtime1.hpp"30#include "ci/ciUtilities.hpp"31#include "compiler/oopMap.hpp"32#include "gc/shared/cardTable.hpp"33#include "gc/shared/cardTableBarrierSet.hpp"34#include "gc/shared/collectedHeap.hpp"35#include "gc/shared/tlab_globals.hpp"36#include "interpreter/interpreter.hpp"37#include "memory/universe.hpp"38#include "nativeInst_arm.hpp"39#include "oops/compiledICHolder.hpp"40#include "oops/oop.inline.hpp"41#include "prims/jvmtiExport.hpp"42#include "register_arm.hpp"43#include "runtime/sharedRuntime.hpp"44#include "runtime/signature.hpp"45#include "runtime/vframeArray.hpp"46#include "utilities/align.hpp"47#include "vmreg_arm.inline.hpp"4849// Note: Rtemp usage is this file should not impact C2 and should be50// correct as long as it is not implicitly used in lower layers (the51// arm [macro]assembler) and used with care in the other C1 specific52// files.5354// Implementation of StubAssembler5556int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, int args_size) {57mov(R0, Rthread);5859int call_offset = set_last_Java_frame(SP, FP, false, Rtemp);6061call(entry);62if (call_offset == -1) { // PC not saved63call_offset = offset();64}65reset_last_Java_frame(Rtemp);6667assert(frame_size() != no_frame_size, "frame must be fixed");68if (_stub_id != Runtime1::forward_exception_id) {69ldr(R3, Address(Rthread, Thread::pending_exception_offset()));70}7172if (oop_result1->is_valid()) {73assert_different_registers(oop_result1, R3, Rtemp);74get_vm_result(oop_result1, Rtemp);75}76if (metadata_result->is_valid()) {77assert_different_registers(metadata_result, R3, Rtemp);78get_vm_result_2(metadata_result, Rtemp);79}8081// Check for pending exception82// unpack_with_exception_in_tls path is taken through83// Runtime1::exception_handler_for_pc84if (_stub_id != Runtime1::forward_exception_id) {85assert(frame_size() != no_frame_size, "cannot directly call forward_exception_id");86cmp(R3, 0);87jump(Runtime1::entry_for(Runtime1::forward_exception_id), relocInfo::runtime_call_type, Rtemp, ne);88} else {89#ifdef ASSERT90// Should not have pending exception in forward_exception stub91ldr(R3, Address(Rthread, Thread::pending_exception_offset()));92cmp(R3, 0);93breakpoint(ne);94#endif // ASSERT95}96return call_offset;97}9899100int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1) {101if (arg1 != R1) {102mov(R1, arg1);103}104return call_RT(oop_result1, metadata_result, entry, 1);105}106107108int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2) {109assert(arg1 == R1 && arg2 == R2, "cannot handle otherwise");110return call_RT(oop_result1, metadata_result, entry, 2);111}112113114int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) {115assert(arg1 == R1 && arg2 == R2 && arg3 == R3, "cannot handle otherwise");116return call_RT(oop_result1, metadata_result, entry, 3);117}118119120#define __ sasm->121122// TODO: ARM - does this duplicate RegisterSaver in SharedRuntime?123124enum RegisterLayout {125fpu_save_size = pd_nof_fpu_regs_reg_alloc,126#ifndef __SOFTFP__127D0_offset = 0,128#endif129R0_offset = fpu_save_size,130R1_offset,131R2_offset,132R3_offset,133R4_offset,134R5_offset,135R6_offset,136#if (FP_REG_NUM != 7)137R7_offset,138#endif139R8_offset,140R9_offset,141R10_offset,142#if (FP_REG_NUM != 11)143R11_offset,144#endif145R12_offset,146FP_offset,147LR_offset,148reg_save_size,149arg1_offset = reg_save_size * wordSize,150arg2_offset = (reg_save_size + 1) * wordSize151};152153154static OopMap* generate_oop_map(StubAssembler* sasm, bool save_fpu_registers = HaveVFP) {155sasm->set_frame_size(reg_save_size /* in words */);156157// Record saved value locations in an OopMap.158// Locations are offsets from sp after runtime call.159OopMap* map = new OopMap(VMRegImpl::slots_per_word * reg_save_size, 0);160161int j=0;162for (int i = R0_offset; i < R10_offset; i++) {163if (j == FP_REG_NUM) {164// skip the FP register, saved below165j++;166}167map->set_callee_saved(VMRegImpl::stack2reg(i), as_Register(j)->as_VMReg());168j++;169}170assert(j == R10->encoding(), "must be");171#if (FP_REG_NUM != 11)172// add R11, if not saved as FP173map->set_callee_saved(VMRegImpl::stack2reg(R11_offset), R11->as_VMReg());174#endif175map->set_callee_saved(VMRegImpl::stack2reg(FP_offset), FP->as_VMReg());176map->set_callee_saved(VMRegImpl::stack2reg(LR_offset), LR->as_VMReg());177178if (save_fpu_registers) {179for (int i = 0; i < fpu_save_size; i++) {180map->set_callee_saved(VMRegImpl::stack2reg(i), as_FloatRegister(i)->as_VMReg());181}182}183184return map;185}186187static OopMap* save_live_registers(StubAssembler* sasm, bool save_fpu_registers = HaveVFP) {188__ block_comment("save_live_registers");189sasm->set_frame_size(reg_save_size /* in words */);190191__ push(RegisterSet(FP) | RegisterSet(LR));192__ push(RegisterSet(R0, R6) | RegisterSet(R8, R10) | R12 | altFP_7_11);193if (save_fpu_registers) {194__ fpush(FloatRegisterSet(D0, fpu_save_size / 2));195} else {196__ sub(SP, SP, fpu_save_size * wordSize);197}198199return generate_oop_map(sasm, save_fpu_registers);200}201202203static void restore_live_registers(StubAssembler* sasm,204bool restore_R0,205bool restore_FP_LR,206bool do_return,207bool restore_fpu_registers = HaveVFP) {208__ block_comment("restore_live_registers");209210if (restore_fpu_registers) {211__ fpop(FloatRegisterSet(D0, fpu_save_size / 2));212if (!restore_R0) {213__ add(SP, SP, (R1_offset - fpu_save_size) * wordSize);214}215} else {216__ add(SP, SP, (restore_R0 ? fpu_save_size : R1_offset) * wordSize);217}218__ pop(RegisterSet((restore_R0 ? R0 : R1), R6) | RegisterSet(R8, R10) | R12 | altFP_7_11);219if (restore_FP_LR) {220__ pop(RegisterSet(FP) | RegisterSet(do_return ? PC : LR));221} else {222assert (!do_return, "return without restoring FP/LR");223}224}225226227static void restore_live_registers_except_R0(StubAssembler* sasm, bool restore_fpu_registers = HaveVFP) {228restore_live_registers(sasm, false, true, true, restore_fpu_registers);229}230231static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = HaveVFP) {232restore_live_registers(sasm, true, true, true, restore_fpu_registers);233}234235static void restore_live_registers_except_FP_LR(StubAssembler* sasm, bool restore_fpu_registers = HaveVFP) {236restore_live_registers(sasm, true, false, false, restore_fpu_registers);237}238239static void restore_live_registers_without_return(StubAssembler* sasm, bool restore_fpu_registers = HaveVFP) {240restore_live_registers(sasm, true, true, false, restore_fpu_registers);241}242243void StubAssembler::save_live_registers() {244::save_live_registers(this);245}246247void StubAssembler::restore_live_registers_without_return() {248::restore_live_registers_without_return(this);249}250251void Runtime1::initialize_pd() {252}253254255OopMapSet* Runtime1::generate_exception_throw(StubAssembler* sasm, address target, bool has_argument) {256OopMap* oop_map = save_live_registers(sasm);257258int call_offset;259if (has_argument) {260__ ldr(R1, Address(SP, arg1_offset));261__ ldr(R2, Address(SP, arg2_offset));262call_offset = __ call_RT(noreg, noreg, target, R1, R2);263} else {264call_offset = __ call_RT(noreg, noreg, target);265}266267OopMapSet* oop_maps = new OopMapSet();268oop_maps->add_gc_map(call_offset, oop_map);269270DEBUG_ONLY(STOP("generate_exception_throw");) // Should not reach here271return oop_maps;272}273274275static void restore_sp_for_method_handle(StubAssembler* sasm) {276// Restore SP from its saved reg (FP) if the exception PC is a MethodHandle call site.277__ ldr_s32(Rtemp, Address(Rthread, JavaThread::is_method_handle_return_offset()));278__ cmp(Rtemp, 0);279__ mov(SP, Rmh_SP_save, ne);280}281282283OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler* sasm) {284__ block_comment("generate_handle_exception");285286bool save_fpu_registers = false;287288// Save registers, if required.289OopMapSet* oop_maps = new OopMapSet();290OopMap* oop_map = NULL;291292switch (id) {293case forward_exception_id: {294save_fpu_registers = HaveVFP;295oop_map = generate_oop_map(sasm);296__ ldr(Rexception_obj, Address(Rthread, Thread::pending_exception_offset()));297__ ldr(Rexception_pc, Address(SP, LR_offset * wordSize));298Register zero = __ zero_register(Rtemp);299__ str(zero, Address(Rthread, Thread::pending_exception_offset()));300break;301}302case handle_exception_id:303save_fpu_registers = HaveVFP;304// fall-through305case handle_exception_nofpu_id:306// At this point all registers MAY be live.307oop_map = save_live_registers(sasm, save_fpu_registers);308break;309case handle_exception_from_callee_id:310// At this point all registers except exception oop (R4/R19) and311// exception pc (R5/R20) are dead.312oop_map = save_live_registers(sasm); // TODO it's not required to save all registers313break;314default: ShouldNotReachHere();315}316317__ str(Rexception_obj, Address(Rthread, JavaThread::exception_oop_offset()));318__ str(Rexception_pc, Address(Rthread, JavaThread::exception_pc_offset()));319320__ str(Rexception_pc, Address(SP, LR_offset * wordSize)); // patch throwing pc into return address321322int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc));323oop_maps->add_gc_map(call_offset, oop_map);324325// Exception handler found326__ str(R0, Address(SP, LR_offset * wordSize)); // patch the return address327328// Restore the registers that were saved at the beginning, remove329// frame and jump to the exception handler.330switch (id) {331case forward_exception_id:332case handle_exception_nofpu_id:333case handle_exception_id:334restore_live_registers(sasm, save_fpu_registers);335// Note: the restore live registers includes the jump to LR (patched to R0)336break;337case handle_exception_from_callee_id:338restore_live_registers_without_return(sasm); // must not jump immediatly to handler339restore_sp_for_method_handle(sasm);340__ ret();341break;342default: ShouldNotReachHere();343}344345DEBUG_ONLY(STOP("generate_handle_exception");) // Should not reach here346347return oop_maps;348}349350351void Runtime1::generate_unwind_exception(StubAssembler* sasm) {352// FP no longer used to find the frame start353// on entry, remove_frame() has already been called (restoring FP and LR)354355// search the exception handler address of the caller (using the return address)356__ mov(c_rarg0, Rthread);357__ mov(Rexception_pc, LR);358__ mov(c_rarg1, LR);359__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), c_rarg0, c_rarg1);360361// Exception oop should be still in Rexception_obj and pc in Rexception_pc362// Jump to handler363__ verify_not_null_oop(Rexception_obj);364365// JSR292 extension366restore_sp_for_method_handle(sasm);367368__ jump(R0);369}370371372OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {373OopMap* oop_map = save_live_registers(sasm);374375// call the runtime patching routine, returns non-zero if nmethod got deopted.376int call_offset = __ call_RT(noreg, noreg, target);377OopMapSet* oop_maps = new OopMapSet();378oop_maps->add_gc_map(call_offset, oop_map);379380DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();381assert(deopt_blob != NULL, "deoptimization blob must have been created");382383__ cmp_32(R0, 0);384385restore_live_registers_except_FP_LR(sasm);386__ pop(RegisterSet(FP) | RegisterSet(PC), eq);387388// Deoptimization needed389// TODO: ARM - no need to restore FP & LR because unpack_with_reexecution() stores them back390__ pop(RegisterSet(FP) | RegisterSet(LR));391392__ jump(deopt_blob->unpack_with_reexecution(), relocInfo::runtime_call_type, Rtemp);393394DEBUG_ONLY(STOP("generate_patching");) // Should not reach here395return oop_maps;396}397398399OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {400const bool must_gc_arguments = true;401const bool dont_gc_arguments = false;402403OopMapSet* oop_maps = NULL;404bool save_fpu_registers = HaveVFP;405406switch (id) {407case forward_exception_id:408{409oop_maps = generate_handle_exception(id, sasm);410// does not return on ARM411}412break;413414case new_instance_id:415case fast_new_instance_id:416case fast_new_instance_init_check_id:417{418const Register result = R0;419const Register klass = R1;420421// If TLAB is disabled, see if there is support for inlining contiguous422// allocations.423// Otherwise, just go to the slow path.424if (!UseTLAB && Universe::heap()->supports_inline_contig_alloc() && id != new_instance_id) {425Label slow_case, slow_case_no_pop;426427// Make sure the class is fully initialized428if (id == fast_new_instance_init_check_id) {429__ ldrb(result, Address(klass, InstanceKlass::init_state_offset()));430__ cmp(result, InstanceKlass::fully_initialized);431__ b(slow_case_no_pop, ne);432}433434// Free some temporary registers435const Register obj_size = R4;436const Register tmp1 = R5;437const Register tmp2 = LR;438const Register obj_end = Rtemp;439440__ raw_push(R4, R5, LR);441442__ ldr_u32(obj_size, Address(klass, Klass::layout_helper_offset()));443__ eden_allocate(result, obj_end, tmp1, tmp2, obj_size, slow_case); // initializes result and obj_end444__ initialize_object(result, obj_end, klass, noreg /* len */, tmp1, tmp2,445instanceOopDesc::header_size() * HeapWordSize, -1,446/* is_tlab_allocated */ false);447__ raw_pop_and_ret(R4, R5);448449__ bind(slow_case);450__ raw_pop(R4, R5, LR);451452__ bind(slow_case_no_pop);453}454455OopMap* map = save_live_registers(sasm);456int call_offset = __ call_RT(result, noreg, CAST_FROM_FN_PTR(address, new_instance), klass);457oop_maps = new OopMapSet();458oop_maps->add_gc_map(call_offset, map);459460// MacroAssembler::StoreStore useless (included in the runtime exit path)461462restore_live_registers_except_R0(sasm);463}464break;465466case counter_overflow_id:467{468OopMap* oop_map = save_live_registers(sasm);469__ ldr(R1, Address(SP, arg1_offset));470__ ldr(R2, Address(SP, arg2_offset));471int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, counter_overflow), R1, R2);472oop_maps = new OopMapSet();473oop_maps->add_gc_map(call_offset, oop_map);474restore_live_registers(sasm);475}476break;477478case new_type_array_id:479case new_object_array_id:480{481if (id == new_type_array_id) {482__ set_info("new_type_array", dont_gc_arguments);483} else {484__ set_info("new_object_array", dont_gc_arguments);485}486487const Register result = R0;488const Register klass = R1;489const Register length = R2;490491// If TLAB is disabled, see if there is support for inlining contiguous492// allocations.493// Otherwise, just go to the slow path.494if (!UseTLAB && Universe::heap()->supports_inline_contig_alloc()) {495Label slow_case, slow_case_no_pop;496497__ cmp_32(length, C1_MacroAssembler::max_array_allocation_length);498__ b(slow_case_no_pop, hs);499500// Free some temporary registers501const Register arr_size = R4;502const Register tmp1 = R5;503const Register tmp2 = LR;504const Register tmp3 = Rtemp;505const Register obj_end = tmp3;506507__ raw_push(R4, R5, LR);508509// Get the allocation size: round_up((length << (layout_helper & 0xff)) + header_size)510__ ldr_u32(tmp1, Address(klass, Klass::layout_helper_offset()));511__ mov(arr_size, MinObjAlignmentInBytesMask);512__ and_32(tmp2, tmp1, (unsigned int)(Klass::_lh_header_size_mask << Klass::_lh_header_size_shift));513514__ add(arr_size, arr_size, AsmOperand(length, lsl, tmp1));515516__ add(arr_size, arr_size, AsmOperand(tmp2, lsr, Klass::_lh_header_size_shift));517__ align_reg(arr_size, arr_size, MinObjAlignmentInBytes);518519// eden_allocate destroys tmp2, so reload header_size after allocation520// eden_allocate initializes result and obj_end521__ eden_allocate(result, obj_end, tmp1, tmp2, arr_size, slow_case);522__ ldrb(tmp2, Address(klass, in_bytes(Klass::layout_helper_offset()) +523Klass::_lh_header_size_shift / BitsPerByte));524__ initialize_object(result, obj_end, klass, length, tmp1, tmp2, tmp2, -1, /* is_tlab_allocated */ false);525__ raw_pop_and_ret(R4, R5);526527__ bind(slow_case);528__ raw_pop(R4, R5, LR);529__ bind(slow_case_no_pop);530}531532OopMap* map = save_live_registers(sasm);533int call_offset;534if (id == new_type_array_id) {535call_offset = __ call_RT(result, noreg, CAST_FROM_FN_PTR(address, new_type_array), klass, length);536} else {537call_offset = __ call_RT(result, noreg, CAST_FROM_FN_PTR(address, new_object_array), klass, length);538}539oop_maps = new OopMapSet();540oop_maps->add_gc_map(call_offset, map);541542// MacroAssembler::StoreStore useless (included in the runtime exit path)543544restore_live_registers_except_R0(sasm);545}546break;547548case new_multi_array_id:549{550__ set_info("new_multi_array", dont_gc_arguments);551552// R0: klass553// R2: rank554// SP: address of 1st dimension555const Register result = R0;556OopMap* map = save_live_registers(sasm);557558__ mov(R1, R0);559__ add(R3, SP, arg1_offset);560int call_offset = __ call_RT(result, noreg, CAST_FROM_FN_PTR(address, new_multi_array), R1, R2, R3);561562oop_maps = new OopMapSet();563oop_maps->add_gc_map(call_offset, map);564565// MacroAssembler::StoreStore useless (included in the runtime exit path)566567restore_live_registers_except_R0(sasm);568}569break;570571case register_finalizer_id:572{573__ set_info("register_finalizer", dont_gc_arguments);574575// Do not call runtime if JVM_ACC_HAS_FINALIZER flag is not set576__ load_klass(Rtemp, R0);577__ ldr_u32(Rtemp, Address(Rtemp, Klass::access_flags_offset()));578579__ tst(Rtemp, JVM_ACC_HAS_FINALIZER);580__ bx(LR, eq);581582// Call VM583OopMap* map = save_live_registers(sasm);584oop_maps = new OopMapSet();585int call_offset = __ call_RT(noreg, noreg,586CAST_FROM_FN_PTR(address, SharedRuntime::register_finalizer), R0);587oop_maps->add_gc_map(call_offset, map);588restore_live_registers(sasm);589}590break;591592case throw_range_check_failed_id:593{594__ set_info("range_check_failed", dont_gc_arguments);595oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_range_check_exception), true);596}597break;598599case throw_index_exception_id:600{601__ set_info("index_range_check_failed", dont_gc_arguments);602oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_index_exception), true);603}604break;605606case throw_div0_exception_id:607{608__ set_info("throw_div0_exception", dont_gc_arguments);609oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_div0_exception), false);610}611break;612613case throw_null_pointer_exception_id:614{615__ set_info("throw_null_pointer_exception", dont_gc_arguments);616oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_null_pointer_exception), false);617}618break;619620case handle_exception_nofpu_id:621case handle_exception_id:622{623__ set_info("handle_exception", dont_gc_arguments);624oop_maps = generate_handle_exception(id, sasm);625}626break;627628case handle_exception_from_callee_id:629{630__ set_info("handle_exception_from_callee", dont_gc_arguments);631oop_maps = generate_handle_exception(id, sasm);632}633break;634635case unwind_exception_id:636{637__ set_info("unwind_exception", dont_gc_arguments);638generate_unwind_exception(sasm);639}640break;641642case throw_array_store_exception_id:643{644__ set_info("throw_array_store_exception", dont_gc_arguments);645oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true);646}647break;648649case throw_class_cast_exception_id:650{651__ set_info("throw_class_cast_exception", dont_gc_arguments);652oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_class_cast_exception), true);653}654break;655656case throw_incompatible_class_change_error_id:657{658__ set_info("throw_incompatible_class_cast_exception", dont_gc_arguments);659oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_incompatible_class_change_error), false);660}661break;662663case slow_subtype_check_id:664{665// (in) R0 - sub, destroyed,666// (in) R1 - super, not changed667// (out) R0 - result: 1 if check passed, 0 otherwise668__ raw_push(R2, R3, LR);669670// Load an array of secondary_supers671__ ldr(R2, Address(R0, Klass::secondary_supers_offset()));672// Length goes to R3673__ ldr_s32(R3, Address(R2, Array<Klass*>::length_offset_in_bytes()));674__ add(R2, R2, Array<Klass*>::base_offset_in_bytes());675676Label loop, miss;677__ bind(loop);678__ cbz(R3, miss);679__ ldr(LR, Address(R2, wordSize, post_indexed));680__ sub(R3, R3, 1);681__ cmp(LR, R1);682__ b(loop, ne);683684// We get here if an equal cache entry is found685__ str(R1, Address(R0, Klass::secondary_super_cache_offset()));686__ mov(R0, 1);687__ raw_pop_and_ret(R2, R3);688689// A cache entry not found - return false690__ bind(miss);691__ mov(R0, 0);692__ raw_pop_and_ret(R2, R3);693}694break;695696case monitorenter_nofpu_id:697save_fpu_registers = false;698// fall through699case monitorenter_id:700{701__ set_info("monitorenter", dont_gc_arguments);702const Register obj = R1;703const Register lock = R2;704OopMap* map = save_live_registers(sasm, save_fpu_registers);705__ ldr(obj, Address(SP, arg1_offset));706__ ldr(lock, Address(SP, arg2_offset));707int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorenter), obj, lock);708oop_maps = new OopMapSet();709oop_maps->add_gc_map(call_offset, map);710restore_live_registers(sasm, save_fpu_registers);711}712break;713714case monitorexit_nofpu_id:715save_fpu_registers = false;716// fall through717case monitorexit_id:718{719__ set_info("monitorexit", dont_gc_arguments);720const Register lock = R1;721OopMap* map = save_live_registers(sasm, save_fpu_registers);722__ ldr(lock, Address(SP, arg1_offset));723int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorexit), lock);724oop_maps = new OopMapSet();725oop_maps->add_gc_map(call_offset, map);726restore_live_registers(sasm, save_fpu_registers);727}728break;729730case deoptimize_id:731{732__ set_info("deoptimize", dont_gc_arguments);733OopMap* oop_map = save_live_registers(sasm);734const Register trap_request = R1;735__ ldr(trap_request, Address(SP, arg1_offset));736int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), trap_request);737oop_maps = new OopMapSet();738oop_maps->add_gc_map(call_offset, oop_map);739restore_live_registers_without_return(sasm);740DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();741assert(deopt_blob != NULL, "deoptimization blob must have been created");742__ jump(deopt_blob->unpack_with_reexecution(), relocInfo::runtime_call_type, noreg);743}744break;745746case access_field_patching_id:747{748__ set_info("access_field_patching", dont_gc_arguments);749oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, access_field_patching));750}751break;752753case load_klass_patching_id:754{755__ set_info("load_klass_patching", dont_gc_arguments);756oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_klass_patching));757}758break;759760case load_appendix_patching_id:761{762__ set_info("load_appendix_patching", dont_gc_arguments);763oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_appendix_patching));764}765break;766767case load_mirror_patching_id:768{769__ set_info("load_mirror_patching", dont_gc_arguments);770oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_mirror_patching));771}772break;773774case predicate_failed_trap_id:775{776__ set_info("predicate_failed_trap", dont_gc_arguments);777778OopMap* oop_map = save_live_registers(sasm);779int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap));780781oop_maps = new OopMapSet();782oop_maps->add_gc_map(call_offset, oop_map);783784restore_live_registers_without_return(sasm);785786DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();787assert(deopt_blob != NULL, "deoptimization blob must have been created");788__ jump(deopt_blob->unpack_with_reexecution(), relocInfo::runtime_call_type, Rtemp);789}790break;791792default:793{794__ set_info("unimplemented entry", dont_gc_arguments);795STOP("unimplemented entry");796}797break;798}799return oop_maps;800}801802#undef __803804#ifdef __SOFTFP__805const char *Runtime1::pd_name_for_address(address entry) {806807#define FUNCTION_CASE(a, f) \808if ((intptr_t)a == CAST_FROM_FN_PTR(intptr_t, f)) return #f809810FUNCTION_CASE(entry, __aeabi_fadd_glibc);811FUNCTION_CASE(entry, __aeabi_fmul);812FUNCTION_CASE(entry, __aeabi_fsub_glibc);813FUNCTION_CASE(entry, __aeabi_fdiv);814815// __aeabi_XXXX_glibc: Imported code from glibc soft-fp bundle for calculation accuracy improvement. See CR 6757269.816FUNCTION_CASE(entry, __aeabi_dadd_glibc);817FUNCTION_CASE(entry, __aeabi_dmul);818FUNCTION_CASE(entry, __aeabi_dsub_glibc);819FUNCTION_CASE(entry, __aeabi_ddiv);820821FUNCTION_CASE(entry, __aeabi_f2d);822FUNCTION_CASE(entry, __aeabi_d2f);823FUNCTION_CASE(entry, __aeabi_i2f);824FUNCTION_CASE(entry, __aeabi_i2d);825FUNCTION_CASE(entry, __aeabi_f2iz);826827FUNCTION_CASE(entry, SharedRuntime::fcmpl);828FUNCTION_CASE(entry, SharedRuntime::fcmpg);829FUNCTION_CASE(entry, SharedRuntime::dcmpl);830FUNCTION_CASE(entry, SharedRuntime::dcmpg);831832FUNCTION_CASE(entry, SharedRuntime::unordered_fcmplt);833FUNCTION_CASE(entry, SharedRuntime::unordered_dcmplt);834FUNCTION_CASE(entry, SharedRuntime::unordered_fcmple);835FUNCTION_CASE(entry, SharedRuntime::unordered_dcmple);836FUNCTION_CASE(entry, SharedRuntime::unordered_fcmpge);837FUNCTION_CASE(entry, SharedRuntime::unordered_dcmpge);838FUNCTION_CASE(entry, SharedRuntime::unordered_fcmpgt);839FUNCTION_CASE(entry, SharedRuntime::unordered_dcmpgt);840841FUNCTION_CASE(entry, SharedRuntime::fneg);842FUNCTION_CASE(entry, SharedRuntime::dneg);843844FUNCTION_CASE(entry, __aeabi_fcmpeq);845FUNCTION_CASE(entry, __aeabi_fcmplt);846FUNCTION_CASE(entry, __aeabi_fcmple);847FUNCTION_CASE(entry, __aeabi_fcmpge);848FUNCTION_CASE(entry, __aeabi_fcmpgt);849850FUNCTION_CASE(entry, __aeabi_dcmpeq);851FUNCTION_CASE(entry, __aeabi_dcmplt);852FUNCTION_CASE(entry, __aeabi_dcmple);853FUNCTION_CASE(entry, __aeabi_dcmpge);854FUNCTION_CASE(entry, __aeabi_dcmpgt);855#undef FUNCTION_CASE856return "";857}858#else // __SOFTFP__859const char *Runtime1::pd_name_for_address(address entry) {860return "<unknown function>";861}862#endif // __SOFTFP__863864865