本文整理汇总了Java中jdk.vm.ci.meta.JavaField类的典型用法代码示例。如果您正苦于以下问题:Java JavaField类的具体用法?Java JavaField怎么用?Java JavaField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaField类属于jdk.vm.ci.meta包,在下文中一共展示了JavaField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkGraph
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
/**
* Checks the invariants for a single graph.
*/
private static void checkGraph(HighTierContext context, StructuredGraph graph) {
if (shouldVerifyEquals(graph.method())) {
// If you add a new type to test here, be sure to add appropriate
// methods to the BadUsageWithEquals class below
new VerifyUsageWithEquals(Value.class).apply(graph, context);
new VerifyUsageWithEquals(Register.class).apply(graph, context);
new VerifyUsageWithEquals(RegisterCategory.class).apply(graph, context);
new VerifyUsageWithEquals(JavaType.class).apply(graph, context);
new VerifyUsageWithEquals(JavaMethod.class).apply(graph, context);
new VerifyUsageWithEquals(JavaField.class).apply(graph, context);
new VerifyUsageWithEquals(LocationIdentity.class).apply(graph, context);
new VerifyUsageWithEquals(LIRKind.class).apply(graph, context);
new VerifyUsageWithEquals(ArithmeticOpTable.class).apply(graph, context);
new VerifyUsageWithEquals(ArithmeticOpTable.Op.class).apply(graph, context);
}
new VerifyDebugUsage().apply(graph, context);
new VerifyCallerSensitiveMethods().apply(graph, context);
new VerifyVirtualizableUsage().apply(graph, context);
new VerifyUpdateUsages().apply(graph, context);
new VerifyBailoutUsage().apply(graph, context);
new VerifyInstanceOfUsage().apply(graph, context);
if (graph.method().isBridge()) {
BridgeMethodUtils.getBridgedMethod(graph.method());
}
}
示例2: tryFastInlineAccessor
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
/**
* Tries to inline {@code targetMethod} if it is an instance field accessor. This avoids the
* overhead of creating and using a nested {@link BytecodeParser} object.
*/
private boolean tryFastInlineAccessor(ValueNode[] args, ResolvedJavaMethod targetMethod) {
byte[] bytecode = targetMethod.getCode();
if (bytecode != null && bytecode.length == ACCESSOR_BYTECODE_LENGTH &&
Bytes.beU1(bytecode, 0) == ALOAD_0 &&
Bytes.beU1(bytecode, 1) == GETFIELD) {
int b4 = Bytes.beU1(bytecode, 4);
if (b4 >= IRETURN && b4 <= ARETURN) {
int cpi = Bytes.beU2(bytecode, 2);
JavaField field = targetMethod.getConstantPool().lookupField(cpi, targetMethod, GETFIELD);
if (field instanceof ResolvedJavaField) {
ValueNode receiver = invocationPluginReceiver.init(targetMethod, args).get();
ResolvedJavaField resolvedField = (ResolvedJavaField) field;
genGetField(resolvedField, receiver);
notifyBeforeInline(targetMethod);
printInlining(targetMethod, targetMethod, true, "inline accessor method (bytecode parsing)");
notifyAfterInline(targetMethod);
return true;
}
}
}
return false;
}
示例3: genPutField
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
private void genPutField(JavaField field, ValueNode value) {
ValueNode receiver = emitExplicitExceptions(frameState.pop(JavaKind.Object));
if (field instanceof ResolvedJavaField) {
ResolvedJavaField resolvedField = (ResolvedJavaField) field;
if (!parsingIntrinsic() && GeneratePIC.getValue(getOptions())) {
graph.recordField(resolvedField);
}
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleStoreField(this, receiver, resolvedField, value)) {
return;
}
}
if (resolvedField.isFinal() && method.isConstructor()) {
finalBarrierRequired = true;
}
genStoreField(receiver, resolvedField, value);
} else {
handleUnresolvedStoreField(field, value, receiver);
}
}
示例4: resolveStaticFieldAccess
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
private ResolvedJavaField resolveStaticFieldAccess(JavaField field, ValueNode value) {
if (field instanceof ResolvedJavaField) {
ResolvedJavaField resolvedField = (ResolvedJavaField) field;
if (resolvedField.getDeclaringClass().isInitialized()) {
return resolvedField;
}
/*
* Static fields have initialization semantics but may be safely accessed under certain
* conditions while the class is being initialized. Executing in the clinit or init of
* classes which are subtypes of the field holder are sure to be running in a context
* where the access is safe.
*/
if (resolvedField.getDeclaringClass().isAssignableFrom(method.getDeclaringClass())) {
if (method.isClassInitializer() || method.isConstructor()) {
return resolvedField;
}
}
}
if (value == null) {
handleUnresolvedLoadField(field, null);
} else {
handleUnresolvedStoreField(field, value, null);
}
return null;
}
示例5: genPutStatic
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
private void genPutStatic(JavaField field) {
ValueNode value = frameState.pop(field.getJavaKind());
ResolvedJavaField resolvedField = resolveStaticFieldAccess(field, value);
if (resolvedField == null) {
return;
}
if (!parsingIntrinsic() && GeneratePIC.getValue(getOptions())) {
graph.recordField(resolvedField);
}
ClassInitializationPlugin classInitializationPlugin = this.graphBuilderConfig.getPlugins().getClassInitializationPlugin();
if (classInitializationPlugin != null && classInitializationPlugin.shouldApply(this, resolvedField.getDeclaringClass())) {
FrameState stateBefore = frameState.create(bci(), getNonIntrinsicAncestor(), false, null, null);
classInitializationPlugin.apply(this, resolvedField.getDeclaringClass(), stateBefore);
}
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleStoreStaticField(this, resolvedField, value)) {
return;
}
}
genStoreField(null, resolvedField, value);
}
示例6: tryFastInlineAccessor
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
/**
* Tries to inline {@code targetMethod} if it is an instance field accessor. This avoids the
* overhead of creating and using a nested {@link BytecodeParser} object.
*/
private boolean tryFastInlineAccessor(ValueNode[] args, ResolvedJavaMethod targetMethod) {
byte[] bytecode = targetMethod.getCode();
if (bytecode.length == ACCESSOR_BYTECODE_LENGTH &&
Bytes.beU1(bytecode, 0) == ALOAD_0 &&
Bytes.beU1(bytecode, 1) == GETFIELD) {
int b4 = Bytes.beU1(bytecode, 4);
if (b4 >= IRETURN && b4 <= ARETURN) {
int cpi = Bytes.beU2(bytecode, 2);
JavaField field = targetMethod.getConstantPool().lookupField(cpi, targetMethod, GETFIELD);
if (field instanceof ResolvedJavaField) {
ValueNode receiver = invocationPluginReceiver.init(targetMethod, args).get();
ResolvedJavaField resolvedField = (ResolvedJavaField) field;
genGetField(resolvedField, receiver);
printInlining(targetMethod, targetMethod, true, "inline accessor method (bytecode parsing)");
return true;
}
}
}
return false;
}
示例7: lookupField
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
private JavaField lookupField(int cpi, int opcode) {
maybeEagerlyResolve(cpi, opcode);
JavaField result = constantPool.lookupField(cpi, method, opcode);
if (graphBuilderConfig.eagerResolving()) {
assert result instanceof ResolvedJavaField : "Not resolved: " + result;
ResolvedJavaType declaringClass = ((ResolvedJavaField) result).getDeclaringClass();
if (!declaringClass.isInitialized()) {
assert declaringClass.isInterface() : "Declaring class not initialized but not an interface? " + declaringClass;
declaringClass.initialize();
}
}
assert !graphBuilderConfig.unresolvedIsError() || (result instanceof ResolvedJavaField && ((ResolvedJavaField) result).getDeclaringClass().isInitialized()) : result;
return result;
}
示例8: genGetField
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
private void genGetField(JavaField field, ValueNode receiverInput) {
ValueNode receiver = emitExplicitExceptions(receiverInput);
if (field instanceof ResolvedJavaField) {
ResolvedJavaField resolvedField = (ResolvedJavaField) field;
genGetField(resolvedField, receiver);
} else {
handleUnresolvedLoadField(field, receiver);
}
}
示例9: genGetStatic
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
private void genGetStatic(JavaField field) {
ResolvedJavaField resolvedField = resolveStaticFieldAccess(field, null);
if (resolvedField == null) {
return;
}
if (!parsingIntrinsic() && GeneratePIC.getValue(getOptions())) {
graph.recordField(resolvedField);
}
/*
* Javac does not allow use of "$assertionsDisabled" for a field name but Eclipse does, in
* which case a suffix is added to the generated field.
*/
if ((parsingIntrinsic() || graphBuilderConfig.omitAssertions()) && resolvedField.isSynthetic() && resolvedField.getName().startsWith("$assertionsDisabled")) {
frameState.push(field.getJavaKind(), ConstantNode.forBoolean(true, graph));
return;
}
ClassInitializationPlugin classInitializationPlugin = this.graphBuilderConfig.getPlugins().getClassInitializationPlugin();
if (classInitializationPlugin != null && classInitializationPlugin.shouldApply(this, resolvedField.getDeclaringClass())) {
FrameState stateBefore = frameState.create(bci(), getNonIntrinsicAncestor(), false, null, null);
classInitializationPlugin.apply(this, resolvedField.getDeclaringClass(), stateBefore);
}
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleLoadStaticField(this, resolvedField)) {
return;
}
}
frameState.push(field.getJavaKind(), append(genLoadField(null, resolvedField)));
}
示例10: lookupField
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
@Override
public JavaField lookupField(int cpi, ResolvedJavaMethod method, int opcode) {
final int index = rawIndexToConstantPoolIndex(cpi, opcode);
final int nameAndTypeIndex = getNameAndTypeRefIndexAt(index);
final int typeIndex = getSignatureRefIndexAt(nameAndTypeIndex);
String typeName = lookupUtf8(typeIndex);
JavaType type = runtime().lookupType(typeName, getHolder(), false);
final int holderIndex = getKlassRefIndexAt(index);
JavaType holder = lookupType(holderIndex, opcode);
if (holder instanceof HotSpotResolvedObjectTypeImpl) {
int[] info = new int[3];
HotSpotResolvedObjectTypeImpl resolvedHolder;
try {
resolvedHolder = compilerToVM().resolveFieldInPool(this, index, (HotSpotResolvedJavaMethodImpl) method, (byte) opcode, info);
} catch (Throwable t) {
/*
* If there was an exception resolving the field we give up and return an unresolved
* field.
*/
return new HotSpotUnresolvedField(holder, lookupUtf8(getNameRefIndexAt(nameAndTypeIndex)), type);
}
final int flags = info[0];
final int offset = info[1];
final int fieldIndex = info[2];
HotSpotResolvedJavaField result = resolvedHolder.createField(type, offset, flags, fieldIndex);
return result;
} else {
return new HotSpotUnresolvedField(holder, lookupUtf8(getNameRefIndexAt(nameAndTypeIndex)), type);
}
}
示例11: lookupField
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
@Override
public JavaField lookupField(int cpi, int opcode) {
final int index = rawIndexToConstantPoolIndex(cpi, opcode);
final int nameAndTypeIndex = getNameAndTypeRefIndexAt(index);
final int nameIndex = getNameRefIndexAt(nameAndTypeIndex);
String name = lookupUtf8(nameIndex);
final int typeIndex = getSignatureRefIndexAt(nameAndTypeIndex);
String typeName = lookupUtf8(typeIndex);
JavaType type = runtime().lookupType(typeName, getHolder(), false);
final int holderIndex = getKlassRefIndexAt(index);
JavaType holder = lookupType(holderIndex, opcode);
if (holder instanceof HotSpotResolvedObjectTypeImpl) {
long[] info = new long[2];
HotSpotResolvedObjectTypeImpl resolvedHolder;
try {
resolvedHolder = compilerToVM().resolveFieldInPool(this, index, (byte) opcode, info);
} catch (Throwable t) {
/*
* If there was an exception resolving the field we give up and return an unresolved
* field.
*/
return new HotSpotUnresolvedField(holder, name, type);
}
final int flags = (int) info[0];
final long offset = info[1];
HotSpotResolvedJavaField result = resolvedHolder.createField(name, type, offset, flags);
return result;
} else {
return new HotSpotUnresolvedField(holder, name, type);
}
}
示例12: lookupField
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
@Override
public JavaField lookupField(int index, ResolvedJavaMethod method, int opcode) {
return get(FieldRef.class, index).resolve(this, opcode);
}
示例13: assertEqualFields
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
static void assertEqualFields(JavaField e, JavaField a) {
if (!e.equals(a)) {
Assert.assertEquals(e.format("%H.%n %T"), a.format("%H.%n %T"));
}
}
示例14: test05
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
boolean test05(JavaField f) {
return aJavaField == f;
}
示例15: test16
import jdk.vm.ci.meta.JavaField; //导入依赖的package包/类
boolean test16(JavaField f) {
return aStaticJavaField == f;
}