src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/LIRGeneratorTool.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54328 37648a9c4a6a
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
    22  */
    22  */
    23 
    23 
    24 
    24 
    25 package org.graalvm.compiler.lir.gen;
    25 package org.graalvm.compiler.lir.gen;
    26 
    26 
    27 import java.util.BitSet;
       
    28 import java.util.List;
       
    29 
       
    30 import org.graalvm.compiler.core.common.CompressEncoding;
    27 import org.graalvm.compiler.core.common.CompressEncoding;
    31 import org.graalvm.compiler.core.common.LIRKind;
    28 import org.graalvm.compiler.core.common.LIRKind;
    32 import org.graalvm.compiler.core.common.calc.Condition;
    29 import org.graalvm.compiler.core.common.calc.Condition;
    33 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
    30 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
    34 import org.graalvm.compiler.core.common.spi.CodeGenProviders;
    31 import org.graalvm.compiler.core.common.spi.CodeGenProviders;
    66      * Factory for creating moves.
    63      * Factory for creating moves.
    67      */
    64      */
    68     interface MoveFactory {
    65     interface MoveFactory {
    69 
    66 
    70         /**
    67         /**
       
    68          * Checks whether the loading of the supplied constant can be deferred until usage.
       
    69          */
       
    70         @SuppressWarnings("unused")
       
    71         default boolean mayEmbedConstantLoad(Constant constant) {
       
    72             return false;
       
    73         }
       
    74 
       
    75         /**
    71          * Checks whether the supplied constant can be used without loading it into a register for
    76          * Checks whether the supplied constant can be used without loading it into a register for
    72          * most operations, i.e., for commonly used arithmetic, logical, and comparison operations.
    77          * most operations, i.e., for commonly used arithmetic, logical, and comparison operations.
    73          *
    78          *
    74          * @param c The constant to check.
    79          * @param constant The constant to check.
    75          * @return True if the constant can be used directly, false if the constant needs to be in a
    80          * @return True if the constant can be used directly, false if the constant needs to be in a
    76          *         register.
    81          *         register.
    77          */
    82          */
    78         boolean canInlineConstant(Constant c);
    83         boolean canInlineConstant(Constant constant);
    79 
    84 
    80         /**
    85         /**
    81          * @param constant The constant that might be moved to a stack slot.
    86          * @param constant The constant that might be moved to a stack slot.
    82          * @return {@code true} if constant to stack moves are supported for this constant.
    87          * @return {@code true} if constant to stack moves are supported for this constant.
    83          */
    88          */
   131      */
   136      */
   132     MoveFactory getSpillMoveFactory();
   137     MoveFactory getSpillMoveFactory();
   133 
   138 
   134     BlockScope getBlockScope(AbstractBlockBase<?> block);
   139     BlockScope getBlockScope(AbstractBlockBase<?> block);
   135 
   140 
       
   141     boolean canInlineConstant(Constant constant);
       
   142 
       
   143     boolean mayEmbedConstantLoad(Constant constant);
       
   144 
   136     Value emitConstant(LIRKind kind, Constant constant);
   145     Value emitConstant(LIRKind kind, Constant constant);
   137 
   146 
   138     Value emitJavaConstant(JavaConstant constant);
   147     Value emitJavaConstant(JavaConstant constant);
   139 
   148 
   140     /**
   149     /**
   193 
   202 
   194     Variable emitMove(Value input);
   203     Variable emitMove(Value input);
   195 
   204 
   196     void emitMove(AllocatableValue dst, Value src);
   205     void emitMove(AllocatableValue dst, Value src);
   197 
   206 
       
   207     Variable emitReadRegister(Register register, ValueKind<?> kind);
       
   208 
       
   209     void emitWriteRegister(Register dst, Value src, ValueKind<?> wordStamp);
       
   210 
   198     void emitMoveConstant(AllocatableValue dst, Constant src);
   211     void emitMoveConstant(AllocatableValue dst, Constant src);
   199 
   212 
   200     Variable emitAddress(AllocatableValue stackslot);
   213     Variable emitAddress(AllocatableValue stackslot);
   201 
   214 
   202     void emitMembar(int barriers);
   215     void emitMembar(int barriers);
   264     @SuppressWarnings("unused")
   277     @SuppressWarnings("unused")
   265     default Variable emitArrayCompareTo(JavaKind kind1, JavaKind kind2, Value array1, Value array2, Value length1, Value length2) {
   278     default Variable emitArrayCompareTo(JavaKind kind1, JavaKind kind2, Value array1, Value array2, Value length1, Value length2) {
   266         throw GraalError.unimplemented("String.compareTo substitution is not implemented on this architecture");
   279         throw GraalError.unimplemented("String.compareTo substitution is not implemented on this architecture");
   267     }
   280     }
   268 
   281 
   269     Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, int constantLength, boolean directPointers);
   282     Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, boolean directPointers);
   270 
   283 
   271     @SuppressWarnings("unused")
   284     @SuppressWarnings("unused")
   272     default Variable emitArrayEquals(JavaKind kind1, JavaKind kind2, Value array1, Value array2, Value length, int constantLength, boolean directPointers) {
   285     default Variable emitArrayEquals(JavaKind kind1, JavaKind kind2, Value array1, Value array2, Value length, boolean directPointers) {
   273         throw GraalError.unimplemented("Array.equals with different types substitution is not implemented on this architecture");
   286         throw GraalError.unimplemented("Array.equals with different types substitution is not implemented on this architecture");
   274     }
   287     }
   275 
   288 
   276     @SuppressWarnings("unused")
   289     @SuppressWarnings("unused")
   277     default Variable emitArrayIndexOf(JavaKind kind, boolean findTwoConsecutive, Value sourcePointer, Value sourceCount, Value... searchValues) {
   290     default Variable emitArrayIndexOf(JavaKind arrayKind, JavaKind valueKind, boolean findTwoConsecutive, Value sourcePointer, Value sourceCount, Value fromIndex, Value... searchValues) {
   278         throw GraalError.unimplemented("String.indexOf substitution is not implemented on this architecture");
   291         throw GraalError.unimplemented("String.indexOf substitution is not implemented on this architecture");
   279     }
   292     }
   280 
   293 
   281     /*
   294     /*
   282      * The routines emitStringLatin1Inflate/3 and emitStringUTF16Compress/3 models a simplified
   295      * The routines emitStringLatin1Inflate/3 and emitStringUTF16Compress/3 models a simplified
   322      * Emits an instruction that prevents speculative execution from proceeding: no instruction
   335      * Emits an instruction that prevents speculative execution from proceeding: no instruction
   323      * after this fence will execute until all previous instructions have retired.
   336      * after this fence will execute until all previous instructions have retired.
   324      */
   337      */
   325     void emitSpeculationFence();
   338     void emitSpeculationFence();
   326 
   339 
   327     default VirtualStackSlot allocateStackSlots(int slots, BitSet objects, List<VirtualStackSlot> outObjectStackSlots) {
   340     default VirtualStackSlot allocateStackSlots(int slots) {
   328         return getResult().getFrameMapBuilder().allocateStackSlots(slots, objects, outObjectStackSlots);
   341         return getResult().getFrameMapBuilder().allocateStackSlots(slots);
   329     }
   342     }
   330 
   343 
   331     default Value emitReadCallerStackPointer(Stamp wordStamp) {
   344     default Value emitReadCallerStackPointer(Stamp wordStamp) {
   332         /*
   345         /*
   333          * We do not know the frame size yet. So we load the address of the first spill slot
   346          * We do not know the frame size yet. So we load the address of the first spill slot
   338     }
   351     }
   339 
   352 
   340     default Value emitReadReturnAddress(Stamp wordStamp, int returnAddressSize) {
   353     default Value emitReadReturnAddress(Stamp wordStamp, int returnAddressSize) {
   341         return emitMove(StackSlot.get(getLIRKind(wordStamp), -returnAddressSize, true));
   354         return emitMove(StackSlot.get(getLIRKind(wordStamp), -returnAddressSize, true));
   342     }
   355     }
       
   356 
       
   357     @SuppressWarnings("unused")
       
   358     default void emitZeroMemory(Value address, Value length, boolean isAligned) {
       
   359         throw GraalError.unimplemented("Bulk zeroing is not implemented on this architecture");
       
   360     }
   343 }
   361 }