Search in sources :

Example 1 with LLVMTextSectionInfo

use of com.oracle.svm.core.graal.llvm.util.LLVMObjectFileReader.LLVMTextSectionInfo in project graal by oracle.

the class LLVMNativeImageCodeCache method linkCompiledBatches.

private void linkCompiledBatches(BatchExecutor executor, DebugContext debug, int numBatches) {
    List<String> compiledBatches = IntStream.range(0, numBatches).mapToObj(this::getBatchCompiledFilename).collect(Collectors.toList());
    nativeLink(debug, getLinkedFilename(), compiledBatches);
    LLVMTextSectionInfo textSectionInfo = objectFileReader.parseCode(getLinkedPath());
    executor.forEach(compilations.entrySet(), entry -> (debugContext) -> {
        HostedMethod method = entry.getKey();
        int offset = textSectionInfo.getOffset(SubstrateUtil.uniqueShortName(method));
        int nextFunctionStartOffset = textSectionInfo.getNextOffset(offset);
        int functionSize = nextFunctionStartOffset - offset;
        CompilationResult compilation = entry.getValue();
        compilation.setTargetCode(null, functionSize);
        method.setCodeAddressOffset(offset);
    });
    compilations.forEach((method, compilation) -> compilationsByStart.put(method.getCodeAddressOffset(), compilation));
    stackMapDumper.dumpOffsets(textSectionInfo);
    stackMapDumper.close();
    HostedMethod firstMethod = (HostedMethod) getFirstCompilation().getMethods()[0];
    buildRuntimeMetadata(new MethodPointer(firstMethod), WordFactory.signed(textSectionInfo.getCodeSize()));
}
Also used : MethodPointer(com.oracle.svm.core.meta.MethodPointer) HostedMethod(com.oracle.svm.hosted.meta.HostedMethod) LLVMTextSectionInfo(com.oracle.svm.core.graal.llvm.util.LLVMObjectFileReader.LLVMTextSectionInfo) CompilationResult(org.graalvm.compiler.code.CompilationResult)

Aggregations

LLVMTextSectionInfo (com.oracle.svm.core.graal.llvm.util.LLVMObjectFileReader.LLVMTextSectionInfo)1 MethodPointer (com.oracle.svm.core.meta.MethodPointer)1 HostedMethod (com.oracle.svm.hosted.meta.HostedMethod)1 CompilationResult (org.graalvm.compiler.code.CompilationResult)1