< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/InvocationPlugins.java

Print this page
rev 56282 : [mq]: graal
   1 /*
   2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 685         if (resolvedRegistrations != null) {
 686             return resolvedRegistrations.get(method);
 687         } else {
 688             if (!method.isBridge()) {
 689                 ResolvedJavaType declaringClass = method.getDeclaringClass();
 690                 flushDeferrables();
 691                 String internalName = declaringClass.getName();
 692                 ClassPlugins classPlugins = registrations.get(internalName);
 693                 InvocationPlugin res = null;
 694                 if (classPlugins != null) {
 695                     res = classPlugins.get(method);
 696                 }
 697                 if (res == null) {
 698                     LateClassPlugins lcp = findLateClassPlugins(internalName);
 699                     if (lcp != null) {
 700                         res = lcp.get(method);
 701                     }
 702                 }
 703                 if (res != null) {
 704                     // A decorator plugin is trusted since it does not replace
 705                     // the method it intrinsifies.
 706                     if (res.isDecorator() || canBeIntrinsified(declaringClass)) {


 707                         return res;
 708                     }
 709                 }
 710                 if (testExtensions != null) {
 711                     // Avoid the synchronization in the common case that there
 712                     // are no test extensions.
 713                     synchronized (this) {
 714                         if (testExtensions != null) {
 715                             List<Binding> bindings = testExtensions.get(internalName);
 716                             if (bindings != null) {
 717                                 String name = method.getName();
 718                                 String descriptor = method.getSignature().toMethodDescriptor();
 719                                 for (Binding b : bindings) {
 720                                     if (b.isStatic == method.isStatic() &&
 721                                                     b.name.equals(name) &&
 722                                                     descriptor.startsWith(b.argumentsDescriptor)) {
 723                                         return b.plugin;
 724                                     }
 725                                 }
 726                             }


   1 /*
   2  * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 685         if (resolvedRegistrations != null) {
 686             return resolvedRegistrations.get(method);
 687         } else {
 688             if (!method.isBridge()) {
 689                 ResolvedJavaType declaringClass = method.getDeclaringClass();
 690                 flushDeferrables();
 691                 String internalName = declaringClass.getName();
 692                 ClassPlugins classPlugins = registrations.get(internalName);
 693                 InvocationPlugin res = null;
 694                 if (classPlugins != null) {
 695                     res = classPlugins.get(method);
 696                 }
 697                 if (res == null) {
 698                     LateClassPlugins lcp = findLateClassPlugins(internalName);
 699                     if (lcp != null) {
 700                         res = lcp.get(method);
 701                     }
 702                 }
 703                 if (res != null) {
 704                     // A decorator plugin is trusted since it does not replace
 705                     // the method it intrinsifies. A GeneratedInvocationPlugin
 706                     // is trusted since it only exists for @NodeIntrinsics and
 707                     // @Fold annotated methods (i.e., trusted Graal code).
 708                     if (res.isDecorator() || res instanceof GeneratedInvocationPlugin || canBeIntrinsified(declaringClass)) {
 709                         return res;
 710                     }
 711                 }
 712                 if (testExtensions != null) {
 713                     // Avoid the synchronization in the common case that there
 714                     // are no test extensions.
 715                     synchronized (this) {
 716                         if (testExtensions != null) {
 717                             List<Binding> bindings = testExtensions.get(internalName);
 718                             if (bindings != null) {
 719                                 String name = method.getName();
 720                                 String descriptor = method.getSignature().toMethodDescriptor();
 721                                 for (Binding b : bindings) {
 722                                     if (b.isStatic == method.isStatic() &&
 723                                                     b.name.equals(name) &&
 724                                                     descriptor.startsWith(b.argumentsDescriptor)) {
 725                                         return b.plugin;
 726                                     }
 727                                 }
 728                             }


< prev index next >