Search in sources :

Example 11 with LLVMSourceType

use of com.oracle.truffle.llvm.runtime.debug.LLVMSourceType in project sulong by graalvm.

the class DebugInfoCache method getSourceSymbol.

LLVMSourceSymbol getSourceSymbol(MDBaseNode mdVariable, boolean isGlobal) {
    if (parsedVariables.containsKey(mdVariable)) {
        return parsedVariables.get(mdVariable);
    }
    LLVMSourceLocation location = scopeBuilder.buildLocation(mdVariable);
    final LLVMSourceType type = typeExtractor.parseType(mdVariable);
    final String varName = MDNameExtractor.getName(mdVariable);
    final LLVMSourceSymbol symbol = new LLVMSourceSymbol(varName, location, type, isGlobal);
    parsedVariables.put(mdVariable, symbol);
    if (location != null) {
        // this is currently the line/column where the symbol was declared, we want the
        // scope
        location = location.getParent();
    }
    if (location != null) {
        location.addSymbol(symbol);
    }
    return symbol;
}
Also used : LLVMSourceLocation(com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation) LLVMSourceSymbol(com.oracle.truffle.llvm.runtime.debug.LLVMSourceSymbol) LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.LLVMSourceType)

Example 12 with LLVMSourceType

use of com.oracle.truffle.llvm.runtime.debug.LLVMSourceType in project sulong by graalvm.

the class DebugInfoFunctionProcessor method initSourceFunction.

private void initSourceFunction(FunctionDefinition function, Source bitcodeSource) {
    final MDBaseNode debugInfo = getDebugInfo(function);
    LLVMSourceLocation scope = null;
    LLVMSourceFunctionType type = null;
    if (debugInfo != null) {
        scope = cache.buildLocation(debugInfo);
        LLVMSourceType actualType = cache.parseType(debugInfo);
        if (actualType instanceof LLVMSourceFunctionType) {
            type = (LLVMSourceFunctionType) actualType;
        }
    }
    if (scope == null) {
        final String sourceText = String.format("%s:%s", bitcodeSource.getName(), function.getName());
        final Source irSource = Source.newBuilder(sourceText).mimeType(DIScopeBuilder.getMimeType(null)).name(sourceText).build();
        final SourceSection simpleSection = irSource.createSection(1);
        scope = LLVMSourceLocation.createBitcodeFunction(function.getName(), simpleSection);
    }
    final SourceFunction sourceFunction = new SourceFunction(scope, type);
    function.setSourceFunction(sourceFunction);
    for (SourceVariable local : sourceFunction.getVariables()) {
        local.processFragments();
    }
}
Also used : MDBaseNode(com.oracle.truffle.llvm.parser.metadata.MDBaseNode) LLVMSourceLocation(com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation) LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.LLVMSourceType) SourceSection(com.oracle.truffle.api.source.SourceSection) LLVMSourceFunctionType(com.oracle.truffle.llvm.runtime.debug.LLVMSourceFunctionType) Source(com.oracle.truffle.api.source.Source)

Example 13 with LLVMSourceType

use of com.oracle.truffle.llvm.runtime.debug.LLVMSourceType in project sulong by graalvm.

the class BasicNodeFactory method registerSourceType.

@Override
public LLVMExpressionNode registerSourceType(FrameSlot valueSlot, LLVMSourceType type) {
    LLVMSourceType actual = type.getActualType();
    if (actual instanceof LLVMSourcePointerType) {
        // only pointer types can contain foreign values
        LLVMSourceType base = ((LLVMSourcePointerType) actual).getBaseType();
        LLVMInteropType interopType = LLVMInteropType.fromSourceType(base);
        if (interopType != null) {
            return new LLVMSetInteropTypeNode(valueSlot, interopType);
        }
    }
    return null;
}
Also used : LLVMSetInteropTypeNode(com.oracle.truffle.llvm.nodes.vars.LLVMSetInteropTypeNode) LLVMSourcePointerType(com.oracle.truffle.llvm.runtime.debug.LLVMSourcePointerType) LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.LLVMSourceType) LLVMInteropType(com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType)

Aggregations

LLVMSourceType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceType)13 LLVMSourceLocation (com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation)5 MDString (com.oracle.truffle.llvm.parser.metadata.MDString)3 LLVMSourceFunctionType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceFunctionType)3 LLVMSourcePointerType (com.oracle.truffle.llvm.runtime.debug.LLVMSourcePointerType)3 LLVMSourceStaticMemberType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceStaticMemberType)3 ArrayList (java.util.ArrayList)3 MDBaseNode (com.oracle.truffle.llvm.parser.metadata.MDBaseNode)2 MDCompositeType (com.oracle.truffle.llvm.parser.metadata.MDCompositeType)2 MDValue (com.oracle.truffle.llvm.parser.metadata.MDValue)2 MetadataValueList (com.oracle.truffle.llvm.parser.metadata.MetadataValueList)2 SymbolImpl (com.oracle.truffle.llvm.parser.model.SymbolImpl)2 LLVMSourceArrayLikeType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceArrayLikeType)2 LLVMSourceBasicType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceBasicType)2 LLVMSourceEnumLikeType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceEnumLikeType)2 LLVMSourceMemberType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceMemberType)2 LLVMSourceStructLikeType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceStructLikeType)2 List (java.util.List)2 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)1 Source (com.oracle.truffle.api.source.Source)1