annotate truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultDirectCallNode.java @ 22157:dc83cc1f94f2

Using fully qualified imports
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Wed, 16 Sep 2015 11:33:22 +0200
parents 9c8c0937da41
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13983
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
1 /*
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
4 *
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
7 * published by the Free Software Foundation. Oracle designates this
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
8 * particular file as subject to the "Classpath" exception as provided
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
9 * by Oracle in the LICENSE file that accompanied this code.
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
10 *
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
11 * This code is distributed in the hope that it will be useful, but WITHOUT
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
14 * version 2 for more details (a copy is included in the LICENSE file that
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
15 * accompanied this code).
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
16 *
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License version
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
18 * 2 along with this work; if not, write to the Free Software Foundation,
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
20 *
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
22 * or visit www.oracle.com if you need additional information or have any
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
23 * questions.
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
24 */
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
25 package com.oracle.truffle.api.impl;
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
26
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
27 import com.oracle.truffle.api.CallTarget;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
28 import com.oracle.truffle.api.Truffle;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
29 import com.oracle.truffle.api.frame.Frame;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
30 import com.oracle.truffle.api.frame.FrameInstance;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
31 import com.oracle.truffle.api.frame.VirtualFrame;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
32 import com.oracle.truffle.api.nodes.DirectCallNode;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
33 import com.oracle.truffle.api.nodes.Node;
13983
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
34
15093
5634b199c4da Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents: 15091
diff changeset
35 /**
5634b199c4da Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents: 15091
diff changeset
36 * This is runtime specific API. Do not use in a guest language.
5634b199c4da Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents: 15091
diff changeset
37 */
5634b199c4da Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents: 15091
diff changeset
38 public final class DefaultDirectCallNode extends DirectCallNode {
13983
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
39
15089
448338c9ce96 Truffle: Made inlining context-insensitive again to reduce complexity.
Christian Humer <christian.humer@gmail.com>
parents: 15064
diff changeset
40 private boolean inliningForced;
448338c9ce96 Truffle: Made inlining context-insensitive again to reduce complexity.
Christian Humer <christian.humer@gmail.com>
parents: 15064
diff changeset
41
17149
0a35e2789735 Truffle: remove unnecessary DefaultTruffleRuntime fields
Andreas Woess <andreas.woess@jku.at>
parents: 15564
diff changeset
42 public DefaultDirectCallNode(CallTarget target) {
13983
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
43 super(target);
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
44 }
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
45
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
46 @Override
15564
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
47 public Object call(final VirtualFrame frame, Object[] arguments) {
17149
0a35e2789735 Truffle: remove unnecessary DefaultTruffleRuntime fields
Andreas Woess <andreas.woess@jku.at>
parents: 15564
diff changeset
48 final CallTarget currentCallTarget = defaultTruffleRuntime().getCurrentFrame().getCallTarget();
15564
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
49 FrameInstance frameInstance = new FrameInstance() {
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
50
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
51 public Frame getFrame(FrameAccess access, boolean slowPath) {
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
52 return frame;
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
53 }
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
54
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
55 public boolean isVirtualFrame() {
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
56 return false;
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
57 }
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
58
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
59 public Node getCallNode() {
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
60 return DefaultDirectCallNode.this;
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
61 }
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
62
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
63 public CallTarget getCallTarget() {
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
64 return currentCallTarget;
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
65 }
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
66 };
17149
0a35e2789735 Truffle: remove unnecessary DefaultTruffleRuntime fields
Andreas Woess <andreas.woess@jku.at>
parents: 15564
diff changeset
67 defaultTruffleRuntime().pushFrame(frameInstance);
15564
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
68 try {
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
69 return getCurrentCallTarget().call(arguments);
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
70 } finally {
17149
0a35e2789735 Truffle: remove unnecessary DefaultTruffleRuntime fields
Andreas Woess <andreas.woess@jku.at>
parents: 15564
diff changeset
71 defaultTruffleRuntime().popFrame();
15564
a3b0ecef8a15 Truffle: Provide default implementation on non-Graal VMs for stack trace functionality.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15093
diff changeset
72 }
15064
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
73 }
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
74
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
75 @Override
15093
5634b199c4da Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents: 15091
diff changeset
76 public void forceInlining() {
5634b199c4da Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents: 15091
diff changeset
77 inliningForced = true;
15064
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
78 }
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
79
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
80 @Override
15093
5634b199c4da Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents: 15091
diff changeset
81 public boolean isInliningForced() {
5634b199c4da Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents: 15091
diff changeset
82 return inliningForced;
13983
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
83 }
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
84
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
85 @Override
18162
ab62800259ff Truffle: renamed the splitting to callTargetCloning. Made RootNode cloning an implementation detail of the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents: 17400
diff changeset
86 public CallTarget getClonedCallTarget() {
13983
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
87 return null;
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
88 }
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
89
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
90 @Override
18162
ab62800259ff Truffle: renamed the splitting to callTargetCloning. Made RootNode cloning an implementation detail of the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents: 17400
diff changeset
91 public boolean cloneCallTarget() {
13983
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
92 return false;
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
93 }
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
94
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
95 @Override
18162
ab62800259ff Truffle: renamed the splitting to callTargetCloning. Made RootNode cloning an implementation detail of the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents: 17400
diff changeset
96 public boolean isCallTargetCloningAllowed() {
13983
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
97 return false;
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
98 }
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
99
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
100 @Override
14566
6681b9eb3f4c Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents: 14078
diff changeset
101 public boolean isInlinable() {
6681b9eb3f4c Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents: 14078
diff changeset
102 return false;
6681b9eb3f4c Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents: 14078
diff changeset
103 }
6681b9eb3f4c Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents: 14078
diff changeset
104
17149
0a35e2789735 Truffle: remove unnecessary DefaultTruffleRuntime fields
Andreas Woess <andreas.woess@jku.at>
parents: 15564
diff changeset
105 private static DefaultTruffleRuntime defaultTruffleRuntime() {
0a35e2789735 Truffle: remove unnecessary DefaultTruffleRuntime fields
Andreas Woess <andreas.woess@jku.at>
parents: 15564
diff changeset
106 return (DefaultTruffleRuntime) Truffle.getRuntime();
0a35e2789735 Truffle: remove unnecessary DefaultTruffleRuntime fields
Andreas Woess <andreas.woess@jku.at>
parents: 15564
diff changeset
107 }
13983
f46cab39a9a2 Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
108 }