src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/CodeSectionProcessor.java
Index
Unified diffs
Context diffs
Sdiffs
Frames
Patch
New
Old
Previous File
Next File
hotspot Cdiff src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/CodeSectionProcessor.java
src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/CodeSectionProcessor.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 26,46 ****
import java.util.ArrayList;
import jdk.tools.jaotc.binformat.BinaryContainer;
import jdk.tools.jaotc.binformat.CodeContainer;
import jdk.tools.jaotc.binformat.Symbol;
! import jdk.tools.jaotc.CompiledMethodInfo.StubInformation;
import org.graalvm.compiler.code.CompilationResult;
import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage;
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.code.site.Call;
import jdk.vm.ci.code.site.Infopoint;
import jdk.vm.ci.code.site.InfopointReason;
import jdk.vm.ci.meta.ResolvedJavaMethod;
! class CodeSectionProcessor {
private final TargetDescription target;
private final BinaryContainer binaryContainer;
--- 26,46 ----
import java.util.ArrayList;
import jdk.tools.jaotc.binformat.BinaryContainer;
import jdk.tools.jaotc.binformat.CodeContainer;
import jdk.tools.jaotc.binformat.Symbol;
! import jdk.tools.jaotc.StubInformation;
import org.graalvm.compiler.code.CompilationResult;
import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage;
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.code.site.Call;
import jdk.vm.ci.code.site.Infopoint;
import jdk.vm.ci.code.site.InfopointReason;
import jdk.vm.ci.meta.ResolvedJavaMethod;
! final class CodeSectionProcessor {
private final TargetDescription target;
private final BinaryContainer binaryContainer;
*** 87,122 ****
String entry = compMethod.getSymbolName();
assert entry != null : "missing name for compiled method";
// Align and pad method entry
CodeContainer codeSection = binaryContainer.getCodeContainer();
! int codeIdOffset = binaryContainer.alignUp(codeSection, binaryContainer.getCodeSegmentSize());
// Store CodeId into code. It will be use by find_aot() using code.segments
methodInfo.setCodeId();
binaryContainer.appendIntToCode(methodInfo.getCodeId());
! int textBaseOffset = binaryContainer.alignUp(codeSection, binaryContainer.getCodeEntryAlignment());
codeSection.createSymbol(textBaseOffset, Symbol.Kind.JAVA_FUNCTION, Symbol.Binding.LOCAL, targetCodeSize, entry);
// Set the offset at which the text section of this method would be layed out
methodInfo.setTextSectionOffset(textBaseOffset);
// Write code bytes of the current method into byte stream
binaryContainer.appendCodeBytes(targetCode, 0, targetCodeSize);
! int currentStubOffset = binaryContainer.alignUp(codeSection, 8);
// Set the offset at which stubs of this method would be laid out
methodInfo.setStubsOffset(currentStubOffset - textBaseOffset);
// step through all calls, for every call, add a stub
for (Infopoint infopoint : compResult.getInfopoints()) {
if (infopoint.reason == InfopointReason.CALL) {
final Call callInfopoint = (Call) infopoint;
if (callInfopoint.target instanceof ResolvedJavaMethod) {
ResolvedJavaMethod call = (ResolvedJavaMethod) callInfopoint.target;
! StubInformation stub = addCallStub(MiscUtils.isVirtualCall(methodInfo, callInfopoint));
// Get the targetSymbol. A symbol for this will be created later during plt
// creation
! String targetSymbol = MiscUtils.uniqueMethodName(call) + ".at." + infopoint.pcOffset;
methodInfo.addStubCode(targetSymbol, stub);
currentStubOffset += stub.getSize();
}
}
}
--- 87,122 ----
String entry = compMethod.getSymbolName();
assert entry != null : "missing name for compiled method";
// Align and pad method entry
CodeContainer codeSection = binaryContainer.getCodeContainer();
! int codeIdOffset = BinaryContainer.alignUp(codeSection, binaryContainer.getCodeSegmentSize());
// Store CodeId into code. It will be use by find_aot() using code.segments
methodInfo.setCodeId();
binaryContainer.appendIntToCode(methodInfo.getCodeId());
! int textBaseOffset = BinaryContainer.alignUp(codeSection, binaryContainer.getCodeEntryAlignment());
codeSection.createSymbol(textBaseOffset, Symbol.Kind.JAVA_FUNCTION, Symbol.Binding.LOCAL, targetCodeSize, entry);
// Set the offset at which the text section of this method would be layed out
methodInfo.setTextSectionOffset(textBaseOffset);
// Write code bytes of the current method into byte stream
binaryContainer.appendCodeBytes(targetCode, 0, targetCodeSize);
! int currentStubOffset = BinaryContainer.alignUp(codeSection, 8);
// Set the offset at which stubs of this method would be laid out
methodInfo.setStubsOffset(currentStubOffset - textBaseOffset);
// step through all calls, for every call, add a stub
for (Infopoint infopoint : compResult.getInfopoints()) {
if (infopoint.reason == InfopointReason.CALL) {
final Call callInfopoint = (Call) infopoint;
if (callInfopoint.target instanceof ResolvedJavaMethod) {
ResolvedJavaMethod call = (ResolvedJavaMethod) callInfopoint.target;
! StubInformation stub = addCallStub(CallInfo.isVirtualCall(methodInfo, callInfopoint));
// Get the targetSymbol. A symbol for this will be created later during plt
// creation
! String targetSymbol = JavaMethodInfo.uniqueMethodName(call) + ".at." + infopoint.pcOffset;
methodInfo.addStubCode(targetSymbol, stub);
currentStubOffset += stub.getSize();
}
}
}
src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/CodeSectionProcessor.java
Index
Unified diffs
Context diffs
Sdiffs
Frames
Patch
New
Old
Previous File
Next File