本文整理汇总了Java中jdk.vm.ci.code.BytecodePosition类的典型用法代码示例。如果您正苦于以下问题:Java BytecodePosition类的具体用法?Java BytecodePosition怎么用?Java BytecodePosition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BytecodePosition类属于jdk.vm.ci.code包,在下文中一共展示了BytecodePosition类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import jdk.vm.ci.code.BytecodePosition; //导入依赖的package包/类
/**
* Parse an {@link Infopoint} generated by the compiler and create all needed binary section
* constructs.
*
* @param methodInfo compiled method info
* @param info info point being processed
*/
void process(CompiledMethodInfo methodInfo, Infopoint info) {
switch (info.reason) {
case CALL:
// All calls in compiled code need a symbol and relocation entry.
processCallInfoPoint(methodInfo, (Call) info);
break;
case SAFEPOINT:
case IMPLICIT_EXCEPTION:
case METHOD_START:
case METHOD_END:
case BYTECODE_POSITION:
break;
default:
throw new InternalError("Unknown info point reason: " + info.reason);
}
if (info.debugInfo == null) {
return;
}
BytecodePosition bcp = info.debugInfo.getBytecodePosition();
if (bcp == null) {
return;
}
recordScopeKlasses(methodInfo, bcp, info.debugInfo.getVirtualObjectMapping());
}
示例2: recordScopeKlasses
import jdk.vm.ci.code.BytecodePosition; //导入依赖的package包/类
private void recordScopeKlasses(CompiledMethodInfo methodInfo, BytecodePosition bcp, VirtualObject[] vos) {
BytecodePosition caller = bcp.getCaller();
if (caller != null) {
recordScopeKlasses(methodInfo, caller, vos);
}
HotSpotResolvedJavaMethod m = (HotSpotResolvedJavaMethod) bcp.getMethod();
HotSpotResolvedObjectType klass = m.getDeclaringClass();
methodInfo.addDependentKlassData(binaryContainer, klass);
if (vos == null) {
return;
}
for (VirtualObject vo : vos) {
HotSpotResolvedObjectType vk = (HotSpotResolvedObjectType) vo.getType();
methodInfo.addDependentKlassData(binaryContainer, vk);
}
}
示例3: approxSourceStackTraceElement
import jdk.vm.ci.code.BytecodePosition; //导入依赖的package包/类
/**
* Gets approximate stack trace elements for a bytecode position.
*/
public static StackTraceElement[] approxSourceStackTraceElement(BytecodePosition bytecodePosition) {
ArrayList<StackTraceElement> elements = new ArrayList<>();
BytecodePosition position = bytecodePosition;
while (position != null) {
ResolvedJavaMethod method = position.getMethod();
if (method != null) {
elements.add(method.asStackTraceElement(position.getBCI()));
}
position = position.getCaller();
}
return elements.toArray(new StackTraceElement[0]);
}
示例4: appendDebugInfo
import jdk.vm.ci.code.BytecodePosition; //导入依赖的package包/类
protected static void appendDebugInfo(StringBuilder sb, DebugInfo info) {
if (info != null) {
ReferenceMap refMap = info.getReferenceMap();
if (refMap != null) {
sb.append(refMap.toString());
sb.append(']');
}
RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo();
if (calleeSaveInfo != null) {
sb.append(" callee-save-info[");
String sep = "";
for (Map.Entry<Register, Integer> e : calleeSaveInfo.registersToSlots(true).entrySet()) {
sb.append(sep).append(e.getKey()).append("->").append(e.getValue());
sep = ", ";
}
sb.append(']');
}
BytecodePosition codePos = info.getBytecodePosition();
if (codePos != null) {
MetaUtil.appendLocation(sb.append(" "), codePos.getMethod(), codePos.getBCI());
if (info.hasFrame()) {
sb.append(" #locals=").append(info.frame().numLocals).append(" #expr=").append(info.frame().numStack);
if (info.frame().numLocks > 0) {
sb.append(" #locks=").append(info.frame().numLocks);
}
}
}
}
}
示例5: debugInfoToString
import jdk.vm.ci.code.BytecodePosition; //导入依赖的package包/类
/**
* Formats given debug info as a multi line string.
*/
protected String debugInfoToString(BytecodePosition codePos, ReferenceMap refMap, IndexedValueMap liveBasePointers, RegisterSaveLayout calleeSaveInfo) {
StringBuilder sb = new StringBuilder();
if (refMap != null) {
sb.append("reference-map: ");
sb.append(refMap.toString());
sb.append("\n");
}
if (liveBasePointers != null) {
sb.append("live-base-pointers: ");
sb.append(liveBasePointers);
sb.append("\n");
}
if (calleeSaveInfo != null) {
sb.append("callee-save-info:");
for (Map.Entry<Register, Integer> e : calleeSaveInfo.registersToSlots(true).entrySet()) {
sb.append(" " + e.getKey() + " -> s" + e.getValue());
}
sb.append("\n");
}
if (codePos != null) {
BytecodePosition curCodePos = codePos;
List<VirtualObject> virtualObjects = new ArrayList<>();
do {
sb.append(MetaUtil.toLocation(curCodePos.getMethod(), curCodePos.getBCI()));
sb.append('\n');
if (curCodePos instanceof BytecodeFrame) {
BytecodeFrame frame = (BytecodeFrame) curCodePos;
if (frame.numStack > 0) {
sb.append("stack: ");
for (int i = 0; i < frame.numStack; i++) {
sb.append(valueToString(frame.getStackValue(i), virtualObjects)).append(' ');
}
sb.append("\n");
}
sb.append("locals: ");
for (int i = 0; i < frame.numLocals; i++) {
sb.append(valueToString(frame.getLocalValue(i), virtualObjects)).append(' ');
}
sb.append("\n");
if (frame.numLocks > 0) {
sb.append("locks: ");
for (int i = 0; i < frame.numLocks; ++i) {
sb.append(valueToString(frame.getLockValue(i), virtualObjects)).append(' ');
}
sb.append("\n");
}
}
curCodePos = curCodePos.getCaller();
} while (curCodePos != null);
for (int i = 0; i < virtualObjects.size(); i++) {
VirtualObject obj = virtualObjects.get(i);
sb.append(obj).append(" ").append(obj.getType().getName()).append(" ");
for (int j = 0; j < obj.getValues().length; j++) {
sb.append(valueToString(obj.getValues()[j], virtualObjects)).append(' ');
}
sb.append("\n");
}
}
return sb.toString();
}
示例6: test
import jdk.vm.ci.code.BytecodePosition; //导入依赖的package包/类
private void test(ReferenceMap refMap) {
BytecodePosition pos = new BytecodePosition(null, dummyMethod, 0);
DebugInfo info = new DebugInfo(pos);
info.setReferenceMap(refMap);
installEmptyCode(new Site[]{new Infopoint(0, info, InfopointReason.SAFEPOINT)}, new Assumption[0], new Comment[0], 16, new DataPatch[0], StackSlot.get(null, 0, true));
}