Search in sources :

Example 1 with FrameSlotKind

use of com.oracle.truffle.api.frame.FrameSlotKind in project sulong by graalvm.

the class LLVMContext method getGlobalFrameSlot.

public FrameSlot getGlobalFrameSlot(Object symbol, Type type) {
    FrameSlotKind kind;
    if (type instanceof PrimitiveType) {
        switch(((PrimitiveType) type).getPrimitiveKind()) {
            case DOUBLE:
                kind = FrameSlotKind.Double;
                break;
            case FLOAT:
                kind = FrameSlotKind.Float;
                break;
            case HALF:
            case I16:
            case I32:
                kind = FrameSlotKind.Int;
                break;
            case I1:
                kind = FrameSlotKind.Boolean;
                break;
            case I64:
                kind = FrameSlotKind.Long;
                break;
            case I8:
                kind = FrameSlotKind.Byte;
                break;
            default:
                kind = FrameSlotKind.Object;
                break;
        }
    } else {
        kind = FrameSlotKind.Object;
    }
    FrameSlot frameSlot = globalFrameDescriptor.findOrAddFrameSlot(symbol, type, kind);
    return frameSlot;
}
Also used : FrameSlotKind(com.oracle.truffle.api.frame.FrameSlotKind) FrameSlot(com.oracle.truffle.api.frame.FrameSlot) PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType)

Example 2 with FrameSlotKind

use of com.oracle.truffle.api.frame.FrameSlotKind in project sulong by graalvm.

the class AsmFactory method addFrameSlot.

void addFrameSlot(String reg, Type type) {
    if (!registers.contains(reg)) {
        registers.add(reg);
        FrameSlotKind kind;
        if (type instanceof PrimitiveType) {
            PrimitiveKind primitiveKind = ((PrimitiveType) type).getPrimitiveKind();
            switch(primitiveKind) {
                case I8:
                    kind = FrameSlotKind.Byte;
                    break;
                case I32:
                    kind = FrameSlotKind.Int;
                    break;
                case I64:
                    kind = FrameSlotKind.Long;
                    break;
                default:
                    kind = FrameSlotKind.Illegal;
                    break;
            }
        } else if (type instanceof PointerType) {
            kind = FrameSlotKind.Object;
        } else {
            kind = FrameSlotKind.Illegal;
        }
        this.frameDescriptor.addFrameSlot(reg, type, kind);
    }
}
Also used : FrameSlotKind(com.oracle.truffle.api.frame.FrameSlotKind) PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) PrimitiveKind(com.oracle.truffle.llvm.runtime.types.PrimitiveType.PrimitiveKind)

Aggregations

FrameSlotKind (com.oracle.truffle.api.frame.FrameSlotKind)2 PrimitiveType (com.oracle.truffle.llvm.runtime.types.PrimitiveType)2 FrameSlot (com.oracle.truffle.api.frame.FrameSlot)1 PointerType (com.oracle.truffle.llvm.runtime.types.PointerType)1 PrimitiveKind (com.oracle.truffle.llvm.runtime.types.PrimitiveType.PrimitiveKind)1