diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java @ 7711:960a15fea39a

Make materialized frame also being usable as a packed frame.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 05 Feb 2013 15:19:17 +0100
parents 5e3d1a68664e
children 1a2d258d481a
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java	Mon Feb 04 13:21:13 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java	Tue Feb 05 15:19:17 2013 +0100
@@ -132,4 +132,23 @@
     void setDouble(FrameSlot slot, double value);
 
     void updateToLatestVersion();
+
+    /**
+     * Converts this virtual frame into a packed frame that has no longer direct access to the local
+     * variables. This packing is an important hint to the Truffle optimizer and therefore passing
+     * around a {@link PackedFrame} should be preferred over passing around a {@link VirtualFrame}
+     * when the probability that an unpacking will occur is low.
+     * 
+     * @return the packed frame
+     */
+    PackedFrame pack();
+
+    /**
+     * Materializes this frame, which allows it to be stored in a field or cast to
+     * {@link java.lang.Object}. The frame however looses the ability to be packed or to access the
+     * caller frame.
+     * 
+     * @return the new materialized frame
+     */
+    MaterializedFrame materialize();
 }