use of com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceFunctionType in project graal by oracle.
the class LLVMFunctionCode method initForeignConstructorCallTarget.
@TruffleBoundary
private void initForeignConstructorCallTarget() {
synchronized (this) {
if (foreignConstructorCallTarget != null) {
return;
}
LLVMLanguage language = LLVMLanguage.get(null);
LLVMSourceFunctionType sourceType = getFunction().getSourceType();
LLVMInteropType interopType = language.getInteropType(sourceType);
LLVMInteropType extractedType = ((LLVMInteropType.Function) interopType).getParameter(0);
if (extractedType instanceof LLVMInteropType.Value) {
LLVMInteropType.Structured structured = ((LLVMInteropType.Value) extractedType).baseType;
LLVMForeignCallNode foreignCall = LLVMForeignConstructorCallNode.create(language, this, interopType, sourceType, structured);
foreignConstructorCallTarget = foreignCall.getCallTarget();
}
}
}
use of com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceFunctionType in project graal by oracle.
the class DITypeExtractor method visit.
@Override
public void visit(MDSubprogram mdSubprogram) {
// 'this' parameter of thunk methods is missing in the debug info, thus fix here.
LLVMSourceType llvmSourceType = resolve(mdSubprogram.getType());
if (Flags.THUNK.isSetIn(mdSubprogram.getFlags())) {
SymbolImpl symbol = MDValue.getIfInstance(mdSubprogram.getFunction());
if (symbol != null && symbol instanceof FunctionDefinition) {
FunctionDefinition function = (FunctionDefinition) symbol;
final DataLayout dataLayout = LLVMLanguage.get(null).getDefaultDataLayout();
LLVMSourceType llvmSourceReturnType = LLVMSourceTypeFactory.resolveType(function.getType().getReturnType(), dataLayout);
List<LLVMSourceType> typeList = new ArrayList<>();
typeList.add(llvmSourceReturnType);
for (FunctionParameter fp : function.getParameters()) {
LLVMSourceType parameterSourceType = LLVMSourceTypeFactory.resolveType(fp.getType(), dataLayout);
typeList.add(parameterSourceType);
}
llvmSourceType = new LLVMSourceFunctionType(typeList);
}
}
parsedTypes.put(mdSubprogram, llvmSourceType);
}
use of com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceFunctionType in project graal by oracle.
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("llvm", sourceText, sourceText).mimeType(DIScopeBuilder.getMimeType(null)).build();
final SourceSection simpleSection = irSource.createSection(1);
scope = LLVMSourceLocation.createBitcodeFunction(function.getName(), simpleSection);
}
final SourceFunction sourceFunction = new SourceFunction(scope, type);
function.setSourceFunction(sourceFunction);
}
use of com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceFunctionType in project graal by oracle.
the class LLVMFunctionCode method initForeignCallTarget.
@TruffleBoundary
private void initForeignCallTarget() {
synchronized (this) {
if (foreignFunctionCallTarget != null) {
return;
}
LLVMLanguage language = LLVMLanguage.get(null);
LLVMSourceFunctionType sourceType = getFunction().getSourceType();
LLVMInteropType interopType = language.getInteropType(sourceType);
RootNode foreignCall;
if (isIntrinsicFunctionSlowPath()) {
FunctionType type = getLLVMFunction().getType();
foreignCall = LLVMForeignIntrinsicCallNode.create(language, getIntrinsicSlowPath(), type, (LLVMInteropType.Function) interopType);
} else {
foreignCall = LLVMForeignFunctionCallNode.create(language, this, interopType, sourceType);
}
foreignFunctionCallTarget = foreignCall.getCallTarget();
}
}
use of com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceFunctionType in project graal by oracle.
the class DITypeExtractor method visit.
@Override
public void visit(MDSubroutine mdSubroutine) {
final List<LLVMSourceType> members = new ArrayList<>();
final LLVMSourceFunctionType type = new LLVMSourceFunctionType(members);
parsedTypes.put(mdSubroutine, type);
getElements(mdSubroutine.getTypes(), members, true);
}
Aggregations