Mercurial > hg > graal-jvmci-8
diff jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java @ 23718:0bd91cd9869d
need to be able to copy internal arrays from LocalVariableTable and LineNumberTable (JDK-8160647)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 30 Jun 2016 22:08:57 +0200 |
parents | 9e1235406b59 |
children | a52d7039723b |
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java Thu Jun 30 22:07:57 2016 +0200 +++ b/jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java Thu Jun 30 22:08:57 2016 +0200 @@ -26,6 +26,8 @@ import java.util.List; /** + * Describes the {@link Local}s for a Java method. + * * @see "https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.13" */ public class LocalVariableTable { @@ -33,6 +35,7 @@ private final Local[] locals; /** + * Creates an object describing the {@link Local}s for a Java method. * * @param locals array of objects describing local variables. This array is now owned by this * object and must not be mutated by the caller. @@ -42,6 +45,13 @@ this.locals = locals; } + /** + * Gets a description of a local variable that occupies the bytecode frame slot indexed by + * {@code slot} and is live at the bytecode index {@code bci} + * + * @return a description of the requested local variable or null if no such variable matches + * {@code slot} and {@code bci} + */ public Local getLocal(int slot, int bci) { Local result = null; for (Local local : locals) { @@ -56,6 +66,16 @@ return result; } + /** + * Gets a copy of the array of {@link Local}s that was passed to this object's constructor. + */ + public Local[] getLocalsCopy() { + return locals.clone(); + } + + /** + * Gets a description of all the local variables live at the bytecode index {@code bci} + */ public Local[] getLocalsAt(int bci) { List<Local> result = new ArrayList<>(); for (Local l : locals) {