本文整理匯總了Java中jdk.vm.ci.code.CodeCacheProvider類的典型用法代碼示例。如果您正苦於以下問題:Java CodeCacheProvider類的具體用法?Java CodeCacheProvider怎麽用?Java CodeCacheProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CodeCacheProvider類屬於jdk.vm.ci.code包,在下文中一共展示了CodeCacheProvider類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: CompilationResultBuilder
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
public CompilationResultBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext,
OptionValues options, DebugContext debug, CompilationResult compilationResult, EconomicMap<Constant, Data> dataCache) {
this.target = codeCache.getTarget();
this.codeCache = codeCache;
this.foreignCalls = foreignCalls;
this.frameMap = frameMap;
this.asm = asm;
this.dataBuilder = dataBuilder;
this.compilationResult = compilationResult;
this.frameContext = frameContext;
this.options = options;
this.debug = debug;
assert frameContext != null;
this.dataCache = dataCache;
if (dataBuilder.needDetailedPatchingInformation() || Assertions.assertionsEnabled()) {
/*
* Always enabled in debug mode, even when the VM does not request detailed information,
* to increase test coverage.
*/
asm.setCodePatchingAnnotationConsumer(assemblerCodeAnnotation -> compilationResult.addAnnotation(new AssemblerAnnotation(assemblerCodeAnnotation)));
}
}
示例2: TestAssembler
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
protected TestAssembler(CodeCacheProvider codeCache, TestHotSpotVMConfig config, int initialFrameSize, int stackAlignment, PlatformKind narrowOopKind, Register... registers) {
this.narrowOopKind = new TestValueKind(narrowOopKind);
this.code = new Buffer();
this.data = new Buffer();
this.sites = new ArrayList<>();
this.dataPatches = new ArrayList<>();
this.codeCache = codeCache;
this.config = config;
this.registers = registers;
this.nextRegister = 0;
this.frameSize = initialFrameSize;
this.stackAlignment = stackAlignment;
this.curStackSlot = initialFrameSize;
}
示例3: getMarkName
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
@Override
public String getMarkName(Mark mark) {
int markId = (int) mark.id;
Field[] fields = runtime.getConfig().getClass().getDeclaredFields();
for (Field f : fields) {
if (f.getName().startsWith("MARKID_")) {
f.setAccessible(true);
try {
if (f.getInt(runtime.getConfig()) == markId) {
return f.getName();
}
} catch (Exception e) {
}
}
}
return CodeCacheProvider.super.getMarkName(mark);
}
示例4: getTargetName
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
/**
* Decodes a call target to a mnemonic if possible.
*/
@Override
public String getTargetName(Call call) {
Field[] fields = runtime.getConfig().getClass().getDeclaredFields();
for (Field f : fields) {
if (f.getName().endsWith("Stub")) {
f.setAccessible(true);
try {
Object address = f.get(runtime.getConfig());
if (address.equals(call.target)) {
return f.getName() + ":0x" + Long.toHexString((Long) address);
}
} catch (Exception e) {
}
}
}
return CodeCacheProvider.super.getTargetName(call);
}
示例5: TestAssembler
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
protected TestAssembler(CodeCacheProvider codeCache, int initialFrameSize, int stackAlignment, PlatformKind narrowOopKind, Register... registers) {
this.narrowOopKind = LIRKind.reference(narrowOopKind);
this.code = new Buffer();
this.data = new Buffer();
this.sites = new ArrayList<>();
this.dataPatches = new ArrayList<>();
this.codeCache = codeCache;
this.registers = registers;
this.nextRegister = 0;
this.frameSize = initialFrameSize;
this.stackAlignment = stackAlignment;
this.curStackSlot = initialFrameSize;
}
示例6: installOptimizedCallTargetCallMethod
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
@SuppressWarnings("try")
public void installOptimizedCallTargetCallMethod() {
Providers providers = getHotSpotProviders();
MetaAccessProvider metaAccess = providers.getMetaAccess();
ResolvedJavaType type = metaAccess.lookupJavaType(OptimizedCallTarget.class);
for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
if (method.getAnnotation(TruffleCallBoundary.class) != null) {
HotSpotCompilationIdentifier compilationId = (HotSpotCompilationIdentifier) getHotSpotBackend().getCompilationIdentifier(method);
CompilationResult compResult = compileMethod(method, compilationId);
CodeCacheProvider codeCache = providers.getCodeCache();
try (Scope s = Debug.scope("CodeInstall", codeCache, method, compResult)) {
CompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(codeCache, method, compilationId.getRequest(), compResult);
codeCache.setDefaultCode(method, compiledCode);
} catch (Throwable e) {
throw Debug.handle(e);
}
}
}
}
示例7: createBuilder
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
@Override
public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext,
OptionValues options, CompilationResult compilationResult) {
return new OptimizedCallTargetInstrumentation(codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, options, compilationResult, config, registers) {
@Override
protected void injectTailCallCode() {
AArch64MacroAssembler masm = (AArch64MacroAssembler) this.asm;
try (ScratchRegister scratch = masm.getScratchRegister()) {
Register thisRegister = codeCache.getRegisterConfig().getCallingConventionRegisters(JavaCall, Object).get(0);
Register spillRegister = scratch.getRegister();
Label doProlog = new Label();
AArch64Address entryPointAddress = AArch64Address.createPairUnscaledImmediateAddress(thisRegister, getFieldOffset("entryPoint", InstalledCode.class));
masm.ldr(64, spillRegister, entryPointAddress);
masm.cbz(64, spillRegister, doProlog);
masm.jmp(spillRegister);
masm.nop();
masm.bind(doProlog);
}
}
};
}
示例8: CompilationResultBuilder
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
public CompilationResultBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext,
OptionValues options, CompilationResult compilationResult, EconomicMap<Constant, Data> dataCache) {
this.target = codeCache.getTarget();
this.codeCache = codeCache;
this.foreignCalls = foreignCalls;
this.frameMap = frameMap;
this.asm = asm;
this.dataBuilder = dataBuilder;
this.compilationResult = compilationResult;
this.frameContext = frameContext;
this.options = options;
assert frameContext != null;
this.dataCache = dataCache;
if (dataBuilder.needDetailedPatchingInformation() || Assertions.ENABLED) {
/*
* Always enabled in debug mode, even when the VM does not request detailed information,
* to increase test coverage.
*/
asm.setCodePatchingAnnotationConsumer(assemblerCodeAnnotation -> compilationResult.addAnnotation(new AssemblerAnnotation(assemblerCodeAnnotation)));
}
}
示例9: disassemble
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
private static String disassemble(CodeCacheProvider codeCache, CompilationResult compResult, InstalledCode installedCode) {
TargetDescription target = codeCache.getTarget();
RegisterConfig regConfig = codeCache.getRegisterConfig();
byte[] code = installedCode == null ? Arrays.copyOf(compResult.getTargetCode(), compResult.getTargetCodeSize()) : installedCode.getCode();
if (code == null) {
// Method was deoptimized/invalidated
return "";
}
long start = installedCode == null ? 0L : installedCode.getStart();
HexCodeFile hcf = new HexCodeFile(code, start, target.arch.getName(), target.wordSize * 8);
if (compResult != null) {
HexCodeFile.addAnnotations(hcf, compResult.getAnnotations());
addExceptionHandlersComment(compResult, hcf);
Register fp = regConfig.getFrameRegister();
RefMapFormatter slotFormatter = new DefaultRefMapFormatter(target.wordSize, fp, 0);
for (Infopoint infopoint : compResult.getInfopoints()) {
if (infopoint instanceof Call) {
Call call = (Call) infopoint;
if (call.debugInfo != null) {
hcf.addComment(call.pcOffset + call.size, CodeUtil.append(new StringBuilder(100), call.debugInfo, slotFormatter).toString());
}
addOperandComment(hcf, call.pcOffset, "{" + codeCache.getTargetName(call) + "}");
} else {
if (infopoint.debugInfo != null) {
hcf.addComment(infopoint.pcOffset, CodeUtil.append(new StringBuilder(100), infopoint.debugInfo, slotFormatter).toString());
}
addOperandComment(hcf, infopoint.pcOffset, "{infopoint: " + infopoint.reason + "}");
}
}
for (DataPatch site : compResult.getDataPatches()) {
hcf.addOperandComment(site.pcOffset, "{" + site.reference.toString() + "}");
}
for (Mark mark : compResult.getMarks()) {
hcf.addComment(mark.pcOffset, codeCache.getMarkName(mark));
}
}
String hcfEmbeddedString = hcf.toEmbeddedString();
return HexCodeFileDisTool.tryDisassemble(hcfEmbeddedString);
}
示例10: disassemble
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
private static String disassemble(CodeCacheProvider codeCache, CompilationResult compResult, InstalledCode installedCode) {
DisassemblerProvider dis = DisassemblerHolder.disassembler;
if (installedCode != null) {
return dis.disassembleInstalledCode(codeCache, compResult, installedCode);
}
return dis.disassembleCompiledCode(codeCache, compResult);
}
示例11: FrameMap
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
/**
* Creates a new frame map for the specified method. The given registerConfig is optional, in
* case null is passed the default RegisterConfig from the CodeCacheProvider will be used.
*/
public FrameMap(CodeCacheProvider codeCache, RegisterConfig registerConfig, ReferenceMapBuilderFactory referenceMapFactory) {
this.target = codeCache.getTarget();
this.registerConfig = registerConfig == null ? codeCache.getRegisterConfig() : registerConfig;
this.frameSize = -1;
this.outgoingSize = codeCache.getMinimumOutgoingSize();
this.objectStackSlots = new ArrayList<>();
this.referenceMapFactory = referenceMapFactory;
}
示例12: FrameMapBuilderImpl
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
public FrameMapBuilderImpl(FrameMap frameMap, CodeCacheProvider codeCache, RegisterConfig registerConfig) {
assert registerConfig != null : "No register config!";
this.registerConfig = registerConfig == null ? codeCache.getRegisterConfig() : registerConfig;
this.codeCache = codeCache;
this.frameMap = frameMap;
this.stackSlots = new ArrayList<>();
this.calls = new ArrayList<>();
this.numStackSlots = 0;
}
示例13: HotSpotForeignCallsProviderImpl
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
public HotSpotForeignCallsProviderImpl(HotSpotJVMCIRuntimeProvider jvmciRuntime, HotSpotGraalRuntimeProvider runtime, MetaAccessProvider metaAccess, CodeCacheProvider codeCache,
WordTypes wordTypes) {
this.jvmciRuntime = jvmciRuntime;
this.runtime = runtime;
this.metaAccess = metaAccess;
this.codeCache = codeCache;
this.wordTypes = wordTypes;
}
示例14: createCallingConvention
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
/**
* Gets a calling convention for a given descriptor and call type.
*/
public static CallingConvention createCallingConvention(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, WordTypes wordTypes, ValueKindFactory<?> valueKindFactory,
ForeignCallDescriptor descriptor, Type ccType) {
assert ccType != null;
Class<?>[] argumentTypes = descriptor.getArgumentTypes();
JavaType[] parameterTypes = new JavaType[argumentTypes.length];
for (int i = 0; i < parameterTypes.length; ++i) {
parameterTypes[i] = asJavaType(argumentTypes[i], metaAccess, wordTypes);
}
JavaType returnType = asJavaType(descriptor.getResultType(), metaAccess, wordTypes);
RegisterConfig regConfig = codeCache.getRegisterConfig();
return regConfig.getCallingConvention(ccType, returnType, parameterTypes, valueKindFactory);
}
示例15: installMethod
import jdk.vm.ci.code.CodeCacheProvider; //導入依賴的package包/類
@SuppressWarnings("try")
private void installMethod(DebugContext debug, final CompilationResult compResult) {
final CodeCacheProvider codeCache = jvmciRuntime.getHostJVMCIBackend().getCodeCache();
HotSpotBackend backend = compiler.getGraalRuntime().getHostBackend();
installedCode = null;
Object[] context = {new DebugDumpScope(getIdString(), true), codeCache, getMethod(), compResult};
try (DebugContext.Scope s = debug.scope("CodeInstall", context)) {
installedCode = (HotSpotInstalledCode) backend.createInstalledCode(debug, getRequest().getMethod(), getRequest(), compResult,
getRequest().getMethod().getSpeculationLog(), null, installAsDefault, context);
} catch (Throwable e) {
throw debug.handle(e);
}
}