< prev index next >

src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java

Print this page
rev 50075 : imported patch jep181-rev1
   1 /*
   2  * Copyright (c) 2001, 2013, 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 612                 // Fall through to next argument
 613             }
 614         }
 615         // Bind last goto if present
 616         if (nextParamLabel != null) {
 617             nextParamLabel.bind();
 618         }
 619 
 620         short invokeStartPC = cb.getLength();
 621 
 622         // OK, ready to perform the invocation.
 623         if (isConstructor) {
 624             cb.opc_invokespecial(targetMethodRef, count, 0);
 625         } else {
 626             if (isStatic()) {
 627                 cb.opc_invokestatic(targetMethodRef,
 628                                     count,
 629                                     typeSizeInStackSlots(returnType));
 630             } else {
 631                 if (isInterface()) {
 632                     if (isPrivate()) {
 633                         cb.opc_invokespecial(targetMethodRef, count, 0);
 634                     } else {
 635                         cb.opc_invokeinterface(targetMethodRef,
 636                                                count,
 637                                                count,
 638                                                typeSizeInStackSlots(returnType));
 639                     }
 640                 } else {
 641                     cb.opc_invokevirtual(targetMethodRef,
 642                                          count,
 643                                          typeSizeInStackSlots(returnType));
 644                 }
 645             }
 646         }
 647 
 648         short invokeEndPC = cb.getLength();
 649 
 650         if (!isConstructor) {
 651             // Box return value if necessary
 652             if (isPrimitive(returnType)) {
 653                 cb.opc_invokestatic(boxingMethodForPrimitiveType(returnType),
 654                                     typeSizeInStackSlots(returnType),
 655                                     0);
 656             } else if (returnType == Void.TYPE) {
 657                 cb.opc_aconst_null();
 658             }
 659         }


   1 /*
   2  * Copyright (c) 2001, 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 612                 // Fall through to next argument
 613             }
 614         }
 615         // Bind last goto if present
 616         if (nextParamLabel != null) {
 617             nextParamLabel.bind();
 618         }
 619 
 620         short invokeStartPC = cb.getLength();
 621 
 622         // OK, ready to perform the invocation.
 623         if (isConstructor) {
 624             cb.opc_invokespecial(targetMethodRef, count, 0);
 625         } else {
 626             if (isStatic()) {
 627                 cb.opc_invokestatic(targetMethodRef,
 628                                     count,
 629                                     typeSizeInStackSlots(returnType));
 630             } else {
 631                 if (isInterface()) {
 632                     cb.opc_invokeinterface(targetMethodRef,
 633                                            count,
 634                                            count,
 635                                            typeSizeInStackSlots(returnType));




 636                 } else {
 637                     cb.opc_invokevirtual(targetMethodRef,
 638                                          count,
 639                                          typeSizeInStackSlots(returnType));
 640                 }
 641             }
 642         }
 643 
 644         short invokeEndPC = cb.getLength();
 645 
 646         if (!isConstructor) {
 647             // Box return value if necessary
 648             if (isPrimitive(returnType)) {
 649                 cb.opc_invokestatic(boxingMethodForPrimitiveType(returnType),
 650                                     typeSizeInStackSlots(returnType),
 651                                     0);
 652             } else if (returnType == Void.TYPE) {
 653                 cb.opc_aconst_null();
 654             }
 655         }


< prev index next >