Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultVirtualFrame.java @ 13201:833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 22 Nov 2013 14:45:09 +0100 |
parents | 856a9864ed93 |
children | a12017c18d5d |
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 |
7307
dc3e86fd3be1
Introduce cutomization capability for canonicalizer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7267
diff
changeset
|
32 public 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
|
33 |
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
|
34 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
|
35 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
|
36 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
|
37 private Object[] locals; |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
38 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
|
39 |
7307
dc3e86fd3be1
Introduce cutomization capability for canonicalizer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7267
diff
changeset
|
40 public 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
|
41 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
|
42 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
|
43 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
|
44 this.locals = new Object[descriptor.getSize()]; |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
45 Arrays.fill(locals, descriptor.getTypeConversion().getDefaultValue()); |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
46 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
|
47 } |
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 |
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
|
49 @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
|
50 @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
|
51 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
|
52 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
|
53 } |
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
|
54 |
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 |
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
|
56 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
|
57 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
|
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 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
|
62 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
|
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 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
|
67 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
|
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 |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
71 public Object getObject(FrameSlot slot) throws FrameSlotTypeException { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
72 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
|
73 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
|
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 |
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
|
76 @Override |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
77 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
|
78 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
|
79 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
|
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 |
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
|
82 @Override |
11427
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
83 public byte getByte(FrameSlot slot) throws FrameSlotTypeException { |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
84 verifyGet(slot, FrameSlotKind.Byte); |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
85 return (byte) locals[slot.getIndex()]; |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
86 } |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
87 |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
88 @Override |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
89 public void setByte(FrameSlot slot, byte value) { |
11427
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
90 verifySet(slot, FrameSlotKind.Byte); |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
91 locals[slot.getIndex()] = value; |
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 |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
94 @Override |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
95 public boolean getBoolean(FrameSlot slot) throws FrameSlotTypeException { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
96 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
|
97 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
|
98 } |
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
|
99 |
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
|
100 @Override |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
101 public void setBoolean(FrameSlot slot, boolean value) { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
102 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
|
103 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
|
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 |
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
|
106 @Override |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
107 public int getInt(FrameSlot slot) throws FrameSlotTypeException { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
108 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
|
109 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
|
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 |
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
|
112 @Override |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
113 public void setInt(FrameSlot slot, int value) { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
114 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
|
115 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
|
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 |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
118 @Override |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
119 public long getLong(FrameSlot slot) throws FrameSlotTypeException { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
120 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
|
121 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
|
122 } |
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
|
123 |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
124 @Override |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
125 public void setLong(FrameSlot slot, long value) { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
126 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
|
127 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
|
128 } |
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
|
129 |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
130 @Override |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
131 public float getFloat(FrameSlot slot) throws FrameSlotTypeException { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
132 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
|
133 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
|
134 } |
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
|
135 |
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
|
136 @Override |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
137 public void setFloat(FrameSlot slot, float value) { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
138 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
|
139 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
|
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 |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
142 @Override |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
143 public double getDouble(FrameSlot slot) throws FrameSlotTypeException { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
144 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
|
145 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
|
146 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
147 |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
148 @Override |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
149 public void setDouble(FrameSlot slot, double value) { |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
150 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
|
151 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
|
152 } |
7721
1a2d258d481a
Added getFrameDescriptor() to Frame interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
153 |
1a2d258d481a
Added getFrameDescriptor() to Frame interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
154 @Override |
1a2d258d481a
Added getFrameDescriptor() to Frame interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
155 public FrameDescriptor getFrameDescriptor() { |
1a2d258d481a
Added getFrameDescriptor() to Frame interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
156 return this.descriptor; |
1a2d258d481a
Added getFrameDescriptor() to Frame interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
157 } |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
158 |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
159 @Override |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
160 public Object getValue(FrameSlot slot) { |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
161 int slotIndex = slot.getIndex(); |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
162 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
|
163 if (!resize()) { |
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
164 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
|
165 } |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
166 } |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
167 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
|
168 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
169 |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
170 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
|
171 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
|
172 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
|
173 if (!resize()) { |
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
174 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
|
175 } |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
176 } |
9321
cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents:
9278
diff
changeset
|
177 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
|
178 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
179 |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
180 private void verifyGet(FrameSlot slot, FrameSlotKind accessKind) throws FrameSlotTypeException { |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
181 int slotIndex = slot.getIndex(); |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
182 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
|
183 if (!resize()) { |
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
184 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
|
185 } |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
186 } |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
187 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
|
188 if (accessKind == FrameSlotKind.Object ? tag != 0 : tag != accessKind.ordinal()) { |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
189 if (slot.getKind() == accessKind || tag == 0) { |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
190 descriptor.getTypeConversion().updateFrameSlot(this, slot, getValue(slot)); |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
191 if (tags[slotIndex] == accessKind.ordinal()) { |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
192 return; |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
193 } |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
194 } |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
195 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
|
196 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
197 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8567
diff
changeset
|
198 |
13201
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
199 private boolean resize() { |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
200 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
|
201 int newSize = descriptor.getSize(); |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
202 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
|
203 locals = Arrays.copyOf(locals, newSize); |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
204 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
|
205 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
|
206 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
|
207 } |
13201
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
208 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
|
209 } |
9952
5d91b0b67cba
Introduce Frame.isInitialized in the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9330
diff
changeset
|
210 |
12643
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
211 private byte getTag(FrameSlot slot) { |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
212 int slotIndex = slot.getIndex(); |
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
213 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
|
214 if (!resize()) { |
833f8e96d0a5
Truffle: improved error mesage for accessing unknonw frame slots.
Christian Humer <christian.humer@gmail.com>
parents:
12643
diff
changeset
|
215 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
|
216 } |
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
|
217 } |
12643
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
218 return tags[slotIndex]; |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
219 } |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
220 |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
221 @Override |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
222 public boolean isObject(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
223 return getTag(slot) == FrameSlotKind.Object.ordinal(); |
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 isByte(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
228 return getTag(slot) == FrameSlotKind.Byte.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 isBoolean(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
233 return getTag(slot) == FrameSlotKind.Boolean.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 isInt(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
238 return getTag(slot) == FrameSlotKind.Int.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 isLong(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
243 return getTag(slot) == FrameSlotKind.Long.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 isFloat(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
248 return getTag(slot) == FrameSlotKind.Float.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 isDouble(FrameSlot slot) { |
856a9864ed93
Frame: add is<Type> methods.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
253 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
|
254 } |
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
|
255 } |