Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
f6b5c7ad
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f6b5c7ad
编写于
10月 21, 2015
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
288743d7
e4644efc
变更
51
隐藏空白更改
内联
并排
Showing
51 changed file
with
127 addition
and
158 deletion
+127
-158
nashorn/samples/jsadapter-fallthrough.js
nashorn/samples/jsadapter-fallthrough.js
+57
-0
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/CallSiteDescriptor.java
...are/classes/jdk/internal/dynalink/CallSiteDescriptor.java
+3
-3
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/ChainedCallSite.java
.../share/classes/jdk/internal/dynalink/ChainedCallSite.java
+31
-11
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DefaultBootstrapper.java
...re/classes/jdk/internal/dynalink/DefaultBootstrapper.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinker.java
...rn/share/classes/jdk/internal/dynalink/DynamicLinker.java
+10
-16
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinkerFactory.java
...e/classes/jdk/internal/dynalink/DynamicLinkerFactory.java
+6
-7
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/MonomorphicCallSite.java
...re/classes/jdk/internal/dynalink/MonomorphicCallSite.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/NoSuchDynamicMethodException.java
...s/jdk/internal/dynalink/NoSuchDynamicMethodException.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/RelinkableCallSite.java
...are/classes/jdk/internal/dynalink/RelinkableCallSite.java
+2
-4
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AbstractJavaLinker.java
...asses/jdk/internal/dynalink/beans/AbstractJavaLinker.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AccessibleMembersLookup.java
.../jdk/internal/dynalink/beans/AccessibleMembersLookup.java
+0
-4
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/ApplicableOverloadedMethods.java
.../internal/dynalink/beans/ApplicableOverloadedMethods.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/BeanLinker.java
...share/classes/jdk/internal/dynalink/beans/BeanLinker.java
+0
-4
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/BeansLinker.java
...hare/classes/jdk/internal/dynalink/beans/BeansLinker.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/CallerSensitiveDynamicMethod.java
...internal/dynalink/beans/CallerSensitiveDynamicMethod.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/ClassLinker.java
...hare/classes/jdk/internal/dynalink/beans/ClassLinker.java
+0
-1
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/ClassString.java
...hare/classes/jdk/internal/dynalink/beans/ClassString.java
+3
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/DynamicMethod.java
...re/classes/jdk/internal/dynalink/beans/DynamicMethod.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/FacetIntrospector.java
...lasses/jdk/internal/dynalink/beans/FacetIntrospector.java
+0
-1
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/GuardedInvocationComponent.java
...k/internal/dynalink/beans/GuardedInvocationComponent.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/MaximallySpecific.java
...lasses/jdk/internal/dynalink/beans/MaximallySpecific.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/OverloadedDynamicMethod.java
.../jdk/internal/dynalink/beans/OverloadedDynamicMethod.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/OverloadedMethod.java
...classes/jdk/internal/dynalink/beans/OverloadedMethod.java
+1
-3
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/SimpleDynamicMethod.java
...sses/jdk/internal/dynalink/beans/SimpleDynamicMethod.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/SingleDynamicMethod.java
...sses/jdk/internal/dynalink/beans/SingleDynamicMethod.java
+0
-1
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/StaticClassLinker.java
...lasses/jdk/internal/dynalink/beans/StaticClassLinker.java
+0
-1
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/ConversionComparator.java
...es/jdk/internal/dynalink/linker/ConversionComparator.java
+3
-1
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardedInvocation.java
...asses/jdk/internal/dynalink/linker/GuardedInvocation.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardingDynamicLinker.java
...s/jdk/internal/dynalink/linker/GuardingDynamicLinker.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardingTypeConverterFactory.java
...nternal/dynalink/linker/GuardingTypeConverterFactory.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/LinkRequest.java
...are/classes/jdk/internal/dynalink/linker/LinkRequest.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/LinkerServices.java
.../classes/jdk/internal/dynalink/linker/LinkerServices.java
+5
-22
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/TypeBasedGuardingDynamicLinker.java
...ernal/dynalink/linker/TypeBasedGuardingDynamicLinker.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/AbstractCallSiteDescriptor.java
...internal/dynalink/support/AbstractCallSiteDescriptor.java
+0
-1
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/AbstractRelinkableCallSite.java
...internal/dynalink/support/AbstractRelinkableCallSite.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/BottomGuardingDynamicLinker.java
...nternal/dynalink/support/BottomGuardingDynamicLinker.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/CallSiteDescriptorFactory.java
.../internal/dynalink/support/CallSiteDescriptorFactory.java
+6
-6
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/ClassMap.java
...share/classes/jdk/internal/dynalink/support/ClassMap.java
+0
-1
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/CompositeGuardingDynamicLinker.java
...rnal/dynalink/support/CompositeGuardingDynamicLinker.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/CompositeTypeBasedGuardingDynamicLinker.java
...link/support/CompositeTypeBasedGuardingDynamicLinker.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/DefaultCallSiteDescriptor.java
.../internal/dynalink/support/DefaultCallSiteDescriptor.java
+0
-1
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/Guards.java
...n/share/classes/jdk/internal/dynalink/support/Guards.java
+0
-1
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LinkRequestImpl.java
...lasses/jdk/internal/dynalink/support/LinkRequestImpl.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LinkerServicesImpl.java
...ses/jdk/internal/dynalink/support/LinkerServicesImpl.java
+0
-7
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/Lookup.java
...n/share/classes/jdk/internal/dynalink/support/Lookup.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LookupCallSiteDescriptor.java
...k/internal/dynalink/support/LookupCallSiteDescriptor.java
+0
-1
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/NameCodec.java
...hare/classes/jdk/internal/dynalink/support/NameCodec.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/RuntimeContextLinkRequestImpl.java
...ernal/dynalink/support/RuntimeContextLinkRequestImpl.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeConverterFactory.java
...s/jdk/internal/dynalink/support/TypeConverterFactory.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeUtilities.java
.../classes/jdk/internal/dynalink/support/TypeUtilities.java
+0
-2
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java
...k/nashorn/internal/runtime/linker/NashornBeansLinker.java
+0
-5
未找到文件。
nashorn/samples/jsadapter-fallthrough.js
0 → 100644
浏览文件 @
f6b5c7ad
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Demonstrate how to provide a default fall-through solution for adapted Java
// objects, forwarding all calls that are not adapted.
var
Date
=
Java
.
type
(
'
java.time.LocalDate
'
)
function
wrapDate
(
d
)
{
return
new
JSAdapter
()
{
__call__
:
function
()
{
// adapted (extra) methods
if
(
arguments
[
0
]
===
'
yesterday
'
)
{
return
d
.
minusDays
(
1
)
}
// fall-through: forward all other, non-adapted method calls
var
args
=
[
d
].
concat
(
Array
.
prototype
.
slice
.
call
(
arguments
,
1
))
return
Function
.
call
.
apply
(
d
[
arguments
[
0
]],
args
)
}
}
}
var
now
=
wrapDate
(
Date
.
now
())
print
(
now
)
print
(
now
.
yesterday
())
// adapted
print
(
now
.
lengthOfMonth
())
// fall through to original method
print
(
now
.
atTime
(
23
,
42
))
// arguments are passed through
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/CallSiteDescriptor.java
浏览文件 @
f6b5c7ad
...
...
@@ -96,8 +96,6 @@ import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
* guarding linkers so they aren't tempted to directly manipulate the call sites. The constructors of built-in
* {@link RelinkableCallSite} implementations all need a call site descriptor. Even if you create your own call site
* descriptors consider using {@link CallSiteDescriptorFactory#tokenizeName(String)} in your implementation.
*
* @author Attila Szegedi
*/
public
interface
CallSiteDescriptor
{
/**
...
...
@@ -157,7 +155,9 @@ public interface CallSiteDescriptor {
public
MethodType
getMethodType
();
/**
* Returns the lookup passed to the bootstrap method.
* Returns the lookup passed to the bootstrap method. If the lookup isn't the public lookup, the
* implementation must check the {@code RuntimePermission("dynalink.getLookup")} permission if a security
* manager is present.
* @return the lookup passed to the bootstrap method.
*/
public
Lookup
getLookup
();
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/ChainedCallSite.java
浏览文件 @
f6b5c7ad
...
...
@@ -85,9 +85,9 @@ package jdk.internal.dynalink;
import
java.lang.invoke.MethodHandle
;
import
java.lang.invoke.MethodHandles
;
import
java.util.Arrays
;
import
java.util.Iterator
;
import
java.util.LinkedList
;
import
java.util.concurrent.atomic.AtomicReference
;
import
jdk.internal.dynalink.linker.GuardedInvocation
;
import
jdk.internal.dynalink.support.AbstractRelinkableCallSite
;
import
jdk.internal.dynalink.support.Lookup
;
...
...
@@ -112,7 +112,14 @@ public class ChainedCallSite extends AbstractRelinkableCallSite {
PRUNE_SWITCHPOINTS
=
MethodHandles
.
insertArguments
(
PRUNE
,
2
,
false
);
}
private
final
AtomicReference
<
LinkedList
<
GuardedInvocation
>>
invocations
=
new
AtomicReference
<>();
/**
* Contains the invocations currently linked into this call site's target. They are used when we are
* relinking to rebuild the guardWithTest chain. Valid values for this field are: {@code null} if there's
* no linked invocations, or an instance of {@link GuardedInvocation} if there is exactly one previous
* invocation, or an instance of {@code GuardedInvocation[]} if there is more than one previous
* invocation.
*/
private
Object
invocations
;
/**
* Creates a new chained call site.
...
...
@@ -142,10 +149,18 @@ public class ChainedCallSite extends AbstractRelinkableCallSite {
}
private
MethodHandle
relinkInternal
(
final
GuardedInvocation
invocation
,
final
MethodHandle
relink
,
final
boolean
reset
,
final
boolean
removeCatches
)
{
final
LinkedList
<
GuardedInvocation
>
currentInvocations
=
invocations
.
get
();
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
final
LinkedList
<
GuardedInvocation
>
newInvocations
=
currentInvocations
==
null
||
reset
?
new
LinkedList
<>()
:
(
LinkedList
)
currentInvocations
.
clone
();
final
Object
currentInvocations
=
invocations
;
final
LinkedList
<
GuardedInvocation
>
newInvocations
;
if
(
currentInvocations
==
null
||
reset
)
{
newInvocations
=
new
LinkedList
<>();
}
else
if
(
currentInvocations
instanceof
GuardedInvocation
)
{
newInvocations
=
new
LinkedList
<>();
newInvocations
.
add
((
GuardedInvocation
)
currentInvocations
);
}
else
if
(
currentInvocations
instanceof
GuardedInvocation
[])
{
newInvocations
=
new
LinkedList
<>(
Arrays
.
asList
(((
GuardedInvocation
[])
currentInvocations
)));
}
else
{
throw
new
AssertionError
();
}
// First, prune the chain of invalidated switchpoints, we always do this
// We also remove any catches if the remove catches flag is set
...
...
@@ -177,12 +192,17 @@ public class ChainedCallSite extends AbstractRelinkableCallSite {
target
=
inv
.
compose
(
target
,
pruneAndInvokeSwitchPoints
,
pruneAndInvokeCatches
);
}
// If nobody else updated the call site while we were rebuilding the chain, set the target to our chain. In case
// we lost the race for multithreaded update, just do nothing. Either the other thread installed the same thing
// we wanted to install, or otherwise, we'll be asked to relink again.
if
(
invocations
.
compareAndSet
(
currentInvocations
,
newInvocations
))
{
setTarget
(
target
);
switch
(
newInvocations
.
size
())
{
case
0
:
invocations
=
null
;
break
;
case
1
:
invocations
=
newInvocations
.
getFirst
();
break
;
default
:
invocations
=
newInvocations
.
toArray
(
new
GuardedInvocation
[
newInvocations
.
size
()]);
}
setTarget
(
target
);
return
target
;
}
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DefaultBootstrapper.java
浏览文件 @
f6b5c7ad
...
...
@@ -97,8 +97,6 @@ import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
* and one that just uses the passed caller as the lookup scope. Using the public lookup one is advised if your language
* runtime has no concept of interacting with Java visibility scopes, as it results in a more lightweight runtime
* information.
*
* @author Attila Szegedi
*/
public
class
DefaultBootstrapper
{
private
static
final
DynamicLinker
dynamicLinker
=
new
DynamicLinkerFactory
().
createLinker
();
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinker.java
浏览文件 @
f6b5c7ad
...
...
@@ -147,15 +147,14 @@ import jdk.internal.dynalink.support.RuntimeContextLinkRequestImpl;
* additional parameters to the bootstrap method) to them.</li>
*
* </ul>
*
* @author Attila Szegedi
*/
public
class
DynamicLinker
{
public
final
class
DynamicLinker
{
private
static
final
String
CLASS_NAME
=
DynamicLinker
.
class
.
getName
();
private
static
final
String
RELINK_METHOD_NAME
=
"relink"
;
private
static
final
String
INITIAL_LINK_CLASS_NAME
=
"java.lang.invoke.MethodHandleNatives"
;
private
static
final
String
INITIAL_LINK_METHOD_NAME
=
"linkCallSite"
;
private
static
final
String
INVOKE_PACKAGE_PREFIX
=
"java.lang.invoke."
;
private
final
LinkerServices
linkerServices
;
private
final
GuardedInvocationFilter
prelinkFilter
;
...
...
@@ -305,25 +304,20 @@ public class DynamicLinker {
final
StackTraceElement
[]
trace
=
new
Throwable
().
getStackTrace
();
for
(
int
i
=
0
;
i
<
trace
.
length
-
1
;
++
i
)
{
final
StackTraceElement
frame
=
trace
[
i
];
// If we found any of our linking entry points on the stack...
if
(
isRelinkFrame
(
frame
)
||
isInitialLinkFrame
(
frame
))
{
return
trace
[
i
+
1
];
// ... then look for the first thing calling it that isn't j.l.invoke
for
(
int
j
=
i
+
1
;
j
<
trace
.
length
;
++
j
)
{
final
StackTraceElement
frame2
=
trace
[
j
];
if
(!
frame2
.
getClassName
().
startsWith
(
INVOKE_PACKAGE_PREFIX
))
{
return
frame2
;
}
}
}
}
return
null
;
}
/**
* Deprecated because of imprecise name.
*
* @deprecated Use {@link #getLinkedCallSiteLocation()} instead.
*
* @return see non-deprecated method
*/
@Deprecated
public
static
StackTraceElement
getRelinkedCallSiteLocation
()
{
return
getLinkedCallSiteLocation
();
}
/**
* Returns {@code true} if the frame represents {@code MethodHandleNatives.linkCallSite()},
* the frame immediately on top of the call site frame when the call site is
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinkerFactory.java
浏览文件 @
f6b5c7ad
...
...
@@ -111,14 +111,13 @@ import jdk.internal.dynalink.support.TypeConverterFactory;
import
jdk.internal.dynalink.support.TypeUtilities
;
/**
* A factory class for creating {@link DynamicLinker}s. The most usual dynamic linker is a linker that is a composition
* of all {@link GuardingDynamicLinker}s known and pre-created by the caller as well as any
* {@link AutoDiscovery automatically discovered} guarding linkers and the standard fallback {@link BeansLinker} and a
* {@link DefaultPrelinkFilter}. See {@link DynamicLinker} documentation for tips on how to use this class.
*
* @author Attila Szegedi
* A factory class for creating {@link DynamicLinker}s. The usual dynamic linker is a linker composed of all
* {@link GuardingDynamicLinker}s known and pre-created by the caller as well as any
* {@link AutoDiscovery automatically discovered} guarding linkers and the standard fallback
* {@link BeansLinker} and a {@link DefaultPrelinkFilter}. See {@link DynamicLinker} documentation for tips on
* how to use this class.
*/
public
class
DynamicLinkerFactory
{
public
final
class
DynamicLinkerFactory
{
/**
* Default value for {@link #setUnstableRelinkThreshold(int) unstable relink threshold}.
*/
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/MonomorphicCallSite.java
浏览文件 @
f6b5c7ad
...
...
@@ -91,8 +91,6 @@ import jdk.internal.dynalink.support.AbstractRelinkableCallSite;
* A relinkable call site that implements monomorphic inline caching strategy. After it linked a method, it will keep it
* until either its guard evaluates to false, or its switchpoint is invalidated, at which time it will throw away the
* previous linkage, and trigger relinking with its associated {@link DynamicLinker}.
*
* @author Attila Szegedi
*/
public
class
MonomorphicCallSite
extends
AbstractRelinkableCallSite
{
/**
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/NoSuchDynamicMethodException.java
浏览文件 @
f6b5c7ad
...
...
@@ -87,8 +87,6 @@ import jdk.internal.dynalink.linker.GuardingDynamicLinker;
/**
* Thrown at the invocation if the call site can not be linked by any available {@link GuardingDynamicLinker}.
*
* @author Attila Szegedi
*/
public
class
NoSuchDynamicMethodException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/RelinkableCallSite.java
浏览文件 @
f6b5c7ad
...
...
@@ -96,13 +96,11 @@ import jdk.internal.dynalink.linker.GuardedInvocation;
* {@link ChainedCallSite} that retains a chain of already linked method handles. The reason this is defined as an
* interface instead of a concrete, albeit abstract class is that it allows independent implementations to choose
* between {@link MutableCallSite} and {@link VolatileCallSite} as they see fit.
*
* @author Attila Szegedi
*/
public
interface
RelinkableCallSite
{
/**
* Initializes the relinkable call site by setting a relink-and-invoke method handle. The call site
implementation
* is supposed to set this method handle as its target.
* Initializes the relinkable call site by setting a relink-and-invoke method handle. The call site
* i
mplementation i
s supposed to set this method handle as its target.
* @param relinkAndInvoke a relink-and-invoke method handle supplied by the {@link DynamicLinker}.
*/
public
void
initialize
(
MethodHandle
relinkAndInvoke
);
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AbstractJavaLinker.java
浏览文件 @
f6b5c7ad
...
...
@@ -111,8 +111,6 @@ import jdk.internal.dynalink.support.TypeUtilities;
/**
* A base class for both {@link StaticClassLinker} and {@link BeanLinker}. Deals with common aspects of property
* exposure and method calls for both static and instance facets of a class.
*
* @author Attila Szegedi
*/
abstract
class
AbstractJavaLinker
implements
GuardingDynamicLinker
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AccessibleMembersLookup.java
浏览文件 @
f6b5c7ad
...
...
@@ -98,8 +98,6 @@ import java.util.Set;
* public, or belongs to a restricted-access package. In that case, it is required to lookup a member in a publicly
* accessible superclass or implemented interface of the class, and use it instead of the member discovered on the
* class.
*
* @author Attila Szegedi
*/
class
AccessibleMembersLookup
{
private
final
Map
<
MethodSignature
,
Method
>
methods
;
...
...
@@ -140,8 +138,6 @@ class AccessibleMembersLookup {
/**
* A helper class that represents a method signature - name and argument types.
*
* @author Attila Szegedi
*/
static
final
class
MethodSignature
{
private
final
String
name
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/ApplicableOverloadedMethods.java
浏览文件 @
f6b5c7ad
...
...
@@ -90,8 +90,6 @@ import jdk.internal.dynalink.support.TypeUtilities;
/**
* Represents overloaded methods applicable to a specific call site signature.
*
* @author Attila Szegedi
*/
class
ApplicableOverloadedMethods
{
private
final
List
<
SingleDynamicMethod
>
methods
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/BeanLinker.java
浏览文件 @
f6b5c7ad
...
...
@@ -102,8 +102,6 @@ import jdk.internal.dynalink.support.TypeUtilities;
/**
* A class that provides linking capabilities for a single POJO class. Normally not used directly, but managed by
* {@link BeansLinker}.
*
* @author Attila Szegedi
*/
class
BeanLinker
extends
AbstractJavaLinker
implements
TypeBasedGuardingDynamicLinker
{
BeanLinker
(
final
Class
<?>
clazz
)
{
...
...
@@ -316,8 +314,6 @@ class BeanLinker extends AbstractJavaLinker implements TypeBasedGuardingDynamicL
/**
* Contains methods to adapt an item getter/setter method handle to the requested type, optionally binding it to a
* fixed key first.
* @author Attila Szegedi
* @version $Id: $
*/
private
static
class
Binder
{
private
final
LinkerServices
linkerServices
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/BeansLinker.java
浏览文件 @
f6b5c7ad
...
...
@@ -125,8 +125,6 @@ import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
* <p><strong>Variable argument invocation</strong> is handled for both methods and constructors.</p>
* <p>Currently, only public fields and methods are supported. Any Lookup objects passed in the
* {@link LinkRequest}s are ignored and {@link MethodHandles#publicLookup()} is used instead.</p>
*
* @author Attila Szegedi
*/
public
class
BeansLinker
implements
GuardingDynamicLinker
{
private
static
final
ClassValue
<
TypeBasedGuardingDynamicLinker
>
linkers
=
new
ClassValue
<
TypeBasedGuardingDynamicLinker
>()
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/CallerSensitiveDynamicMethod.java
浏览文件 @
f6b5c7ad
...
...
@@ -98,8 +98,6 @@ import jdk.internal.dynalink.support.Lookup;
* caller sensitive, it doesn't cache a method handle but rather uses the passed lookup object in
* {@link #getTarget(java.lang.invoke.MethodHandles.Lookup)} to unreflect a method handle from the reflective member on
* every request.
*
* @author Attila Szegedi
*/
class
CallerSensitiveDynamicMethod
extends
SingleDynamicMethod
{
// Typed as "AccessibleObject" as it can be either a method or a constructor.
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/ClassLinker.java
浏览文件 @
f6b5c7ad
...
...
@@ -93,7 +93,6 @@ import jdk.internal.dynalink.support.Lookup;
* A linker for java.lang.Class objects. Provides a synthetic property "static" that allows access to static fields and
* methods on the class (respecting property getter/setter conventions). Note that Class objects are not recognized by
* the Dynalink as constructors for the instances of the class, {@link StaticClass} is used for this purpose.
* @author Attila Szegedi
*/
class
ClassLinker
extends
BeanLinker
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/ClassString.java
浏览文件 @
f6b5c7ad
...
...
@@ -92,8 +92,9 @@ import jdk.internal.dynalink.support.Guards;
import
jdk.internal.dynalink.support.TypeUtilities
;
/**
*
* @author Attila Szegedi
* Represents a sequence of {@link Class} objects, useful for representing method signatures. Provides value
* semantics for using them as map keys, as well as specificity calculations and applicability checks as per
* JLS.
*/
final
class
ClassString
{
/**
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/DynamicMethod.java
浏览文件 @
f6b5c7ad
...
...
@@ -93,8 +93,6 @@ import jdk.internal.dynalink.linker.LinkerServices;
* overloaded methods will perform overload resolution (actually, it will perform partial overloaded resolution at link
* time, but if that fails to identify exactly one target method, it will generate a method handle that will perform the
* rest of the overload resolution at invocation time for actual argument types).
*
* @author Attila Szegedi
*/
abstract
class
DynamicMethod
{
private
final
String
name
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/FacetIntrospector.java
浏览文件 @
f6b5c7ad
...
...
@@ -97,7 +97,6 @@ import jdk.internal.dynalink.support.Lookup;
/**
* Base for classes that expose class field and method information to an {@link AbstractJavaLinker}. There are
* subclasses for instance (bean) and static facet of a class.
* @author Attila Szegedi
*/
abstract
class
FacetIntrospector
{
private
final
Class
<?>
clazz
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/GuardedInvocationComponent.java
浏览文件 @
f6b5c7ad
...
...
@@ -91,8 +91,6 @@ import jdk.internal.dynalink.linker.GuardedInvocation;
* {@link AbstractJavaLinker}. In addition to holding a guarded invocation, it holds semantic information about its
* guard. All guards produced in the AbstractJavaLinker are either "Class.isInstance()" or "getClass() == clazz"
* expressions. This allows choosing the most restrictive guard as the guard for the composition of two components.
* @author Attila Szegedi
* @version $Id: $
*/
class
GuardedInvocationComponent
{
enum
ValidationType
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/MaximallySpecific.java
浏览文件 @
f6b5c7ad
...
...
@@ -94,8 +94,6 @@ import jdk.internal.dynalink.support.TypeUtilities;
/**
* Utility class that encapsulates the algorithm for choosing the maximally specific methods.
*
* @author Attila Szegedi
*/
class
MaximallySpecific
{
/**
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/OverloadedDynamicMethod.java
浏览文件 @
f6b5c7ad
...
...
@@ -101,8 +101,6 @@ import jdk.internal.dynalink.support.TypeUtilities;
* Represents a group of {@link SingleDynamicMethod} objects that represents all overloads of a particular name (or all
* constructors) for a particular class. Correctly handles overload resolution, variable arity methods, and caller
* sensitive methods within the overloads.
*
* @author Attila Szegedi
*/
class
OverloadedDynamicMethod
extends
DynamicMethod
{
/**
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/OverloadedMethod.java
浏览文件 @
f6b5c7ad
...
...
@@ -100,8 +100,6 @@ import jdk.internal.dynalink.support.TypeUtilities;
* a vararg subset depending on the subclass. The method is for a fixed number of arguments though (as it is generated
* for a concrete call site). As such, all methods in the subset can be invoked with the specified number of arguments
* (exactly matching for fixargs, or having less than or equal fixed arguments, for varargs).
*
* @author Attila Szegedi
*/
class
OverloadedMethod
{
private
final
Map
<
ClassString
,
MethodHandle
>
argTypesToMethods
=
new
ConcurrentHashMap
<>();
...
...
@@ -122,7 +120,7 @@ class OverloadedMethod {
fixArgMethods
=
new
ArrayList
<>(
methodHandles
.
size
());
varArgMethods
=
new
ArrayList
<>(
methodHandles
.
size
());
final
int
argNum
=
callSiteType
.
parameterCount
();
for
(
MethodHandle
mh:
methodHandles
)
{
for
(
final
MethodHandle
mh:
methodHandles
)
{
if
(
mh
.
isVarargsCollector
())
{
final
MethodHandle
asFixed
=
mh
.
asFixedArity
();
if
(
argNum
==
asFixed
.
type
().
parameterCount
())
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/SimpleDynamicMethod.java
浏览文件 @
f6b5c7ad
...
...
@@ -93,8 +93,6 @@ import java.lang.invoke.MethodType;
* {@link #getTarget(Lookup)}. Can be used in general to represents dynamic methods bound to a single method handle,
* even if that handle is not mapped to a Java method, i.e. as a wrapper around field getters/setters, array element
* getters/setters, etc.
*
* @author Attila Szegedi
*/
class
SimpleDynamicMethod
extends
SingleDynamicMethod
{
private
final
MethodHandle
target
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/SingleDynamicMethod.java
浏览文件 @
f6b5c7ad
...
...
@@ -97,7 +97,6 @@ import jdk.internal.dynalink.support.Lookup;
* Base class for dynamic methods that dispatch to a single target Java method or constructor. Handles adaptation of the
* target method to a call site type (including mapping variable arity methods to a call site signature with different
* arity).
* @author Attila Szegedi
*/
abstract
class
SingleDynamicMethod
extends
DynamicMethod
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/StaticClassLinker.java
浏览文件 @
f6b5c7ad
...
...
@@ -99,7 +99,6 @@ import jdk.internal.dynalink.support.Lookup;
/**
* Provides a linker for the {@link StaticClass} objects.
* @author Attila Szegedi
*/
class
StaticClassLinker
implements
TypeBasedGuardingDynamicLinker
{
private
static
final
ClassValue
<
SingleClassStaticsLinker
>
linkers
=
new
ClassValue
<
SingleClassStaticsLinker
>()
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/ConversionComparator.java
浏览文件 @
f6b5c7ad
...
...
@@ -90,15 +90,17 @@ package jdk.internal.dynalink.linker;
* of additional conversions. The static way of selecting the "most specific" method will fail more often, because there
* will be multiple maximally specific method with unrelated signatures. In these cases, language runtimes can be asked
* to resolve the ambiguity by expressing preferences for one conversion over the other.
* @author Attila Szegedi
*/
public
interface
ConversionComparator
{
/**
* Enumeration of possible outcomes of comparing one conversion to another.
*/
enum
Comparison
{
/** The conversions cannot be compared. **/
INDETERMINATE
,
/** The first conversion is better than the second one. **/
TYPE_1_BETTER
,
/** The second conversion is better than the first one. **/
TYPE_2_BETTER
,
}
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardedInvocation.java
浏览文件 @
f6b5c7ad
...
...
@@ -101,8 +101,6 @@ import jdk.internal.dynalink.support.Guards;
* external invalidation of the invocation handle. The invocation handle is suitable for invocation if the guard
* handle returns true for its arguments, and as long as the switch point is not invalidated. Both the guard and the
* switch point are optional; neither, one, or both can be present.
*
* @author Attila Szegedi
*/
public
class
GuardedInvocation
{
private
final
MethodHandle
invocation
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardingDynamicLinker.java
浏览文件 @
f6b5c7ad
...
...
@@ -89,8 +89,6 @@ package jdk.internal.dynalink.linker;
* very least, it depends on the receiver belonging to the language runtime of the linker). Language runtime
* implementors will normally implement one for their own language, and declare it in the
* <tt>META-INF/services/jdk.internal.dynalink.linker.GuardingDynamicLinker</tt> file within their JAR file.
*
* @author Attila Szegedi
*/
public
interface
GuardingDynamicLinker
{
/**
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardingTypeConverterFactory.java
浏览文件 @
f6b5c7ad
...
...
@@ -91,8 +91,6 @@ import jdk.internal.dynalink.support.TypeUtilities;
* very likely want to implement {@link ConversionComparator} interface too, as your additional language-specific
* conversions, in absence of a strategy for prioritizing these conversions, will cause more ambiguity in selecting the
* correct overload when trying to link to an overloaded POJO method.
*
* @author Attila Szegedi
*/
public
interface
GuardingTypeConverterFactory
{
/**
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/LinkRequest.java
浏览文件 @
f6b5c7ad
...
...
@@ -89,8 +89,6 @@ import jdk.internal.dynalink.DynamicLinkerFactory;
/**
* Represents a request to link a particular invocation at a particular call site. Instances of these requests are being
* passed to {@link GuardingDynamicLinker}.
*
* @author Attila Szegedi
*/
public
interface
LinkRequest
{
/**
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/LinkerServices.java
浏览文件 @
f6b5c7ad
...
...
@@ -95,8 +95,6 @@ import jdk.internal.dynalink.support.TypeUtilities;
* Interface for services provided to {@link GuardingDynamicLinker} instances by the {@link DynamicLinker} that owns
* them. You can think of it as the interface of the {@link DynamicLinker} that faces the {@link GuardingDynamicLinker}
* s.
*
* @author Attila Szegedi
*/
public
interface
LinkerServices
{
/**
...
...
@@ -130,7 +128,11 @@ public interface LinkerServices {
* {@link MethodHandles#filterArguments(MethodHandle, int, MethodHandle...)} with
* {@link GuardingTypeConverterFactory}-produced type converters as filters.
*/
public
MethodHandle
asTypeLosslessReturn
(
MethodHandle
handle
,
MethodType
fromType
);
public
default
MethodHandle
asTypeLosslessReturn
(
final
MethodHandle
handle
,
final
MethodType
fromType
)
{
final
Class
<?>
handleReturnType
=
handle
.
type
().
returnType
();
return
asType
(
handle
,
TypeUtilities
.
isConvertibleWithoutLoss
(
handleReturnType
,
fromType
.
returnType
())
?
fromType
:
fromType
.
changeReturnType
(
handleReturnType
));
}
/**
* Given a source and target type, returns a method handle that converts between them. Never returns null; in worst
...
...
@@ -188,23 +190,4 @@ public interface LinkerServices {
* @return a method handle with parameters and/or return type potentially filtered for wrapping and unwrapping.
*/
public
MethodHandle
filterInternalObjects
(
final
MethodHandle
target
);
/**
* If we could just use Java 8 constructs, then {@code asTypeSafeReturn} would be a method with default
* implementation. Since we can't do that, we extract common default implementations into this static class.
*/
public
static
class
Implementation
{
/**
* Default implementation for {@link LinkerServices#asTypeLosslessReturn(MethodHandle, MethodType)}.
* @param linkerServices the linker services that delegates to this implementation
* @param handle the passed handle
* @param fromType the passed type
* @return the converted method handle, as per the {@code asTypeSafeReturn} semantics.
*/
public
static
MethodHandle
asTypeLosslessReturn
(
final
LinkerServices
linkerServices
,
final
MethodHandle
handle
,
final
MethodType
fromType
)
{
final
Class
<?>
handleReturnType
=
handle
.
type
().
returnType
();
return
linkerServices
.
asType
(
handle
,
TypeUtilities
.
isConvertibleWithoutLoss
(
handleReturnType
,
fromType
.
returnType
())
?
fromType
:
fromType
.
changeReturnType
(
handleReturnType
));
}
}
}
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/TypeBasedGuardingDynamicLinker.java
浏览文件 @
f6b5c7ad
...
...
@@ -88,8 +88,6 @@ package jdk.internal.dynalink.linker;
* argument at linking invocation time. (The first argument is usually the receiver class). Most language-specific
* linkers will fall into this category, as they recognize their native objects as Java objects of classes implementing
* a specific language-native interface or superclass. The linker mechanism can optimize the dispatch for these linkers.
*
* @author Attila Szegedi
*/
public
interface
TypeBasedGuardingDynamicLinker
extends
GuardingDynamicLinker
{
/**
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/AbstractCallSiteDescriptor.java
浏览文件 @
f6b5c7ad
...
...
@@ -91,7 +91,6 @@ import jdk.internal.dynalink.CallSiteDescriptor;
/**
* A base class for call site descriptor implementations. Provides reconstruction of the name from the tokens, as well
* as a generally useful {@code equals} and {@code hashCode} methods.
* @author Attila Szegedi
*/
public
abstract
class
AbstractCallSiteDescriptor
implements
CallSiteDescriptor
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/AbstractRelinkableCallSite.java
浏览文件 @
f6b5c7ad
...
...
@@ -90,8 +90,6 @@ import jdk.internal.dynalink.RelinkableCallSite;
/**
* A basic implementation of the {@link RelinkableCallSite} as a {@link MutableCallSite} subclass.
*
* @author Attila Szegedi
*/
public
abstract
class
AbstractRelinkableCallSite
extends
MutableCallSite
implements
RelinkableCallSite
{
private
final
CallSiteDescriptor
descriptor
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/BottomGuardingDynamicLinker.java
浏览文件 @
f6b5c7ad
...
...
@@ -91,8 +91,6 @@ import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
/**
* A linker that can't link any call site. Only used internally by {@link CompositeTypeBasedGuardingDynamicLinker}. Can
* be used by other language runtimes if they need it though.
*
* @author Attila Szegedi
*/
public
class
BottomGuardingDynamicLinker
implements
TypeBasedGuardingDynamicLinker
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/CallSiteDescriptorFactory.java
浏览文件 @
f6b5c7ad
...
...
@@ -97,12 +97,12 @@ import java.util.WeakHashMap;
import
jdk.internal.dynalink.CallSiteDescriptor
;
/**
* Usable as a default factory for call site descriptor implementations. It is weakly canonicalizing, meaning
it will
*
return the same immutable call site descriptor for identical inputs, i.e. repeated requests for a descriptor
*
signifying public lookup for "dyn:getProp:color" of type "Object(Object)" will return the same object as long as
*
a previously created, at least softly reachable one exists. It also uses several different implementations of the
*
{@link CallSiteDescriptor} internally, and chooses the most space-efficient one based on the input.
*
@author Attila Szegedi
* Usable as a default factory for call site descriptor implementations. It is weakly canonicalizing, meaning
*
it will return the same immutable call site descriptor for identical inputs, i.e. repeated requests for a
*
descriptor signifying public lookup for {@code "dyn:getProp:color"} of type {@code Object(Object)} will
*
return the same object as long as a previously created, at least softly reachable one exists. It also uses
*
several different implementations of the {@link CallSiteDescriptor} internally, and chooses the most
*
space-efficient one based on the input.
*/
public
class
CallSiteDescriptorFactory
{
private
static
final
WeakHashMap
<
CallSiteDescriptor
,
Reference
<
CallSiteDescriptor
>>
publicDescs
=
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/ClassMap.java
浏览文件 @
f6b5c7ad
...
...
@@ -96,7 +96,6 @@ import java.util.concurrent.ConcurrentMap;
* A dual map that can either strongly or weakly reference a given class depending on whether the class is visible from
* a class loader or not.
*
* @author Attila Szegedi
* @param <T> the type of the values in the map
*/
public
abstract
class
ClassMap
<
T
>
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/CompositeGuardingDynamicLinker.java
浏览文件 @
f6b5c7ad
...
...
@@ -95,8 +95,6 @@ import jdk.internal.dynalink.linker.LinkerServices;
* A {@link GuardingDynamicLinker} that delegates sequentially to a list of other guarding dynamic linkers. The first
* value returned from a component linker other than null is returned. If no component linker returns an invocation,
* null is returned.
*
* @author Attila Szegedi
*/
public
class
CompositeGuardingDynamicLinker
implements
GuardingDynamicLinker
,
Serializable
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/CompositeTypeBasedGuardingDynamicLinker.java
浏览文件 @
f6b5c7ad
...
...
@@ -98,8 +98,6 @@ import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
* are queried sequentially on their {@link TypeBasedGuardingDynamicLinker#canLinkType(Class)} method. The linkers
* returning true are then bound to the class, and next time a receiver of same type is encountered, the linking is
* delegated to those linkers only, speeding up dispatch.
*
* @author Attila Szegedi
*/
public
class
CompositeTypeBasedGuardingDynamicLinker
implements
TypeBasedGuardingDynamicLinker
,
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/DefaultCallSiteDescriptor.java
浏览文件 @
f6b5c7ad
...
...
@@ -91,7 +91,6 @@ import jdk.internal.dynalink.CallSiteDescriptor;
* A default, fairly light implementation of a call site descriptor used for describing non-standard operations. It does
* not store {@link Lookup} objects but always returns the public lookup from its {@link #getLookup()} method. If you
* need to support non-public lookup, you can use {@link LookupCallSiteDescriptor}.
* @author Attila Szegedi
*/
class
DefaultCallSiteDescriptor
extends
AbstractCallSiteDescriptor
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/Guards.java
浏览文件 @
f6b5c7ad
...
...
@@ -94,7 +94,6 @@ import jdk.internal.dynalink.linker.LinkerServices;
/**
* Utility methods for creating typical guards. TODO: introduce reasonable caching of created guards.
*
* @author Attila Szegedi
*/
public
class
Guards
{
private
static
final
Logger
LOG
=
Logger
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LinkRequestImpl.java
浏览文件 @
f6b5c7ad
...
...
@@ -89,8 +89,6 @@ import jdk.internal.dynalink.linker.LinkRequest;
/**
* Default implementation of the {@link LinkRequest}, representing a link request to a call site that passes no language
* runtime specific native context arguments on the stack.
*
* @author Attila Szegedi
*/
public
class
LinkRequestImpl
implements
LinkRequest
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LinkerServicesImpl.java
浏览文件 @
f6b5c7ad
...
...
@@ -94,8 +94,6 @@ import jdk.internal.dynalink.linker.MethodHandleTransformer;
/**
* Default implementation of the {@link LinkerServices} interface.
*
* @author Attila Szegedi
*/
public
class
LinkerServicesImpl
implements
LinkerServices
{
...
...
@@ -131,11 +129,6 @@ public class LinkerServicesImpl implements LinkerServices {
return
typeConverterFactory
.
asType
(
handle
,
fromType
);
}
@Override
public
MethodHandle
asTypeLosslessReturn
(
final
MethodHandle
handle
,
final
MethodType
fromType
)
{
return
Implementation
.
asTypeLosslessReturn
(
this
,
handle
,
fromType
);
}
@Override
public
MethodHandle
getTypeConverter
(
final
Class
<?>
sourceType
,
final
Class
<?>
targetType
)
{
return
typeConverterFactory
.
getTypeConverter
(
sourceType
,
targetType
);
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/Lookup.java
浏览文件 @
f6b5c7ad
...
...
@@ -93,8 +93,6 @@ import java.lang.reflect.Method;
/**
* A wrapper around MethodHandles.Lookup that masks checked exceptions in those cases when you're looking up methods
* within your own codebase (therefore it is an error if they are not present).
*
* @author Attila Szegedi
*/
public
class
Lookup
{
private
final
MethodHandles
.
Lookup
lookup
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LookupCallSiteDescriptor.java
浏览文件 @
f6b5c7ad
...
...
@@ -89,7 +89,6 @@ import jdk.internal.dynalink.CallSiteDescriptor;
/**
* A call site descriptor that stores a specific {@link Lookup}. It does not, however, store static bootstrap arguments.
* @author Attila Szegedi
*/
class
LookupCallSiteDescriptor
extends
DefaultCallSiteDescriptor
{
private
final
Lookup
lookup
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/NameCodec.java
浏览文件 @
f6b5c7ad
...
...
@@ -99,8 +99,6 @@ import jdk.internal.dynalink.CallSiteDescriptor;
* have your own way of creating call site descriptors, but you still delegate to this method of the default factory
* (it is recommended that you do), then you have demangling handled for you already, and only need to ensure that you
* mangle the names when you're emitting them in the bytecode.
*
* @author Attila Szegedi
*/
public
class
NameCodec
{
private
static
final
char
ESCAPE_CHAR
=
'\\'
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/RuntimeContextLinkRequestImpl.java
浏览文件 @
f6b5c7ad
...
...
@@ -89,8 +89,6 @@ import jdk.internal.dynalink.linker.LinkRequest;
/**
* A link request implementation for call sites that pass language runtime specific context arguments on the stack. The
* context specific arguments should be the first "n" arguments.
*
* @author Attila Szegedi
*/
public
class
RuntimeContextLinkRequestImpl
extends
LinkRequestImpl
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeConverterFactory.java
浏览文件 @
f6b5c7ad
...
...
@@ -103,8 +103,6 @@ import jdk.internal.dynalink.linker.MethodTypeConversionStrategy;
* A factory for type converters. This class is the main implementation behind the
* {@link LinkerServices#asType(MethodHandle, MethodType)}. It manages the known {@link GuardingTypeConverterFactory}
* instances and creates appropriate converters for method handles.
*
* @author Attila Szegedi
*/
public
class
TypeConverterFactory
{
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeUtilities.java
浏览文件 @
f6b5c7ad
...
...
@@ -96,8 +96,6 @@ import java.util.Set;
/**
* Various static utility methods for testing type relationships.
*
* @author Attila Szegedi
*/
public
class
TypeUtilities
{
static
final
Class
<
Object
>
OBJECT_CLASS
=
Object
.
class
;
...
...
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java
浏览文件 @
f6b5c7ad
...
...
@@ -210,11 +210,6 @@ public class NashornBeansLinker implements GuardingDynamicLinker {
return
linkerServices
.
asType
(
handle
,
fromType
);
}
@Override
public
MethodHandle
asTypeLosslessReturn
(
final
MethodHandle
handle
,
final
MethodType
fromType
)
{
return
Implementation
.
asTypeLosslessReturn
(
this
,
handle
,
fromType
);
}
@Override
public
MethodHandle
getTypeConverter
(
final
Class
<?>
sourceType
,
final
Class
<?>
targetType
)
{
return
linkerServices
.
getTypeConverter
(
sourceType
,
targetType
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录