mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8193325: StackFrameInfo::getByteCodeIndex returns wrong value if bci > 32767
Reviewed-by: coleenp, fparain, shade, plevart
This commit is contained in:
parent
04cb846933
commit
5542307097
2 changed files with 14 additions and 13 deletions
|
@ -2677,14 +2677,14 @@ void java_lang_StackFrameInfo::to_stack_trace_element(Handle stackFrame, Handle
|
||||||
Method* method = java_lang_StackFrameInfo::get_method(stackFrame, holder, CHECK);
|
Method* method = java_lang_StackFrameInfo::get_method(stackFrame, holder, CHECK);
|
||||||
|
|
||||||
short version = stackFrame->short_field(_version_offset);
|
short version = stackFrame->short_field(_version_offset);
|
||||||
short bci = stackFrame->short_field(_bci_offset);
|
int bci = stackFrame->int_field(_bci_offset);
|
||||||
Symbol* name = method->name();
|
Symbol* name = method->name();
|
||||||
java_lang_StackTraceElement::fill_in(stack_trace_element, holder, method, version, bci, name, CHECK);
|
java_lang_StackTraceElement::fill_in(stack_trace_element, holder, method, version, bci, name, CHECK);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STACKFRAMEINFO_FIELDS_DO(macro) \
|
#define STACKFRAMEINFO_FIELDS_DO(macro) \
|
||||||
macro(_memberName_offset, k, "memberName", object_signature, false); \
|
macro(_memberName_offset, k, "memberName", object_signature, false); \
|
||||||
macro(_bci_offset, k, "bci", short_signature, false)
|
macro(_bci_offset, k, "bci", int_signature, false)
|
||||||
|
|
||||||
void java_lang_StackFrameInfo::compute_offsets() {
|
void java_lang_StackFrameInfo::compute_offsets() {
|
||||||
InstanceKlass* k = SystemDictionary::StackFrameInfo_klass();
|
InstanceKlass* k = SystemDictionary::StackFrameInfo_klass();
|
||||||
|
@ -4224,6 +4224,7 @@ void java_lang_StackFrameInfo::set_version(oop element, short value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void java_lang_StackFrameInfo::set_bci(oop element, int value) {
|
void java_lang_StackFrameInfo::set_bci(oop element, int value) {
|
||||||
|
assert(value >= 0 && value < max_jushort, "must be a valid bci value");
|
||||||
element->int_field_put(_bci_offset, value);
|
element->int_field_put(_bci_offset, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -31,23 +31,23 @@ import java.lang.StackWalker.StackFrame;
|
||||||
import java.lang.invoke.MethodType;
|
import java.lang.invoke.MethodType;
|
||||||
|
|
||||||
class StackFrameInfo implements StackFrame {
|
class StackFrameInfo implements StackFrame {
|
||||||
private final byte RETAIN_CLASS_REF = 0x01;
|
|
||||||
|
|
||||||
private final static JavaLangInvokeAccess JLIA =
|
private final static JavaLangInvokeAccess JLIA =
|
||||||
SharedSecrets.getJavaLangInvokeAccess();
|
SharedSecrets.getJavaLangInvokeAccess();
|
||||||
|
|
||||||
private final byte flags;
|
private final boolean retainClassRef;
|
||||||
private final Object memberName;
|
private final Object memberName; // MemberName initialized by VM
|
||||||
private final short bci;
|
private int bci; // initialized by VM to >= 0
|
||||||
private volatile StackTraceElement ste;
|
private volatile StackTraceElement ste;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create StackFrameInfo for StackFrameTraverser and LiveStackFrameTraverser
|
* Construct an empty StackFrameInfo object that will be filled by the VM
|
||||||
* to use
|
* during stack walking.
|
||||||
|
*
|
||||||
|
* @see StackStreamFactory.AbstractStackWalker#callStackWalk
|
||||||
|
* @see StackStreamFactory.AbstractStackWalker#fetchStackFrames
|
||||||
*/
|
*/
|
||||||
StackFrameInfo(StackWalker walker) {
|
StackFrameInfo(StackWalker walker) {
|
||||||
this.flags = walker.retainClassRef ? RETAIN_CLASS_REF : 0;
|
this.retainClassRef = walker.retainClassRef;
|
||||||
this.bci = -1;
|
|
||||||
this.memberName = JLIA.newMemberName();
|
this.memberName = JLIA.newMemberName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ class StackFrameInfo implements StackFrame {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureRetainClassRefEnabled() {
|
private void ensureRetainClassRefEnabled() {
|
||||||
if ((flags & RETAIN_CLASS_REF) == 0) {
|
if (!retainClassRef) {
|
||||||
throw new UnsupportedOperationException("No access to RETAIN_CLASS_REFERENCE");
|
throw new UnsupportedOperationException("No access to RETAIN_CLASS_REFERENCE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue