本文整理汇总了Java中jdk.vm.ci.hotspot.HotSpotCompiledCode类的典型用法代码示例。如果您正苦于以下问题:Java HotSpotCompiledCode类的具体用法?Java HotSpotCompiledCode怎么用?Java HotSpotCompiledCode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HotSpotCompiledCode类属于jdk.vm.ci.hotspot包,在下文中一共展示了HotSpotCompiledCode类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
protected void test(TestCompiler compiler, Method method, Object... args) {
try {
HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(method);
TestAssembler asm = createAssembler();
asm.emitPrologue();
compiler.compile(asm);
asm.emitEpilogue();
HotSpotCompiledCode code = asm.finish(resolvedMethod);
InstalledCode installed = codeCache.addCode(resolvedMethod, code, null, null);
Object expected = method.invoke(null, args);
Object actual = installed.executeVarargs(args);
Assert.assertEquals(expected, actual);
} catch (Exception e) {
e.printStackTrace();
Assert.fail(e.toString());
}
}
示例2: test
import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
protected void test(TestCompiler compiler, Method method, Object... args) {
HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(method);
TestAssembler asm = createAssembler();
asm.emitPrologue();
compiler.compile(asm);
asm.emitEpilogue();
HotSpotCompiledCode code = asm.finish(resolvedMethod);
InstalledCode installed = codeCache.addCode(resolvedMethod, code, null, null);
try {
Object expected = method.invoke(null, args);
Object actual = installed.executeVarargs(args);
Assert.assertEquals(expected, actual);
} catch (Exception e) {
e.printStackTrace();
Assert.fail(e.toString());
}
}
示例3: installNativeFunctionStub
import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
/**
* Creates and installs a stub for calling a native function.
*/
@SuppressWarnings("try")
void installNativeFunctionStub(HotSpotNativeFunctionHandle function) {
Plugins plugins = new Plugins(providers.getGraphBuilderPlugins());
plugins.prependParameterPlugin(new ConstantBindingParameterPlugin(new Object[]{function, null}, providers.getMetaAccess(), providers.getSnippetReflection()));
PhaseSuite<HighTierContext> graphBuilder = new PhaseSuite<>();
graphBuilder.appendPhase(new GraphBuilderPhase(GraphBuilderConfiguration.getDefault(plugins)));
Suites suites = providers.getSuites().getDefaultSuites(options);
LIRSuites lirSuites = providers.getSuites().getDefaultLIRSuites(options);
StructuredGraph g = new StructuredGraph.Builder(options).method(callStubMethod).compilationId(backend.getCompilationIdentifier(callStubMethod)).build();
CompilationResult compResult = GraalCompiler.compileGraph(g, callStubMethod, providers, backend, graphBuilder, OptimisticOptimizations.ALL, DefaultProfilingInfo.get(TriState.UNKNOWN), suites,
lirSuites, new CompilationResult(), CompilationResultBuilderFactory.Default);
HotSpotCodeCacheProvider codeCache = providers.getCodeCache();
try (Scope s = Debug.scope("CodeInstall", codeCache, g.method(), compResult)) {
HotSpotCompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(codeCache, g.method(), null, compResult);
function.code = codeCache.addCode(g.method(), compiledCode, null, null);
} catch (Throwable e) {
throw Debug.handle(e);
}
}
示例4: finish
import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
public HotSpotCompiledCode finish(HotSpotResolvedJavaMethod method) {
int id = method.allocateCompileId(0);
byte[] finishedCode = code.finish();
Site[] finishedSites = sites.toArray(new Site[0]);
byte[] finishedData = data.finish();
DataPatch[] finishedDataPatches = dataPatches.toArray(new DataPatch[0]);
return new HotSpotCompiledNmethod(method.getName(), finishedCode, finishedCode.length, finishedSites, new Assumption[0], new ResolvedJavaMethod[]{method}, new Comment[0], finishedData, 16,
finishedDataPatches, false, frameSize, deoptRescue, method, 0, id, 0L, false);
}
示例5: installMethod
import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
@SuppressWarnings("try")
private void installMethod(final CompilationResult compResult) {
final CodeCacheProvider codeCache = jvmciRuntime.getHostJVMCIBackend().getCodeCache();
installedCode = null;
Object[] context = {new DebugDumpScope(getIdString(), true), codeCache, getMethod(), compResult};
try (Scope s = Debug.scope("CodeInstall", context)) {
HotSpotCompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(codeCache, getRequest().getMethod(), getRequest(), compResult);
installedCode = (HotSpotInstalledCode) codeCache.installCode(getRequest().getMethod(), compiledCode, null, getRequest().getMethod().getSpeculationLog(), installAsDefault);
} catch (Throwable e) {
throw Debug.handle(e);
}
}
示例6: compiledCode
import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
public HotSpotCompiledCode compiledCode(CompilationResult result) {
return HotSpotCompiledCodeBuilder.createCompiledCode(backend.getCodeCache(), null, null, result);
}
示例7: compiledCode
import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
HotSpotCompiledCode compiledCode() {
if (code == null) {
code = methodInfo.compiledCode(compilationResult);
}
return code;
}
示例8: compiledCode
import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
public HotSpotCompiledCode compiledCode(CompilationResult result) {
return HotSpotCompiledCodeBuilder.createCompiledCode(backend.getCodeCache(), method, null, result);
}
示例9: createCompiledCode
import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
public static HotSpotCompiledCode createCompiledCode(CodeCacheProvider codeCache, ResolvedJavaMethod method, HotSpotCompilationRequest compRequest, CompilationResult compResult) {
String name = compResult.getName();
byte[] targetCode = compResult.getTargetCode();
int targetCodeSize = compResult.getTargetCodeSize();
Site[] sites = getSortedSites(codeCache, compResult);
Assumption[] assumptions = compResult.getAssumptions();
ResolvedJavaMethod[] methods = compResult.getMethods();
List<CodeAnnotation> annotations = compResult.getAnnotations();
Comment[] comments = new Comment[annotations.size()];
if (!annotations.isEmpty()) {
for (int i = 0; i < comments.length; i++) {
CodeAnnotation annotation = annotations.get(i);
String text;
if (annotation instanceof CodeComment) {
CodeComment codeComment = (CodeComment) annotation;
text = codeComment.value;
} else if (annotation instanceof JumpTable) {
JumpTable jumpTable = (JumpTable) annotation;
text = "JumpTable [" + jumpTable.low + " .. " + jumpTable.high + "]";
} else {
text = annotation.toString();
}
comments[i] = new Comment(annotation.position, text);
}
}
DataSection data = compResult.getDataSection();
byte[] dataSection = new byte[data.getSectionSize()];
ByteBuffer buffer = ByteBuffer.wrap(dataSection).order(ByteOrder.nativeOrder());
Builder<DataPatch> patchBuilder = Stream.builder();
data.buildDataSection(buffer, vmConstant -> {
patchBuilder.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant)));
});
int dataSectionAlignment = data.getSectionAlignment();
DataPatch[] dataSectionPatches = patchBuilder.build().toArray(len -> new DataPatch[len]);
int totalFrameSize = compResult.getTotalFrameSize();
StackSlot customStackArea = compResult.getCustomStackArea();
boolean isImmutablePIC = compResult.isImmutablePIC();
if (method instanceof HotSpotResolvedJavaMethod) {
HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method;
int entryBCI = compResult.getEntryBCI();
boolean hasUnsafeAccess = compResult.hasUnsafeAccess();
int id;
long jvmciEnv;
if (compRequest != null) {
id = compRequest.getId();
jvmciEnv = compRequest.getJvmciEnv();
} else {
id = hsMethod.allocateCompileId(entryBCI);
jvmciEnv = 0L;
}
return new HotSpotCompiledNmethod(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, isImmutablePIC,
totalFrameSize, customStackArea, hsMethod, entryBCI, id, jvmciEnv, hasUnsafeAccess);
} else {
return new HotSpotCompiledCode(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, isImmutablePIC,
totalFrameSize, customStackArea);
}
}
示例10: installEmptyCode
import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
protected void installEmptyCode(Site[] sites, Assumption[] assumptions, Comment[] comments, int dataSectionAlignment, DataPatch[] dataSectionPatches, StackSlot deoptRescueSlot) {
HotSpotCompiledCode code = new HotSpotCompiledCode("dummyMethod", new byte[0], 0, sites, assumptions, new ResolvedJavaMethod[]{dummyMethod}, comments, new byte[8], dataSectionAlignment,
dataSectionPatches, false, 0, deoptRescueSlot);
codeCache.addCode(dummyMethod, code, null, null);
}
示例11: finish
import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
@Override
public HotSpotCompiledCode finish(HotSpotResolvedJavaMethod method) {
frameSize += SPARC.REGISTER_SAFE_AREA_SIZE;
return super.finish(method);
}
示例12: compiledCode
import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
HotSpotCompiledCode compiledCode(CompilationResult result);