Possible bug in StackFrameInfo#getByteCodeIndex?

David Lloyd david.lloyd at redhat.com
Tue Dec 12 13:44:22 UTC 2017


Thanks!

On Mon, Dec 11, 2017 at 3:53 PM, mandy chung <mandy.chung at oracle.com> wrote:
> I filed https://bugs.openjdk.java.net/browse/JDK-8193325.   I can sponsor
> this patch for you.
>
> --- a/src/java.base/share/classes/java/lang/StackFrameInfo.java
> +++ b/src/java.base/share/classes/java/lang/StackFrameInfo.java
> @@ -93,7 +93,7 @@
>          if (isNativeMethod())
>              return -1;
>
> -        return bci;
> +        return bci & 0xffff;
>      }
>
> Mandy
>
> On 12/7/17 8:19 PM, David Lloyd wrote:
>
> I was doing some research related to AccessController, and I noted
> this code [1] in StackFrameInfo#getByteCodeIndex():
>
> @Override
> public int getByteCodeIndex() {
>     // bci not available for native methods
>     if (isNativeMethod())
>         return -1;
>
>     return bci;
> }
>
> Now bci is of type short, and given the spec of the method, should the
> return not be:
>
>     return bci & 0xffff;
>
> instead?  Else it would return wrong values for methods with more than
> 32767 bytecodes in them.
>
> [1]
> http://hg.openjdk.java.net/jdk/jdk/file/e3b6cb90d7ce/src/java.base/share/classes/java/lang/StackFrameInfo.java#l96
>
>



-- 
- DML


More information about the core-libs-dev mailing list