src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotLIRGenerator.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotLIRGenerator.java

Print this page




   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  */
  23 package org.graalvm.compiler.hotspot;
  24 

  25 import org.graalvm.compiler.core.common.LIRKind;
  26 import org.graalvm.compiler.debug.GraalError;
  27 import org.graalvm.compiler.hotspot.meta.HotSpotConstantLoadAction;
  28 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
  29 import org.graalvm.compiler.hotspot.nodes.DeoptimizationFetchUnrollInfoCallNode;
  30 import org.graalvm.compiler.hotspot.nodes.EnterUnpackFramesStackFrameNode;
  31 import org.graalvm.compiler.hotspot.nodes.GraalHotSpotVMConfigNode;
  32 import org.graalvm.compiler.hotspot.nodes.LeaveCurrentStackFrameNode;
  33 import org.graalvm.compiler.hotspot.nodes.LeaveDeoptimizedStackFrameNode;
  34 import org.graalvm.compiler.hotspot.nodes.LeaveUnpackFramesStackFrameNode;
  35 import org.graalvm.compiler.hotspot.nodes.PushInterpreterFrameNode;
  36 import org.graalvm.compiler.hotspot.nodes.SaveAllRegistersNode;
  37 import org.graalvm.compiler.hotspot.nodes.UncommonTrapCallNode;
  38 import org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyNode;
  39 import org.graalvm.compiler.hotspot.nodes.aot.ResolveConstantNode;
  40 import org.graalvm.compiler.hotspot.nodes.aot.ResolveMethodAndLoadCountersNode;
  41 import org.graalvm.compiler.hotspot.nodes.profiling.RandomSeedNode;
  42 import org.graalvm.compiler.hotspot.replacements.EncodedSymbolConstant;
  43 import org.graalvm.compiler.lir.LIRFrameState;
  44 import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp;
  45 import org.graalvm.compiler.lir.VirtualStackSlot;
  46 import org.graalvm.compiler.lir.gen.LIRGenerator;
  47 import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
  48 
  49 import jdk.vm.ci.hotspot.HotSpotMetaspaceConstant;
  50 import jdk.vm.ci.hotspot.HotSpotObjectConstant;
  51 import jdk.vm.ci.meta.Constant;
  52 import jdk.vm.ci.meta.DeoptimizationAction;
  53 import jdk.vm.ci.meta.DeoptimizationReason;
  54 import jdk.vm.ci.meta.ResolvedJavaMethod;
  55 import jdk.vm.ci.meta.Value;
  56 
  57 /**
  58  * This interface defines the contract a HotSpot backend LIR generator needs to fulfill in addition
  59  * to abstract methods from {@link LIRGenerator} and {@link LIRGeneratorTool}.
  60  */
  61 public interface HotSpotLIRGenerator extends LIRGeneratorTool {
  62 
  63     /**
  64      * Emits an operation to make a tail call.
  65      *
  66      * @param args the arguments of the call
  67      * @param address the target address of the call
  68      */
  69     void emitTailcall(Value[] args, Value address);
  70 
  71     void emitDeoptimizeCaller(DeoptimizationAction action, DeoptimizationReason reason);
  72 
  73     /**
  74      * Emits code for a {@link SaveAllRegistersNode}.
  75      *
  76      * @return a {@link SaveRegistersOp} operation
  77      */
  78     SaveRegistersOp emitSaveAllRegisters();
  79 
  80     /**
  81      * Emits code for a {@link LeaveCurrentStackFrameNode}.
  82      *
  83      * @param saveRegisterOp saved registers
  84      */
  85     default void emitLeaveCurrentStackFrame(SaveRegistersOp saveRegisterOp) {
  86         throw GraalError.unimplemented();
  87     }
  88 
  89     /**
  90      * Emits code for a {@link LeaveDeoptimizedStackFrameNode}.
  91      *
  92      * @param frameSize
  93      * @param initialInfo
  94      */
  95     default void emitLeaveDeoptimizedStackFrame(Value frameSize, Value initialInfo) {
  96         throw GraalError.unimplemented();
  97     }
  98 
  99     /**
 100      * Emits code for a {@link EnterUnpackFramesStackFrameNode}.
 101      *
 102      * @param framePc
 103      * @param senderSp
 104      * @param senderFp
 105      * @param saveRegisterOp
 106      */
 107     default void emitEnterUnpackFramesStackFrame(Value framePc, Value senderSp, Value senderFp, SaveRegistersOp saveRegisterOp) {
 108         throw GraalError.unimplemented();
 109     }
 110 
 111     /**
 112      * Emits code for a {@link LeaveUnpackFramesStackFrameNode}.
 113      *
 114      * @param saveRegisterOp
 115      */
 116     default void emitLeaveUnpackFramesStackFrame(SaveRegistersOp saveRegisterOp) {
 117         throw GraalError.unimplemented();
 118     }
 119 
 120     /**
 121      * Emits code for a {@link PushInterpreterFrameNode}.
 122      *
 123      * @param frameSize
 124      * @param framePc
 125      * @param senderSp
 126      * @param initialInfo
 127      */
 128     default void emitPushInterpreterFrame(Value frameSize, Value framePc, Value senderSp, Value initialInfo) {
 129         throw GraalError.unimplemented();
 130     }
 131 
 132     /**
 133      * Emits code for a {@link LoadConstantIndirectlyNode}.
 134      *
 135      * @param constant
 136      * @return value of loaded address in register
 137      */
 138     default Value emitLoadObjectAddress(Constant constant) {
 139         throw GraalError.unimplemented();
 140     }
 141 
 142     /**
 143      * Emits code for a {@link LoadConstantIndirectlyNode}.
 144      *
 145      * @param constant original constant
 146      * @param action action to perform on the metaspace object
 147      * @return Value of loaded address in register
 148      */
 149     default Value emitLoadMetaspaceAddress(Constant constant, HotSpotConstantLoadAction action) {
 150         throw GraalError.unimplemented();
 151     }
 152 


 211      * @param constant original constant
 212      * @param constantDescription a symbolic description of the {@link HotSpotMetaspaceConstant}
 213      *            generated by {@link EncodedSymbolConstant}
 214      * @param frameState frame state for the runtime call
 215      * @return Returns the address of the requested constant.
 216      */
 217     default Value emitKlassInitializationAndRetrieval(Constant constant, Value constantDescription, LIRFrameState frameState) {
 218         throw GraalError.unimplemented();
 219     }
 220 
 221     /**
 222      * Emits code for a {@link RandomSeedNode}.
 223      *
 224      * @return value of the counter
 225      */
 226     default Value emitRandomSeed() {
 227         throw GraalError.unimplemented();
 228     }
 229 
 230     /**
 231      * Emits code for a {@link UncommonTrapCallNode}.
 232      *
 233      * @param trapRequest
 234      * @param mode
 235      * @param saveRegisterOp
 236      * @return a {@code Deoptimization::UnrollBlock} pointer
 237      */
 238     default Value emitUncommonTrapCall(Value trapRequest, Value mode, SaveRegistersOp saveRegisterOp) {
 239         throw GraalError.unimplemented();
 240     }
 241 
 242     /**
 243      * Emits code for a {@link DeoptimizationFetchUnrollInfoCallNode}.
 244      *
 245      * @param mode
 246      * @param saveRegisterOp
 247      * @return a {@code Deoptimization::UnrollBlock} pointer
 248      */
 249     default Value emitDeoptimizationFetchUnrollInfoCall(Value mode, SaveRegistersOp saveRegisterOp) {
 250         throw GraalError.unimplemented();
 251     }
 252 
 253     /**
 254      * Gets a stack slot for a lock at a given lock nesting depth.
 255      */
 256     VirtualStackSlot getLockSlot(int lockDepth);
 257 
 258     @Override
 259     HotSpotProviders getProviders();
 260 
 261     Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull);
 262 
 263     Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull);
 264 
 265 }


   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  */
  23 package org.graalvm.compiler.hotspot;
  24 
  25 import org.graalvm.compiler.core.common.CompressEncoding;
  26 import org.graalvm.compiler.core.common.LIRKind;
  27 import org.graalvm.compiler.debug.GraalError;
  28 import org.graalvm.compiler.hotspot.meta.HotSpotConstantLoadAction;
  29 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;


  30 import org.graalvm.compiler.hotspot.nodes.GraalHotSpotVMConfigNode;






  31 import org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyNode;
  32 import org.graalvm.compiler.hotspot.nodes.aot.ResolveConstantNode;
  33 import org.graalvm.compiler.hotspot.nodes.aot.ResolveMethodAndLoadCountersNode;
  34 import org.graalvm.compiler.hotspot.nodes.profiling.RandomSeedNode;
  35 import org.graalvm.compiler.hotspot.replacements.EncodedSymbolConstant;
  36 import org.graalvm.compiler.lir.LIRFrameState;

  37 import org.graalvm.compiler.lir.VirtualStackSlot;
  38 import org.graalvm.compiler.lir.gen.LIRGenerator;
  39 import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
  40 
  41 import jdk.vm.ci.hotspot.HotSpotMetaspaceConstant;
  42 import jdk.vm.ci.hotspot.HotSpotObjectConstant;
  43 import jdk.vm.ci.meta.Constant;
  44 import jdk.vm.ci.meta.DeoptimizationAction;
  45 import jdk.vm.ci.meta.DeoptimizationReason;
  46 import jdk.vm.ci.meta.ResolvedJavaMethod;
  47 import jdk.vm.ci.meta.Value;
  48 
  49 /**
  50  * This interface defines the contract a HotSpot backend LIR generator needs to fulfill in addition
  51  * to abstract methods from {@link LIRGenerator} and {@link LIRGeneratorTool}.
  52  */
  53 public interface HotSpotLIRGenerator extends LIRGeneratorTool {
  54 
  55     /**
  56      * Emits an operation to make a tail call.
  57      *
  58      * @param args the arguments of the call
  59      * @param address the target address of the call
  60      */
  61     void emitTailcall(Value[] args, Value address);
  62 
  63     void emitDeoptimizeCaller(DeoptimizationAction action, DeoptimizationReason reason);
  64 
  65     /**



























































  66      * Emits code for a {@link LoadConstantIndirectlyNode}.
  67      *
  68      * @param constant
  69      * @return value of loaded address in register
  70      */
  71     default Value emitLoadObjectAddress(Constant constant) {
  72         throw GraalError.unimplemented();
  73     }
  74 
  75     /**
  76      * Emits code for a {@link LoadConstantIndirectlyNode}.
  77      *
  78      * @param constant original constant
  79      * @param action action to perform on the metaspace object
  80      * @return Value of loaded address in register
  81      */
  82     default Value emitLoadMetaspaceAddress(Constant constant, HotSpotConstantLoadAction action) {
  83         throw GraalError.unimplemented();
  84     }
  85 


 144      * @param constant original constant
 145      * @param constantDescription a symbolic description of the {@link HotSpotMetaspaceConstant}
 146      *            generated by {@link EncodedSymbolConstant}
 147      * @param frameState frame state for the runtime call
 148      * @return Returns the address of the requested constant.
 149      */
 150     default Value emitKlassInitializationAndRetrieval(Constant constant, Value constantDescription, LIRFrameState frameState) {
 151         throw GraalError.unimplemented();
 152     }
 153 
 154     /**
 155      * Emits code for a {@link RandomSeedNode}.
 156      *
 157      * @return value of the counter
 158      */
 159     default Value emitRandomSeed() {
 160         throw GraalError.unimplemented();
 161     }
 162 
 163     /**























 164      * Gets a stack slot for a lock at a given lock nesting depth.
 165      */
 166     VirtualStackSlot getLockSlot(int lockDepth);
 167 
 168     @Override
 169     HotSpotProviders getProviders();
 170 
 171     Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull);
 172 
 173     Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull);
 174 
 175 }
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotLIRGenerator.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File