< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64Move.java

Print this page
rev 56282 : [mq]: graal
   1 /*
   2  * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 532                         masm.mov(64, dst, crb.uncompressedNullRegister);
 533                     } else {
 534                         masm.mov(dst, 0);
 535                     }
 536                 } else if (crb.target.inlineObjects) {
 537                     crb.recordInlineDataInCode(input);
 538                     masm.mov(dst, 0xDEADDEADDEADDEADL, true);
 539                 } else {
 540                     masm.ldr(64, dst, (AArch64Address) crb.recordDataReferenceInCode(input, 8));
 541                 }
 542                 break;
 543             default:
 544                 throw GraalError.shouldNotReachHere("kind=" + input.getJavaKind().getStackKind());
 545         }
 546     }
 547 
 548     private static void const2stack(CompilationResultBuilder crb, AArch64MacroAssembler masm, Value result, JavaConstant constant) {
 549         try (ScratchRegister addrReg = masm.getScratchRegister()) {
 550             StackSlot slot = (StackSlot) result;
 551             AArch64Address resultAddress = loadStackSlotAddress(crb, masm, slot, addrReg.getRegister());
 552             if (constant.isDefaultForKind() || constant.isNull()) {
 553                 emitStore(crb, masm, (AArch64Kind) result.getPlatformKind(), resultAddress, zr.asValue(LIRKind.combine(result)));
 554             } else {
 555                 try (ScratchRegister sc = masm.getScratchRegister()) {
 556                     Value scratchRegisterValue = sc.getRegister().asValue(LIRKind.combine(result));
 557                     const2reg(crb, masm, scratchRegisterValue, constant);
 558                     emitStore(crb, masm, (AArch64Kind) result.getPlatformKind(), resultAddress, scratchRegisterValue);
 559                 }
 560             }
 561         }
 562     }
 563 
 564     /**
 565      * Returns AArch64Address of given StackSlot. We cannot use CompilationResultBuilder.asAddress
 566      * since this calls AArch64MacroAssembler.makeAddress with displacements that may be larger than
 567      * 9-bit signed, which cannot be handled by that method.
 568      *
 569      * Instead we create an address ourselves. We use scaled unsigned addressing since we know the
 570      * transfersize, which gives us a 15-bit address range (for longs/doubles) respectively a 14-bit
 571      * range (for everything else).
 572      *


   1 /*
   2  * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 532                         masm.mov(64, dst, crb.uncompressedNullRegister);
 533                     } else {
 534                         masm.mov(dst, 0);
 535                     }
 536                 } else if (crb.target.inlineObjects) {
 537                     crb.recordInlineDataInCode(input);
 538                     masm.mov(dst, 0xDEADDEADDEADDEADL, true);
 539                 } else {
 540                     masm.ldr(64, dst, (AArch64Address) crb.recordDataReferenceInCode(input, 8));
 541                 }
 542                 break;
 543             default:
 544                 throw GraalError.shouldNotReachHere("kind=" + input.getJavaKind().getStackKind());
 545         }
 546     }
 547 
 548     private static void const2stack(CompilationResultBuilder crb, AArch64MacroAssembler masm, Value result, JavaConstant constant) {
 549         try (ScratchRegister addrReg = masm.getScratchRegister()) {
 550             StackSlot slot = (StackSlot) result;
 551             AArch64Address resultAddress = loadStackSlotAddress(crb, masm, slot, addrReg.getRegister());
 552             if (constant.isNull() && !crb.mustReplaceWithUncompressedNullRegister(constant)) {
 553                 emitStore(crb, masm, (AArch64Kind) result.getPlatformKind(), resultAddress, zr.asValue(LIRKind.combine(result)));
 554             } else {
 555                 try (ScratchRegister sc = masm.getScratchRegister()) {
 556                     Value scratchRegisterValue = sc.getRegister().asValue(LIRKind.combine(result));
 557                     const2reg(crb, masm, scratchRegisterValue, constant);
 558                     emitStore(crb, masm, (AArch64Kind) result.getPlatformKind(), resultAddress, scratchRegisterValue);
 559                 }
 560             }
 561         }
 562     }
 563 
 564     /**
 565      * Returns AArch64Address of given StackSlot. We cannot use CompilationResultBuilder.asAddress
 566      * since this calls AArch64MacroAssembler.makeAddress with displacements that may be larger than
 567      * 9-bit signed, which cannot be handled by that method.
 568      *
 569      * Instead we create an address ourselves. We use scaled unsigned addressing since we know the
 570      * transfersize, which gives us a 15-bit address range (for longs/doubles) respectively a 14-bit
 571      * range (for everything else).
 572      *


< prev index next >