diff truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java @ 22435:dc2bfc816011

Documenting and testing behavior of FrameDescriptor#shallowCopy
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Thu, 03 Dec 2015 19:48:03 +0100
parents c11ce7d2e2c3
children fa86f9f3848d
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java	Thu Dec 03 19:37:45 2015 +0100
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java	Thu Dec 03 19:48:03 2015 +0100
@@ -237,7 +237,7 @@
      * Deeper copy of the descriptor. Copies all slots in the descriptor, but only their identifiers
      * - not their {@link FrameSlot#getInfo()} neither their {@link FrameSlot#getKind()}!
      * 
-     * @return new instance of a descritor with copies of values from this one
+     * @return new instance of a descriptor with copies of values from this one
      */
     public FrameDescriptor copy() {
         FrameDescriptor clonedFrameDescriptor = new FrameDescriptor(this.defaultValue);
@@ -248,6 +248,13 @@
         return clonedFrameDescriptor;
     }
 
+    /**
+     * Shallow copy of the descriptor. Re-uses the existing slots in new descriptor. As a result, if
+     * you {@link FrameSlot#setKind(com.oracle.truffle.api.frame.FrameSlotKind) change kind} of one
+     * of the slots it is changed in the original as well as in the shallow copy.
+     * 
+     * @return new instance of a descriptor with copies of values from this one
+     */
     public FrameDescriptor shallowCopy() {
         FrameDescriptor clonedFrameDescriptor = new FrameDescriptor(this.defaultValue);
         clonedFrameDescriptor.slots.addAll(slots);