本文整理匯總了Java中jdk.vm.ci.meta.ResolvedJavaMethod.getMaxLocals方法的典型用法代碼示例。如果您正苦於以下問題:Java ResolvedJavaMethod.getMaxLocals方法的具體用法?Java ResolvedJavaMethod.getMaxLocals怎麽用?Java ResolvedJavaMethod.getMaxLocals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jdk.vm.ci.meta.ResolvedJavaMethod
的用法示例。
在下文中一共展示了ResolvedJavaMethod.getMaxLocals方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: test
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
@Test
public void test() {
ResolvedJavaMethod resolvedMethod = metaAccess.lookupJavaMethod(getMethod("testNull"));
int bci = 0;
int numLocals = resolvedMethod.getMaxLocals();
int numStack = 0;
JavaValue[] values = new JavaValue[numLocals];
JavaKind[] slotKinds = new JavaKind[numLocals];
BytecodeFrame frame = new BytecodeFrame(null, resolvedMethod, bci, false, false, values, slotKinds, numLocals, numStack, 0);
int size = hotspotCodeCache().interpreterFrameSize(frame);
if (size <= 0) {
Assert.fail("expected non-zero result");
}
}
示例2: test
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
protected void test(DebugInfoCompiler compiler, Method method, int bci, Location[] objects, Location[] derivedBase, int[] sizeInBytes, JavaKind... slotKinds) {
ResolvedJavaMethod resolvedMethod = metaAccess.lookupJavaMethod(method);
int numLocals = resolvedMethod.getMaxLocals();
int numStack = slotKinds.length - numLocals;
JavaValue[] values = new JavaValue[slotKinds.length];
test(asm -> {
/*
* Ensure that any objects mentioned in the VirtualObjects are also in the OopMap.
*/
List<Location> newLocations = new ArrayList<Location>(Arrays.asList(objects));
List<Location> newDerived = new ArrayList<Location>(Arrays.asList(derivedBase));
int[] newSizeInBytes = sizeInBytes;
VirtualObject[] vobjs = compiler.compile(asm, values);
if (vobjs != null) {
for (VirtualObject obj : vobjs) {
JavaValue[] objValues = obj.getValues();
for (int i = 0; i < objValues.length; i++) {
if (obj.getSlotKind(i) == JavaKind.Object) {
Location oopLocation = null;
int bytes = -1;
if (objValues[i] instanceof RegisterValue) {
RegisterValue reg = (RegisterValue) objValues[i];
oopLocation = Location.register(reg.getRegister());
bytes = reg.getValueKind().getPlatformKind().getSizeInBytes();
} else if (objValues[i] instanceof StackSlot) {
StackSlot slot = (StackSlot) objValues[i];
oopLocation = Location.stack(asm.getOffset(slot));
bytes = slot.getValueKind().getPlatformKind().getSizeInBytes();
}
if (oopLocation != null && !newLocations.contains(oopLocation)) {
newLocations.add(oopLocation);
newDerived.add(null);
newSizeInBytes = Arrays.copyOf(newSizeInBytes, newSizeInBytes.length + 1);
newSizeInBytes[newSizeInBytes.length - 1] = bytes;
}
}
}
}
}
BytecodeFrame frame = new BytecodeFrame(null, resolvedMethod, bci, false, false, values, slotKinds, numLocals, numStack, 0);
DebugInfo info = new DebugInfo(frame, vobjs);
info.setReferenceMap(new HotSpotReferenceMap(newLocations.toArray(new Location[0]), newDerived.toArray(new Location[0]), newSizeInBytes, 8));
asm.emitTrap(info);
}, method);
}