本文整理匯總了Java中jdk.vm.ci.meta.ResolvedJavaMethod.isStatic方法的典型用法代碼示例。如果您正苦於以下問題:Java ResolvedJavaMethod.isStatic方法的具體用法?Java ResolvedJavaMethod.isStatic怎麽用?Java ResolvedJavaMethod.isStatic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jdk.vm.ci.meta.ResolvedJavaMethod
的用法示例。
在下文中一共展示了ResolvedJavaMethod.isStatic方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testUnsafe
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
@Test
public void testUnsafe() {
int m = 42;
long addr1 = createBuffer();
long addr2 = createBuffer();
try {
ResolvedJavaMethod method = getResolvedJavaMethod("readWriteReadUnsafe");
Object receiver = method.isStatic() ? null : this;
Result expect = executeExpected(method, receiver, addr1, m);
if (getCodeCache() == null) {
return;
}
testAgainstExpected(method, expect, receiver, addr2, m);
} catch (AssumptionViolatedException e) {
// Suppress so that subsequent calls to this method within the
// same Junit @Test annotated method can proceed.
} finally {
disposeBuffer(addr1);
disposeBuffer(addr2);
}
}
示例2: testByteBuffer
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
@Test
public void testByteBuffer() {
int m = 42;
try {
ResolvedJavaMethod method = getResolvedJavaMethod("readWriteReadByteBuffer");
Object receiver = method.isStatic() ? null : this;
Result expect = executeExpected(method, receiver, ByteBuffer.allocateDirect(32), m);
if (getCodeCache() == null) {
return;
}
ByteBuffer warmupBuffer = ByteBuffer.allocateDirect(32);
for (int i = 0; i < 10000; ++i) {
readWriteReadByteBuffer(warmupBuffer, (i % 50) + 1);
warmupBuffer.putInt(0, 0);
}
testAgainstExpected(method, expect, receiver, ByteBuffer.allocateDirect(32), m);
} catch (AssumptionViolatedException e) {
// Suppress so that subsequent calls to this method within the
// same Junit @Test annotated method can proceed.
}
}
示例3: runTest
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
protected void runTest(OptionValues options, Set<DeoptimizationReason> shouldNotDeopt, boolean bind, boolean noProfile, String name, Object... args) {
ResolvedJavaMethod method = getResolvedJavaMethod(name);
Object receiver = method.isStatic() ? null : this;
Result expect = executeExpected(method, receiver, args);
if (noProfile) {
method.reprofile();
}
testAgainstExpected(options, method, expect, shouldNotDeopt, receiver, args);
if (args.length > 0 && bind) {
if (noProfile) {
method.reprofile();
}
this.argsToBind = args;
testAgainstExpected(options, method, expect, shouldNotDeopt, receiver, args);
this.argsToBind = null;
}
}
示例4: createParameterStamps
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
public static Stamp[] createParameterStamps(Assumptions assumptions, ResolvedJavaMethod method) {
Signature sig = method.getSignature();
Stamp[] result = new Stamp[sig.getParameterCount(!method.isStatic())];
int index = 0;
if (!method.isStatic()) {
result[index++] = StampFactory.objectNonNull(TypeReference.create(assumptions, method.getDeclaringClass()));
}
int max = sig.getParameterCount(false);
ResolvedJavaType accessingClass = method.getDeclaringClass();
for (int i = 0; i < max; i++) {
JavaType type = sig.getParameterType(i, accessingClass);
JavaKind kind = type.getJavaKind();
Stamp stamp;
if (kind == JavaKind.Object && type instanceof ResolvedJavaType) {
stamp = StampFactory.object(TypeReference.create(assumptions, (ResolvedJavaType) type));
} else {
stamp = StampFactory.forKind(kind);
}
result[index++] = stamp;
}
return result;
}
示例5: getCallingConvention
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
/**
* Create a calling convention from a {@link ResolvedJavaMethod}.
*/
public static CallingConvention getCallingConvention(CodeCacheProvider codeCache, CallingConvention.Type type, ResolvedJavaMethod method, ValueKindFactory<?> valueKindFactory) {
Signature sig = method.getSignature();
JavaType retType = sig.getReturnType(null);
int sigCount = sig.getParameterCount(false);
JavaType[] argTypes;
int argIndex = 0;
if (!method.isStatic()) {
argTypes = new JavaType[sigCount + 1];
argTypes[argIndex++] = method.getDeclaringClass();
} else {
argTypes = new JavaType[sigCount];
}
for (int i = 0; i < sigCount; i++) {
argTypes[argIndex++] = sig.getParameterType(i, null);
}
RegisterConfig registerConfig = codeCache.getRegisterConfig();
return registerConfig.getCallingConvention(type, retType, argTypes, valueKindFactory);
}
示例6: testVirtualMethodTableAccess
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
/**
* All public non-final methods should be available in the vtable.
*/
@Test
public void testVirtualMethodTableAccess() {
for (Class<?> c : classes) {
if (c.isPrimitive() || c.isInterface()) {
continue;
}
ResolvedJavaType receiverType = metaAccess.lookupJavaType(c);
for (Method m : c.getMethods()) {
ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
if (!method.isStatic() && !method.isFinal() && !method.getDeclaringClass().isLeaf() && !method.getDeclaringClass().isInterface()) {
assertTrue(method + " not available in " + receiverType, method.isInVirtualMethodTable(receiverType));
}
}
}
}
示例7: findMethod
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
ResolvedJavaMethod findMethod(ResolvedJavaType type, String name, String descriptor, boolean isStatic) {
ResolvedJavaMethod method = getMethods(type).lookup(type, name, descriptor);
if (method != null && method.isStatic() == isStatic) {
return method;
}
return null;
}
示例8: createTargetInvokeNode
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
/**
* Creates an {@link InvokeNode} for the given target method. The {@link CallTargetNode} passed
* to the InvokeNode is in fact a {@link ResolvedMethodHandleCallTargetNode}.
*
* @return invoke node for the member name target
*/
private static InvokeNode createTargetInvokeNode(Assumptions assumptions, IntrinsicMethod intrinsicMethod, ResolvedJavaMethod target, ResolvedJavaMethod original, int bci, StampPair returnStamp,
ValueNode[] arguments) {
InvokeKind targetInvokeKind = target.isStatic() ? InvokeKind.Static : InvokeKind.Special;
JavaType targetReturnType = target.getSignature().getReturnType(null);
// MethodHandleLinkTo* nodes have a trailing MemberName argument which
// needs to be popped.
ValueNode[] targetArguments;
switch (intrinsicMethod) {
case INVOKE_BASIC:
targetArguments = arguments;
break;
case LINK_TO_STATIC:
case LINK_TO_SPECIAL:
case LINK_TO_VIRTUAL:
case LINK_TO_INTERFACE:
targetArguments = Arrays.copyOfRange(arguments, 0, arguments.length - 1);
break;
default:
throw GraalError.shouldNotReachHere();
}
StampPair targetReturnStamp = StampFactory.forDeclaredType(assumptions, targetReturnType, false);
MethodCallTargetNode callTarget = ResolvedMethodHandleCallTargetNode.create(targetInvokeKind, target, targetArguments, targetReturnStamp, original, arguments, returnStamp);
// The call target can have a different return type than the invoker,
// e.g. the target returns an Object but the invoker void. In this case
// we need to use the stamp of the invoker. Note: always using the
// invoker's stamp would be wrong because it's a less concrete type
// (usually java.lang.Object).
if (returnStamp.getTrustedStamp().getStackKind() == JavaKind.Void) {
return new InvokeNode(callTarget, bci, StampFactory.forVoid());
} else {
return new InvokeNode(callTarget, bci);
}
}
示例9: init
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
public InvocationPluginReceiver init(ResolvedJavaMethod targetMethod, ValueNode[] newArgs) {
if (!targetMethod.isStatic()) {
this.args = newArgs;
this.value = null;
return this;
}
return null;
}
示例10: addMethod
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
/**
* Adds a root method to the static analysis. The method must be static and must not have any
* parameters, because the possible types of the parameters would not be known.
*/
public void addMethod(ResolvedJavaMethod method) {
if (!method.isStatic() || method.getSignature().getParameterCount(false) > 0) {
error("Entry point method is not static or has parameters: " + method.format("%H.%n(%p)"));
}
addToWorklist(results.lookupMethod(method));
}
示例11: test
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
protected final Result test(OptionValues options, String name, Object... args) {
try {
ResolvedJavaMethod method = getResolvedJavaMethod(name);
Object receiver = method.isStatic() ? null : this;
return test(options, method, receiver, args);
} catch (AssumptionViolatedException e) {
// Suppress so that subsequent calls to this method within the
// same Junit @Test annotated method can proceed.
return null;
}
}
示例12: InvocationPluginAssertions
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
InvocationPluginAssertions(InvocationPlugin plugin, ValueNode[] args, ResolvedJavaMethod targetMethod, JavaKind resultType) {
guarantee(Assertions.assertionsEnabled(), "%s should only be loaded and instantiated if assertions are enabled", getClass().getSimpleName());
this.plugin = plugin;
this.targetMethod = targetMethod;
this.args = args;
this.resultType = resultType;
this.beforeStackSize = frameState.stackSize();
this.needsNullCheck = !targetMethod.isStatic() && args[0].getStackKind() == JavaKind.Object && !StampTool.isPointerNonNull(args[0].stamp());
this.nodeCount = graph.getNodeCount();
this.mark = graph.getMark();
}
示例13: synchronizedObject
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
private ValueNode synchronizedObject(FrameStateBuilder state, ResolvedJavaMethod target) {
if (target.isStatic()) {
return appendConstant(getConstantReflection().asJavaClass(target.getDeclaringClass()));
} else {
return state.loadLocal(0, JavaKind.Object);
}
}
示例14: doInline
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
protected LoopScope doInline(PEMethodScope methodScope, LoopScope loopScope, InvokeData invokeData, InlineInfo inlineInfo, ValueNode[] arguments) {
ResolvedJavaMethod inlineMethod = inlineInfo.getMethodToInline();
EncodedGraph graphToInline = lookupEncodedGraph(inlineMethod, inlineInfo.getIntrinsicBytecodeProvider());
if (graphToInline == null) {
return null;
}
if (methodScope.inliningDepth > Options.InliningDepthError.getValue(options)) {
throw tooDeepInlining(methodScope);
}
for (InlineInvokePlugin plugin : inlineInvokePlugins) {
plugin.notifyBeforeInline(inlineMethod);
}
Invoke invoke = invokeData.invoke;
FixedNode invokeNode = invoke.asNode();
FixedWithNextNode predecessor = (FixedWithNextNode) invokeNode.predecessor();
invokeNode.replaceAtPredecessor(null);
PEMethodScope inlineScope = new PEMethodScope(graph, methodScope, loopScope, graphToInline, inlineMethod, invokeData, methodScope.inliningDepth + 1,
loopExplosionPlugin, arguments);
if (!inlineMethod.isStatic()) {
if (StampTool.isPointerAlwaysNull(arguments[0])) {
/*
* The receiver is null, so we can unconditionally throw a NullPointerException
* instead of performing any inlining.
*/
DeoptimizeNode deoptimizeNode = graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.NullCheckException));
predecessor.setNext(deoptimizeNode);
finishInlining(inlineScope);
/* Continue decoding in the caller. */
return loopScope;
} else if (!StampTool.isPointerNonNull(arguments[0])) {
/* The receiver might be null, so we need to insert a null check. */
PEAppendGraphBuilderContext graphBuilderContext = new PEAppendGraphBuilderContext(inlineScope, predecessor);
arguments[0] = graphBuilderContext.nullCheckedValue(arguments[0]);
predecessor = graphBuilderContext.lastInstr;
}
}
LoopScope inlineLoopScope = createInitialLoopScope(inlineScope, predecessor);
/*
* The GraphEncoder assigns parameters a nodeId immediately after the fixed nodes.
* Initializing createdNodes here avoid decoding and immediately replacing the
* ParameterNodes.
*/
int firstArgumentNodeId = inlineScope.maxFixedNodeOrderId + 1;
for (int i = 0; i < arguments.length; i++) {
inlineLoopScope.createdNodes[firstArgumentNodeId + i] = arguments[i];
}
/*
* Do the actual inlining by returning the initial loop scope for the inlined method scope.
*/
return inlineLoopScope;
}
示例15: emitCodePrefix
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
/**
* Emits the code prior to the verified entry point.
*
* @param installedCodeOwner see {@link Backend#emitCode}
*/
public void emitCodePrefix(ResolvedJavaMethod installedCodeOwner, CompilationResultBuilder crb, AMD64MacroAssembler asm, RegisterConfig regConfig, Label verifiedEntry) {
HotSpotProviders providers = getProviders();
if (installedCodeOwner != null && !installedCodeOwner.isStatic()) {
crb.recordMark(config.MARKID_UNVERIFIED_ENTRY);
CallingConvention cc = regConfig.getCallingConvention(HotSpotCallingConventionType.JavaCallee, null, new JavaType[]{providers.getMetaAccess().lookupJavaType(Object.class)}, this);
Register inlineCacheKlass = rax; // see definition of IC_Klass in
// c1_LIRAssembler_x86.cpp
Register receiver = asRegister(cc.getArgument(0));
AMD64Address src = new AMD64Address(receiver, config.hubOffset);
if (config.useCompressedClassPointers) {
Register register = r10;
AMD64HotSpotMove.decodeKlassPointer(crb, asm, register, providers.getRegisters().getHeapBaseRegister(), src, config);
if (GeneratePIC.getValue(crb.getOptions())) {
asm.movq(providers.getRegisters().getHeapBaseRegister(), asm.getPlaceholder(-1));
crb.recordMark(config.MARKID_NARROW_OOP_BASE_ADDRESS);
} else {
if (config.narrowKlassBase != 0) {
// The heap base register was destroyed above, so restore it
asm.movq(providers.getRegisters().getHeapBaseRegister(), config.narrowOopBase);
}
}
asm.cmpq(inlineCacheKlass, register);
} else {
asm.cmpq(inlineCacheKlass, src);
}
AMD64Call.directConditionalJmp(crb, asm, getForeignCalls().lookupForeignCall(IC_MISS_HANDLER), ConditionFlag.NotEqual);
}
asm.align(config.codeEntryAlignment);
crb.recordMark(config.MARKID_OSR_ENTRY);
asm.bind(verifiedEntry);
crb.recordMark(config.MARKID_VERIFIED_ENTRY);
if (GeneratePIC.getValue(crb.getOptions())) {
// Check for method state
HotSpotFrameContext frameContext = (HotSpotFrameContext) crb.frameContext;
if (!frameContext.isStub) {
crb.recordInlineDataInCodeWithNote(new HotSpotSentinelConstant(LIRKind.value(AMD64Kind.QWORD), JavaKind.Long), HotSpotConstantLoadAction.MAKE_NOT_ENTRANT);
asm.movq(AMD64.rax, asm.getPlaceholder(-1));
asm.testq(AMD64.rax, AMD64.rax);
AMD64Call.directConditionalJmp(crb, asm, getForeignCalls().lookupForeignCall(WRONG_METHOD_HANDLER), ConditionFlag.NotZero);
}
}
}