Path: blob/master/src/hotspot/cpu/arm/assembler_arm_32.cpp
40930 views
/*1* Copyright (c) 2008, 2018, 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/assembler.hpp"26#include "asm/assembler.inline.hpp"27#include "ci/ciEnv.hpp"28#include "gc/shared/cardTableBarrierSet.hpp"29#include "gc/shared/collectedHeap.inline.hpp"30#include "interpreter/interpreter.hpp"31#include "interpreter/interpreterRuntime.hpp"32#include "interpreter/templateInterpreterGenerator.hpp"33#include "memory/resourceArea.hpp"34#include "prims/jvm_misc.hpp"35#include "prims/methodHandles.hpp"36#include "runtime/biasedLocking.hpp"37#include "runtime/interfaceSupport.inline.hpp"38#include "runtime/objectMonitor.hpp"39#include "runtime/os.hpp"40#include "runtime/sharedRuntime.hpp"41#include "runtime/stubRoutines.hpp"42#include "utilities/hashtable.hpp"43#include "utilities/macros.hpp"4445#ifdef COMPILER246// Convert the raw encoding form into the form expected by the47// constructor for Address.48Address Address::make_raw(int base, int index, int scale, int disp, relocInfo::relocType disp_reloc) {49RelocationHolder rspec;50if (disp_reloc != relocInfo::none) {51rspec = Relocation::spec_simple(disp_reloc);52}5354Register rindex = as_Register(index);55if (rindex != PC) {56assert(disp == 0, "unsupported");57Address madr(as_Register(base), rindex, lsl, scale);58madr._rspec = rspec;59return madr;60} else {61assert(scale == 0, "not supported");62Address madr(as_Register(base), disp);63madr._rspec = rspec;64return madr;65}66}67#endif6869void AsmOperand::initialize_rotated_imm(unsigned int imm) {70for (int shift = 2; shift <= 24; shift += 2) {71if ((imm & ~(0xff << shift)) == 0) {72_encoding = 1 << 25 | (32 - shift) << 7 | imm >> shift;73return;74}75}76assert((imm & 0x0ffffff0) == 0, "too complicated constant: %d (%x)", imm, imm);77_encoding = 1 << 25 | 4 << 7 | imm >> 28 | imm << 4;78}7980bool AsmOperand::is_rotated_imm(unsigned int imm) {81if ((imm >> 8) == 0) {82return true;83}84for (int shift = 2; shift <= 24; shift += 2) {85if ((imm & ~(0xff << shift)) == 0) {86return true;87}88}89if ((imm & 0x0ffffff0) == 0) {90return true;91}92return false;93}949596