Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/internal/SpecializationNode.java @ 21576:9c2c8e4b5333
Merge with 4b3b38415adf974774952abb69b359053d6f0018
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Thu, 28 May 2015 10:16:13 -0700 |
parents | 986f1c0d6f55 |
children | b1530a6cce8c |
rev | line source |
---|---|
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * accompanied this code). |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 * questions. |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 */ |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
25 package com.oracle.truffle.api.dsl.internal; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
26 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 import java.lang.reflect.*; |
19291
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
28 import java.util.*; |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
29 import java.util.concurrent.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
30 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
31 import com.oracle.truffle.api.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
32 import com.oracle.truffle.api.dsl.*; |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
33 import com.oracle.truffle.api.dsl.internal.SlowPathEvent.SlowPathEvent0; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
34 import com.oracle.truffle.api.dsl.internal.SlowPathEvent.SlowPathEvent1; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
35 import com.oracle.truffle.api.dsl.internal.SlowPathEvent.SlowPathEvent2; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
36 import com.oracle.truffle.api.dsl.internal.SlowPathEvent.SlowPathEvent3; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
37 import com.oracle.truffle.api.dsl.internal.SlowPathEvent.SlowPathEvent4; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
38 import com.oracle.truffle.api.dsl.internal.SlowPathEvent.SlowPathEvent5; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
39 import com.oracle.truffle.api.dsl.internal.SlowPathEvent.SlowPathEventN; |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
40 import com.oracle.truffle.api.frame.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
41 import com.oracle.truffle.api.nodes.*; |
20129
5b7db8941fd7
Truffle: make NodeClass and NodeField a top-level class.
Christian Humer <christian.humer@gmail.com>
parents:
19786
diff
changeset
|
42 import com.oracle.truffle.api.nodes.NodeFieldAccessor; |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
43 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 /** |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
45 * Internal implementation dependent base class for generated specialized nodes. |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
46 */ |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
47 @NodeInfo(cost = NodeCost.NONE) |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
48 @SuppressWarnings("unused") |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
49 public abstract class SpecializationNode extends Node { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
50 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
51 @Child protected SpecializationNode next; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
52 |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
53 final int index; |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
54 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
55 public SpecializationNode() { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
56 this(-1); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
57 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
58 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
59 public SpecializationNode(int index) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
60 this.index = index; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
61 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
62 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
63 @Override |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
64 public final NodeCost getCost() { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
65 return NodeCost.NONE; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
66 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
67 |
19281
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
68 public void reset() { |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
69 SpecializationNode start = findStart(); |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
70 SpecializationNode end = findEnd(); |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
71 if (start != end) { |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
72 start.replace(end, "reset specialization"); |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
73 } |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
74 } |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
75 |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
76 public static Node updateRoot(Node node) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
77 updateRootImpl(((SpecializedNode) node).getSpecializationNode(), node); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
78 return node; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
79 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
80 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
81 private static void updateRootImpl(SpecializationNode start, Node node) { |
20130
8dc73c226c63
Truffle: cache NodeClass lookup in Node.
Christian Humer <christian.humer@gmail.com>
parents:
20129
diff
changeset
|
82 NodeFieldAccessor[] fields = NodeClass.get(start).getFields(); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
83 for (int i = fields.length - 1; i >= 0; i--) { |
20129
5b7db8941fd7
Truffle: make NodeClass and NodeField a top-level class.
Christian Humer <christian.humer@gmail.com>
parents:
19786
diff
changeset
|
84 NodeFieldAccessor f = fields[i]; |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
85 if (f.getName().equals("root")) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
86 f.putObject(start, node); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
87 break; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
88 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
89 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
90 if (start.next != null) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
91 updateRootImpl(start.next, node); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
92 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
93 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
94 |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
95 protected final SpecializationNode polymorphicMerge(SpecializationNode newNode, SpecializationNode merged) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
96 if (merged == newNode && count() <= 2) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
97 return removeSame(new SlowPathEvent0(this, "merged polymorphic to monomorphic", null)); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
98 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
99 return merged; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
100 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
101 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
102 public final NodeCost getNodeCost() { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
103 switch (count()) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
104 case 0: |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
105 case 1: |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
106 return NodeCost.UNINITIALIZED; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
107 case 2: |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
108 return NodeCost.MONOMORPHIC; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
109 default: |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
110 return NodeCost.POLYMORPHIC; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
111 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
112 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
113 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
114 protected abstract Node[] getSuppliedChildren(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
115 |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
116 protected SpecializationNode merge(SpecializationNode newNode, Frame frame) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
117 if (isIdentical(newNode, frame)) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
118 return this; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
119 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
120 return next != null ? next.merge(newNode, frame) : newNode; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
121 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
122 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
123 protected SpecializationNode merge(SpecializationNode newNode, Frame frame, Object o1) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
124 if (isIdentical(newNode, frame, o1)) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
125 return this; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
126 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
127 return next != null ? next.merge(newNode, frame, o1) : newNode; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
128 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
129 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
130 protected SpecializationNode merge(SpecializationNode newNode, Frame frame, Object o1, Object o2) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
131 if (isIdentical(newNode, frame, o1, o2)) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
132 return this; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
133 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
134 return next != null ? next.merge(newNode, frame, o1, o2) : newNode; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
135 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
136 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
137 protected SpecializationNode merge(SpecializationNode newNode, Frame frame, Object o1, Object o2, Object o3) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
138 if (isIdentical(newNode, frame, o1, o2, o3)) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
139 return this; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
140 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
141 return next != null ? next.merge(newNode, frame, o1, o2, o3) : newNode; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
142 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
143 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
144 protected SpecializationNode merge(SpecializationNode newNode, Frame frame, Object o1, Object o2, Object o3, Object o4) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
145 if (isIdentical(newNode, frame, o1, o2, o3, o4)) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
146 return this; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
147 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
148 return next != null ? next.merge(newNode, frame, o1, o2, o3, o4) : newNode; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
149 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
150 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
151 protected SpecializationNode merge(SpecializationNode newNode, Frame frame, Object o1, Object o2, Object o3, Object o4, Object o5) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
152 if (isIdentical(newNode, frame, o1, o2, o3, o4, o5)) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
153 return this; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
154 } |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
155 return next != null ? next.merge(newNode, frame, o1, o2, o3, o4, o5) : newNode; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
156 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
157 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
158 protected SpecializationNode merge(SpecializationNode newNode, Frame frame, Object... args) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
159 if (isIdentical(newNode, frame, args)) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
160 return this; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
161 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
162 return next != null ? next.merge(newNode, frame, args) : newNode; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
163 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
164 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
165 protected boolean isSame(SpecializationNode other) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
166 return getClass() == other.getClass(); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
167 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
168 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
169 protected boolean isIdentical(SpecializationNode newNode, Frame frame) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
170 return isSame(newNode); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
171 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
172 |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
173 protected boolean isIdentical(SpecializationNode newNode, Frame frame, Object o1) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
174 return isSame(newNode); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
175 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
176 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
177 protected boolean isIdentical(SpecializationNode newNode, Frame frame, Object o1, Object o2) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
178 return isSame(newNode); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
179 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
180 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
181 protected boolean isIdentical(SpecializationNode newNode, Frame frame, Object o1, Object o2, Object o3) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
182 return isSame(newNode); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
183 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
184 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
185 protected boolean isIdentical(SpecializationNode newNode, Frame frame, Object o1, Object o2, Object o3, Object o4) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
186 return isSame(newNode); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
187 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
188 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
189 protected boolean isIdentical(SpecializationNode newNode, Frame frame, Object o1, Object o2, Object o3, Object o4, Object o5) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
190 return isSame(newNode); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
191 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
192 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
193 protected boolean isIdentical(SpecializationNode newNode, Frame frame, Object... args) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
194 return isSame(newNode); |
19289
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
195 } |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
196 |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
197 protected final int countSame(SpecializationNode node) { |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
198 return findStart().countSameImpl(node); |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
199 } |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
200 |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
201 private int countSameImpl(SpecializationNode node) { |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
202 if (next != null) { |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
203 return next.countSameImpl(node) + (isSame(node) ? 1 : 0); |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
204 } else { |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
205 return 0; |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
206 } |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
207 } |
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
208 |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
209 @Override |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
210 public final boolean equals(Object obj) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
211 if (obj instanceof SpecializationNode) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
212 return ((SpecializationNode) obj).isSame(this); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
213 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
214 return super.equals(obj); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
215 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
216 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
217 @Override |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
218 public final int hashCode() { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
219 return index; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
220 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
221 |
18766
a720bf2e2f43
Truffle-DSL: checkstyle fixes.
Christian Humer <christian.humer@gmail.com>
parents:
18761
diff
changeset
|
222 private int count() { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
223 return next != null ? next.count() + 1 : 1; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
224 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
225 |
19281
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
226 private SpecializationNode findEnd() { |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
227 SpecializationNode node = this; |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
228 while (node.next != null) { |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
229 node = node.next; |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
230 } |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
231 return node; |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
232 } |
92880b0f7fed
Truffle-DSL: add internal API support to reset the specialization chain.
Christian Humer <christian.humer@gmail.com>
parents:
18802
diff
changeset
|
233 |
19291
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
234 protected final Object removeThis(final CharSequence reason, Frame frame) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
235 return removeThisImpl(reason).acceptAndExecute(frame); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
236 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
237 |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
238 protected final Object removeThis(final CharSequence reason, Frame frame, Object o1) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
239 return removeThisImpl(reason).acceptAndExecute(frame, o1); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
240 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
241 |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
242 protected final Object removeThis(final CharSequence reason, Frame frame, Object o1, Object o2) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
243 return removeThisImpl(reason).acceptAndExecute(frame, o1, o2); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
244 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
245 |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
246 protected final Object removeThis(final CharSequence reason, Frame frame, Object o1, Object o2, Object o3) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
247 return removeThisImpl(reason).acceptAndExecute(frame, o1, o2, o3); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
248 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
249 |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
250 protected final Object removeThis(final CharSequence reason, Frame frame, Object o1, Object o2, Object o3, Object o4) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
251 return removeThisImpl(reason).acceptAndExecute(frame, o1, o2, o3, o4); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
252 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
253 |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
254 protected final Object removeThis(final CharSequence reason, Frame frame, Object o1, Object o2, Object o3, Object o4, Object o5) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
255 return removeThisImpl(reason).acceptAndExecute(frame, o1, o2, o3, o4, o5); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
256 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
257 |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
258 protected final Object removeThis(final CharSequence reason, Frame frame, Object... args) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
259 return removeThisImpl(reason).acceptAndExecute(frame, args); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
260 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
261 |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
262 private SpecializationNode removeThisImpl(final CharSequence reason) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
263 this.replace(this.next, reason); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
264 return findEnd().findStart(); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
265 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
266 |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
267 protected final SpecializationNode removeSame(final CharSequence reason) { |
19784
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
268 SpecializationNode start = SpecializationNode.this.findStart(); |
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
269 SpecializationNode current = start; |
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
270 while (current != null) { |
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
271 if (current.isSame(SpecializationNode.this)) { |
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
272 NodeUtil.nonAtomicReplace(current, current.next, reason); |
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
273 if (current == start) { |
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
274 start = start.next; |
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
275 } |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
276 } |
19784
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
277 current = current.next; |
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
278 } |
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
279 return SpecializationNode.this.findEnd().findStart(); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
280 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
281 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
282 /** Find the topmost of the specialization chain. */ |
18766
a720bf2e2f43
Truffle-DSL: checkstyle fixes.
Christian Humer <christian.humer@gmail.com>
parents:
18761
diff
changeset
|
283 private SpecializationNode findStart() { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
284 SpecializationNode node = this; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
285 Node parent = this.getParent(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
286 while (parent instanceof SpecializationNode) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
287 SpecializationNode parentCast = ((SpecializationNode) parent); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
288 if (parentCast.next != node) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
289 break; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
290 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
291 node = parentCast; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
292 parent = node.getParent(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
293 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
294 return node; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
295 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
296 |
19289
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
297 private Node findRoot() { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
298 return findStart().getParent(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
299 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
300 |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
301 private SpecializedNode findSpecializedNode() { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
302 return (SpecializedNode) findEnd().findStart().getParent(); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
303 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
304 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
305 private static SpecializationNode removeSameImpl(SpecializationNode toRemove, CharSequence reason) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
306 SpecializationNode start = toRemove.findStart(); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
307 SpecializationNode current = start; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
308 while (current != null) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
309 if (current.isSame(toRemove)) { |
19765
f682b9e6ca07
Truffle: expose non-atomic replace API to Truffle DSL to avoid multiple RootNode lookups for multiple replaces in one atomic block.
Christian Humer <christian.humer@gmail.com>
parents:
19764
diff
changeset
|
310 NodeUtil.nonAtomicReplace(current, current.next, reason); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
311 if (current == start) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
312 start = start.next; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
313 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
314 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
315 current = current.next; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
316 } |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
317 return toRemove.findEnd().findStart(); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
318 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
319 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
320 public Object acceptAndExecute(Frame frame) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
321 throw new UnsupportedOperationException(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
322 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
323 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
324 public Object acceptAndExecute(Frame frame, Object o1) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
325 throw new UnsupportedOperationException(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
326 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
327 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
328 public Object acceptAndExecute(Frame frame, Object o1, Object o2) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
329 throw new UnsupportedOperationException(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
330 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
331 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
332 public Object acceptAndExecute(Frame frame, Object o1, Object o2, Object o3) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
333 throw new UnsupportedOperationException(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
334 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
335 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
336 public Object acceptAndExecute(Frame frame, Object o1, Object o2, Object o3, Object o4) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
337 throw new UnsupportedOperationException(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
338 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
339 |
18802
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
340 public Object acceptAndExecute(Frame frame, Object o1, Object o2, Object o3, Object o4, Object o5) { |
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
341 throw new UnsupportedOperationException(); |
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
342 } |
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
343 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
344 public Object acceptAndExecute(Frame frame, Object... args) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
345 throw new UnsupportedOperationException(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
346 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
347 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
348 protected SpecializationNode createFallback() { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
349 return null; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
350 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
351 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
352 protected SpecializationNode createPolymorphic() { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
353 return null; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
354 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
355 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
356 protected SpecializationNode createNext(Frame frame) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
357 throw new UnsupportedOperationException(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
358 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
359 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
360 protected SpecializationNode createNext(Frame frame, Object o1) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
361 throw new UnsupportedOperationException(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
362 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
363 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
364 protected SpecializationNode createNext(Frame frame, Object o1, Object o2) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
365 throw new UnsupportedOperationException(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
366 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
367 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
368 protected SpecializationNode createNext(Frame frame, Object o1, Object o2, Object o3) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
369 throw new UnsupportedOperationException(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
370 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
371 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
372 protected SpecializationNode createNext(Frame frame, Object o1, Object o2, Object o3, Object o4) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
373 throw new UnsupportedOperationException(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
374 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
375 |
18802
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
376 protected SpecializationNode createNext(Frame frame, Object o1, Object o2, Object o3, Object o4, Object o5) { |
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
377 throw new UnsupportedOperationException(); |
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
378 } |
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
379 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
380 protected SpecializationNode createNext(Frame frame, Object... args) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
381 throw new UnsupportedOperationException(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
382 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
383 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
384 protected final Object uninitialized(Frame frame) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
385 CompilerDirectives.transferToInterpreterAndInvalidate(); |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
386 SpecializationNode newNode = atomic(new InsertionEvent0(this, "insert new specialization", frame)); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
387 if (newNode == null) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
388 return unsupported(frame); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
389 } |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
390 return newNode.acceptAndExecute(frame); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
391 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
392 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
393 protected final Object uninitialized(Frame frame, Object o1) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
394 CompilerDirectives.transferToInterpreterAndInvalidate(); |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
395 SpecializationNode newNode = atomic(new InsertionEvent1(this, "insert new specialization", frame, o1)); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
396 if (newNode == null) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
397 return unsupported(frame, o1); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
398 } |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
399 return newNode.acceptAndExecute(frame, o1); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
400 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
401 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
402 protected final Object uninitialized(Frame frame, Object o1, Object o2) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
403 CompilerDirectives.transferToInterpreterAndInvalidate(); |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
404 SpecializationNode newNode = atomic(new InsertionEvent2(this, "insert new specialization", frame, o1, o2)); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
405 if (newNode == null) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
406 return unsupported(frame, o1, o2); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
407 } |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
408 return newNode.acceptAndExecute(frame, o1, o2); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
409 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
410 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
411 protected final Object uninitialized(Frame frame, Object o1, Object o2, Object o3) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
412 CompilerDirectives.transferToInterpreterAndInvalidate(); |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
413 SpecializationNode newNode = atomic(new InsertionEvent3(this, "insert new specialization", frame, o1, o2, o3)); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
414 if (newNode == null) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
415 return unsupported(frame, o1, o2, o3); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
416 } |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
417 return newNode.acceptAndExecute(frame, o1, o2, o3); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
418 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
419 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
420 protected final Object uninitialized(Frame frame, Object o1, Object o2, Object o3, Object o4) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
421 CompilerDirectives.transferToInterpreterAndInvalidate(); |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
422 SpecializationNode newNode = atomic(new InsertionEvent4(this, "insert new specialization", frame, o1, o2, o3, o4)); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
423 if (newNode == null) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
424 return unsupported(frame, o1, o2, o3, o4); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
425 } |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
426 return newNode.acceptAndExecute(frame, o1, o2, o3, o4); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
427 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
428 |
18802
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
429 protected final Object uninitialized(Frame frame, Object o1, Object o2, Object o3, Object o4, Object o5) { |
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
430 CompilerDirectives.transferToInterpreterAndInvalidate(); |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
431 SpecializationNode newNode = atomic(new InsertionEvent5(this, "insert new specialization", frame, o1, o2, o3, o4, o5)); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
432 if (newNode == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
433 return unsupported(frame, o1, o2, o3, o4, o5); |
18802
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
434 } |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
435 return newNode.acceptAndExecute(frame, o1, o2, o3, o4, o5); |
18802
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
436 } |
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
437 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
438 protected final Object uninitialized(Frame frame, Object... args) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
439 CompilerDirectives.transferToInterpreterAndInvalidate(); |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
440 SpecializationNode newNode = atomic(new InsertionEventN(this, "insert new specialization", frame, args)); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
441 if (newNode == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
442 return unsupported(frame, args); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
443 } |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
444 return newNode.acceptAndExecute(frame, args); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
445 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
446 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
447 protected final Object remove(String reason, Frame frame) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
448 return atomic(new RemoveEvent0(this, reason, frame)).acceptAndExecute(frame); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
449 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
450 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
451 protected final Object remove(String reason, Frame frame, Object o1) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
452 return atomic(new RemoveEvent1(this, reason, frame, o1)).acceptAndExecute(frame, o1); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
453 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
454 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
455 protected final Object remove(String reason, Frame frame, Object o1, Object o2) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
456 return atomic(new RemoveEvent2(this, reason, frame, o1, o2)).acceptAndExecute(frame, o1, o2); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
457 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
458 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
459 protected final Object remove(String reason, Frame frame, Object o1, Object o2, Object o3) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
460 return atomic(new RemoveEvent3(this, reason, frame, o1, o2, o3)).acceptAndExecute(frame, o1, o2, o3); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
461 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
462 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
463 protected final Object remove(String reason, Frame frame, Object o1, Object o2, Object o3, Object o4) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
464 return atomic(new RemoveEvent4(this, reason, frame, o1, o2, o3, o4)).acceptAndExecute(frame, o1, o2, o3, o4); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
465 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
466 |
18802
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
467 protected final Object remove(String reason, Frame frame, Object o1, Object o2, Object o3, Object o4, Object o5) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
468 return atomic(new RemoveEvent5(this, reason, frame, o1, o2, o3, o4, o5)).acceptAndExecute(frame, o1, o2, o3, o4, o5); |
18802
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
469 } |
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
470 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
471 protected final Object remove(String reason, Frame frame, Object... args) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
472 return atomic(new RemoveEventN(this, reason, frame, args)).acceptAndExecute(frame, args); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
473 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
474 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
475 protected Object unsupported(Frame frame) { |
19289
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
476 throw new UnsupportedSpecializationException(findRoot(), getSuppliedChildren()); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
477 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
478 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
479 protected Object unsupported(Frame frame, Object o1) { |
19289
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
480 throw new UnsupportedSpecializationException(findRoot(), getSuppliedChildren(), o1); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
481 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
482 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
483 protected Object unsupported(Frame frame, Object o1, Object o2) { |
19289
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
484 throw new UnsupportedSpecializationException(findRoot(), getSuppliedChildren(), o1, o2); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
485 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
486 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
487 protected Object unsupported(Frame frame, Object o1, Object o2, Object o3) { |
19289
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
488 throw new UnsupportedSpecializationException(findRoot(), getSuppliedChildren(), o1, o2, o3); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
489 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
490 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
491 protected Object unsupported(Frame frame, Object o1, Object o2, Object o3, Object o4) { |
19289
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
492 throw new UnsupportedSpecializationException(findRoot(), getSuppliedChildren(), o1, o2, o3, o4); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
493 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
494 |
18802
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
495 protected Object unsupported(Frame frame, Object o1, Object o2, Object o3, Object o4, Object o5) { |
19289
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
496 throw new UnsupportedSpecializationException(findRoot(), getSuppliedChildren(), o1, o2, o3, o4, o5); |
18802
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
497 } |
71e372cae32e
Truffle-DSL: increase maximum number of acceptAndExecute arguments to 5.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
498 |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18766
diff
changeset
|
499 protected Object unsupported(Frame frame, Object... args) { |
19289
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
500 throw new UnsupportedSpecializationException(findRoot(), getSuppliedChildren(), args); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
501 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
502 |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
503 static SpecializationNode insertSorted(SpecializationNode start, final SpecializationNode generated, final CharSequence message, final SpecializationNode merged) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
504 if (merged == generated) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
505 // new node |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
506 if (start.count() == 2) { |
21065
986f1c0d6f55
Truffle-DSL: do not generate polymorphic nodes for nodes with all parameters evaluated in all execute methods.
Christian Humer <christian.humer@oracle.com>
parents:
20130
diff
changeset
|
507 SpecializationNode polymorphic = start.createPolymorphic(); |
986f1c0d6f55
Truffle-DSL: do not generate polymorphic nodes for nodes with all parameters evaluated in all execute methods.
Christian Humer <christian.humer@oracle.com>
parents:
20130
diff
changeset
|
508 /* |
986f1c0d6f55
Truffle-DSL: do not generate polymorphic nodes for nodes with all parameters evaluated in all execute methods.
Christian Humer <christian.humer@oracle.com>
parents:
20130
diff
changeset
|
509 * For nodes with all parameters evaluated in the execute method we do not need a |
986f1c0d6f55
Truffle-DSL: do not generate polymorphic nodes for nodes with all parameters evaluated in all execute methods.
Christian Humer <christian.humer@oracle.com>
parents:
20130
diff
changeset
|
510 * polymorphic node. the generated code returns null in createPolymorphic in this |
986f1c0d6f55
Truffle-DSL: do not generate polymorphic nodes for nodes with all parameters evaluated in all execute methods.
Christian Humer <christian.humer@oracle.com>
parents:
20130
diff
changeset
|
511 * case. |
986f1c0d6f55
Truffle-DSL: do not generate polymorphic nodes for nodes with all parameters evaluated in all execute methods.
Christian Humer <christian.humer@oracle.com>
parents:
20130
diff
changeset
|
512 */ |
986f1c0d6f55
Truffle-DSL: do not generate polymorphic nodes for nodes with all parameters evaluated in all execute methods.
Christian Humer <christian.humer@oracle.com>
parents:
20130
diff
changeset
|
513 if (polymorphic != null) { |
986f1c0d6f55
Truffle-DSL: do not generate polymorphic nodes for nodes with all parameters evaluated in all execute methods.
Christian Humer <christian.humer@oracle.com>
parents:
20130
diff
changeset
|
514 insertAt(start, polymorphic, "insert polymorphic"); |
986f1c0d6f55
Truffle-DSL: do not generate polymorphic nodes for nodes with all parameters evaluated in all execute methods.
Christian Humer <christian.humer@oracle.com>
parents:
20130
diff
changeset
|
515 } |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
516 } |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
517 SpecializationNode current = start; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
518 while (current != null && current.index < generated.index) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
519 current = current.next; |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
520 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
521 return insertAt(current, generated, message); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
522 } else { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
523 // existing node |
19289
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
19281
diff
changeset
|
524 return start; |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
525 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
526 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
527 |
19765
f682b9e6ca07
Truffle: expose non-atomic replace API to Truffle DSL to avoid multiple RootNode lookups for multiple replaces in one atomic block.
Christian Humer <christian.humer@gmail.com>
parents:
19764
diff
changeset
|
528 static <T> SpecializationNode insertAt(SpecializationNode node, SpecializationNode insertBefore, CharSequence reason) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
529 insertBefore.next = node; |
19765
f682b9e6ca07
Truffle: expose non-atomic replace API to Truffle DSL to avoid multiple RootNode lookups for multiple replaces in one atomic block.
Christian Humer <christian.humer@gmail.com>
parents:
19764
diff
changeset
|
530 // always guaranteed to be executed inside of an atomic block |
f682b9e6ca07
Truffle: expose non-atomic replace API to Truffle DSL to avoid multiple RootNode lookups for multiple replaces in one atomic block.
Christian Humer <christian.humer@gmail.com>
parents:
19764
diff
changeset
|
531 return NodeUtil.nonAtomicReplace(node, insertBefore, reason); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
532 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
533 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
534 @Override |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
535 public final String toString() { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
536 Class<?> clazz = getClass(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
537 StringBuilder b = new StringBuilder(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
538 b.append(clazz.getSimpleName()); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
539 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
540 appendFields(b, clazz); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
541 if (next != null) { |
19291
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
542 b.append("\n -> ").append(next.toString()); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
543 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
544 return b.toString(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
545 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
546 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
547 private void appendFields(StringBuilder b, Class<?> clazz) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
548 Field[] fields = clazz.getDeclaredFields(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
549 if (fields.length == 0) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
550 return; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
551 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
552 b.append("("); |
19291
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
553 String sep = ""; |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
554 for (Field field : fields) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
555 if (Modifier.isStatic(field.getModifiers())) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
556 continue; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
557 } |
19291
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
558 b.append(sep); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
559 String name = field.getName(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
560 if (name.equals("root")) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
561 continue; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
562 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
563 b.append(field.getName()); |
19291
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
564 b.append(" = "); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
565 try { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
566 field.setAccessible(true); |
19291
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
567 Object value = field.get(this); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
568 if (value instanceof Object[]) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
569 b.append(Arrays.toString((Object[]) field.get(this))); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
570 } else { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
571 b.append(field.get(this)); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
572 } |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
573 } catch (IllegalArgumentException e) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
574 b.append(e.toString()); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
575 } catch (IllegalAccessException e) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
576 b.append(e.toString()); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
577 } |
19291
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
578 sep = ", "; |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
579 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
580 b.append(")"); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
581 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
582 |
19291
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
583 protected static void check(Assumption assumption) throws InvalidAssumptionException { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
584 if (assumption != null) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
585 assumption.check(); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
586 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
587 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
588 |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
589 @ExplodeLoop |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
590 protected static void check(Assumption[] assumptions) throws InvalidAssumptionException { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
591 if (assumptions != null) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
592 CompilerAsserts.compilationConstant(assumptions.length); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
593 for (Assumption assumption : assumptions) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
594 check(assumption); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
595 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
596 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
597 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
598 |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
599 protected static boolean isValid(Assumption assumption) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
600 if (assumption != null) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
601 return assumption.isValid(); |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
602 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
603 return true; |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
604 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
605 |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
606 protected static boolean isValid(Assumption[] assumptions) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
607 if (assumptions != null) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
608 for (Assumption assumption : assumptions) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
609 if (!isValid(assumption)) { |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
610 return false; |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
611 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
612 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
613 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
614 return true; |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
615 } |
f4792a544170
Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents:
19289
diff
changeset
|
616 |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
617 private static final class InsertionEvent0 extends SlowPathEvent0 implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
618 |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
619 public InsertionEvent0(SpecializationNode source, String reason, Frame frame) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
620 super(source, reason, frame); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
621 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
622 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
623 public SpecializationNode call() throws Exception { |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
624 SpecializationNode next = source.createNext(frame); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
625 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
626 next = source.createFallback(); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
627 } |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
628 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
629 return null; |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
630 } |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
631 SpecializationNode start = source.findStart(); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
632 if (start.index == Integer.MAX_VALUE) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
633 return insertAt(start, next, this); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
634 } else { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
635 return insertSorted(start, next, this, start.merge(next, frame)); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
636 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
637 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
638 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
639 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
640 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
641 private static final class InsertionEvent1 extends SlowPathEvent1 implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
642 |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
643 public InsertionEvent1(SpecializationNode source, String reason, Frame frame, Object o1) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
644 super(source, reason, frame, o1); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
645 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
646 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
647 public SpecializationNode call() throws Exception { |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
648 SpecializationNode next = source.createNext(frame, o1); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
649 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
650 next = source.createFallback(); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
651 } |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
652 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
653 return null; |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
654 } |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
655 SpecializationNode start = source.findStart(); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
656 if (start.index == Integer.MAX_VALUE) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
657 return insertAt(start, next, this); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
658 } else { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
659 return insertSorted(start, next, this, start.merge(next, frame, o1)); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
660 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
661 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
662 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
663 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
664 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
665 private static final class InsertionEvent2 extends SlowPathEvent2 implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
666 |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
667 public InsertionEvent2(SpecializationNode source, String reason, Frame frame, Object o1, Object o2) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
668 super(source, reason, frame, o1, o2); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
669 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
670 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
671 public SpecializationNode call() throws Exception { |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
672 SpecializationNode next = source.createNext(frame, o1, o2); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
673 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
674 next = source.createFallback(); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
675 } |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
676 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
677 return null; |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
678 } |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
679 SpecializationNode start = source.findStart(); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
680 if (start.index == Integer.MAX_VALUE) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
681 return insertAt(start, next, this); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
682 } else { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
683 return insertSorted(start, next, this, start.merge(next, frame, o1, o2)); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
684 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
685 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
686 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
687 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
688 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
689 private static final class InsertionEvent3 extends SlowPathEvent3 implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
690 |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
691 public InsertionEvent3(SpecializationNode source, String reason, Frame frame, Object o1, Object o2, Object o3) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
692 super(source, reason, frame, o1, o2, o3); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
693 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
694 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
695 public SpecializationNode call() throws Exception { |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
696 SpecializationNode next = source.createNext(frame, o1, o2, o3); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
697 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
698 next = source.createFallback(); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
699 } |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
700 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
701 return null; |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
702 } |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
703 SpecializationNode start = source.findStart(); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
704 if (start.index == Integer.MAX_VALUE) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
705 return insertAt(start, next, this); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
706 } else { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
707 return insertSorted(start, next, this, start.merge(next, frame, o1, o2, o3)); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
708 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
709 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
710 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
711 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
712 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
713 private static final class InsertionEvent4 extends SlowPathEvent4 implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
714 |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
715 public InsertionEvent4(SpecializationNode source, String reason, Frame frame, Object o1, Object o2, Object o3, Object o4) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
716 super(source, reason, frame, o1, o2, o3, o4); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
717 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
718 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
719 public SpecializationNode call() throws Exception { |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
720 SpecializationNode next = source.createNext(frame, o1, o2, o3, o4); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
721 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
722 next = source.createFallback(); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
723 } |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
724 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
725 return null; |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
726 } |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
727 SpecializationNode start = source.findStart(); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
728 if (start.index == Integer.MAX_VALUE) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
729 return insertAt(start, next, this); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
730 } else { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
731 return insertSorted(start, next, this, start.merge(next, frame, o1, o2, o3, o4)); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
732 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
733 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
734 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
735 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
736 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
737 private static final class InsertionEvent5 extends SlowPathEvent5 implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
738 |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
739 public InsertionEvent5(SpecializationNode source, String reason, Frame frame, Object o1, Object o2, Object o3, Object o4, Object o5) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
740 super(source, reason, frame, o1, o2, o3, o4, o5); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
741 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
742 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
743 public SpecializationNode call() throws Exception { |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
744 SpecializationNode next = source.createNext(frame, o1, o2, o3, o4, o5); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
745 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
746 next = source.createFallback(); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
747 } |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
748 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
749 return null; |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
750 } |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
751 SpecializationNode start = source.findStart(); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
752 if (start.index == Integer.MAX_VALUE) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
753 return insertAt(start, next, this); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
754 } else { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
755 return insertSorted(start, next, this, start.merge(next, frame, o1, o2, o3, o4, o5)); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
756 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
757 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
758 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
759 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
760 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
761 private static final class InsertionEventN extends SlowPathEventN implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
762 |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
763 public InsertionEventN(SpecializationNode source, String reason, Frame frame, Object[] args) { |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
764 super(source, reason, frame, args); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
765 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
766 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
767 public SpecializationNode call() throws Exception { |
19786
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
768 SpecializationNode next = source.createNext(frame, args); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
769 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
770 next = source.createFallback(); |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
771 } |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
772 if (next == null) { |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
773 return null; |
7108d2319169
Truffle-DSL: make the whole specialization block atomic to avoid unnecessary node allocations.
Christian Humer <christian.humer@gmail.com>
parents:
19784
diff
changeset
|
774 } |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
775 SpecializationNode start = source.findStart(); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
776 if (start.index == Integer.MAX_VALUE) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
777 return insertAt(start, next, this); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
778 } else { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
779 return insertSorted(start, next, this, start.merge(next, frame, args)); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
780 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
781 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
782 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
783 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
784 private static final class RemoveEvent0 extends SlowPathEvent0 implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
785 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
786 public RemoveEvent0(SpecializationNode source, String reason, Frame frame) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
787 super(source, reason, frame); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
788 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
789 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
790 public SpecializationNode call() throws Exception { |
19784
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
791 return source.removeSame(this); |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
792 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
793 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
794 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
795 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
796 private static final class RemoveEvent1 extends SlowPathEvent1 implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
797 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
798 public RemoveEvent1(SpecializationNode source, String reason, Frame frame, Object o1) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
799 super(source, reason, frame, o1); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
800 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
801 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
802 public SpecializationNode call() throws Exception { |
19784
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
803 return source.removeSame(this); |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
804 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
805 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
806 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
807 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
808 private static final class RemoveEvent2 extends SlowPathEvent2 implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
809 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
810 public RemoveEvent2(SpecializationNode source, String reason, Frame frame, Object o1, Object o2) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
811 super(source, reason, frame, o1, o2); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
812 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
813 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
814 public SpecializationNode call() throws Exception { |
19784
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
815 return source.removeSame(this); |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
816 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
817 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
818 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
819 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
820 private static final class RemoveEvent3 extends SlowPathEvent3 implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
821 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
822 public RemoveEvent3(SpecializationNode source, String reason, Frame frame, Object o1, Object o2, Object o3) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
823 super(source, reason, frame, o1, o2, o3); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
824 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
825 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
826 public SpecializationNode call() throws Exception { |
19784
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
827 return source.removeSame(this); |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
828 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
829 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
830 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
831 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
832 private static final class RemoveEvent4 extends SlowPathEvent4 implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
833 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
834 public RemoveEvent4(SpecializationNode source, String reason, Frame frame, Object o1, Object o2, Object o3, Object o4) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
835 super(source, reason, frame, o1, o2, o3, o4); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
836 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
837 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
838 public SpecializationNode call() throws Exception { |
19784
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
839 return source.removeSame(this); |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
840 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
841 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
842 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
843 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
844 private static final class RemoveEvent5 extends SlowPathEvent5 implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
845 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
846 public RemoveEvent5(SpecializationNode source, String reason, Frame frame, Object o1, Object o2, Object o3, Object o4, Object o5) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
847 super(source, reason, frame, o1, o2, o3, o4, o5); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
848 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
849 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
850 public SpecializationNode call() throws Exception { |
19784
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
851 return source.removeSame(this); |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
852 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
853 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
854 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
855 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
856 private static final class RemoveEventN extends SlowPathEventN implements Callable<SpecializationNode> { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
857 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
858 public RemoveEventN(SpecializationNode source, String reason, Frame frame, Object[] args) { |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
859 super(source, reason, frame, args); |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
860 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
861 |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
862 public SpecializationNode call() throws Exception { |
19784
8caabd6cf363
Truffle-DSL: removeSame does not need to run using atomic. It is always used in an atomic block already.
Christian Humer <christian.humer@gmail.com>
parents:
19765
diff
changeset
|
863 return source.removeSame(this); |
19764
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
864 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
865 } |
e8d2f3f95dcd
Truffle-DSL: implemented duplication check for specializations with @Cached to avoid duplicates for multithreaded AST execution.
Christian Humer <christian.humer@gmail.com>
parents:
19291
diff
changeset
|
866 |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
867 } |