Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultVirtualFrame.java @ 13760:a12017c18d5d
Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Fri, 24 Jan 2014 18:13:38 -0800 |
parents | 833f8e96d0a5 |
children | 64dcb92ee75a |
rev | line source |
---|---|
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
11279
494b818b527c
Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10911
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
494b818b527c
Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10911
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
494b818b527c
Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10911
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * accompanied this code). |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 * questions. |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 */ |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 package com.oracle.truffle.api.impl; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import java.util.*; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 import com.oracle.truffle.api.*; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.truffle.api.frame.*; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 |
13760
a12017c18d5d
Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13201
diff
changeset
|
32 /** |
a12017c18d5d
Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13201
diff
changeset
|
33 * This is an implementation-specific class. Do not use or instantiate it. Instead, use |
a12017c18d5d
Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13201
diff
changeset
|
34 * {@link TruffleRuntime#createVirtualFrame(PackedFrame, Arguments, FrameDescriptor)} to create a |
a12017c18d5d
Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13201
diff
changeset
|
35 * {@link VirtualFrame}. |
a12017c18d5d
Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13201
diff
changeset
|
36 */ |
a12017c18d5d
Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13201
diff
changeset
|
37 final class DefaultVirtualFrame implements VirtualFrame { |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 private final FrameDescriptor descriptor; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 private final PackedFrame caller; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 private final Arguments arguments; |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
42 private Object[] locals; |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
43 private byte[] tags; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 |
13760
a12017c18d5d
Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13201
diff
changeset
|
45 DefaultVirtualFrame(FrameDescriptor descriptor, PackedFrame caller, Arguments arguments) { |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 this.descriptor = descriptor; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 this.caller = caller; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 this.arguments = arguments; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 this.locals = new Object[descriptor.getSize()]; |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
50 Arrays.fill(locals, descriptor.getTypeConversion().getDefaultValue()); |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
51 this.tags = new byte[descriptor.getSize()]; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 |
9330
e162d9e32830
Added a clazz parameter to Frame.getArguments in order to allow unsafe access to the arguments object (i.e., avoiding the null check and the type cast).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9321
diff
changeset
|
54 @SuppressWarnings("unchecked") |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 @Override |
9330
e162d9e32830
Added a clazz parameter to Frame.getArguments in order to allow unsafe access to the arguments object (i.e., avoiding the null check and the type cast).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9321
diff
changeset
|
56 public <T extends Arguments> T getArguments(Class<T> clazz) { |
e162d9e32830
Added a clazz parameter to Frame.getArguments in order to allow unsafe access to the arguments object (i.e., avoiding the null check and the type cast).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9321
diff
changeset
|
57 return (T) arguments; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 @Override |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 public PackedFrame getCaller() { |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 return caller; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 @Override |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 public PackedFrame pack() { |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 return new DefaultPackedFrame(this); |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 @Override |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 public MaterializedFrame materialize() { |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
72 return new DefaultMaterializedFrame(this); |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 @Override |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
76 public Object getObject(FrameSlot slot) throws FrameSlotTypeException { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
77 verifyGet(slot, FrameSlotKind.Object); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
78 return locals[slot.getIndex()]; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 @Override |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
82 public void setObject(FrameSlot slot, Object value) { |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
83 verifySet(slot, FrameSlotKind.Object); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
84 locals[slot.getIndex()] = value; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
85 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
86 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
87 @Override |
11427
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
88 public byte getByte(FrameSlot slot) throws FrameSlotTypeException { |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
89 verifyGet(slot, FrameSlotKind.Byte); |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
90 return (byte) locals[slot.getIndex()]; |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
91 } |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
92 |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
93 @Override |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
94 public void setByte(FrameSlot slot, byte value) { |
11427
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
95 verifySet(slot, FrameSlotKind.Byte); |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
96 locals[slot.getIndex()] = value; |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
97 } |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
98 |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
99 @Override |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
100 public boolean getBoolean(FrameSlot slot) throws FrameSlotTypeException { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
101 verifyGet(slot, FrameSlotKind.Boolean); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
102 return (boolean) locals[slot.getIndex()]; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
103 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 @Override |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
106 public void setBoolean(FrameSlot slot, boolean value) { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
107 verifySet(slot, FrameSlotKind.Boolean); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
108 locals[slot.getIndex()] = value; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
109 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
110 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 @Override |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
112 public int getInt(FrameSlot slot) throws FrameSlotTypeException { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
113 verifyGet(slot, FrameSlotKind.Int); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
114 return (int) locals[slot.getIndex()]; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
115 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
116 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
117 @Override |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
118 public void setInt(FrameSlot slot, int value) { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
119 verifySet(slot, FrameSlotKind.Int); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
120 locals[slot.getIndex()] = value; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
123 @Override |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
124 public long getLong(FrameSlot slot) throws FrameSlotTypeException { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
125 verifyGet(slot, FrameSlotKind.Long); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
126 return (long) locals[slot.getIndex()]; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
127 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
128 |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
129 @Override |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
130 public void setLong(FrameSlot slot, long value) { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
131 verifySet(slot, FrameSlotKind.Long); |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
132 locals[slot.getIndex()] = value; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
133 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
134 |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
135 @Override |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
136 public float getFloat(FrameSlot slot) throws FrameSlotTypeException { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
137 verifyGet(slot, FrameSlotKind.Float); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
138 return (float) locals[slot.getIndex()]; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
139 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
140 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
141 @Override |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
142 public void setFloat(FrameSlot slot, float value) { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
143 verifySet(slot, FrameSlotKind.Float); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
144 locals[slot.getIndex()] = value; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 } |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
146 |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
147 @Override |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
148 public double getDouble(FrameSlot slot) throws FrameSlotTypeException { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
149 verifyGet(slot, FrameSlotKind.Double); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
150 return (double) locals[slot.getIndex()]; |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
151 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
152 |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
153 @Override |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
154 public void setDouble(FrameSlot slot, double value) { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
155 verifySet(slot, FrameSlotKind.Double); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
156 locals[slot.getIndex()] = value; |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 } |
7721
1a2d258d481a
Added getFrameDescriptor() to Frame interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
158 |
1a2d258d481a
Added getFrameDescriptor() to Frame interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
159 @Override |
1a2d258d481a
Added getFrameDescriptor() to Frame interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
160 public FrameDescriptor getFrameDescriptor() { |
1a2d258d481a
Added getFrameDescriptor() to Frame interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
161 return this.descriptor; |
1a2d258d481a
Added getFrameDescriptor() to Frame interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
162 } |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
163 |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
164 @Override |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
165 public Object getValue(FrameSlot slot) { |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
166 int slotIndex = slot.getIndex(); |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
167 if (slotIndex >= tags.length) { |
13201
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
168 if (!resize()) { |
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
169 throw new IllegalArgumentException(String.format("The frame slot '%s' is not known by the frame descriptor.", slot)); |
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
170 } |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
171 } |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
172 return locals[slotIndex]; |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
173 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
174 |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
175 private void verifySet(FrameSlot slot, FrameSlotKind accessKind) { |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
176 int slotIndex = slot.getIndex(); |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
177 if (slotIndex >= tags.length) { |
13201
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
178 if (!resize()) { |
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
179 throw new IllegalArgumentException(String.format("The frame slot '%s' is not known by the frame descriptor.", slot)); |
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
180 } |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
181 } |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
182 tags[slotIndex] = (byte) accessKind.ordinal(); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
183 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
184 |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
185 private void verifyGet(FrameSlot slot, FrameSlotKind accessKind) throws FrameSlotTypeException { |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
186 int slotIndex = slot.getIndex(); |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
187 if (slotIndex >= tags.length) { |
13201
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
188 if (!resize()) { |
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
189 throw new IllegalArgumentException(String.format("The frame slot '%s' is not known by the frame descriptor.", slot)); |
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
190 } |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
191 } |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
192 byte tag = tags[slotIndex]; |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
193 if (accessKind == FrameSlotKind.Object ? tag != 0 : tag != accessKind.ordinal()) { |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
194 if (slot.getKind() == accessKind || tag == 0) { |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
195 descriptor.getTypeConversion().updateFrameSlot(this, slot, getValue(slot)); |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
196 if (tags[slotIndex] == accessKind.ordinal()) { |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
197 return; |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
198 } |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
199 } |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
200 throw new FrameSlotTypeException(); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
201 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
202 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
203 |
13201
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
204 private boolean resize() { |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
205 int oldSize = tags.length; |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
206 int newSize = descriptor.getSize(); |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
207 if (newSize > oldSize) { |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
208 locals = Arrays.copyOf(locals, newSize); |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
209 Arrays.fill(locals, oldSize, newSize, descriptor.getTypeConversion().getDefaultValue()); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
210 tags = Arrays.copyOf(tags, newSize); |
13201
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
211 return true; |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
212 } |
13201
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
213 return false; |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
214 } |
9952
5d91b0b67cba
Introduce Frame.isInitialized in the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9330
diff
changeset
|
215 |
12643
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
216 private byte getTag(FrameSlot slot) { |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
217 int slotIndex = slot.getIndex(); |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
218 if (slotIndex >= tags.length) { |
13201
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
219 if (!resize()) { |
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
220 throw new IllegalArgumentException(String.format("The frame slot '%s' is not known by the frame descriptor.", slot)); |
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
221 } |
10911
3c398866d634
Frame.isInitialized: add method substitution and suppress AIOOBE if frame size < descriptor size.
Andreas Woess <andreas.woess@jku.at>
parents:
10680
diff
changeset
|
222 } |
12643
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
223 return tags[slotIndex]; |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
224 } |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
225 |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
226 @Override |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
227 public boolean isObject(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
228 return getTag(slot) == FrameSlotKind.Object.ordinal(); |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
229 } |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
230 |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
231 @Override |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
232 public boolean isByte(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
233 return getTag(slot) == FrameSlotKind.Byte.ordinal(); |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
234 } |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
235 |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
236 @Override |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
237 public boolean isBoolean(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
238 return getTag(slot) == FrameSlotKind.Boolean.ordinal(); |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
239 } |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
240 |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
241 @Override |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
242 public boolean isInt(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
243 return getTag(slot) == FrameSlotKind.Int.ordinal(); |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
244 } |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
245 |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
246 @Override |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
247 public boolean isLong(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
248 return getTag(slot) == FrameSlotKind.Long.ordinal(); |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
249 } |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
250 |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
251 @Override |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
252 public boolean isFloat(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
253 return getTag(slot) == FrameSlotKind.Float.ordinal(); |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
254 } |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
255 |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
256 @Override |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
257 public boolean isDouble(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
258 return getTag(slot) == FrameSlotKind.Double.ordinal(); |
9952
5d91b0b67cba
Introduce Frame.isInitialized in the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9330
diff
changeset
|
259 } |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
260 } |