當前位置: 首頁>>代碼示例>>Java>>正文


Java CodeCacheProvider類代碼示例

本文整理匯總了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)));
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:CompilationResultBuilder.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:19,代碼來源:TestAssembler.java

示例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);
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:18,代碼來源:HotSpotCodeCacheProvider.java

示例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);
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:21,代碼來源:HotSpotCodeCacheProvider.java

示例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;
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:18,代碼來源:TestAssembler.java

示例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);
            }
        }
    }
}
 
開發者ID:graalvm,項目名稱:graal-core,代碼行數:20,代碼來源:HotSpotTruffleRuntime.java

示例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);
            }
        }
    };
}
 
開發者ID:graalvm,項目名稱:graal-core,代碼行數:23,代碼來源:AArch64OptimizedCallTargetInstumentationFactory.java

示例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)));
    }
}
 
開發者ID:graalvm,項目名稱:graal-core,代碼行數:23,代碼來源:CompilationResultBuilder.java

示例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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:40,代碼來源:HexCodeFileDisassemblerProvider.java

示例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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:CFGPrinterObserver.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:FrameMap.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:FrameMapBuilderImpl.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:HotSpotForeignCallsProviderImpl.java

示例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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:16,代碼來源:HotSpotForeignCallLinkageImpl.java

示例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);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:CompilationTask.java


注:本文中的jdk.vm.ci.code.CodeCacheProvider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。