8139304: Remove elaborate call site descriptor class hierarchy and factory for them. Remove AutoDiscovery, DefaultPrelinkFilter, and BottomGuardingDynamicLinker as they can be inlined into DynamicLinkerFactory. Remove CallerSensitiveDetector as it can be inlined into AbstractJavaLinker. Make ClassMap non-public.
authorattila
Mon, 19 Oct 2015 08:23:03 +0200
changeset 33330 35531ae624ef
parent 33008 9d7d11b9d0f6
child 33331 273e6a10de22
8139304: Remove elaborate call site descriptor class hierarchy and factory for them. Remove AutoDiscovery, DefaultPrelinkFilter, and BottomGuardingDynamicLinker as they can be inlined into DynamicLinkerFactory. Remove CallerSensitiveDetector as it can be inlined into AbstractJavaLinker. Make ClassMap non-public. Reviewed-by: hannesw, sundar
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/CallSiteDescriptor.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/ChainedCallSite.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/ClassLoaderGetterContextProvider.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/ClassMap.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DefaultBootstrapper.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinker.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinkerFactory.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/GuardedInvocationFilter.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/LinkerServicesImpl.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/TypeConverterFactory.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AbstractJavaLinker.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/CallerSensitiveDetector.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/DynamicMethodLinker.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/AbstractCallSiteDescriptor.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/AutoDiscovery.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/BottomGuardingDynamicLinker.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/CallSiteDescriptorFactory.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/ClassLoaderGetterContextProvider.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/ClassMap.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/DefaultCallSiteDescriptor.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/DefaultPrelinkFilter.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/Guards.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LinkerServicesImpl.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LookupCallSiteDescriptor.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/NameCodec.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/NamedDynCallSiteDescriptor.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/RuntimeContextLinkRequestImpl.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/SimpleCallSiteDescriptor.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeConverterFactory.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/UnnamedDynCallSiteDescriptor.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Undefined.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaSuperAdapterLinker.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornLinker.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/CallSiteDescriptor.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/CallSiteDescriptor.java	Mon Oct 19 08:23:03 2015 +0200
@@ -83,19 +83,21 @@
 
 package jdk.internal.dynalink;
 
