Search in sources :

Example 16 with PrimitiveType

use of com.oracle.truffle.llvm.runtime.types.PrimitiveType in project sulong by graalvm.

the class LLVMFrameNullerUtil method nullObject.

public static void nullObject(VirtualFrame frame, FrameSlot frameSlot) {
    CompilerAsserts.partialEvaluationConstant(frameSlot.getInfo());
    CompilerAsserts.partialEvaluationConstant(frameSlot.getInfo() == null);
    if (frameSlot.getInfo() != null) {
        Type type = (Type) frameSlot.getInfo();
        CompilerAsserts.partialEvaluationConstant(Type.isFunctionOrFunctionPointer(type));
        CompilerAsserts.partialEvaluationConstant(type instanceof VectorType);
        CompilerAsserts.partialEvaluationConstant(type instanceof VariableBitWidthType);
        CompilerAsserts.partialEvaluationConstant(type instanceof PrimitiveType && ((PrimitiveType) type).getPrimitiveKind() == PrimitiveKind.X86_FP80);
        if (Type.isFunctionOrFunctionPointer(type)) {
            nullFunction(frame, frameSlot);
        } else if (type instanceof VectorType && ((VectorType) type).getElementType() instanceof PrimitiveType) {
            nullVector(frame, frameSlot, ((PrimitiveType) ((VectorType) type).getElementType()).getPrimitiveKind());
        } else if (type instanceof VectorType && ((VectorType) type).getElementType() instanceof PointerType) {
            frame.setObject(frameSlot, LLVMAddressVector.createNullVector());
        } else if (type instanceof VariableBitWidthType) {
            nullIVarBit(frame, frameSlot);
        } else if (type instanceof PrimitiveType && ((PrimitiveType) type).getPrimitiveKind() == PrimitiveKind.X86_FP80) {
            null80BitFloat(frame, frameSlot);
        }
    }
    // This is a best effort approach. It could still be that LLVMAddress clashes with some
    // other class.
    nullAddress(frame, frameSlot);
}
Also used : PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) VariableBitWidthType(com.oracle.truffle.llvm.runtime.types.VariableBitWidthType) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) Type(com.oracle.truffle.llvm.runtime.types.Type) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) VariableBitWidthType(com.oracle.truffle.llvm.runtime.types.VariableBitWidthType) PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType)

Aggregations

PrimitiveType (com.oracle.truffle.llvm.runtime.types.PrimitiveType)16 PointerType (com.oracle.truffle.llvm.runtime.types.PointerType)12 LLVMExpressionNode (com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode)11 Type (com.oracle.truffle.llvm.runtime.types.Type)8 VoidType (com.oracle.truffle.llvm.runtime.types.VoidType)8 FrameSlot (com.oracle.truffle.api.frame.FrameSlot)7 StructureType (com.oracle.truffle.llvm.runtime.types.StructureType)7 PrimitiveKind (com.oracle.truffle.llvm.runtime.types.PrimitiveType.PrimitiveKind)5 LLVMUnsupportedInlineAssemblerNode (com.oracle.truffle.llvm.nodes.others.LLVMUnsupportedInlineAssemblerNode)3 VariableBitWidthType (com.oracle.truffle.llvm.runtime.types.VariableBitWidthType)3 VectorType (com.oracle.truffle.llvm.runtime.types.VectorType)3 FrameSlotKind (com.oracle.truffle.api.frame.FrameSlotKind)2 LLVMAMD64Target (com.oracle.truffle.llvm.nodes.asm.support.LLVMAMD64Target)2 LLVMArithmeticInstructionType (com.oracle.truffle.llvm.parser.instructions.LLVMArithmeticInstructionType)2 LLVMConversionType (com.oracle.truffle.llvm.parser.instructions.LLVMConversionType)2 LLVMSourcePointerType (com.oracle.truffle.llvm.runtime.debug.LLVMSourcePointerType)2 LLVMSourceType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceType)2 LLVMInteropType (com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType)2 AggregateType (com.oracle.truffle.llvm.runtime.types.AggregateType)2 ArrayType (com.oracle.truffle.llvm.runtime.types.ArrayType)2