author | attila |
Wed, 20 Dec 2017 17:36:50 +0100 | |
changeset 48411 | 4ff5c5206427 |
parent 47738 | e4d7a32e6a91 |
permissions | -rw-r--r-- |
16147 | 1 |
/* |
16151 | 2 |
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
16147 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package jdk.nashorn.internal.runtime.linker; |
|
27 |
||
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
28 |
import static jdk.dynalink.StandardNamespace.ELEMENT; |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
29 |
import static jdk.dynalink.StandardNamespace.METHOD; |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
30 |
import static jdk.dynalink.StandardNamespace.PROPERTY; |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
31 |
import static jdk.dynalink.StandardOperation.GET; |
48411 | 32 |
import static jdk.dynalink.StandardOperation.REMOVE; |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
33 |
import static jdk.dynalink.StandardOperation.SET; |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
34 |
|
18841
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
35 |
import java.lang.invoke.MethodHandles; |
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
36 |
import java.lang.invoke.MethodHandles.Lookup; |
16147 | 37 |
import java.lang.invoke.MethodType; |
33536
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
38 |
import java.lang.ref.Reference; |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
39 |
import java.lang.ref.WeakReference; |
33341
cc9fa3638714
8139905: Add a convenience AccessControlContext factory
attila
parents:
33331
diff
changeset
|
40 |
import java.security.AccessControlContext; |
33331
273e6a10de22
8139435: Make sure CallSiteDescriptor.getLookup is subject to a security check
attila
parents:
33330
diff
changeset
|
41 |
import java.security.AccessController; |
273e6a10de22
8139435: Make sure CallSiteDescriptor.getLookup is subject to a security check
attila
parents:
33330
diff
changeset
|
42 |
import java.security.PrivilegedAction; |
33536
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
43 |
import java.util.Collections; |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
44 |
import java.util.Map; |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
45 |
import java.util.WeakHashMap; |
18841
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
46 |
import java.util.concurrent.ConcurrentHashMap; |
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
47 |
import java.util.concurrent.ConcurrentMap; |
33536
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
48 |
import java.util.stream.Stream; |
34447
ec4c069f9436
8141338: Move jdk.internal.dynalink package to jdk.dynalink
attila
parents:
33536
diff
changeset
|
49 |
import jdk.dynalink.CallSiteDescriptor; |
ec4c069f9436
8141338: Move jdk.internal.dynalink package to jdk.dynalink
attila
parents:
33536
diff
changeset
|
50 |
import jdk.dynalink.NamedOperation; |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
51 |
import jdk.dynalink.NamespaceOperation; |
34447
ec4c069f9436
8141338: Move jdk.internal.dynalink package to jdk.dynalink
attila
parents:
33536
diff
changeset
|
52 |
import jdk.dynalink.Operation; |
36686
a351eacd4c42
8150218: Autoconversion SAM adapters sometimes don't get privileges
attila
parents:
34732
diff
changeset
|
53 |
import jdk.dynalink.SecureLookupSupplier; |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
54 |
import jdk.dynalink.StandardNamespace; |
34447
ec4c069f9436
8141338: Move jdk.internal.dynalink package to jdk.dynalink
attila
parents:
33536
diff
changeset
|
55 |
import jdk.dynalink.StandardOperation; |
24731
ab0c8fc915ae
8038406: Testability: as a first step of moving loggers away from the process global space, the Debug object now supports logging POJOs from log entries as an event queue, which can be introspected from test scripts. This is way better than screen scraping brittle and subject-to-change log output.
lagergren
parents:
24725
diff
changeset
|
56 |
import jdk.nashorn.internal.ir.debug.NashornTextifier; |
33341
cc9fa3638714
8139905: Add a convenience AccessControlContext factory
attila
parents:
33331
diff
changeset
|
57 |
import jdk.nashorn.internal.runtime.AccessControlContextFactory; |
32049
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
58 |
import jdk.nashorn.internal.runtime.ScriptRuntime; |
16147 | 59 |
|
60 |
/** |
|
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
61 |
* Nashorn-specific implementation of Dynalink's {@link CallSiteDescriptor}. |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
62 |
* The reason we have our own subclass is that we're storing flags in an |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
63 |
* additional primitive field. The class also exposes some useful utilities in |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
64 |
* form of static methods. |
16147 | 65 |
*/ |
33342 | 66 |
public final class NashornCallSiteDescriptor extends CallSiteDescriptor { |
48411 | 67 |
// Lowest four bits describe the operation |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
68 |
/** Property getter operation {@code obj.prop} */ |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
69 |
public static final int GET_PROPERTY = 0; |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
70 |
/** Element getter operation {@code obj[index]} */ |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
71 |
public static final int GET_ELEMENT = 1; |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
72 |
/** Property getter operation, subsequently invoked {@code obj.prop()} */ |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
73 |
public static final int GET_METHOD_PROPERTY = 2; |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
74 |
/** Element getter operation, subsequently invoked {@code obj[index]()} */ |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
75 |
public static final int GET_METHOD_ELEMENT = 3; |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
76 |
/** Property setter operation {@code obj.prop = value} */ |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
77 |
public static final int SET_PROPERTY = 4; |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
78 |
/** Element setter operation {@code obj[index] = value} */ |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
79 |
public static final int SET_ELEMENT = 5; |
48411 | 80 |
/** Property remove operation {@code delete obj.prop} */ |
81 |
public static final int REMOVE_PROPERTY = 6; |
|
82 |
/** Element remove operation {@code delete obj[index]} */ |
|
83 |
public static final int REMOVE_ELEMENT = 7; |
|
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
84 |
/** Call operation {@code fn(args...)} */ |
48411 | 85 |
public static final int CALL = 8; |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
86 |
/** New operation {@code new Constructor(args...)} */ |
48411 | 87 |
public static final int NEW = 9; |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
88 |
|
48411 | 89 |
private static final int OPERATION_MASK = 15; |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
90 |
|
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
91 |
// Correspond to the operation indices above. |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
92 |
private static final Operation[] OPERATIONS = new Operation[] { |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
93 |
GET.withNamespaces(PROPERTY, ELEMENT, METHOD), |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
94 |
GET.withNamespaces(ELEMENT, PROPERTY, METHOD), |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
95 |
GET.withNamespaces(METHOD, PROPERTY, ELEMENT), |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
96 |
GET.withNamespaces(METHOD, ELEMENT, PROPERTY), |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
97 |
SET.withNamespaces(PROPERTY, ELEMENT), |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
98 |
SET.withNamespaces(ELEMENT, PROPERTY), |
48411 | 99 |
REMOVE.withNamespaces(PROPERTY, ELEMENT), |
100 |
REMOVE.withNamespaces(ELEMENT, PROPERTY), |
|
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
101 |
StandardOperation.CALL, |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
102 |
StandardOperation.NEW |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
103 |
}; |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
104 |
|
16147 | 105 |
/** Flags that the call site references a scope variable (it's an identifier reference or a var declaration, not a |
106 |
* property access expression. */ |
|
48411 | 107 |
public static final int CALLSITE_SCOPE = 1 << 4; |
16147 | 108 |
/** Flags that the call site is in code that uses ECMAScript strict mode. */ |
48411 | 109 |
public static final int CALLSITE_STRICT = 1 << 5; |
17255 | 110 |
/** Flags that a property getter or setter call site references a scope variable that is located at a known distance |
111 |
* in the scope chain. Such getters and setters can often be linked more optimally using these assumptions. */ |
|
48411 | 112 |
public static final int CALLSITE_FAST_SCOPE = 1 << 6; |
24719 | 113 |
/** Flags that a callsite type is optimistic, i.e. we might get back a wider return value than encoded in the |
114 |
* descriptor, and in that case we have to throw an UnwarrantedOptimismException */ |
|
48411 | 115 |
public static final int CALLSITE_OPTIMISTIC = 1 << 7; |
24738
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
116 |
/** Is this really an apply that we try to call as a call? */ |
48411 | 117 |
public static final int CALLSITE_APPLY_TO_CALL = 1 << 8; |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
25865
diff
changeset
|
118 |
/** Does this a callsite for a variable declaration? */ |
48411 | 119 |
public static final int CALLSITE_DECLARE = 1 << 9; |
16147 | 120 |
|
121 |
/** Flags that the call site is profiled; Contexts that have {@code "profile.callsites"} boolean property set emit |
|
122 |
* code where call sites have this flag set. */ |
|
48411 | 123 |
public static final int CALLSITE_PROFILE = 1 << 10; |
16147 | 124 |
/** Flags that the call site is traced; Contexts that have {@code "trace.callsites"} property set emit code where |
125 |
* call sites have this flag set. */ |
|
48411 | 126 |
public static final int CALLSITE_TRACE = 1 << 11; |
16147 | 127 |
/** Flags that the call site linkage miss (and thus, relinking) is traced; Contexts that have the keyword |
128 |
* {@code "miss"} in their {@code "trace.callsites"} property emit code where call sites have this flag set. */ |
|
48411 | 129 |
public static final int CALLSITE_TRACE_MISSES = 1 << 12; |
16147 | 130 |
/** Flags that entry/exit to/from the method linked at call site are traced; Contexts that have the keyword |
24719 | 131 |
* {@code "enterexit"} in their {@code "trace.callsites"} property emit code where call sites have this flag set. */ |
48411 | 132 |
public static final int CALLSITE_TRACE_ENTEREXIT = 1 << 13; |
16147 | 133 |
/** Flags that values passed as arguments to and returned from the method linked at call site are traced; Contexts |
134 |
* that have the keyword {@code "values"} in their {@code "trace.callsites"} property emit code where call sites |
|
135 |
* have this flag set. */ |
|
48411 | 136 |
public static final int CALLSITE_TRACE_VALUES = 1 << 14; |
24738
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
137 |
|
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
138 |
//we could have more tracing flags here, for example CALLSITE_TRACE_SCOPE, but bits are a bit precious |
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
139 |
//right now given the program points |
24719 | 140 |
|
141 |
/** |
|
142 |
* Number of bits the program point is shifted to the left in the flags (lowest bit containing a program point). |
|
143 |
* Always one larger than the largest flag shift. Note that introducing a new flag halves the number of program |
|
144 |
* points we can have. |
|
145 |
* TODO: rethink if we need the various profile/trace flags or the linker can use the Context instead to query its |
|
146 |
* trace/profile settings. |
|
147 |
*/ |
|
48411 | 148 |
public static final int CALLSITE_PROGRAM_POINT_SHIFT = 15; |
24719 | 149 |
|
150 |
/** |
|
48411 | 151 |
* Maximum program point value. We have 17 bits left over after flags, and |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
152 |
* it should be plenty. Program points are local to a single function. Every |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
153 |
* function maps to a single JVM bytecode method that can have at most 65535 |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
154 |
* bytes. (Large functions are synthetically split into smaller functions.) |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
155 |
* A single invokedynamic is 5 bytes; even if a method consists of only |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
156 |
* invokedynamic instructions that leaves us with at most 65535/5 = 13107 |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
157 |
* program points for the largest single method; those can be expressed on |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
158 |
* 14 bits. It is true that numbering of program points is independent of |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
159 |
* bytecode representation, but if a function would need more than ~14 bits |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
160 |
* for the program points, then it is reasonable to presume splitter |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
161 |
* would've split it into several smaller functions already. |
24719 | 162 |
*/ |
24725
7bb1f687a852
8033334: Make sure that scope depth information is maintained in the RecompilableScriptFunctionDatas, to avoid unnecessary slow proto linkage when doing on demand compilation
lagergren
parents:
24719
diff
changeset
|
163 |
public static final int MAX_PROGRAM_POINT_VALUE = (1 << 32 - CALLSITE_PROGRAM_POINT_SHIFT) - 1; |
24719 | 164 |
|
165 |
/** |
|
166 |
* Flag mask to get the program point flags |
|
167 |
*/ |
|
168 |
public static final int FLAGS_MASK = (1 << CALLSITE_PROGRAM_POINT_SHIFT) - 1; |
|
16147 | 169 |
|
18841
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
170 |
private static final ClassValue<ConcurrentMap<NashornCallSiteDescriptor, NashornCallSiteDescriptor>> canonicals = |
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
171 |
new ClassValue<ConcurrentMap<NashornCallSiteDescriptor,NashornCallSiteDescriptor>>() { |
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
172 |
@Override |
24731
ab0c8fc915ae
8038406: Testability: as a first step of moving loggers away from the process global space, the Debug object now supports logging POJOs from log entries as an event queue, which can be introspected from test scripts. This is way better than screen scraping brittle and subject-to-change log output.
lagergren
parents:
24725
diff
changeset
|
173 |
protected ConcurrentMap<NashornCallSiteDescriptor, NashornCallSiteDescriptor> computeValue(final Class<?> type) { |
18841
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
174 |
return new ConcurrentHashMap<>(); |
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
175 |
} |
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
176 |
}; |
16147 | 177 |
|
33341
cc9fa3638714
8139905: Add a convenience AccessControlContext factory
attila
parents:
33331
diff
changeset
|
178 |
private static final AccessControlContext GET_LOOKUP_PERMISSION_CONTEXT = |
36686
a351eacd4c42
8150218: Autoconversion SAM adapters sometimes don't get privileges
attila
parents:
34732
diff
changeset
|
179 |
AccessControlContextFactory.createAccessControlContext(SecureLookupSupplier.GET_LOOKUP_PERMISSION_NAME); |
33341
cc9fa3638714
8139905: Add a convenience AccessControlContext factory
attila
parents:
33331
diff
changeset
|
180 |
|
33536
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
181 |
@SuppressWarnings("unchecked") |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
182 |
private static final Map<String, Reference<NamedOperation>>[] NAMED_OPERATIONS = |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
183 |
Stream.generate(() -> Collections.synchronizedMap(new WeakHashMap<>())) |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
184 |
.limit(OPERATIONS.length).toArray(Map[]::new); |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
185 |
|
16147 | 186 |
private final int flags; |
187 |
||
24731
ab0c8fc915ae
8038406: Testability: as a first step of moving loggers away from the process global space, the Debug object now supports logging POJOs from log entries as an event queue, which can be introspected from test scripts. This is way better than screen scraping brittle and subject-to-change log output.
lagergren
parents:
24725
diff
changeset
|
188 |
/** |
ab0c8fc915ae
8038406: Testability: as a first step of moving loggers away from the process global space, the Debug object now supports logging POJOs from log entries as an event queue, which can be introspected from test scripts. This is way better than screen scraping brittle and subject-to-change log output.
lagergren
parents:
24725
diff
changeset
|
189 |
* Function used by {@link NashornTextifier} to represent call site flags in |
ab0c8fc915ae
8038406: Testability: as a first step of moving loggers away from the process global space, the Debug object now supports logging POJOs from log entries as an event queue, which can be introspected from test scripts. This is way better than screen scraping brittle and subject-to-change log output.
lagergren
parents:
24725
diff
changeset
|
190 |
* human readable form |
ab0c8fc915ae
8038406: Testability: as a first step of moving loggers away from the process global space, the Debug object now supports logging POJOs from log entries as an event queue, which can be introspected from test scripts. This is way better than screen scraping brittle and subject-to-change log output.
lagergren
parents:
24725
diff
changeset
|
191 |
* @param flags call site flags |
34732 | 192 |
* @param sb the string builder |
24731
ab0c8fc915ae
8038406: Testability: as a first step of moving loggers away from the process global space, the Debug object now supports logging POJOs from log entries as an event queue, which can be introspected from test scripts. This is way better than screen scraping brittle and subject-to-change log output.
lagergren
parents:
24725
diff
changeset
|
193 |
*/ |
34732 | 194 |
public static void appendFlags(final int flags, final StringBuilder sb) { |
195 |
final int pp = flags >> CALLSITE_PROGRAM_POINT_SHIFT; |
|
196 |
if (pp != 0) { |
|
197 |
sb.append(" pp=").append(pp); |
|
198 |
} |
|
24725
7bb1f687a852
8033334: Make sure that scope depth information is maintained in the RecompilableScriptFunctionDatas, to avoid unnecessary slow proto linkage when doing on demand compilation
lagergren
parents:
24719
diff
changeset
|
199 |
if ((flags & CALLSITE_SCOPE) != 0) { |
7bb1f687a852
8033334: Make sure that scope depth information is maintained in the RecompilableScriptFunctionDatas, to avoid unnecessary slow proto linkage when doing on demand compilation
lagergren
parents:
24719
diff
changeset
|
200 |
if ((flags & CALLSITE_FAST_SCOPE) != 0) { |
34732 | 201 |
sb.append(" fastscope"); |
24725
7bb1f687a852
8033334: Make sure that scope depth information is maintained in the RecompilableScriptFunctionDatas, to avoid unnecessary slow proto linkage when doing on demand compilation
lagergren
parents:
24719
diff
changeset
|
202 |
} else { |
34732 | 203 |
sb.append(" scope"); |
24725
7bb1f687a852
8033334: Make sure that scope depth information is maintained in the RecompilableScriptFunctionDatas, to avoid unnecessary slow proto linkage when doing on demand compilation
lagergren
parents:
24719
diff
changeset
|
204 |
} |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
25865
diff
changeset
|
205 |
if ((flags & CALLSITE_DECLARE) != 0) { |
34732 | 206 |
sb.append(" declare"); |
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
25865
diff
changeset
|
207 |
} |
34732 | 208 |
} else { |
209 |
assert (flags & CALLSITE_FAST_SCOPE) == 0 : "can't be fastscope without scope"; |
|
24725
7bb1f687a852
8033334: Make sure that scope depth information is maintained in the RecompilableScriptFunctionDatas, to avoid unnecessary slow proto linkage when doing on demand compilation
lagergren
parents:
24719
diff
changeset
|
210 |
} |
24738
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
211 |
if ((flags & CALLSITE_APPLY_TO_CALL) != 0) { |
34732 | 212 |
sb.append(" apply2call"); |
24738
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
213 |
} |
24725
7bb1f687a852
8033334: Make sure that scope depth information is maintained in the RecompilableScriptFunctionDatas, to avoid unnecessary slow proto linkage when doing on demand compilation
lagergren
parents:
24719
diff
changeset
|
214 |
if ((flags & CALLSITE_STRICT) != 0) { |
34732 | 215 |
sb.append(" strict"); |
24725
7bb1f687a852
8033334: Make sure that scope depth information is maintained in the RecompilableScriptFunctionDatas, to avoid unnecessary slow proto linkage when doing on demand compilation
lagergren
parents:
24719
diff
changeset
|
216 |
} |
7bb1f687a852
8033334: Make sure that scope depth information is maintained in the RecompilableScriptFunctionDatas, to avoid unnecessary slow proto linkage when doing on demand compilation
lagergren
parents:
24719
diff
changeset
|
217 |
} |
7bb1f687a852
8033334: Make sure that scope depth information is maintained in the RecompilableScriptFunctionDatas, to avoid unnecessary slow proto linkage when doing on demand compilation
lagergren
parents:
24719
diff
changeset
|
218 |
|
16147 | 219 |
/** |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
220 |
* Given call site flags, returns the operation name encoded in them. |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
221 |
* @param flags flags |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
222 |
* @return the operation name |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
223 |
*/ |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
224 |
public static String getOperationName(final int flags) { |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
225 |
switch(flags & OPERATION_MASK) { |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
226 |
case 0: return "GET_PROPERTY"; |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
227 |
case 1: return "GET_ELEMENT"; |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
228 |
case 2: return "GET_METHOD_PROPERTY"; |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
229 |
case 3: return "GET_METHOD_ELEMENT"; |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
230 |
case 4: return "SET_PROPERTY"; |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
231 |
case 5: return "SET_ELEMENT"; |
48411 | 232 |
case 6: return "REMOVE_PROPERTY"; |
233 |
case 7: return "REMOVE_ELEMENT"; |
|
234 |
case 8: return "CALL"; |
|
235 |
case 9: return "NEW"; |
|
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
236 |
default: throw new AssertionError(); |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
237 |
} |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
238 |
} |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
239 |
|
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
240 |
/** |
16147 | 241 |
* Retrieves a Nashorn call site descriptor with the specified values. Since call site descriptors are immutable |
242 |
* this method is at liberty to retrieve canonicalized instances (although it is not guaranteed it will do so). |
|
18841
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
243 |
* @param lookup the lookup describing the script |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
244 |
* @param name the name at the call site. Can not be null, but it can be empty. |
16147 | 245 |
* @param methodType the method type at the call site |
246 |
* @param flags Nashorn-specific call site flags |
|
247 |
* @return a call site descriptor with the specified values. |
|
248 |
*/ |
|
18841
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
249 |
public static NashornCallSiteDescriptor get(final MethodHandles.Lookup lookup, final String name, |
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
250 |
final MethodType methodType, final int flags) { |
33536
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
251 |
final int opIndex = flags & OPERATION_MASK; |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
252 |
final Operation baseOp = OPERATIONS[opIndex]; |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
253 |
final String decodedName = NameCodec.decode(name); |
33536
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
254 |
final Operation op = decodedName.isEmpty() ? baseOp : getNamedOperation(decodedName, opIndex, baseOp); |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
255 |
return get(lookup, op, methodType, flags); |
16147 | 256 |
} |
257 |
||
33536
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
258 |
private static NamedOperation getNamedOperation(final String name, final int opIndex, final Operation baseOp) { |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
259 |
final Map<String, Reference<NamedOperation>> namedOps = NAMED_OPERATIONS[opIndex]; |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
260 |
final Reference<NamedOperation> ref = namedOps.get(name); |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
261 |
if (ref != null) { |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
262 |
final NamedOperation existing = ref.get(); |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
263 |
if (existing != null) { |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
264 |
return existing; |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
265 |
} |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
266 |
} |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
267 |
final NamedOperation newOp = baseOp.named(name); |
33536
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
268 |
namedOps.put(name, new WeakReference<>(newOp)); |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
269 |
return newOp; |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
270 |
} |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
271 |
|
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
272 |
private static NashornCallSiteDescriptor get(final MethodHandles.Lookup lookup, final Operation operation, final MethodType methodType, final int flags) { |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
273 |
final NashornCallSiteDescriptor csd = new NashornCallSiteDescriptor(lookup, operation, methodType, flags); |
16147 | 274 |
// Many of these call site descriptors are identical (e.g. every getter for a property color will be |
33536
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
275 |
// "GET_PROPERTY:color(Object)Object", so it makes sense canonicalizing them. Make an exception for |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
276 |
// optimistic call site descriptors, as they also carry a program point making them unique. |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
277 |
if (csd.isOptimistic()) { |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
278 |
return csd; |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
279 |
} |
3168b2a1640e
8141425: Improve caching in NashornCallSiteDescriptor
attila
parents:
33533
diff
changeset
|
280 |
final NashornCallSiteDescriptor canonical = canonicals.get(lookup.lookupClass()).putIfAbsent(csd, csd); |
18841
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
281 |
return canonical != null ? canonical : csd; |
16147 | 282 |
} |
283 |
||
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
284 |
private NashornCallSiteDescriptor(final MethodHandles.Lookup lookup, final Operation operation, final MethodType methodType, final int flags) { |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
285 |
super(lookup, operation, methodType); |
16147 | 286 |
this.flags = flags; |
287 |
} |
|
288 |
||
33342 | 289 |
static Lookup getLookupInternal(final CallSiteDescriptor csd) { |
33331
273e6a10de22
8139435: Make sure CallSiteDescriptor.getLookup is subject to a security check
attila
parents:
33330
diff
changeset
|
290 |
if (csd instanceof NashornCallSiteDescriptor) { |
33342 | 291 |
return ((NashornCallSiteDescriptor)csd).getLookupPrivileged(); |
33331
273e6a10de22
8139435: Make sure CallSiteDescriptor.getLookup is subject to a security check
attila
parents:
33330
diff
changeset
|
292 |
} |
33342 | 293 |
return AccessController.doPrivileged((PrivilegedAction<Lookup>)()->csd.getLookup(), GET_LOOKUP_PERMISSION_CONTEXT); |
18841
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
294 |
} |
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
295 |
|
9bbc4b8832b2
8010946: AccessControl.doPrivileged is broken when called from js script
attila
parents:
17255
diff
changeset
|
296 |
@Override |
33342 | 297 |
public boolean equals(final Object obj) { |
298 |
return super.equals(obj) && flags == ((NashornCallSiteDescriptor)obj).flags; |
|
16147 | 299 |
} |
300 |
||
301 |
@Override |
|
33342 | 302 |
public int hashCode() { |
303 |
return super.hashCode() ^ flags; |
|
16147 | 304 |
} |
305 |
||
306 |
/** |
|
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
307 |
* Returns the named operand in the passed descriptor's operation. |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
308 |
* Equivalent to |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
309 |
* {@code ((NamedOperation)desc.getOperation()).getName().toString()} for |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
310 |
* descriptors with a named operand. For descriptors without named operands |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
311 |
* returns null. |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
312 |
* @param desc the call site descriptors |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
313 |
* @return the named operand in this descriptor's operation. |
16147 | 314 |
*/ |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
315 |
public static String getOperand(final CallSiteDescriptor desc) { |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
316 |
final Operation operation = desc.getOperation(); |
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
317 |
return operation instanceof NamedOperation ? ((NamedOperation)operation).getName().toString() : null; |
16147 | 318 |
} |
319 |
||
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
320 |
private static StandardNamespace findFirstStandardNamespace(final CallSiteDescriptor desc) { |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
321 |
return StandardNamespace.findFirst(desc.getOperation()); |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
322 |
} |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
323 |
|
16147 | 324 |
/** |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
325 |
* Returns true if the operation of the call descriptor is operating on the method namespace first. |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
326 |
* @param desc the call descriptor in question. |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
327 |
* @return true if the operation of the call descriptor is operating on the method namespace first. |
16147 | 328 |
*/ |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
329 |
public static boolean isMethodFirstOperation(final CallSiteDescriptor desc) { |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
330 |
return findFirstStandardNamespace(desc) == StandardNamespace.METHOD; |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
331 |
} |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
332 |
|
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
333 |
/** |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
334 |
* Returns true if there's a namespace operation in the call descriptor and it is operating on at least |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
335 |
* one {@link StandardNamespace}. This method is only needed for exported linkers, since internal linkers |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
336 |
* always operate on Nashorn-generated call sites, and they always operate on standard namespaces only. |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
337 |
* @param desc the call descriptor in question. |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
338 |
* @return true if the operation of the call descriptor is operating on at least one standard namespace. |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
339 |
*/ |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
340 |
public static boolean hasStandardNamespace(final CallSiteDescriptor desc) { |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
341 |
return findFirstStandardNamespace(desc) != null; |
32049
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
342 |
} |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
343 |
|
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
344 |
/** |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
345 |
* Returns the base operation in this call site descriptor after unwrapping it from both a named operation |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
346 |
* and a namespace operation. |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
347 |
* @param desc the call site descriptor. |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
348 |
* @return the base operation in this call site descriptor. |
32049
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
349 |
*/ |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
350 |
public static Operation getBaseOperation(final CallSiteDescriptor desc) { |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
351 |
return NamespaceOperation.getBaseOperation(NamedOperation.getBaseOperation(desc.getOperation())); |
32049
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
352 |
} |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
353 |
|
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
354 |
/** |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
355 |
* Returns the standard operation that is the base operation in this call site descriptor. |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
356 |
* @param desc the call site descriptor. |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
357 |
* @return the standard operation that is the base operation in this call site descriptor. |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
358 |
* @throws ClassCastException if the base operation is not a standard operation. This method is only |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
359 |
* safe to use when the base operation is known to be a standard operation (e.g. all Nashorn call sites |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
360 |
* are such, so it's safe to use from internal linkers). |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
361 |
*/ |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
362 |
public static StandardOperation getStandardOperation(final CallSiteDescriptor desc) { |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
363 |
return (StandardOperation)getBaseOperation(desc); |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
364 |
} |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
365 |
|
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
366 |
/** |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
367 |
* Returns true if the passed call site descriptor contains the specified standard operation on the |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
368 |
* specified standard namespace. |
33345
ef8c859f7992
8140273: restore use of CompositeOperation.contains where it is needed
attila
parents:
33343
diff
changeset
|
369 |
* @param desc the call site descriptor. |
ef8c859f7992
8140273: restore use of CompositeOperation.contains where it is needed
attila
parents:
33343
diff
changeset
|
370 |
* @param operation the operation whose presence is tested. |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
371 |
* @param namespace the namespace on which the operation operates. |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
372 |
* @return Returns true if the call site descriptor contains the specified standard operation on the |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
373 |
* specified standard namespace. |
33345
ef8c859f7992
8140273: restore use of CompositeOperation.contains where it is needed
attila
parents:
33343
diff
changeset
|
374 |
*/ |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
375 |
public static boolean contains(final CallSiteDescriptor desc, final StandardOperation operation, final StandardNamespace namespace) { |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
376 |
return NamespaceOperation.contains(NamedOperation.getBaseOperation(desc.getOperation()), operation, namespace); |
33345
ef8c859f7992
8140273: restore use of CompositeOperation.contains where it is needed
attila
parents:
33343
diff
changeset
|
377 |
} |
ef8c859f7992
8140273: restore use of CompositeOperation.contains where it is needed
attila
parents:
33343
diff
changeset
|
378 |
|
ef8c859f7992
8140273: restore use of CompositeOperation.contains where it is needed
attila
parents:
33343
diff
changeset
|
379 |
/** |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
380 |
* Returns the error message to be used when CALL or NEW is used on a non-function. |
32049
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
381 |
* |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
382 |
* @param obj object on which CALL or NEW is used |
32049
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
383 |
* @return error message |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
384 |
*/ |
41842
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
385 |
private String getFunctionErrorMessage(final Object obj) { |
50202a344d28
8168005: Introduce namespaces for GET, SET Dynalink operations
attila
parents:
36686
diff
changeset
|
386 |
final String funcDesc = getOperand(this); |
32049
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
387 |
return funcDesc != null? funcDesc : ScriptRuntime.safeToString(obj); |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
388 |
} |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
389 |
|
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
390 |
/** |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
391 |
* Returns the error message to be used when CALL or NEW is used on a non-function. |
32049
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
392 |
* |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
393 |
* @param desc call site descriptor |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
394 |
* @param obj object on which CALL or NEW is used |
32049
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
395 |
* @return error message |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
396 |
*/ |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
397 |
public static String getFunctionErrorMessage(final CallSiteDescriptor desc, final Object obj) { |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
398 |
return desc instanceof NashornCallSiteDescriptor ? |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
399 |
((NashornCallSiteDescriptor)desc).getFunctionErrorMessage(obj) : |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
400 |
ScriptRuntime.safeToString(obj); |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
401 |
} |
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
402 |
|
af8f6292d54d
8133119: Error message associated with TypeError for call and new should include stringified Node
sundar
parents:
32048
diff
changeset
|
403 |
/** |
16147 | 404 |
* Returns the Nashorn-specific flags for this call site descriptor. |
405 |
* @param desc the descriptor. It can be any kind of a call site descriptor, not necessarily a |
|
406 |
* {@code NashornCallSiteDescriptor}. This allows for graceful interoperability when linking Nashorn with code |
|
407 |
* generated outside of Nashorn. |
|
408 |
* @return the Nashorn-specific flags for the call site, or 0 if the passed descriptor is not a Nashorn call site |
|
409 |
* descriptor. |
|
410 |
*/ |
|
26765
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
411 |
public static int getFlags(final CallSiteDescriptor desc) { |
16147 | 412 |
return desc instanceof NashornCallSiteDescriptor ? ((NashornCallSiteDescriptor)desc).flags : 0; |
413 |
} |
|
414 |
||
415 |
/** |
|
416 |
* Returns true if this descriptor has the specified flag set, see {@code CALLSITE_*} constants in this class. |
|
417 |
* @param flag the tested flag |
|
418 |
* @return true if the flag is set, false otherwise |
|
419 |
*/ |
|
420 |
private boolean isFlag(final int flag) { |
|
421 |
return (flags & flag) != 0; |
|
422 |
} |
|
423 |
||
424 |
/** |
|
425 |
* Returns true if this descriptor has the specified flag set, see {@code CALLSITE_*} constants in this class. |
|
426 |
* @param desc the descriptor. It can be any kind of a call site descriptor, not necessarily a |
|
427 |
* {@code NashornCallSiteDescriptor}. This allows for graceful interoperability when linking Nashorn with code |
|
428 |
* generated outside of Nashorn. |
|
429 |
* @param flag the tested flag |
|
31738 | 430 |
* @return true if the flag is set, false otherwise (it will be false if the descriptor is not a Nashorn call site |
16147 | 431 |
* descriptor). |
432 |
*/ |
|
433 |
private static boolean isFlag(final CallSiteDescriptor desc, final int flag) { |
|
434 |
return (getFlags(desc) & flag) != 0; |
|
435 |
} |
|
436 |
||
437 |
/** |
|
438 |
* Returns true if this descriptor is a Nashorn call site descriptor and has the {@link #CALLSITE_SCOPE} flag set. |
|
439 |
* @param desc the descriptor. It can be any kind of a call site descriptor, not necessarily a |
|
440 |
* {@code NashornCallSiteDescriptor}. This allows for graceful interoperability when linking Nashorn with code |
|
441 |
* generated outside of Nashorn. |
|
442 |
* @return true if the descriptor is a Nashorn call site descriptor, and the flag is set, false otherwise. |
|
443 |
*/ |
|
444 |
public static boolean isScope(final CallSiteDescriptor desc) { |
|
445 |
return isFlag(desc, CALLSITE_SCOPE); |
|
446 |
} |
|
447 |
||
448 |
/** |
|
449 |
* Returns true if this descriptor is a Nashorn call site descriptor and has the {@link #CALLSITE_FAST_SCOPE} flag set. |
|
450 |
* @param desc the descriptor. It can be any kind of a call site descriptor, not necessarily a |
|
451 |
* {@code NashornCallSiteDescriptor}. This allows for graceful interoperability when linking Nashorn with code |
|
452 |
* generated outside of Nashorn. |
|
453 |
* @return true if the descriptor is a Nashorn call site descriptor, and the flag is set, false otherwise. |
|
454 |
*/ |
|
455 |
public static boolean isFastScope(final CallSiteDescriptor desc) { |
|
456 |
return isFlag(desc, CALLSITE_FAST_SCOPE); |
|
457 |
} |
|
458 |
||
459 |
/** |
|
460 |
* Returns true if this descriptor is a Nashorn call site descriptor and has the {@link #CALLSITE_STRICT} flag set. |
|
461 |
* @param desc the descriptor. It can be any kind of a call site descriptor, not necessarily a |
|
462 |
* {@code NashornCallSiteDescriptor}. This allows for graceful interoperability when linking Nashorn with code |
|
463 |
* generated outside of Nashorn. |
|
464 |
* @return true if the descriptor is a Nashorn call site descriptor, and the flag is set, false otherwise. |
|
465 |
*/ |
|
466 |
public static boolean isStrict(final CallSiteDescriptor desc) { |
|
467 |
return isFlag(desc, CALLSITE_STRICT); |
|
468 |
} |
|
469 |
||
24719 | 470 |
/** |
24738
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
471 |
* Returns true if this is an apply call that we try to call as |
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
472 |
* a "call" |
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
473 |
* @param desc descriptor |
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
474 |
* @return true if apply to call |
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
475 |
*/ |
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
476 |
public static boolean isApplyToCall(final CallSiteDescriptor desc) { |
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
477 |
return isFlag(desc, CALLSITE_APPLY_TO_CALL); |
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
478 |
} |
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
479 |
|
be2026c9717c
8039746: Transform applies to calls wherever possible, for ScriptFunctions and JSObjects.
lagergren
parents:
24731
diff
changeset
|
480 |
/** |
24719 | 481 |
* Is this an optimistic call site |
482 |
* @param desc descriptor |
|
483 |
* @return true if optimistic |
|
484 |
*/ |
|
485 |
public static boolean isOptimistic(final CallSiteDescriptor desc) { |
|
486 |
return isFlag(desc, CALLSITE_OPTIMISTIC); |
|
487 |
} |
|
488 |
||
489 |
/** |
|
26377
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
25865
diff
changeset
|
490 |
* Does this callsite contain a declaration for its target? |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
25865
diff
changeset
|
491 |
* @param desc descriptor |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
25865
diff
changeset
|
492 |
* @return true if contains declaration |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
25865
diff
changeset
|
493 |
*/ |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
25865
diff
changeset
|
494 |
public static boolean isDeclaration(final CallSiteDescriptor desc) { |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
25865
diff
changeset
|
495 |
return isFlag(desc, CALLSITE_DECLARE); |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
25865
diff
changeset
|
496 |
} |
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
25865
diff
changeset
|
497 |
|
028dad61662f
8051889: Implement block scoping in symbol assignment and scope computation
hannesw
parents:
25865
diff
changeset
|
498 |
/** |
26765
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
499 |
* Returns true if {@code flags} has the {@link #CALLSITE_STRICT} bit set. |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
500 |
* @param flags the flags |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
501 |
* @return true if the flag is set, false otherwise. |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
502 |
*/ |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
503 |
public static boolean isStrictFlag(final int flags) { |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
504 |
return (flags & CALLSITE_STRICT) != 0; |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
505 |
} |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
506 |
|
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
507 |
/** |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
508 |
* Returns true if {@code flags} has the {@link #CALLSITE_SCOPE} bit set. |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
509 |
* @param flags the flags |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
510 |
* @return true if the flag is set, false otherwise. |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
511 |
*/ |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
512 |
public static boolean isScopeFlag(final int flags) { |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
513 |
return (flags & CALLSITE_SCOPE) != 0; |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
514 |
} |
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
515 |
|
97501edd2979
8047764: Indexed or polymorphic set on global affects Object.prototype
hannesw
parents:
26377
diff
changeset
|
516 |
/** |
47738
e4d7a32e6a91
8185119: Uninitialized const when using multiple threads
hannesw
parents:
47216
diff
changeset
|
517 |
* Returns true if {@code flags} has the {@link #CALLSITE_DECLARE} bit set. |
e4d7a32e6a91
8185119: Uninitialized const when using multiple threads
hannesw
parents:
47216
diff
changeset
|
518 |
* @param flags the flags |
e4d7a32e6a91
8185119: Uninitialized const when using multiple threads
hannesw
parents:
47216
diff
changeset
|
519 |
* @return true if the flag is set, false otherwise. |
e4d7a32e6a91
8185119: Uninitialized const when using multiple threads
hannesw
parents:
47216
diff
changeset
|
520 |
*/ |
e4d7a32e6a91
8185119: Uninitialized const when using multiple threads
hannesw
parents:
47216
diff
changeset
|
521 |
public static boolean isDeclaration(final int flags) { |
e4d7a32e6a91
8185119: Uninitialized const when using multiple threads
hannesw
parents:
47216
diff
changeset
|
522 |
return (flags & CALLSITE_DECLARE) != 0; |
e4d7a32e6a91
8185119: Uninitialized const when using multiple threads
hannesw
parents:
47216
diff
changeset
|
523 |
} |
e4d7a32e6a91
8185119: Uninitialized const when using multiple threads
hannesw
parents:
47216
diff
changeset
|
524 |
|
e4d7a32e6a91
8185119: Uninitialized const when using multiple threads
hannesw
parents:
47216
diff
changeset
|
525 |
/** |
24719 | 526 |
* Get a program point from a descriptor (must be optimistic) |
527 |
* @param desc descriptor |
|
528 |
* @return program point |
|
529 |
*/ |
|
530 |
public static int getProgramPoint(final CallSiteDescriptor desc) { |
|
531 |
assert isOptimistic(desc) : "program point requested from non-optimistic descriptor " + desc; |
|
532 |
return getFlags(desc) >> CALLSITE_PROGRAM_POINT_SHIFT; |
|
533 |
} |
|
534 |
||
16147 | 535 |
boolean isProfile() { |
536 |
return isFlag(CALLSITE_PROFILE); |
|
537 |
} |
|
538 |
||
539 |
boolean isTrace() { |
|
540 |
return isFlag(CALLSITE_TRACE); |
|
541 |
} |
|
542 |
||
543 |
boolean isTraceMisses() { |
|
544 |
return isFlag(CALLSITE_TRACE_MISSES); |
|
545 |
} |
|
546 |
||
547 |
boolean isTraceEnterExit() { |
|
548 |
return isFlag(CALLSITE_TRACE_ENTEREXIT); |
|
549 |
} |
|
550 |
||
551 |
boolean isTraceObjects() { |
|
552 |
return isFlag(CALLSITE_TRACE_VALUES); |
|
553 |
} |
|
554 |
||
24719 | 555 |
boolean isOptimistic() { |
556 |
return isFlag(CALLSITE_OPTIMISTIC); |
|
557 |
} |
|
558 |
||
16147 | 559 |
@Override |
33342 | 560 |
public CallSiteDescriptor changeMethodTypeInternal(final MethodType newMethodType) { |
33343
23abd10384a5
8139931: Introduce Operation objects in Dynalink instead of string encoding
attila
parents:
33342
diff
changeset
|
561 |
return get(getLookupPrivileged(), getOperation(), newMethodType, flags); |
33331
273e6a10de22
8139435: Make sure CallSiteDescriptor.getLookup is subject to a security check
attila
parents:
33330
diff
changeset
|
562 |
} |
41843
40da931419f1
8169050: underscore_linker.js sample fails after dynalink changes for JDK-8168005
sundar
parents:
41842
diff
changeset
|
563 |
|
40da931419f1
8169050: underscore_linker.js sample fails after dynalink changes for JDK-8168005
sundar
parents:
41842
diff
changeset
|
564 |
@Override |
40da931419f1
8169050: underscore_linker.js sample fails after dynalink changes for JDK-8168005
sundar
parents:
41842
diff
changeset
|
565 |
protected CallSiteDescriptor changeOperationInternal(final Operation newOperation) { |
40da931419f1
8169050: underscore_linker.js sample fails after dynalink changes for JDK-8168005
sundar
parents:
41842
diff
changeset
|
566 |
return get(getLookupPrivileged(), newOperation, getMethodType(), flags); |
40da931419f1
8169050: underscore_linker.js sample fails after dynalink changes for JDK-8168005
sundar
parents:
41842
diff
changeset
|
567 |
} |
16147 | 568 |
} |