+import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.invoke.MethodType;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.StringTokenizer;
+import jdk.internal.dynalink.support.NameCodec;
 
 /**
  * An immutable descriptor of a call site. It is an immutable object that contains all the information about a call
- * site: the class performing the lookups, the name of the method being invoked, and the method signature. The library
- * has a default {@link CallSiteDescriptorFactory} for descriptors that you can use, or you can create your own
- * descriptor classes, especially if you need to add further information (values passed in additional parameters to the
- * bootstrap method) to them. Call site descriptors are used in this library in place of passing a real call site to
+ * site: the class performing the lookups, the name of the method being invoked, and the method signature. Call site descriptors are used in this library in place of passing a real call site to
  * 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.
+ * descriptors consider using {@link CallSiteDescriptor#tokenizeName(String)} in your implementation.
  */
 public interface CallSiteDescriptor {
     /**
@@ -155,10 +157,10 @@
     public MethodType getMethodType();
 
     /**
-     * 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.
+     * Returns the lookup passed to the bootstrap method.
      * @return the lookup passed to the bootstrap method.
+     * @throws SecurityException if the lookup isn't the {@link MethodHandles#publicLookup()} and a security
+     * manager is present, and a check for {@code RuntimePermission("dynalink.getLookup")} fails.
      */
     public Lookup getLookup();
 
@@ -171,4 +173,43 @@
      */
     public CallSiteDescriptor changeMethodType(MethodType newMethodType);
 
+
+    /**
+     * Tokenizes a composite operation name along pipe characters. I.e. if you have a "dyn:getElem|getProp|getMethod"
+     * operation, returns a list of ["getElem", "getProp", "getMethod"]. The tokens are not interned.
+     * @return a list of tokens
+     */
+    public default List<String> tokenizeOperators() {
+        final String ops = getNameToken(CallSiteDescriptor.OPERATOR);
+        final StringTokenizer tok = new StringTokenizer(ops, CallSiteDescriptor.OPERATOR_DELIMITER);
+        final int count = tok.countTokens();
+        if(count == 1) {
+            return Collections.singletonList(ops);
+        }
+        final String[] tokens = new String[count];
+        for(int i = 0; i < count; ++i) {
+            tokens[i] = tok.nextToken();
+        }
+        return Arrays.asList(tokens);
+    }
+
+    /**
+     * Tokenizes the composite name along colons, as well as {@link NameCodec#decode(String) demangles} and interns
+     * the tokens. The first two tokens are not demangled as they are supposed to be the naming scheme and the name of
+     * the operation which can be expected to consist of just alphabetical characters.
+     * @param name the composite name consisting of colon-separated, possibly mangled tokens.
+     * @return an array of tokens
+     */
+    public static String[] tokenizeName(final String name) {
+        final StringTokenizer tok = new StringTokenizer(name, CallSiteDescriptor.TOKEN_DELIMITER);
+        final String[] tokens = new String[tok.countTokens()];
+        for(int i = 0; i < tokens.length; ++i) {
+            String token = tok.nextToken();
+            if(i > 1) {
+                token = NameCodec.decode(token);
+            }
+            tokens[i] = token.intern();
+        }
+        return tokens;
+    }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/ChainedCallSite.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/ChainedCallSite.java	Mon Oct 19 08:23:03 2015 +0200
@@ -175,7 +175,7 @@
         // adding any new invocations to it.
         if(invocation != null) {
             // Remove oldest entry if we're at max length
-            if(newInvocations.size() == getMaxChainLength()) {
+            if(newInvocations.size() == checkMaxChainLength(getMaxChainLength())) {
                 newInvocations.removeFirst();
             }
             newInvocations.addLast(invocation);
@@ -206,6 +206,13 @@
         return target;
     }
 
+    private static int checkMaxChainLength(final int maxChainLength) {
+        if (maxChainLength > 0) {
+            return maxChainLength;
+        }
+        throw new RuntimeException("getMaxChainLength() returned a non-positive value");
+
+    }
     /**
      * Creates a method that rebuilds our call chain, pruning it of any invalidated switchpoints, and then invokes that
      * chain.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/ClassLoaderGetterContextProvider.java	Mon Oct 19 08:23:03 2015 +0200
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       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 the copyright holder nor the names of
+         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 COPYRIGHT HOLDER
+       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.
+*/
+
+package jdk.internal.dynalink;
+
+import java.security.AccessControlContext;
+import java.security.Permissions;
+import java.security.ProtectionDomain;
+
+/**
+ * This class exposes a canonical {@link AccessControlContext} with a single {@link RuntimePermission} for
+ * {@code "getClassLoader"} permission that is used by other parts of the code to narrow their set of permissions when
+ * they're retrieving class loaders in privileged blocks.
+ */
+final class ClassLoaderGetterContextProvider {
+    /**
+     * Canonical instance of {@link AccessControlContext} with a single {@link RuntimePermission} for
+     * {@code "getClassLoader"} permission.
+     */
+    static final AccessControlContext GET_CLASS_LOADER_CONTEXT;
+    static {
+        final Permissions perms = new Permissions();
+        perms.add(new RuntimePermission("getClassLoader"));
+        GET_CLASS_LOADER_CONTEXT = new AccessControlContext(
+                new ProtectionDomain[] { new ProtectionDomain(null, perms) });
+    }
+
+    private ClassLoaderGetterContextProvider() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/ClassMap.java	Mon Oct 19 08:23:03 2015 +0200
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       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 the copyright holder nor the names of
+         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 COPYRIGHT HOLDER
+       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.
+*/
+
+package jdk.internal.dynalink;
+
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import jdk.internal.dynalink.support.Guards;
+
+/**
+ * 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.
+ *
+ * @param <T> the type of the values in the map
+ */
+abstract class ClassMap<T> {
+    private final ConcurrentMap<Class<?>, T> map = new ConcurrentHashMap<>();
+    private final Map<Class<?>, Reference<T>> weakMap = new WeakHashMap<>();
+    private final ClassLoader classLoader;
+
+    /**
+     * Creates a new class map. It will use strong references for all keys and values where the key is a class visible
+     * from the class loader, and will use weak keys and soft values for all other classes.
+     *
+     * @param classLoader the classloader that determines strong referenceability.
+     */
+    ClassMap(final ClassLoader classLoader) {
+        this.classLoader = classLoader;
+    }
+
+    /**
+     * Compute the value associated with the given class. It is possible that the method will be invoked several times
+     * (or even concurrently) for the same class parameter.
+     *
+     * @param clazz the class to compute the value for
+     * @return the return value. Must not be null.
+     */
+    abstract T computeValue(Class<?> clazz);
+
+    /**
+     * Returns the value associated with the class
+     *
+     * @param clazz the class
+     * @return the value associated with the class
+     */
+    T get(final Class<?> clazz) {
+        // Check in fastest first - objects we're allowed to strongly reference
+        final T v = map.get(clazz);
+        if(v != null) {
+            return v;
+        }
+        // Check objects we're not allowed to strongly reference
+        Reference<T> ref;
+        synchronized(weakMap) {
+            ref = weakMap.get(clazz);
+        }
+        if(ref != null) {
+            final T refv = ref.get();
+            if(refv != null) {
+                return refv;
+            }
+        }
+        // Not found in either place; create a new value
+        final T newV = computeValue(clazz);
+        assert newV != null;
+
+        final ClassLoader clazzLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+            @Override
+            public ClassLoader run() {
+                return clazz.getClassLoader();
+            }
+        }, ClassLoaderGetterContextProvider.GET_CLASS_LOADER_CONTEXT);
+
+        // If allowed to strongly reference, put it in the fast map
+        if(Guards.canReferenceDirectly(classLoader, clazzLoader)) {
+            final T oldV = map.putIfAbsent(clazz, newV);
+            return oldV != null ? oldV : newV;
+        }
+        // Otherwise, put it into the weak map
+        synchronized(weakMap) {
+            ref = weakMap.get(clazz);
+            if(ref != null) {
+                final T oldV = ref.get();
+                if(oldV != null) {
+                    return oldV;
+                }
+            }
+            weakMap.put(clazz, new SoftReference<>(newV));
+            return newV;
+        }
+    }
+}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DefaultBootstrapper.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink;
-
-import java.lang.invoke.CallSite;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodType;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
-
-/**
- * A convenience default bootstrapper that exposes static bootstrap methods which language runtimes that need the very
- * default behavior can use with minimal setup. When first referenced, it will create a dynamic linker with default
- * settings for the {@link DynamicLinkerFactory}, and its bootstrap methods will create {@link MonomorphicCallSite} for
- * all call sites. It has two bootstrap methods: one creates call sites that use the
- * {@link MethodHandles#publicLookup()} as the lookup for all call sites and disregard the one passed in as the caller,
- * 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.
- */
-public class DefaultBootstrapper {
-    private static final DynamicLinker dynamicLinker = new DynamicLinkerFactory().createLinker();
-
-    private DefaultBootstrapper() {
-    }
-
-    /**
-     * Use this method as your bootstrap method (see the documentation of the java.lang.invoke package for how to do
-     * this). In case your language runtime doesn't have a concept of interaction with Java access scopes, you might
-     * want to consider using
-     * {@link #publicBootstrap(java.lang.invoke.MethodHandles.Lookup, String, MethodType)} instead.
-     *
-     * @param caller the caller's lookup
-     * @param name the name of the method at the call site
-     * @param type the method signature at the call site
-     * @return a new {@link MonomorphicCallSite} linked with the default dynamic linker.
-     */
-    public static CallSite bootstrap(final MethodHandles.Lookup caller, final String name, final MethodType type) {
-        return bootstrapInternal(caller, name, type);
-    }
-
-    /**
-     * Use this method as your bootstrap method (see the documentation of the java.lang.invoke package for how to do
-     * this) when your language runtime doesn't have a concept of interaction with Java access scopes. If you need to
-     * preserve the different caller Lookup objects in the call sites, use
-     * {@link #bootstrap(java.lang.invoke.MethodHandles.Lookup, String, MethodType)} instead
-     *
-     * @param caller the caller's lookup. It is ignored as the call sites will be created with
-     * {@link MethodHandles#publicLookup()} instead.
-     * @param name the name of the method at the call site
-     * @param type the method signature at the call site
-     * @return a new {@link MonomorphicCallSite} linked with the default dynamic linker.
-     */
-    public static CallSite publicBootstrap(final MethodHandles.Lookup caller, final String name, final MethodType type) {
-        return bootstrapInternal(MethodHandles.publicLookup(), name, type);
-    }
-
-    private static CallSite bootstrapInternal(final MethodHandles.Lookup caller, final String name, final MethodType type) {
-        return dynamicLinker.link(new MonomorphicCallSite(CallSiteDescriptorFactory.create(caller, name, type)));
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinker.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinker.java	Mon Oct 19 08:23:03 2015 +0200
@@ -93,10 +93,10 @@
 import jdk.internal.dynalink.linker.GuardingDynamicLinker;
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.linker.LinkerServices;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.internal.dynalink.support.LinkRequestImpl;
 import jdk.internal.dynalink.support.Lookup;
 import jdk.internal.dynalink.support.RuntimeContextLinkRequestImpl;
+import jdk.internal.dynalink.support.SimpleCallSiteDescriptor;
 
 /**
  * The linker for {@link RelinkableCallSite} objects. Users of it (scripting
@@ -130,7 +130,7 @@
  * language. If your runtime doesn't have its own language and/or object model
  * (i.e., it's a generic scripting shell), you don't need to implement a dynamic
  * linker; you would simply not invoke the {@code setPrioritizedLinker} method
- * on the factory, or even better, simply use {@link DefaultBootstrapper}.</li>
+ * on the factory.</li>
  *
  * <li>The performance of the programs can depend on your choice of the class to
  * represent call sites. The above example used {@link MonomorphicCallSite}, but
@@ -141,10 +141,10 @@
  * <li>You also need to provide {@link CallSiteDescriptor}s to your call sites.
  * They are immutable objects that contain all the information about the call
  * site: the class performing the lookups, the name of the method being invoked,
- * and the method signature. The library has a default {@link CallSiteDescriptorFactory}
- * for descriptors that you can use, or you can create your own descriptor
- * classes, especially if you need to add further information (values passed in
- * additional parameters to the bootstrap method) to them.</li>
+ * and the method signature. The library provides a {@link SimpleCallSiteDescriptor},
+ * or you can create your own descriptor classes, especially if you need to add
+ * further information (values passed in additional parameters to the bootstrap method)
+ * to them.</li>
  *
  * </ul>
  */
@@ -319,6 +319,16 @@
     }
 
     /**
+     * Returns the currently processed link request, or null if the method is invoked outside of the linking process.
+     * @return the currently processed link request, or null.
+     * @throws SecurityException if the calling code doesn't have the {@code "dynalink.getCurrentLinkRequest"} runtime
+     * permission.
+     */
+    public static LinkRequest getCurrentLinkRequest() {
+        return LinkerServicesImpl.getCurrentLinkRequest();
+    }
+
+    /**
      * 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
      * being linked for the first time.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinkerFactory.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinkerFactory.java	Mon Oct 19 08:23:03 2015 +0200
@@ -92,30 +92,27 @@
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.ServiceLoader;
 import java.util.Set;
 import jdk.internal.dynalink.beans.BeansLinker;
+import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.GuardingDynamicLinker;
 import jdk.internal.dynalink.linker.GuardingTypeConverterFactory;
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.linker.LinkerServices;
 import jdk.internal.dynalink.linker.MethodHandleTransformer;
 import jdk.internal.dynalink.linker.MethodTypeConversionStrategy;
-import jdk.internal.dynalink.support.AutoDiscovery;
-import jdk.internal.dynalink.support.BottomGuardingDynamicLinker;
-import jdk.internal.dynalink.support.ClassLoaderGetterContextProvider;
 import jdk.internal.dynalink.support.CompositeGuardingDynamicLinker;
 import jdk.internal.dynalink.support.CompositeTypeBasedGuardingDynamicLinker;
-import jdk.internal.dynalink.support.DefaultPrelinkFilter;
-import jdk.internal.dynalink.support.LinkerServicesImpl;
-import jdk.internal.dynalink.support.TypeConverterFactory;
 import jdk.internal.dynalink.support.TypeUtilities;
 
 /**
  * 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.
+ * guarding linkers automatically discovered as declared in
+ * {@code /META-INF/services/jdk.internal.dynalink.linker.GuardingDynamicLinker} resources in the classpath (see
+ * {@link ServiceLoader} for the description of this mechanism), and the standard fallback {@link BeansLinker}.
+ * See {@link DynamicLinker} documentation for tips on how to use this class.
  */
 public final class DynamicLinkerFactory {
     /**
@@ -255,7 +252,8 @@
      * Set the pre-link filter. This is a {@link GuardedInvocationFilter} that will get the final chance to modify the
      * guarded invocation after it has been created by a component linker and before the dynamic linker links it into
      * the call site. It is normally used to adapt the return value type of the invocation to the type of the call site.
-     * When not set explicitly, {@link DefaultPrelinkFilter} will be used.
+     * When not set explicitly, a default pre-link filter will be used that simply calls
+     * {@link GuardedInvocation#asType(LinkerServices, java.lang.invoke.MethodType)}
      * @param prelinkFilter the pre-link filter for the dynamic linker.
      */
     public void setPrelinkFilter(final GuardedInvocationFilter prelinkFilter) {
@@ -317,7 +315,12 @@
         addClasses(knownLinkerClasses, fallbackLinkers);
 
         final ClassLoader effectiveClassLoader = classLoaderExplicitlySet ? classLoader : getThreadContextClassLoader();
-        final List<GuardingDynamicLinker> discovered = AutoDiscovery.loadLinkers(effectiveClassLoader);
+        final List<GuardingDynamicLinker> discovered = new LinkedList<>();
+        final ServiceLoader<GuardingDynamicLinker> linkerLoader = ServiceLoader.load(GuardingDynamicLinker.class, effectiveClassLoader);
+        for(final GuardingDynamicLinker linker: linkerLoader) {
+            discovered.add(linker);
+        }
+
         // Now, concatenate ...
         final List<GuardingDynamicLinker> linkers =
                 new ArrayList<>(prioritizedLinkers.size() + discovered.size()
@@ -336,7 +339,7 @@
         final GuardingDynamicLinker composite;
         switch(linkers.size()) {
             case 0: {
-                composite = BottomGuardingDynamicLinker.INSTANCE;
+                composite = (r, s) -> null; // linker that can't link anything
                 break;
             }
             case 1: {
@@ -357,7 +360,7 @@
         }
 
         if(prelinkFilter == null) {
-            prelinkFilter = new DefaultPrelinkFilter();
+            prelinkFilter = (inv, request, linkerServices) -> inv.asType(linkerServices, request.getCallSiteDescriptor().getMethodType());
         }
 
         return new DynamicLinker(new LinkerServicesImpl(new TypeConverterFactory(typeConverters,
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/GuardedInvocationFilter.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/GuardedInvocationFilter.java	Mon Oct 19 08:23:03 2015 +0200
@@ -91,6 +91,7 @@
  * Interface for objects that are used to transform one guarded invocation into another one. Typical usage is for
  * implementing {@link DynamicLinkerFactory#setPrelinkFilter(GuardedInvocationFilter) pre-link filters}.
  */
+@FunctionalInterface
 public interface GuardedInvocationFilter {
     /**
      * Given a guarded invocation, return a potentially different guarded invocation.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/LinkerServicesImpl.java	Mon Oct 19 08:23:03 2015 +0200
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       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 the copyright holder nor the names of
+         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 COPYRIGHT HOLDER
+       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.
+*/
+
+package jdk.internal.dynalink;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodType;
+import jdk.internal.dynalink.linker.ConversionComparator.Comparison;
+import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.GuardingDynamicLinker;
+import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.internal.dynalink.linker.LinkerServices;
+import jdk.internal.dynalink.linker.MethodHandleTransformer;
+
+/**
+ * Default implementation of the {@link LinkerServices} interface.
+ */
+final class LinkerServicesImpl implements LinkerServices {
+    private static final RuntimePermission GET_CURRENT_LINK_REQUEST = new RuntimePermission("dynalink.getCurrentLinkRequest");
+    private static final ThreadLocal<LinkRequest> threadLinkRequest = new ThreadLocal<>();
+
+    private final TypeConverterFactory typeConverterFactory;
+    private final GuardingDynamicLinker topLevelLinker;
+    private final MethodHandleTransformer internalObjectsFilter;
+
+    /**
+     * Creates a new linker services object.
+     *
+     * @param typeConverterFactory the type converter factory exposed by the services.
+     * @param topLevelLinker the top level linker used by the services.
+     * @param internalObjectsFilter a method handle transformer that is supposed to act as the implementation of this
+     * services' {@link #filterInternalObjects(java.lang.invoke.MethodHandle)} method.
+     */
+    LinkerServicesImpl(final TypeConverterFactory typeConverterFactory,
+            final GuardingDynamicLinker topLevelLinker, final MethodHandleTransformer internalObjectsFilter) {
+        this.typeConverterFactory = typeConverterFactory;
+        this.topLevelLinker = topLevelLinker;
+        this.internalObjectsFilter = internalObjectsFilter;
+    }
+
+    @Override
+    public boolean canConvert(final Class<?> from, final Class<?> to) {
+        return typeConverterFactory.canConvert(from, to);
+    }
+
+    @Override
+    public MethodHandle asType(final MethodHandle handle, final MethodType fromType) {
+        return typeConverterFactory.asType(handle, fromType);
+    }
+
+    @Override
+    public MethodHandle getTypeConverter(final Class<?> sourceType, final Class<?> targetType) {
+        return typeConverterFactory.getTypeConverter(sourceType, targetType);
+    }
+
+    @Override
+    public Comparison compareConversion(final Class<?> sourceType, final Class<?> targetType1, final Class<?> targetType2) {
+        return typeConverterFactory.compareConversion(sourceType, targetType1, targetType2);
+    }
+
+    @Override
+    public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest) throws Exception {
+        final LinkRequest prevLinkRequest = threadLinkRequest.get();
+        threadLinkRequest.set(linkRequest);
+        try {
+            return topLevelLinker.getGuardedInvocation(linkRequest, this);
+        } finally {
+            threadLinkRequest.set(prevLinkRequest);
+        }
+    }
+
+    @Override
+    public MethodHandle filterInternalObjects(final MethodHandle target) {
+        return internalObjectsFilter != null ? internalObjectsFilter.transform(target) : target;
+    }
+
+    static LinkRequest getCurrentLinkRequest() {
+        final LinkRequest currentRequest = threadLinkRequest.get();
+        if (currentRequest != null) {
+            final SecurityManager sm = System.getSecurityManager();
+            if(sm != null) {
+                sm.checkPermission(GET_CURRENT_LINK_REQUEST);
+            }
+        }
+        return currentRequest;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/TypeConverterFactory.java	Mon Oct 19 08:23:03 2015 +0200
@@ -0,0 +1,409 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       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 the copyright holder nor the names of
+         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 COPYRIGHT HOLDER
+       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.
+*/
+
+package jdk.internal.dynalink;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.invoke.WrongMethodTypeException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.LinkedList;
+import java.util.List;
+import jdk.internal.dynalink.linker.ConversionComparator;
+import jdk.internal.dynalink.linker.ConversionComparator.Comparison;
+import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.GuardedTypeConversion;
+import jdk.internal.dynalink.linker.GuardingTypeConverterFactory;
+import jdk.internal.dynalink.linker.LinkerServices;
+import jdk.internal.dynalink.linker.MethodTypeConversionStrategy;
+import jdk.internal.dynalink.support.TypeUtilities;
+
+/**
+ * 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.
+ */
+final class TypeConverterFactory {
+
+    private final GuardingTypeConverterFactory[] factories;
+    private final ConversionComparator[] comparators;
+    private final MethodTypeConversionStrategy autoConversionStrategy;
+
+    private final ClassValue<ClassMap<MethodHandle>> converterMap = new ClassValue<ClassMap<MethodHandle>>() {
+        @Override
+        protected ClassMap<MethodHandle> computeValue(final Class<?> sourceType) {
+            return new ClassMap<MethodHandle>(getClassLoader(sourceType)) {
+                @Override
+                protected MethodHandle computeValue(final Class<?> targetType) {
+                    try {
+                        return createConverter(sourceType, targetType);
+                    } catch (final RuntimeException e) {
+                        throw e;
+                    } catch (final Exception e) {
+                        throw new RuntimeException(e);
+                    }
+                }
+            };
+        }
+    };
+
+    private final ClassValue<ClassMap<MethodHandle>> converterIdentityMap = new ClassValue<ClassMap<MethodHandle>>() {
+        @Override
+        protected ClassMap<MethodHandle> computeValue(final Class<?> sourceType) {
+            return new ClassMap<MethodHandle>(getClassLoader(sourceType)) {
+                @Override
+                protected MethodHandle computeValue(final Class<?> targetType) {
+                    if(!canAutoConvert(sourceType, targetType)) {
+                        final MethodHandle converter = getCacheableTypeConverter(sourceType, targetType);
+                        if(converter != IDENTITY_CONVERSION) {
+                            return converter;
+                        }
+                    }
+                    return IDENTITY_CONVERSION.asType(MethodType.methodType(targetType, sourceType));
+                }
+            };
+        }
+    };
+
+    private final ClassValue<ClassMap<Boolean>> canConvert = new ClassValue<ClassMap<Boolean>>() {
+        @Override
+        protected ClassMap<Boolean> computeValue(final Class<?> sourceType) {
+            return new ClassMap<Boolean>(getClassLoader(sourceType)) {
+                @Override
+                protected Boolean computeValue(final Class<?> targetType) {
+                    try {
+                        return getTypeConverterNull(sourceType, targetType) != null;
+                    } catch (final RuntimeException e) {
+                        throw e;
+                    } catch (final Exception e) {
+                        throw new RuntimeException(e);
+                    }
+                }
+            };
+        }
+    };
+
+    private static ClassLoader getClassLoader(final Class<?> clazz) {
+        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+            @Override
+            public ClassLoader run() {
+                return clazz.getClassLoader();
+            }
+        }, ClassLoaderGetterContextProvider.GET_CLASS_LOADER_CONTEXT);
+    }
+
+    /**
+     * Creates a new type converter factory from the available {@link GuardingTypeConverterFactory} instances.
+     *
+     * @param factories the {@link GuardingTypeConverterFactory} instances to compose.
+     * @param autoConversionStrategy conversion strategy for automatic type conversions. After
+     * {@link #asType(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType)} has applied all custom
+     * conversions to a method handle, it still needs to effect
+     * {@link TypeUtilities#isMethodInvocationConvertible(Class, Class) method invocation conversions} that
+     * can usually be automatically applied as per
+     * {@link java.lang.invoke.MethodHandle#asType(java.lang.invoke.MethodType)}.
+     * However, sometimes language runtimes will want to customize even those conversions for their own call
+     * sites. A typical example is allowing unboxing of null return values, which is by default prohibited by
+     * ordinary {@code MethodHandles.asType}. In this case, a language runtime can install its own custom
+     * automatic conversion strategy, that can deal with null values. Note that when the strategy's
+     * {@link MethodTypeConversionStrategy#asType(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType)}
+     * is invoked, the custom language conversions will already have been applied to the method handle, so by
+     * design the difference between the handle's current method type and the desired final type will always
+     * only be ones that can be subjected to method invocation conversions. Can be null, in which case no
+     * custom strategy is employed.
+     */
+    TypeConverterFactory(final Iterable<? extends GuardingTypeConverterFactory> factories,
+            final MethodTypeConversionStrategy autoConversionStrategy) {
+        final List<GuardingTypeConverterFactory> l = new LinkedList<>();
+        final List<ConversionComparator> c = new LinkedList<>();
+        for(final GuardingTypeConverterFactory factory: factories) {
+            l.add(factory);
+            if(factory instanceof ConversionComparator) {
+                c.add((ConversionComparator)factory);
+            }
+        }
+        this.factories = l.toArray(new GuardingTypeConverterFactory[l.size()]);
+        this.comparators = c.toArray(new ConversionComparator[c.size()]);
+        this.autoConversionStrategy = autoConversionStrategy;
+    }
+
+    /**
+     * Similar to {@link MethodHandle#asType(MethodType)} except it also hooks in method handles produced by
+     * {@link GuardingTypeConverterFactory} implementations, providing for language-specific type coercing of
+     * parameters. For all conversions that are not a JLS method invocation conversion it'll insert
+     * {@link MethodHandles#filterArguments(MethodHandle, int, MethodHandle...)} with composite filters
+     * provided by {@link GuardingTypeConverterFactory} implementations. For the remaining JLS method invocation
+     * conversions, it will invoke {@link MethodTypeConversionStrategy#asType(MethodHandle, MethodType)} first
+     * if an automatic conversion strategy was specified in the
+     * {@link #TypeConverterFactory(Iterable, MethodTypeConversionStrategy) constructor}, and finally apply
+     * {@link MethodHandle#asType(MethodType)} for any remaining conversions.
+     *
+     * @param handle target method handle
+     * @param fromType the types of source arguments
+     * @return a method handle that is a suitable combination of {@link MethodHandle#asType(MethodType)},
+     * {@link MethodTypeConversionStrategy#asType(MethodHandle, MethodType)}, and
+     * {@link MethodHandles#filterArguments(MethodHandle, int, MethodHandle...)} with
+     * {@link GuardingTypeConverterFactory} produced type converters as filters.
+     */
+    MethodHandle asType(final MethodHandle handle, final MethodType fromType) {
+        MethodHandle newHandle = handle;
+        final MethodType toType = newHandle.type();
+        final int l = toType.parameterCount();
+        if(l != fromType.parameterCount()) {
+            throw new WrongMethodTypeException("Parameter counts differ: " + handle.type() + " vs. " + fromType);
+        }
+        int pos = 0;
+        final List<MethodHandle> converters = new LinkedList<>();
+        for(int i = 0; i < l; ++i) {
+            final Class<?> fromParamType = fromType.parameterType(i);
+            final Class<?> toParamType = toType.parameterType(i);
+            if(canAutoConvert(fromParamType, toParamType)) {
+                newHandle = applyConverters(newHandle, pos, converters);
+            } else {
+                final MethodHandle converter = getTypeConverterNull(fromParamType, toParamType);
+                if(converter != null) {
+                    if(converters.isEmpty()) {
+                        pos = i;
+                    }
+                    converters.add(converter);
+                } else {
+                    newHandle = applyConverters(newHandle, pos, converters);
+                }
+            }
+        }
+        newHandle = applyConverters(newHandle, pos, converters);
+
+        // Convert return type
+        final Class<?> fromRetType = fromType.returnType();
+        final Class<?> toRetType = toType.returnType();
+        if(fromRetType != Void.TYPE && toRetType != Void.TYPE) {
+            if(!canAutoConvert(toRetType, fromRetType)) {
+                final MethodHandle converter = getTypeConverterNull(toRetType, fromRetType);
+                if(converter != null) {
+                    newHandle = MethodHandles.filterReturnValue(newHandle, converter);
+                }
+            }
+        }
+
+        // Give change to automatic conversion strategy, if one is present.
+        final MethodHandle autoConvertedHandle =
+                autoConversionStrategy != null ? autoConversionStrategy.asType(newHandle, fromType) : newHandle;
+
+        // Do a final asType for any conversions that remain.
+        return autoConvertedHandle.asType(fromType);
+    }
+
+    private static MethodHandle applyConverters(final MethodHandle handle, final int pos, final List<MethodHandle> converters) {
+        if(converters.isEmpty()) {
+            return handle;
+        }
+        final MethodHandle newHandle =
+                MethodHandles.filterArguments(handle, pos, converters.toArray(new MethodHandle[converters.size()]));
+        converters.clear();
+        return newHandle;
+    }
+
+    /**
+     * Returns true if there might exist a conversion between the requested types (either an automatic JVM conversion,
+     * or one provided by any available {@link GuardingTypeConverterFactory}), or false if there definitely does not
+     * exist a conversion between the requested types. Note that returning true does not guarantee that the conversion
+     * will succeed at runtime (notably, if the "from" or "to" types are sufficiently generic), but returning false
+     * guarantees that it would fail.
+     *
+     * @param from the source type for the conversion
+     * @param to the target type for the conversion
+     * @return true if there can be a conversion, false if there can not.
+     */
+    boolean canConvert(final Class<?> from, final Class<?> to) {
+        return canAutoConvert(from, to) || canConvert.get(from).get(to);
+    }
+
+    /**
+     * Determines which of the two type conversions from a source type to the two target types is preferred. This is
+     * used for dynamic overloaded method resolution. If the source type is convertible to exactly one target type with
+     * a method invocation conversion, it is chosen, otherwise available {@link ConversionComparator}s are consulted.
+     * @param sourceType the source type.
+     * @param targetType1 one potential target type
+     * @param targetType2 another potential target type.
+     * @return one of Comparison constants that establish which - if any - of the target types is preferable for the
+     * conversion.
+     */
+    Comparison compareConversion(final Class<?> sourceType, final Class<?> targetType1, final Class<?> targetType2) {
+        for(final ConversionComparator comparator: comparators) {
+            final Comparison result = comparator.compareConversion(sourceType, targetType1, targetType2);
+            if(result != Comparison.INDETERMINATE) {
+                return result;
+            }
+        }
+        if(TypeUtilities.isMethodInvocationConvertible(sourceType, targetType1)) {
+            if(!TypeUtilities.isMethodInvocationConvertible(sourceType, targetType2)) {
+                return Comparison.TYPE_1_BETTER;
+            }
+        } else if(TypeUtilities.isMethodInvocationConvertible(sourceType, targetType2)) {
+            return Comparison.TYPE_2_BETTER;
+        }
+        return Comparison.INDETERMINATE;
+    }
+
+    /**
+     * Determines whether it's safe to perform an automatic conversion between the source and target class.
+     *
+     * @param fromType convert from this class
+     * @param toType convert to this class
+     * @return true if it's safe to let MethodHandles.convertArguments() to handle this conversion.
+     */
+    /*private*/ static boolean canAutoConvert(final Class<?> fromType, final Class<?> toType) {
+        return TypeUtilities.isMethodInvocationConvertible(fromType, toType);
+    }
+
+    /*private*/ MethodHandle getCacheableTypeConverterNull(final Class<?> sourceType, final Class<?> targetType) {
+        final MethodHandle converter = getCacheableTypeConverter(sourceType, targetType);
+        return converter == IDENTITY_CONVERSION ? null : converter;
+    }
+
+    /*private*/ MethodHandle getTypeConverterNull(final Class<?> sourceType, final Class<?> targetType) {
+        try {
+            return getCacheableTypeConverterNull(sourceType, targetType);
+        } catch(final NotCacheableConverter e) {
+            return e.converter;
+        }
+    }
+
+    /*private*/ MethodHandle getCacheableTypeConverter(final Class<?> sourceType, final Class<?> targetType) {
+        return converterMap.get(sourceType).get(targetType);
+    }
+
+    /**
+     * Given a source and target type, returns a method handle that converts between them. Never returns null; in worst
+     * case it will return an identity conversion (that might fail for some values at runtime). You can use this method
+     * if you have a piece of your program that is written in Java, and you need to reuse existing type conversion
+     * machinery in a non-invokedynamic context.
+     * @param sourceType the type to convert from
+     * @param targetType the type to convert to
+     * @return a method handle performing the conversion.
+     */
+    MethodHandle getTypeConverter(final Class<?> sourceType, final Class<?> targetType) {
+        try {
+            return converterIdentityMap.get(sourceType).get(targetType);
+        } catch(final NotCacheableConverter e) {
+            return e.converter;
+        }
+    }
+
+    /*private*/ MethodHandle createConverter(final Class<?> sourceType, final Class<?> targetType) throws Exception {
+        final MethodType type = MethodType.methodType(targetType, sourceType);
+        final MethodHandle identity = IDENTITY_CONVERSION.asType(type);
+        MethodHandle last = identity;
+        boolean cacheable = true;
+        for(int i = factories.length; i-- > 0;) {
+            final GuardedTypeConversion next = factories[i].convertToType(sourceType, targetType);
+            if(next != null) {
+                cacheable = cacheable && next.isCacheable();
+                final GuardedInvocation conversionInvocation = next.getConversionInvocation();
+                conversionInvocation.assertType(type);
+                last = conversionInvocation.compose(last);
+            }
+        }
+        if(last == identity) {
+            return IDENTITY_CONVERSION;
+        }
+        if(cacheable) {
+            return last;
+        }
+        throw new NotCacheableConverter(last);
+    }
+
+    /*private*/ static final MethodHandle IDENTITY_CONVERSION = MethodHandles.identity(Object.class);
+
+    @SuppressWarnings("serial")
+    private static class NotCacheableConverter extends RuntimeException {
+        final MethodHandle converter;
+
+        NotCacheableConverter(final MethodHandle converter) {
+            super("", null, false, false);
+            this.converter = converter;
+        }
+    }
+}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AbstractJavaLinker.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AbstractJavaLinker.java	Mon Oct 19 08:23:03 2015 +0200
@@ -103,10 +103,10 @@
 import jdk.internal.dynalink.linker.GuardingDynamicLinker;
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.linker.LinkerServices;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.internal.dynalink.support.Guards;
 import jdk.internal.dynalink.support.Lookup;
 import jdk.internal.dynalink.support.TypeUtilities;
+import sun.reflect.CallerSensitive;
 
 /**
  * A base class for both {@link StaticClassLinker} and {@link BeanLinker}. Deals with common aspects of property
@@ -284,7 +284,7 @@
      * @return the single dynamic method representing the reflective member
      */
     private static SingleDynamicMethod createDynamicMethod(final AccessibleObject m) {
-        if(CallerSensitiveDetector.isCallerSensitive(m)) {
+        if (m.isAnnotationPresent(CallerSensitive.class)) {
             // Method has @CallerSensitive annotation
             return new CallerSensitiveDynamicMethod(m);
         }
@@ -350,7 +350,7 @@
         if("callMethod" == op) {
             return getCallPropWithThis(callSiteDescriptor, linkerServices);
         }
-        List<String> operations = CallSiteDescriptorFactory.tokenizeOperators(callSiteDescriptor);
+        List<String> operations = callSiteDescriptor.tokenizeOperators();
         while(!operations.isEmpty()) {
             final GuardedInvocationComponent gic = getGuardedInvocationComponent(callSiteDescriptor, linkerServices,
                     operations);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/CallerSensitiveDetector.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.beans;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
-import sun.reflect.CallerSensitive;
-
-/**
- * Utility class that determines if a method or constructor is caller sensitive. It actually encapsulates two different
- * strategies for determining caller sensitivity; a more robust one that works if Dynalink runs as code with access
- * to {@code sun.reflect} package, and an unprivileged one that is used when Dynalink doesn't have access to that
- * package. Note that even the unprivileged strategy is ordinarily robust, but it relies on the {@code toString} method
- * of the annotation. If an attacker were to use a different annotation to spoof the string representation of the
- * {@code CallerSensitive} annotation, they could designate their own methods as caller sensitive. This however does not
- * escalate privileges, only causes Dynalink to never cache method handles for such methods, so all it would do would
- * decrease the performance in linking such methods. In the opposite case when an attacker could trick Dynalink into not
- * recognizing genuine {@code CallerSensitive} annotations, Dynalink would treat caller sensitive methods as ordinary
- * methods, and would cache them bound to a zero-privilege delegate as the caller (just what Dynalink did before it
- * could handle caller-sensitive methods). That would practically render caller-sensitive methods exposed through
- * Dynalink unusable, but again, can not lead to any privilege escalations. Therefore, even the less robust unprivileged
- * strategy is safe; the worst thing a successful attack against it can achieve is slight reduction in Dynalink-exposed
- * functionality or performance.
- */
-public class CallerSensitiveDetector {
-
-    private static final DetectionStrategy DETECTION_STRATEGY = getDetectionStrategy();
-
-    static boolean isCallerSensitive(final AccessibleObject ao) {
-        return DETECTION_STRATEGY.isCallerSensitive(ao);
-    }
-
-    private static DetectionStrategy getDetectionStrategy() {
-        try {
-            return new PrivilegedDetectionStrategy();
-        } catch(final Throwable t) {
-            return new UnprivilegedDetectionStrategy();
-        }
-    }
-
-    private abstract static class DetectionStrategy {
-        abstract boolean isCallerSensitive(AccessibleObject ao);
-    }
-
-    private static class PrivilegedDetectionStrategy extends DetectionStrategy {
-        private static final Class<? extends Annotation> CALLER_SENSITIVE_ANNOTATION_CLASS = CallerSensitive.class;
-
-        @Override
-        boolean isCallerSensitive(final AccessibleObject ao) {
-            return ao.getAnnotation(CALLER_SENSITIVE_ANNOTATION_CLASS) != null;
-        }
-    }
-
-    private static class UnprivilegedDetectionStrategy extends DetectionStrategy {
-        private static final String CALLER_SENSITIVE_ANNOTATION_STRING = "@sun.reflect.CallerSensitive()";
-
-        @Override
-        boolean isCallerSensitive(final AccessibleObject o) {
-            for(final Annotation a: o.getAnnotations()) {
-                if(String.valueOf(a).equals(CALLER_SENSITIVE_ANNOTATION_STRING)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/DynamicMethodLinker.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/DynamicMethodLinker.java	Mon Oct 19 08:23:03 2015 +0200
@@ -90,7 +90,6 @@
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.linker.LinkerServices;
 import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.internal.dynalink.support.Guards;
 
 /**
@@ -119,8 +118,8 @@
         final MethodHandle invocation;
 
         if (operator == "call" && !constructor) {
-            invocation = dynMethod.getInvocation(
-                    CallSiteDescriptorFactory.dropParameterTypes(desc, 0, 1), linkerServices);
+            invocation = dynMethod.getInvocation(desc.changeMethodType(
+                    desc.getMethodType().dropParameterTypes(0, 1)), linkerServices);
         } else if (operator == "new" && constructor) {
             final MethodHandle ctorInvocation = dynMethod.getInvocation(desc, linkerServices);
             if(ctorInvocation == null) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/AbstractCallSiteDescriptor.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/AbstractCallSiteDescriptor.java	Mon Oct 19 08:23:03 2015 +0200
@@ -99,11 +99,6 @@
         return appendName(new StringBuilder(getNameLength())).toString();
     }
 
-   @Override
-   public Lookup getLookup() {
-       return MethodHandles.publicLookup();
-   }
-
     @Override
     public boolean equals(final Object obj) {
         return obj instanceof CallSiteDescriptor && equals((CallSiteDescriptor)obj);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/AutoDiscovery.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.support;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ServiceLoader;
-import jdk.internal.dynalink.DynamicLinkerFactory;
-import jdk.internal.dynalink.linker.GuardingDynamicLinker;
-
-/**
- * Provides methods for automatic discovery of all guarding dynamic linkers listed in the
- * <tt>/META-INF/services/jdk.internal.dynalink.linker.GuardingDynamicLinker</tt> resources of all JAR files for a
- * particular class loader. Ordinarily, you will not use this class directly, but you will use a
- * {@link DynamicLinkerFactory} instead.
- */
-public class AutoDiscovery {
-
-    private AutoDiscovery() {
-    }
-
-    /**
-     * Discovers all guarding dynamic linkers listed in JAR files of the context class loader of the current thread.
-     *
-     * @return a list of available linkers. Can be zero-length list but not null.
-     */
-    public static List<GuardingDynamicLinker> loadLinkers() {
-        return getLinkers(ServiceLoader.load(GuardingDynamicLinker.class));
-    }
-
-    /**
-     * Discovers all guarding dynamic linkers listed in JAR files of the specified class loader.
-     *
-     * @param cl the class loader to use
-     * @return a list of guarding dynamic linkers available through the specified class loader. Can be zero-length list
-     * but not null.
-     */
-    public static List<GuardingDynamicLinker> loadLinkers(final ClassLoader cl) {
-        return getLinkers(ServiceLoader.load(GuardingDynamicLinker.class, cl));
-    }
-
-    /**
-     * I can't believe there's no Collections API for making a List given an Iterator...
-     */
-    private static <T> List<T> getLinkers(final ServiceLoader<T> loader) {
-        final List<T> list = new LinkedList<>();
-        for(final T linker: loader) {
-            list.add(linker);
-        }
-        return list;
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/BottomGuardingDynamicLinker.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.support;
-
-import jdk.internal.dynalink.linker.GuardedInvocation;
-import jdk.internal.dynalink.linker.LinkRequest;
-import jdk.internal.dynalink.linker.LinkerServices;
-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.
- */
-public class BottomGuardingDynamicLinker implements TypeBasedGuardingDynamicLinker {
-
-    /**
-     * The sole instance of this stateless linker.
-     */
-    public static final BottomGuardingDynamicLinker INSTANCE = new BottomGuardingDynamicLinker();
-
-    private BottomGuardingDynamicLinker() {
-    }
-
-    @Override
-    public boolean canLinkType(final Class<?> type) {
-        return false;
-    }
-
-    @Override
-    public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest, final LinkerServices linkerServices) {
-        return null;
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/CallSiteDescriptorFactory.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,274 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.support;
-
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodHandles.Lookup;
-import java.lang.invoke.MethodType;
-import java.lang.ref.Reference;
-import java.lang.ref.WeakReference;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.StringTokenizer;
-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 {@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 =
-            new WeakHashMap<>();
-
-
-    private CallSiteDescriptorFactory() {
-    }
-
-    /**
-     * Creates a new call site descriptor instance. The actual underlying class of the instance is dependent on the
-     * passed arguments to be space efficient; i.e. if you  only use the public lookup, you'll get back an
-     * implementation that doesn't waste space on storing the lookup object.
-     * @param lookup the lookup that determines access rights at the call site. If your language runtime doesn't have
-     * equivalents of Java access concepts, just use {@link MethodHandles#publicLookup()}. Must not be null.
-     * @param name the name of the method at the call site. Must not be null.
-     * @param methodType the type of the method at the call site. Must not be null.
-     * @return a call site descriptor representing the input. Note that although the method name is "create", it will
-     * in fact return a weakly-referenced canonical instance.
-     */
-    public static CallSiteDescriptor create(final Lookup lookup, final String name, final MethodType methodType) {
-        Objects.requireNonNull(name);
-        Objects.requireNonNull(methodType);
-        Objects.requireNonNull(lookup);
-        final String[] tokenizedName = tokenizeName(name);
-        if(isPublicLookup(lookup)) {
-            return getCanonicalPublicDescriptor(createPublicCallSiteDescriptor(tokenizedName, methodType));
-        }
-        return new LookupCallSiteDescriptor(tokenizedName, methodType, lookup);
-    }
-
-    static CallSiteDescriptor getCanonicalPublicDescriptor(final CallSiteDescriptor desc) {
-        synchronized(publicDescs) {
-            final Reference<CallSiteDescriptor> ref = publicDescs.get(desc);
-            if(ref != null) {
-                final CallSiteDescriptor canonical = ref.get();
-                if(canonical != null) {
-                    return canonical;
-                }
-            }
-            publicDescs.put(desc, createReference(desc));
-        }
-        return desc;
-    }
-
-    /**
-     * Override this to use a different kind of references for the cache
-     * @param desc desc
-     * @return reference
-     */
-    protected static Reference<CallSiteDescriptor> createReference(final CallSiteDescriptor desc) {
-        return new WeakReference<>(desc);
-    }
-
-    private static CallSiteDescriptor createPublicCallSiteDescriptor(final String[] tokenizedName, final MethodType methodType) {
-        final int l = tokenizedName.length;
-        if(l > 0 && tokenizedName[0] == "dyn") {
-            if(l == 2) {
-                return new UnnamedDynCallSiteDescriptor(tokenizedName[1], methodType);
-            } if (l == 3) {
-                return new NamedDynCallSiteDescriptor(tokenizedName[1], tokenizedName[2], methodType);
-            }
-        }
-        return new DefaultCallSiteDescriptor(tokenizedName, methodType);
-    }
-
-    private static boolean isPublicLookup(final Lookup lookup) {
-        return lookup == MethodHandles.publicLookup();
-    }
-
-    /**
-     * Tokenizes the composite name along colons, as well as {@link NameCodec#decode(String) demangles} and interns
-     * the tokens. The first two tokens are not demangled as they are supposed to be the naming scheme and the name of
-     * the operation which can be expected to consist of just alphabetical characters.
-     * @param name the composite name consisting of colon-separated, possibly mangled tokens.
-     * @return an array of tokens
-     */
-    public static String[] tokenizeName(final String name) {
-        final StringTokenizer tok = new StringTokenizer(name, CallSiteDescriptor.TOKEN_DELIMITER);
-        final String[] tokens = new String[tok.countTokens()];
-        for(int i = 0; i < tokens.length; ++i) {
-            String token = tok.nextToken();
-            if(i > 1) {
-                token = NameCodec.decode(token);
-            }
-            tokens[i] = token.intern();
-        }
-        return tokens;
-    }
-
-    /**
-     * Tokenizes a composite operation name along pipe characters. I.e. if you have a "dyn:getElem|getProp|getMethod"
-     * operation, returns a list of ["getElem", "getProp", "getMethod"]. The tokens are not interned.
-     * @param desc the call site descriptor with the operation
-     * @return a list of tokens
-     */
-    public static List<String> tokenizeOperators(final CallSiteDescriptor desc) {
-        final String ops = desc.getNameToken(CallSiteDescriptor.OPERATOR);
-        final StringTokenizer tok = new StringTokenizer(ops, CallSiteDescriptor.OPERATOR_DELIMITER);
-        final int count = tok.countTokens();
-        if(count == 1) {
-            return Collections.singletonList(ops);
-        }
-        final String[] tokens = new String[count];
-        for(int i = 0; i < count; ++i) {
-            tokens[i] = tok.nextToken();
-        }
-        return Arrays.asList(tokens);
-    }
-
-    /**
-     * Returns a new call site descriptor that is identical to the passed one, except that it has some parameter types
-     * removed from its method type.
-     * @param desc the original call site descriptor
-     * @param start index of the first parameter to remove
-     * @param end index of the first parameter to not remove
-     * @return a new call site descriptor with modified method type
-     */
-    public static CallSiteDescriptor dropParameterTypes(final CallSiteDescriptor desc, final int start, final int end) {
-        return desc.changeMethodType(desc.getMethodType().dropParameterTypes(start, end));
-    }
-
-    /**
-     * Returns a new call site descriptor that is identical to the passed one, except that it has a single parameter
-     * type changed in its method type.
-     * @param desc the original call site descriptor
-     * @param num index of the parameter to change
-     * @param nptype the new parameter type
-     * @return a new call site descriptor with modified method type
-     */
-    public static CallSiteDescriptor changeParameterType(final CallSiteDescriptor desc, final int num, final Class<?> nptype) {
-        return desc.changeMethodType(desc.getMethodType().changeParameterType(num, nptype));
-    }
-
-    /**
-     * Returns a new call site descriptor that is identical to the passed one, except that it has the return type
-     * changed in its method type.
-     * @param desc the original call site descriptor
-     * @param nrtype the new return type
-     * @return a new call site descriptor with modified method type
-     */
-    public static CallSiteDescriptor changeReturnType(final CallSiteDescriptor desc, final Class<?> nrtype) {
-        return desc.changeMethodType(desc.getMethodType().changeReturnType(nrtype));
-    }
-
-    /**
-     * Returns a new call site descriptor that is identical to the passed one, except that it has additional parameter
-     * types inserted into its method type.
-     * @param desc the original call site descriptor
-     * @param num index at which the new parameters are inserted
-     * @param ptypesToInsert the new types to insert
-     * @return a new call site descriptor with modified method type
-     */
-    public static CallSiteDescriptor insertParameterTypes(final CallSiteDescriptor desc, final int num, final Class<?>... ptypesToInsert) {
-        return desc.changeMethodType(desc.getMethodType().insertParameterTypes(num, ptypesToInsert));
-    }
-
-    /**
-     * Returns a new call site descriptor that is identical to the passed one, except that it has additional parameter
-     * types inserted into its method type.
-     * @param desc the original call site descriptor
-     * @param num index at which the new parameters are inserted
-     * @param ptypesToInsert the new types to insert
-     * @return a new call site descriptor with modified method type
-     */
-    public static CallSiteDescriptor insertParameterTypes(final CallSiteDescriptor desc, final int num, final List<Class<?>> ptypesToInsert) {
-        return desc.changeMethodType(desc.getMethodType().insertParameterTypes(num, ptypesToInsert));
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/ClassLoaderGetterContextProvider.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.support;
-
-import java.security.AccessControlContext;
-import java.security.Permissions;
-import java.security.ProtectionDomain;
-
-/**
- * This class exposes a canonical {@link AccessControlContext} with a single {@link RuntimePermission} for
- * {@code "getClassLoader"} permission that is used by other parts of the code to narrow their set of permissions when
- * they're retrieving class loaders in privileged blocks.
- */
-public class ClassLoaderGetterContextProvider {
-    /**
-     * Canonical instance of {@link AccessControlContext} with a single {@link RuntimePermission} for
-     * {@code "getClassLoader"} permission.
-     */
-    public static final AccessControlContext GET_CLASS_LOADER_CONTEXT;
-    static {
-        final Permissions perms = new Permissions();
-        perms.add(new RuntimePermission("getClassLoader"));
-        GET_CLASS_LOADER_CONTEXT = new AccessControlContext(
-                new ProtectionDomain[] { new ProtectionDomain(null, perms) });
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/ClassMap.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.support;
-
-import java.lang.ref.Reference;
-import java.lang.ref.SoftReference;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Map;
-import java.util.WeakHashMap;
-import java.util.concurrent.ConcurrentHashMap;
-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.
- *
- * @param <T> the type of the values in the map
- */
-public abstract class ClassMap<T> {
-    private final ConcurrentMap<Class<?>, T> map = new ConcurrentHashMap<>();
-    private final Map<Class<?>, Reference<T>> weakMap = new WeakHashMap<>();
-    private final ClassLoader classLoader;
-
-    /**
-     * Creates a new class map. It will use strong references for all keys and values where the key is a class visible
-     * from the class loader, and will use weak keys and soft values for all other classes.
-     *
-     * @param classLoader the classloader that determines strong referenceability.
-     */
-    protected ClassMap(final ClassLoader classLoader) {
-        this.classLoader = classLoader;
-    }
-
-    /**
-     * Compute the value associated with the given class. It is possible that the method will be invoked several times
-     * (or even concurrently) for the same class parameter.
-     *
-     * @param clazz the class to compute the value for
-     * @return the return value. Must not be null.
-     */
-    protected abstract T computeValue(Class<?> clazz);
-
-    /**
-     * Returns the value associated with the class
-     *
-     * @param clazz the class
-     * @return the value associated with the class
-     */
-    public T get(final Class<?> clazz) {
-        // Check in fastest first - objects we're allowed to strongly reference
-        final T v = map.get(clazz);
-        if(v != null) {
-            return v;
-        }
-        // Check objects we're not allowed to strongly reference
-        Reference<T> ref;
-        synchronized(weakMap) {
-            ref = weakMap.get(clazz);
-        }
-        if(ref != null) {
-            final T refv = ref.get();
-            if(refv != null) {
-                return refv;
-            }
-        }
-        // Not found in either place; create a new value
-        final T newV = computeValue(clazz);
-        assert newV != null;
-
-        final ClassLoader clazzLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
-            @Override
-            public ClassLoader run() {
-                return clazz.getClassLoader();
-            }
-        }, ClassLoaderGetterContextProvider.GET_CLASS_LOADER_CONTEXT);
-
-        // If allowed to strongly reference, put it in the fast map
-        if(Guards.canReferenceDirectly(classLoader, clazzLoader)) {
-            final T oldV = map.putIfAbsent(clazz, newV);
-            return oldV != null ? oldV : newV;
-        }
-        // Otherwise, put it into the weak map
-        synchronized(weakMap) {
-            ref = weakMap.get(clazz);
-            if(ref != null) {
-                final T oldV = ref.get();
-                if(oldV != null) {
-                    return oldV;
-                }
-            }
-            weakMap.put(clazz, new SoftReference<>(newV));
-            return newV;
-        }
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/DefaultCallSiteDescriptor.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.support;
-
-import java.lang.invoke.MethodHandles.Lookup;
-import java.lang.invoke.MethodType;
-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}.
- */
-class DefaultCallSiteDescriptor extends AbstractCallSiteDescriptor {
-
-    private final String[] tokenizedName;
-    private final MethodType methodType;
-
-    DefaultCallSiteDescriptor(final String[] tokenizedName, final MethodType methodType) {
-        this.tokenizedName = tokenizedName;
-        this.methodType = methodType;
-    }
-
-    @Override
-    public int getNameTokenCount() {
-        return tokenizedName.length;
-    }
-
-    @Override
-    public String getNameToken(final int i) {
-        try {
-            return tokenizedName[i];
-        } catch(final ArrayIndexOutOfBoundsException e) {
-            throw new IllegalArgumentException(e.getMessage());
-        }
-    }
-
-    String[] getTokenizedName() {
-        return tokenizedName;
-    }
-
-    @Override
-    public MethodType getMethodType() {
-        return methodType;
-    }
-
-    @Override
-    public CallSiteDescriptor changeMethodType(final MethodType newMethodType) {
-        return CallSiteDescriptorFactory.getCanonicalPublicDescriptor(new DefaultCallSiteDescriptor(tokenizedName,
-                newMethodType));
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/DefaultPrelinkFilter.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.support;
-
-import jdk.internal.dynalink.GuardedInvocationFilter;
-import jdk.internal.dynalink.linker.GuardedInvocation;
-import jdk.internal.dynalink.linker.LinkRequest;
-import jdk.internal.dynalink.linker.LinkerServices;
-
-/**
- * Default filter for guarded invocation pre link filtering
- */
-public class DefaultPrelinkFilter implements GuardedInvocationFilter {
-    @Override
-    public GuardedInvocation filter(final GuardedInvocation inv, final LinkRequest request, final LinkerServices linkerServices) {
-        return inv.asType(linkerServices, request.getCallSiteDescriptor().getMethodType());
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/Guards.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/Guards.java	Mon Oct 19 08:23:03 2015 +0200
@@ -92,10 +92,9 @@
 import jdk.internal.dynalink.linker.LinkerServices;
 
 /**
- * Utility methods for creating typical guards. TODO: introduce reasonable caching of created guards.
- *
+ * Utility methods for creating typical guards.
  */
-public class Guards {
+public final class Guards {
     private static final Logger LOG = Logger
             .getLogger(Guards.class.getName(), "jdk.internal.dynalink.support.messages");
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LinkerServicesImpl.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.support;
-
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodType;
-import jdk.internal.dynalink.linker.ConversionComparator.Comparison;
-import jdk.internal.dynalink.linker.GuardedInvocation;
-import jdk.internal.dynalink.linker.GuardingDynamicLinker;
-import jdk.internal.dynalink.linker.LinkRequest;
-import jdk.internal.dynalink.linker.LinkerServices;
-import jdk.internal.dynalink.linker.MethodHandleTransformer;
-
-/**
- * Default implementation of the {@link LinkerServices} interface.
- */
-public class LinkerServicesImpl implements LinkerServices {
-
-    private static final RuntimePermission GET_CURRENT_LINK_REQUEST = new RuntimePermission("dynalink.getCurrentLinkRequest");
-    private static final ThreadLocal<LinkRequest> threadLinkRequest = new ThreadLocal<>();
-
-    private final TypeConverterFactory typeConverterFactory;
-    private final GuardingDynamicLinker topLevelLinker;
-    private final MethodHandleTransformer internalObjectsFilter;
-
-    /**
-     * Creates a new linker services object.
-     *
-     * @param typeConverterFactory the type converter factory exposed by the services.
-     * @param topLevelLinker the top level linker used by the services.
-     * @param internalObjectsFilter a method handle transformer that is supposed to act as the implementation of this
-     * services' {@link #filterInternalObjects(java.lang.invoke.MethodHandle)} method.
-     */
-    public LinkerServicesImpl(final TypeConverterFactory typeConverterFactory,
-            final GuardingDynamicLinker topLevelLinker, final MethodHandleTransformer internalObjectsFilter) {
-        this.typeConverterFactory = typeConverterFactory;
-        this.topLevelLinker = topLevelLinker;
-        this.internalObjectsFilter = internalObjectsFilter;
-    }
-
-    @Override
-    public boolean canConvert(final Class<?> from, final Class<?> to) {
-        return typeConverterFactory.canConvert(from, to);
-    }
-
-    @Override
-    public MethodHandle asType(final MethodHandle handle, final MethodType fromType) {
-        return typeConverterFactory.asType(handle, fromType);
-    }
-
-    @Override
-    public MethodHandle getTypeConverter(final Class<?> sourceType, final Class<?> targetType) {
-        return typeConverterFactory.getTypeConverter(sourceType, targetType);
-    }
-
-    @Override
-    public Comparison compareConversion(final Class<?> sourceType, final Class<?> targetType1, final Class<?> targetType2) {
-        return typeConverterFactory.compareConversion(sourceType, targetType1, targetType2);
-    }
-
-    @Override
-    public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest) throws Exception {
-        final LinkRequest prevLinkRequest = threadLinkRequest.get();
-        threadLinkRequest.set(linkRequest);
-        try {
-            return topLevelLinker.getGuardedInvocation(linkRequest, this);
-        } finally {
-            threadLinkRequest.set(prevLinkRequest);
-        }
-    }
-
-    @Override
-    public MethodHandle filterInternalObjects(final MethodHandle target) {
-        return internalObjectsFilter != null ? internalObjectsFilter.transform(target) : target;
-    }
-
-    /**
-     * Returns the currently processed link request, or null if the method is invoked outside of the linking process.
-     * @return the currently processed link request, or null.
-     * @throws SecurityException if the calling code doesn't have the {@code "dynalink.getCurrentLinkRequest"} runtime
-     * permission.
-     */
-    public static LinkRequest getCurrentLinkRequest() {
-        final SecurityManager sm = System.getSecurityManager();
-        if(sm != null) {
-            sm.checkPermission(GET_CURRENT_LINK_REQUEST);
-        }
-        return threadLinkRequest.get();
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LookupCallSiteDescriptor.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.support;
-
-import java.lang.invoke.MethodHandles.Lookup;
-import java.lang.invoke.MethodType;
-import jdk.internal.dynalink.CallSiteDescriptor;
-
-/**
- * A call site descriptor that stores a specific {@link Lookup}. It does not, however, store static bootstrap arguments.
- */
-class LookupCallSiteDescriptor extends DefaultCallSiteDescriptor {
-    private final Lookup lookup;
-
-    /**
-     * Create a new call site descriptor from explicit information.
-     * @param tokenizedName the name of the method
-     * @param methodType the method type
-     * @param lookup the lookup
-     */
-    LookupCallSiteDescriptor(final String[] tokenizedName, final MethodType methodType, final Lookup lookup) {
-        super(tokenizedName, methodType);
-        this.lookup = lookup;
-    }
-
-    @Override
-    public Lookup getLookup() {
-        return lookup;
-    }
-
-    @Override
-    public CallSiteDescriptor changeMethodType(final MethodType newMethodType) {
-        return new LookupCallSiteDescriptor(getTokenizedName(), newMethodType, lookup);
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/NameCodec.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/NameCodec.java	Mon Oct 19 08:23:03 2015 +0200
@@ -94,7 +94,7 @@
  * individual tokens, and not the whole name at the call site, i.e. the colon character normally separating the tokens
  * is never mangled. I.e. you wouldn't mangle {@code dyn:getProp:color} into {@code dyn\!getProp\!color}, but you would
  * mangle {@code dyn:getProp:color$} into {@code dyn:getProp:\=color\%} (only mangling the individual token containing
- * the symbol {@code color$}). {@link CallSiteDescriptorFactory#tokenizeName(String)} (and by implication, all call site
+ * the symbol {@code color$}). {@link CallSiteDescriptor#tokenizeName(String)} (and by implication, all call site
  * descriptors it creates) will automatically perform demangling on the passed names. If you use this factory, or you
  * 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
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/NamedDynCallSiteDescriptor.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.support;
-
-import java.lang.invoke.MethodType;
-import jdk.internal.dynalink.CallSiteDescriptor;
-
-class NamedDynCallSiteDescriptor extends UnnamedDynCallSiteDescriptor {
-    private final String name;
-
-    NamedDynCallSiteDescriptor(final String op, final String name, final MethodType methodType) {
-        super(op, methodType);
-        this.name = name;
-    }
-
-    @Override
-    public int getNameTokenCount() {
-        return 3;
-    }
-
-    @Override
-    public String getNameToken(final int i) {
-        switch(i) {
-            case 0: return "dyn";
-            case 1: return getOp();
-            case 2: return name;
-            default: throw new IndexOutOfBoundsException(String.valueOf(i));
-        }
-    }
-
-    @Override
-    public CallSiteDescriptor changeMethodType(final MethodType newMethodType) {
-        return CallSiteDescriptorFactory.getCanonicalPublicDescriptor(new NamedDynCallSiteDescriptor(getOp(), name,
-                newMethodType));
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/RuntimeContextLinkRequestImpl.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/RuntimeContextLinkRequestImpl.java	Mon Oct 19 08:23:03 2015 +0200
@@ -119,9 +119,10 @@
     @Override
     public LinkRequest withoutRuntimeContext() {
         if(contextStrippedRequest == null) {
+            final CallSiteDescriptor desc = getCallSiteDescriptor();
             contextStrippedRequest =
-                    new LinkRequestImpl(CallSiteDescriptorFactory.dropParameterTypes(getCallSiteDescriptor(), 1,
-                            runtimeContextArgCount + 1), getCallSiteToken(), getLinkCount(), isCallSiteUnstable(), getTruncatedArguments());
+                    new LinkRequestImpl(desc.changeMethodType(desc.getMethodType().dropParameterTypes(1, runtimeContextArgCount + 1)),
+                            getCallSiteToken(), getLinkCount(), isCallSiteUnstable(), getTruncatedArguments());
         }
         return contextStrippedRequest;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/SimpleCallSiteDescriptor.java	Mon Oct 19 08:23:03 2015 +0200
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2015 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       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 the copyright holder nor the names of
+         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 COPYRIGHT HOLDER
+       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.
+*/
+
+package jdk.internal.dynalink.support;
+
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.invoke.MethodType;
+import java.security.Permission;
+import java.util.Objects;
+import jdk.internal.dynalink.CallSiteDescriptor;
+
+/**
+ * A simple implementation of the call site descriptor. It stores the lookup, the name, and the method type.
+ */
+public class SimpleCallSiteDescriptor extends AbstractCallSiteDescriptor {
+    private static final Permission GET_LOOKUP_PERMISSION = new RuntimePermission("dynalink.getLookup");
+
+    private final Lookup lookup;
+    private final String[] tokenizedName;
+    private final MethodType methodType;
+
+    /**
+     * Creates a new simple call site descriptor.
+     * @param lookup the lookup at the call site, as passed to the bootstrap method. Must not be null.
+     * @param name the name of the operation at the call site, as passed to the bootstrap method. Must not be null.
+     * @param methodType the signature of operation at the call site, as passed to the bootstrap method. Must not be null.
+     */
+    public SimpleCallSiteDescriptor(final Lookup lookup, final String name, final MethodType methodType) {
+        this(Objects.requireNonNull(lookup, "lookup"),
+                CallSiteDescriptor.tokenizeName(Objects.requireNonNull(name, "name")),
+                Objects.requireNonNull(methodType, "methodType"));
+    }
+
+    private SimpleCallSiteDescriptor(final Lookup lookup, final String[] tokenizedName, final MethodType methodType) {
+        this.lookup = lookup;
+        this.tokenizedName = tokenizedName;
+        this.methodType = methodType;
+    }
+
+    @Override
+    public int getNameTokenCount() {
+        return tokenizedName.length;
+    }
+
+    @Override
+    public String getNameToken(final int i) {
+        try {
+            return tokenizedName[i];
+        } catch(final ArrayIndexOutOfBoundsException e) {
+            throw new IllegalArgumentException(e.getMessage());
+        }
+    }
+
+    @Override
+    public MethodType getMethodType() {
+        return methodType;
+    }
+
+    @Override
+    public final Lookup getLookup() {
+        return lookup;
+    }
+
+    @Override
+    public CallSiteDescriptor changeMethodType(final MethodType newMethodType) {
+        return new SimpleCallSiteDescriptor(lookup, tokenizedName, newMethodType);
+    }
+}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeConverterFactory.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,408 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.support;
-
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodType;
-import java.lang.invoke.WrongMethodTypeException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.LinkedList;
-import java.util.List;
-import jdk.internal.dynalink.linker.ConversionComparator;
-import jdk.internal.dynalink.linker.ConversionComparator.Comparison;
-import jdk.internal.dynalink.linker.GuardedInvocation;
-import jdk.internal.dynalink.linker.GuardedTypeConversion;
-import jdk.internal.dynalink.linker.GuardingTypeConverterFactory;
-import jdk.internal.dynalink.linker.LinkerServices;
-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.
- */
-public class TypeConverterFactory {
-
-    private final GuardingTypeConverterFactory[] factories;
-    private final ConversionComparator[] comparators;
-    private final MethodTypeConversionStrategy autoConversionStrategy;
-
-    private final ClassValue<ClassMap<MethodHandle>> converterMap = new ClassValue<ClassMap<MethodHandle>>() {
-        @Override
-        protected ClassMap<MethodHandle> computeValue(final Class<?> sourceType) {
-            return new ClassMap<MethodHandle>(getClassLoader(sourceType)) {
-                @Override
-                protected MethodHandle computeValue(final Class<?> targetType) {
-                    try {
-                        return createConverter(sourceType, targetType);
-                    } catch (final RuntimeException e) {
-                        throw e;
-                    } catch (final Exception e) {
-                        throw new RuntimeException(e);
-                    }
-                }
-            };
-        }
-    };
-
-    private final ClassValue<ClassMap<MethodHandle>> converterIdentityMap = new ClassValue<ClassMap<MethodHandle>>() {
-        @Override
-        protected ClassMap<MethodHandle> computeValue(final Class<?> sourceType) {
-            return new ClassMap<MethodHandle>(getClassLoader(sourceType)) {
-                @Override
-                protected MethodHandle computeValue(final Class<?> targetType) {
-                    if(!canAutoConvert(sourceType, targetType)) {
-                        final MethodHandle converter = getCacheableTypeConverter(sourceType, targetType);
-                        if(converter != IDENTITY_CONVERSION) {
-                            return converter;
-                        }
-                    }
-                    return IDENTITY_CONVERSION.asType(MethodType.methodType(targetType, sourceType));
-                }
-            };
-        }
-    };
-
-    private final ClassValue<ClassMap<Boolean>> canConvert = new ClassValue<ClassMap<Boolean>>() {
-        @Override
-        protected ClassMap<Boolean> computeValue(final Class<?> sourceType) {
-            return new ClassMap<Boolean>(getClassLoader(sourceType)) {
-                @Override
-                protected Boolean computeValue(final Class<?> targetType) {
-                    try {
-                        return getTypeConverterNull(sourceType, targetType) != null;
-                    } catch (final RuntimeException e) {
-                        throw e;
-                    } catch (final Exception e) {
-                        throw new RuntimeException(e);
-                    }
-                }
-            };
-        }
-    };
-
-    private static ClassLoader getClassLoader(final Class<?> clazz) {
-        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
-            @Override
-            public ClassLoader run() {
-                return clazz.getClassLoader();
-            }
-        }, ClassLoaderGetterContextProvider.GET_CLASS_LOADER_CONTEXT);
-    }
-
-    /**
-     * Creates a new type converter factory from the available {@link GuardingTypeConverterFactory} instances.
-     *
-     * @param factories the {@link GuardingTypeConverterFactory} instances to compose.
-     * @param autoConversionStrategy conversion strategy for automatic type conversions. After
-     * {@link #asType(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType)} has applied all custom
-     * conversions to a method handle, it still needs to effect
-     * {@link TypeUtilities#isMethodInvocationConvertible(Class, Class) method invocation conversions} that
-     * can usually be automatically applied as per
-     * {@link java.lang.invoke.MethodHandle#asType(java.lang.invoke.MethodType)}.
-     * However, sometimes language runtimes will want to customize even those conversions for their own call
-     * sites. A typical example is allowing unboxing of null return values, which is by default prohibited by
-     * ordinary {@code MethodHandles.asType}. In this case, a language runtime can install its own custom
-     * automatic conversion strategy, that can deal with null values. Note that when the strategy's
-     * {@link MethodTypeConversionStrategy#asType(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType)}
-     * is invoked, the custom language conversions will already have been applied to the method handle, so by
-     * design the difference between the handle's current method type and the desired final type will always
-     * only be ones that can be subjected to method invocation conversions. Can be null, in which case no
-     * custom strategy is employed.
-     */
-    public TypeConverterFactory(final Iterable<? extends GuardingTypeConverterFactory> factories,
-            final MethodTypeConversionStrategy autoConversionStrategy) {
-        final List<GuardingTypeConverterFactory> l = new LinkedList<>();
-        final List<ConversionComparator> c = new LinkedList<>();
-        for(final GuardingTypeConverterFactory factory: factories) {
-            l.add(factory);
-            if(factory instanceof ConversionComparator) {
-                c.add((ConversionComparator)factory);
-            }
-        }
-        this.factories = l.toArray(new GuardingTypeConverterFactory[l.size()]);
-        this.comparators = c.toArray(new ConversionComparator[c.size()]);
-        this.autoConversionStrategy = autoConversionStrategy;
-    }
-
-    /**
-     * Similar to {@link MethodHandle#asType(MethodType)} except it also hooks in method handles produced by
-     * {@link GuardingTypeConverterFactory} implementations, providing for language-specific type coercing of
-     * parameters. For all conversions that are not a JLS method invocation conversion it'll insert
-     * {@link MethodHandles#filterArguments(MethodHandle, int, MethodHandle...)} with composite filters
-     * provided by {@link GuardingTypeConverterFactory} implementations. For the remaining JLS method invocation
-     * conversions, it will invoke {@link MethodTypeConversionStrategy#asType(MethodHandle, MethodType)} first
-     * if an automatic conversion strategy was specified in the
-     * {@link #TypeConverterFactory(Iterable, MethodTypeConversionStrategy) constructor}, and finally apply
-     * {@link MethodHandle#asType(MethodType)} for any remaining conversions.
-     *
-     * @param handle target method handle
-     * @param fromType the types of source arguments
-     * @return a method handle that is a suitable combination of {@link MethodHandle#asType(MethodType)},
-     * {@link MethodTypeConversionStrategy#asType(MethodHandle, MethodType)}, and
-     * {@link MethodHandles#filterArguments(MethodHandle, int, MethodHandle...)} with
-     * {@link GuardingTypeConverterFactory} produced type converters as filters.
-     */
-    public MethodHandle asType(final MethodHandle handle, final MethodType fromType) {
-        MethodHandle newHandle = handle;
-        final MethodType toType = newHandle.type();
-        final int l = toType.parameterCount();
-        if(l != fromType.parameterCount()) {
-            throw new WrongMethodTypeException("Parameter counts differ: " + handle.type() + " vs. " + fromType);
-        }
-        int pos = 0;
-        final List<MethodHandle> converters = new LinkedList<>();
-        for(int i = 0; i < l; ++i) {
-            final Class<?> fromParamType = fromType.parameterType(i);
-            final Class<?> toParamType = toType.parameterType(i);
-            if(canAutoConvert(fromParamType, toParamType)) {
-                newHandle = applyConverters(newHandle, pos, converters);
-            } else {
-                final MethodHandle converter = getTypeConverterNull(fromParamType, toParamType);
-                if(converter != null) {
-                    if(converters.isEmpty()) {
-                        pos = i;
-                    }
-                    converters.add(converter);
-                } else {
-                    newHandle = applyConverters(newHandle, pos, converters);
-                }
-            }
-        }
-        newHandle = applyConverters(newHandle, pos, converters);
-
-        // Convert return type
-        final Class<?> fromRetType = fromType.returnType();
-        final Class<?> toRetType = toType.returnType();
-        if(fromRetType != Void.TYPE && toRetType != Void.TYPE) {
-            if(!canAutoConvert(toRetType, fromRetType)) {
-                final MethodHandle converter = getTypeConverterNull(toRetType, fromRetType);
-                if(converter != null) {
-                    newHandle = MethodHandles.filterReturnValue(newHandle, converter);
-                }
-            }
-        }
-
-        // Give change to automatic conversion strategy, if one is present.
-        final MethodHandle autoConvertedHandle =
-                autoConversionStrategy != null ? autoConversionStrategy.asType(newHandle, fromType) : newHandle;
-
-        // Do a final asType for any conversions that remain.
-        return autoConvertedHandle.asType(fromType);
-    }
-
-    private static MethodHandle applyConverters(final MethodHandle handle, final int pos, final List<MethodHandle> converters) {
-        if(converters.isEmpty()) {
-            return handle;
-        }
-        final MethodHandle newHandle =
-                MethodHandles.filterArguments(handle, pos, converters.toArray(new MethodHandle[converters.size()]));
-        converters.clear();
-        return newHandle;
-    }
-
-    /**
-     * Returns true if there might exist a conversion between the requested types (either an automatic JVM conversion,
-     * or one provided by any available {@link GuardingTypeConverterFactory}), or false if there definitely does not
-     * exist a conversion between the requested types. Note that returning true does not guarantee that the conversion
-     * will succeed at runtime (notably, if the "from" or "to" types are sufficiently generic), but returning false
-     * guarantees that it would fail.
-     *
-     * @param from the source type for the conversion
-     * @param to the target type for the conversion
-     * @return true if there can be a conversion, false if there can not.
-     */
-    public boolean canConvert(final Class<?> from, final Class<?> to) {
-        return canAutoConvert(from, to) || canConvert.get(from).get(to);
-    }
-
-    /**
-     * Determines which of the two type conversions from a source type to the two target types is preferred. This is
-     * used for dynamic overloaded method resolution. If the source type is convertible to exactly one target type with
-     * a method invocation conversion, it is chosen, otherwise available {@link ConversionComparator}s are consulted.
-     * @param sourceType the source type.
-     * @param targetType1 one potential target type
-     * @param targetType2 another potential target type.
-     * @return one of Comparison constants that establish which - if any - of the target types is preferable for the
-     * conversion.
-     */
-    public Comparison compareConversion(final Class<?> sourceType, final Class<?> targetType1, final Class<?> targetType2) {
-        for(final ConversionComparator comparator: comparators) {
-            final Comparison result = comparator.compareConversion(sourceType, targetType1, targetType2);
-            if(result != Comparison.INDETERMINATE) {
-                return result;
-            }
-        }
-        if(TypeUtilities.isMethodInvocationConvertible(sourceType, targetType1)) {
-            if(!TypeUtilities.isMethodInvocationConvertible(sourceType, targetType2)) {
-                return Comparison.TYPE_1_BETTER;
-            }
-        } else if(TypeUtilities.isMethodInvocationConvertible(sourceType, targetType2)) {
-            return Comparison.TYPE_2_BETTER;
-        }
-        return Comparison.INDETERMINATE;
-    }
-
-    /**
-     * Determines whether it's safe to perform an automatic conversion between the source and target class.
-     *
-     * @param fromType convert from this class
-     * @param toType convert to this class
-     * @return true if it's safe to let MethodHandles.convertArguments() to handle this conversion.
-     */
-    /*private*/ static boolean canAutoConvert(final Class<?> fromType, final Class<?> toType) {
-        return TypeUtilities.isMethodInvocationConvertible(fromType, toType);
-    }
-
-    /*private*/ MethodHandle getCacheableTypeConverterNull(final Class<?> sourceType, final Class<?> targetType) {
-        final MethodHandle converter = getCacheableTypeConverter(sourceType, targetType);
-        return converter == IDENTITY_CONVERSION ? null : converter;
-    }
-
-    /*private*/ MethodHandle getTypeConverterNull(final Class<?> sourceType, final Class<?> targetType) {
-        try {
-            return getCacheableTypeConverterNull(sourceType, targetType);
-        } catch(final NotCacheableConverter e) {
-            return e.converter;
-        }
-    }
-
-    /*private*/ MethodHandle getCacheableTypeConverter(final Class<?> sourceType, final Class<?> targetType) {
-        return converterMap.get(sourceType).get(targetType);
-    }
-
-    /**
-     * Given a source and target type, returns a method handle that converts between them. Never returns null; in worst
-     * case it will return an identity conversion (that might fail for some values at runtime). You can use this method
-     * if you have a piece of your program that is written in Java, and you need to reuse existing type conversion
-     * machinery in a non-invokedynamic context.
-     * @param sourceType the type to convert from
-     * @param targetType the type to convert to
-     * @return a method handle performing the conversion.
-     */
-    public MethodHandle getTypeConverter(final Class<?> sourceType, final Class<?> targetType) {
-        try {
-            return converterIdentityMap.get(sourceType).get(targetType);
-        } catch(final NotCacheableConverter e) {
-            return e.converter;
-        }
-    }
-
-    /*private*/ MethodHandle createConverter(final Class<?> sourceType, final Class<?> targetType) throws Exception {
-        final MethodType type = MethodType.methodType(targetType, sourceType);
-        final MethodHandle identity = IDENTITY_CONVERSION.asType(type);
-        MethodHandle last = identity;
-        boolean cacheable = true;
-        for(int i = factories.length; i-- > 0;) {
-            final GuardedTypeConversion next = factories[i].convertToType(sourceType, targetType);
-            if(next != null) {
-                cacheable = cacheable && next.isCacheable();
-                final GuardedInvocation conversionInvocation = next.getConversionInvocation();
-                conversionInvocation.assertType(type);
-                last = conversionInvocation.compose(last);
-            }
-        }
-        if(last == identity) {
-            return IDENTITY_CONVERSION;
-        }
-        if(cacheable) {
-            return last;
-        }
-        throw new NotCacheableConverter(last);
-    }
-
-    /*private*/ static final MethodHandle IDENTITY_CONVERSION = MethodHandles.identity(Object.class);
-
-    @SuppressWarnings("serial")
-    private static class NotCacheableConverter extends RuntimeException {
-        final MethodHandle converter;
-
-        NotCacheableConverter(final MethodHandle converter) {
-            super("", null, false, false);
-            this.converter = converter;
-        }
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/UnnamedDynCallSiteDescriptor.java	Thu Oct 15 16:50:08 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       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 the copyright holder nor the names of
-         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 COPYRIGHT HOLDER
-       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.
-*/
-
-package jdk.internal.dynalink.support;
-
-import java.lang.invoke.MethodType;
-import jdk.internal.dynalink.CallSiteDescriptor;
-
-class UnnamedDynCallSiteDescriptor extends AbstractCallSiteDescriptor {
-    private final MethodType methodType;
-    private final String op;
-
-    UnnamedDynCallSiteDescriptor(final String op, final MethodType methodType) {
-        this.op = op;
-        this.methodType = methodType;
-    }
-
-    @Override
-    public int getNameTokenCount() {
-        return 2;
-    }
-
-    String getOp() {
-        return op;
-    }
-
-    @Override
-    public String getNameToken(final int i) {
-        switch(i) {
-            case 0: return "dyn";
-            case 1: return op;
-            default: throw new IndexOutOfBoundsException(String.valueOf(i));
-        }
-    }
-
-    @Override
-    public MethodType getMethodType() {
-        return methodType;
-    }
-
-    @Override
-    public CallSiteDescriptor changeMethodType(final MethodType newMethodType) {
-        return CallSiteDescriptorFactory.getCanonicalPublicDescriptor(new UnnamedDynCallSiteDescriptor(op,
-                newMethodType));
-    }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java	Mon Oct 19 08:23:03 2015 +0200
@@ -44,7 +44,6 @@
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.GuardingDynamicLinker;
 import jdk.internal.dynalink.linker.LinkRequest;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.internal.dynalink.support.LinkRequestImpl;
 import jdk.nashorn.api.scripting.ScriptObjectMirror;
 import jdk.nashorn.internal.lookup.Lookup;
@@ -64,6 +63,7 @@
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 import jdk.nashorn.internal.runtime.linker.InvokeByName;
 import jdk.nashorn.internal.runtime.linker.NashornBeansLinker;
+import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
 
 /**
  * ECMA 15.2 Object objects
@@ -834,8 +834,8 @@
     }
 
     private static LinkRequest createLinkRequest(final String operation, final MethodType methodType, final Object source) {
-        return new LinkRequestImpl(CallSiteDescriptorFactory.create(MethodHandles.publicLookup(), operation,
-                methodType), null, 0, false, source);
+        return new LinkRequestImpl(NashornCallSiteDescriptor.get(MethodHandles.publicLookup(), operation,
+                methodType, 0), null, 0, false, source);
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java	Mon Oct 19 08:23:03 2015 +0200
@@ -68,7 +68,6 @@
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.codegen.ObjectClassGenerator;
 import jdk.nashorn.internal.codegen.types.Type;
@@ -1840,7 +1839,7 @@
         // JavaScript is "immune" to all currently defined Dynalink composite operation - getProp is the same as getElem
         // is the same as getMethod as JavaScript objects have a single namespace for all three. Therefore, we don't
         // care about them, and just link to whatever is the first operation.
-        final String operator = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
+        final String operator = desc.tokenizeOperators().get(0);
         // NOTE: we support getElem and setItem as JavaScript doesn't distinguish items from properties. Nashorn itself
         // emits "dyn:getProp:identifier" for "<expr>.<identifier>" and "dyn:getElem" for "<expr>[<expr>]", but we are
         // more flexible here and dispatch not on operation name (getProp vs. getElem), but rather on whether the
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Undefined.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Undefined.java	Mon Oct 19 08:23:03 2015 +0200
@@ -32,7 +32,6 @@
 import java.lang.invoke.MethodHandles;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.internal.dynalink.support.Guards;
 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
 
@@ -92,7 +91,7 @@
      * @return GuardedInvocation to be invoked at call site.
      */
     public static GuardedInvocation lookup(final CallSiteDescriptor desc) {
-        final String operator = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
+        final String operator = desc.tokenizeOperators().get(0);
 
         switch (operator) {
         case "new":
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java	Mon Oct 19 08:23:03 2015 +0200
@@ -35,7 +35,6 @@
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.nashorn.api.scripting.AbstractJSObject;
 import jdk.nashorn.api.scripting.ScriptObjectMirror;
 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
@@ -137,7 +136,7 @@
         if (self != null) {
             final String fallBack;
 
-            final String operator = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
+            final String operator = desc.tokenizeOperators().get(0);
 
             switch (operator) {
             case "callMethod":
@@ -211,7 +210,7 @@
 
     @Override
     protected Object invokeNoSuchProperty(final String name, final boolean isScope, final int programPoint) {
-        FindProperty find = expression.findProperty(NO_SUCH_PROPERTY_NAME, true);
+        final FindProperty find = expression.findProperty(NO_SUCH_PROPERTY_NAME, true);
         if (find != null) {
             final Object func = find.getObjectValue();
             if (func instanceof ScriptFunction) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java	Mon Oct 19 08:23:03 2015 +0200
@@ -39,7 +39,6 @@
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.linker.LinkerServices;
 import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.lookup.MethodHandleFunctionality;
 import jdk.nashorn.internal.runtime.JSType;
@@ -119,12 +118,12 @@
     }
 
     private GuardedInvocation lookup(final CallSiteDescriptor desc, final LinkRequest request, final LinkerServices linkerServices) throws Exception {
-        final String operator = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
+        final String operator = desc.tokenizeOperators().get(0);
         final int c = desc.getNameTokenCount();
         GuardedInvocation inv;
         try {
             inv = nashornBeansLinker.getGuardedInvocation(request, linkerServices);
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             inv = null;
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Mon Oct 19 08:23:03 2015 +0200
@@ -36,7 +36,6 @@
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.linker.LinkerServices;
 import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.lookup.MethodHandleFunctionality;
@@ -94,7 +93,7 @@
     }
 
     private GuardedInvocation lookup(final CallSiteDescriptor desc, final LinkRequest request, final LinkerServices linkerServices) throws Exception {
-        final String operator = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
+        final String operator = desc.tokenizeOperators().get(0);
         final int c = desc.getNameTokenCount();
 
         switch (operator) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaSuperAdapterLinker.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaSuperAdapterLinker.java	Mon Oct 19 08:23:03 2015 +0200
@@ -37,7 +37,6 @@
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.linker.LinkerServices;
 import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.internal.dynalink.support.Lookup;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 
@@ -78,7 +77,7 @@
         }
 
         final CallSiteDescriptor descriptor = linkRequest.getCallSiteDescriptor();
-        if(!CallSiteDescriptorFactory.tokenizeOperators(descriptor).contains(GET_METHOD)) {
+        if(!descriptor.tokenizeOperators().contains(GET_METHOD)) {
             // We only handle getMethod
             return null;
         }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java	Mon Oct 19 08:23:03 2015 +0200
@@ -32,7 +32,6 @@
 import java.util.concurrent.ConcurrentMap;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.support.AbstractCallSiteDescriptor;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.nashorn.internal.ir.debug.NashornTextifier;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 
@@ -150,7 +149,7 @@
      */
     public static NashornCallSiteDescriptor get(final MethodHandles.Lookup lookup, final String name,
             final MethodType methodType, final int flags) {
-        final String[] tokenizedName = CallSiteDescriptorFactory.tokenizeName(name);
+        final String[] tokenizedName = CallSiteDescriptor.tokenizeName(name);
         assert tokenizedName.length >= 2;
         assert "dyn".equals(tokenizedName[0]);
         assert tokenizedName[1] != null;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornLinker.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornLinker.java	Mon Oct 19 08:23:03 2015 +0200
@@ -40,6 +40,7 @@
 import java.util.Queue;
 import javax.script.Bindings;
 import jdk.internal.dynalink.CallSiteDescriptor;
+import jdk.internal.dynalink.DynamicLinker;
 import jdk.internal.dynalink.linker.ConversionComparator;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.GuardedTypeConversion;
@@ -48,7 +49,6 @@
 import jdk.internal.dynalink.linker.LinkerServices;
 import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
 import jdk.internal.dynalink.support.Guards;
-import jdk.internal.dynalink.support.LinkerServicesImpl;
 import jdk.internal.dynalink.support.Lookup;
 import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.api.scripting.ScriptObjectMirror;
@@ -175,7 +175,7 @@
         final LinkRequest currentRequest = AccessController.doPrivileged(new PrivilegedAction<LinkRequest>() {
             @Override
             public LinkRequest run() {
-                return LinkerServicesImpl.getCurrentLinkRequest();
+                return DynamicLinker.getCurrentLinkRequest();
             }
         });
         return currentRequest == null ? MethodHandles.publicLookup() : currentRequest.getCallSiteDescriptor().getLookup();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java	Mon Oct 19 08:23:03 2015 +0200
@@ -35,7 +35,6 @@
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.internal.dynalink.support.Guards;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.FindProperty;
@@ -109,7 +108,7 @@
             find = null;
         }
 
-        final String firstOp = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
+        final String firstOp = desc.tokenizeOperators().get(0);
 
         switch (firstOp) {
         case "getProp":
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java	Thu Oct 15 16:50:08 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java	Mon Oct 19 08:23:03 2015 +0200
@@ -34,10 +34,9 @@
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.linker.LinkerServices;
 import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
-import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.nashorn.api.scripting.ClassFilter;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.Context;
-import jdk.nashorn.internal.objects.Global;
 
 /**
  * Check java reflection permission for java reflective and java.lang.invoke access from scripts
@@ -130,7 +129,7 @@
             // allow 'static' access on Class objects representing public classes of non-restricted packages
             if ((self instanceof Class) && Modifier.isPublic(((Class<?>)self).getModifiers())) {
                 final CallSiteDescriptor desc = requestWithoutContext.getCallSiteDescriptor();
-                if(CallSiteDescriptorFactory.tokenizeOperators(desc).contains("getProp")) {
+                if(desc.tokenizeOperators().contains("getProp")) {
                     if (desc.getNameTokenCount() > CallSiteDescriptor.NAME_OPERAND &&
                         "static".equals(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND))) {
                         if (Context.isAccessibleClass((Class<?>)self) && !isReflectionClass((Class<?>)self)) {