Mercurial > hg > graal-compiler
changeset 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 | d19837d236e5 |
children | 0a346c23cbd5 |
files | graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/PackedFrame.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/VirtualFrame.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultMaterializedFrame.java |
diffstat | 4 files changed, 36 insertions(+), 21 deletions(-) [+] |
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(); }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/PackedFrame.java Mon Feb 04 13:21:13 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/PackedFrame.java Tue Feb 05 15:19:17 2013 +0100 @@ -35,5 +35,5 @@ * * @return the virtual frame that was the content of this packed frame */ - VirtualFrame unpack(); + Frame unpack(); }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/VirtualFrame.java Mon Feb 04 13:21:13 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/VirtualFrame.java Tue Feb 05 15:19:17 2013 +0100 @@ -35,29 +35,10 @@ public interface VirtualFrame extends Frame { /** - * 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(); - - /** * Accesses the caller frame passed in via {@link CallTarget#call}. To get full access, it must * be first unpacked using {@link PackedFrame#unpack()}. * * @return the caller frame or null if this was a root method call */ PackedFrame getCaller(); - - /** - * 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(); }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultMaterializedFrame.java Mon Feb 04 13:21:13 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultMaterializedFrame.java Tue Feb 05 15:19:17 2013 +0100 @@ -25,7 +25,7 @@ import com.oracle.truffle.api.*; import com.oracle.truffle.api.frame.*; -final class DefaultMaterializedFrame implements MaterializedFrame { +final class DefaultMaterializedFrame implements MaterializedFrame, PackedFrame { private final DefaultVirtualFrame wrapped; @@ -102,4 +102,19 @@ public void updateToLatestVersion() { wrapped.updateToLatestVersion(); } + + @Override + public PackedFrame pack() { + return this; + } + + @Override + public MaterializedFrame materialize() { + return this; + } + + @Override + public Frame unpack() { + return this; + } }