< prev index next >

src/java.base/share/classes/java/lang/StackFrameInfo.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -29,27 +29,29 @@
 
 import java.lang.StackWalker.StackFrame;
 import java.lang.invoke.MethodType;
 
 class StackFrameInfo implements StackFrame {
-    private final byte RETAIN_CLASS_REF = 0x01;
+    private final static byte RETAIN_CLASS_REF = 0x01;
 
     private final static JavaLangInvokeAccess JLIA =
         SharedSecrets.getJavaLangInvokeAccess();
 
     private final byte flags;
-    private final Object memberName;
-    private final short bci;
+    private final Object memberName;    // MemberName initialized by VM
+    private short bci;                  // unsigned 16-bit value set by VM
     private volatile StackTraceElement ste;
 
     /*
-     * Create StackFrameInfo for StackFrameTraverser and LiveStackFrameTraverser
-     * to use
+     * Construct an empty StackFrameInfo object that will be filled by the VM
+     * during stack walking.
+     *
+     * @see StackStreamFactory.AbstractStackWalker#callStackWalk
+     * @see StackStreamFactory.AbstractStackWalker#fetchStackFrames
      */
     StackFrameInfo(StackWalker walker) {
         this.flags = walker.retainClassRef ? RETAIN_CLASS_REF : 0;
-        this.bci = -1;
         this.memberName = JLIA.newMemberName();
     }
 
     // package-private called by StackStreamFactory to skip
     // the capability check

@@ -90,11 +92,11 @@
     public int getByteCodeIndex() {
         // bci not available for native methods
         if (isNativeMethod())
             return -1;
 
-        return bci;
+        return Short.toUnsignedInt(bci);
     }
 
     @Override
     public String getFileName() {
         return toStackTraceElement().getFileName();
< prev index next >