diff --git a/buildspecs/aix_ppc-64.spec b/buildspecs/aix_ppc-64.spec index fbe8957a76e..670507a757b 100644 --- a/buildspecs/aix_ppc-64.spec +++ b/buildspecs/aix_ppc-64.spec @@ -231,7 +231,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/aix_ppc-64_cmprssptrs.spec b/buildspecs/aix_ppc-64_cmprssptrs.spec index 65e1101da3b..750c36611fa 100644 --- a/buildspecs/aix_ppc-64_cmprssptrs.spec +++ b/buildspecs/aix_ppc-64_cmprssptrs.spec @@ -227,7 +227,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/aix_ppc.spec b/buildspecs/aix_ppc.spec index 5d70cd2813c..8ba361503fe 100644 --- a/buildspecs/aix_ppc.spec +++ b/buildspecs/aix_ppc.spec @@ -228,7 +228,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/j9.flags b/buildspecs/j9.flags index 854f7443871..0a5b5e6c5ed 100644 --- a/buildspecs/j9.flags +++ b/buildspecs/j9.flags @@ -653,10 +653,6 @@ all data is stored in their own region. It additionaly reduces footprint, mainly Indicates that this spec should run automated testing jobs in the nightly build This spec will not run any tests and will be a "build only" spec - - Indicates that this spec should run automated testing jobs in the nightly build - This spec will not run any tests and will be a "build only" spec - Indicates that this spec wishes to not run the AllocFib test suite in the nightly build AllocFib test suite will be run in the nightly build, if otherwise included @@ -1824,10 +1820,6 @@ Only available on zOS Enables support for @Packed types (Structs) No support for @Packed types (Structs) - - Enables support for Project Panama features such as native method handles - No support for Project Panama features such as native method handles - Enables support for Foreign Linker API (part of Project Panama) such as native invocations to ffi_call No support for Foreign Linker API diff --git a/buildspecs/linux_390-64.spec b/buildspecs/linux_390-64.spec index 87edd7b8877..bff02e81bc8 100644 --- a/buildspecs/linux_390-64.spec +++ b/buildspecs/linux_390-64.spec @@ -229,7 +229,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_390-64_cmprssptrs.spec b/buildspecs/linux_390-64_cmprssptrs.spec index 37d91440c42..f30c34aa169 100644 --- a/buildspecs/linux_390-64_cmprssptrs.spec +++ b/buildspecs/linux_390-64_cmprssptrs.spec @@ -231,7 +231,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_390.spec b/buildspecs/linux_390.spec index 6f1b093b3fa..9d1e4bf9487 100644 --- a/buildspecs/linux_390.spec +++ b/buildspecs/linux_390.spec @@ -230,7 +230,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_aarch64.spec b/buildspecs/linux_aarch64.spec index b7fe4187dba..57bb3c9d844 100644 --- a/buildspecs/linux_aarch64.spec +++ b/buildspecs/linux_aarch64.spec @@ -213,7 +213,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_aarch64_cmprssptrs.spec b/buildspecs/linux_aarch64_cmprssptrs.spec index 10ae863ed51..250f2ce6cfa 100644 --- a/buildspecs/linux_aarch64_cmprssptrs.spec +++ b/buildspecs/linux_aarch64_cmprssptrs.spec @@ -213,7 +213,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_aarch64_cmprssptrs_cross.spec b/buildspecs/linux_aarch64_cmprssptrs_cross.spec index 390c6ce462c..e28a9aabb45 100644 --- a/buildspecs/linux_aarch64_cmprssptrs_cross.spec +++ b/buildspecs/linux_aarch64_cmprssptrs_cross.spec @@ -214,7 +214,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_aarch64_cross.spec b/buildspecs/linux_aarch64_cross.spec index 1ba01a8236e..c13717cb0b9 100644 --- a/buildspecs/linux_aarch64_cross.spec +++ b/buildspecs/linux_aarch64_cross.spec @@ -214,7 +214,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_arm.spec b/buildspecs/linux_arm.spec index feafae2ac89..6c20c7101ab 100644 --- a/buildspecs/linux_arm.spec +++ b/buildspecs/linux_arm.spec @@ -230,7 +230,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_arm_linaro.spec b/buildspecs/linux_arm_linaro.spec index 2e286e5108c..ebb4c039c97 100644 --- a/buildspecs/linux_arm_linaro.spec +++ b/buildspecs/linux_arm_linaro.spec @@ -229,7 +229,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_ppc-64.spec b/buildspecs/linux_ppc-64.spec index c0043623212..d8bbd985359 100644 --- a/buildspecs/linux_ppc-64.spec +++ b/buildspecs/linux_ppc-64.spec @@ -229,7 +229,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_ppc-64_cmprssptrs.spec b/buildspecs/linux_ppc-64_cmprssptrs.spec index 7a95cedc706..7d268ef5bc2 100644 --- a/buildspecs/linux_ppc-64_cmprssptrs.spec +++ b/buildspecs/linux_ppc-64_cmprssptrs.spec @@ -227,7 +227,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_ppc-64_cmprssptrs_le.spec b/buildspecs/linux_ppc-64_cmprssptrs_le.spec index bb1056c0947..e6b1abad22a 100644 --- a/buildspecs/linux_ppc-64_cmprssptrs_le.spec +++ b/buildspecs/linux_ppc-64_cmprssptrs_le.spec @@ -232,7 +232,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_ppc-64_le.spec b/buildspecs/linux_ppc-64_le.spec index c6dd9e22d61..2372beb21ca 100644 --- a/buildspecs/linux_ppc-64_le.spec +++ b/buildspecs/linux_ppc-64_le.spec @@ -232,7 +232,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_ppc.spec b/buildspecs/linux_ppc.spec index 89af82a3a4f..94ac4fbb4ba 100644 --- a/buildspecs/linux_ppc.spec +++ b/buildspecs/linux_ppc.spec @@ -227,7 +227,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_riscv64.spec b/buildspecs/linux_riscv64.spec index 4d3ce89af57..7d2b5eeba6b 100644 --- a/buildspecs/linux_riscv64.spec +++ b/buildspecs/linux_riscv64.spec @@ -223,7 +223,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_riscv64_cmprssptrs.spec b/buildspecs/linux_riscv64_cmprssptrs.spec index c630e906c96..2b00c23d654 100644 --- a/buildspecs/linux_riscv64_cmprssptrs.spec +++ b/buildspecs/linux_riscv64_cmprssptrs.spec @@ -223,7 +223,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_riscv64_cmprssptrs_cross.spec b/buildspecs/linux_riscv64_cmprssptrs_cross.spec index 021b2a79cbb..f782de09336 100644 --- a/buildspecs/linux_riscv64_cmprssptrs_cross.spec +++ b/buildspecs/linux_riscv64_cmprssptrs_cross.spec @@ -224,7 +224,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_riscv64_cross.spec b/buildspecs/linux_riscv64_cross.spec index f8b948f5162..c404442d451 100644 --- a/buildspecs/linux_riscv64_cross.spec +++ b/buildspecs/linux_riscv64_cross.spec @@ -224,7 +224,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_x86-64.spec b/buildspecs/linux_x86-64.spec index 0a79f6beec0..0ee39da3595 100644 --- a/buildspecs/linux_x86-64.spec +++ b/buildspecs/linux_x86-64.spec @@ -230,7 +230,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_x86-64_cmprssptrs.spec b/buildspecs/linux_x86-64_cmprssptrs.spec index 057dab2d0bc..2582d3d1100 100644 --- a/buildspecs/linux_x86-64_cmprssptrs.spec +++ b/buildspecs/linux_x86-64_cmprssptrs.spec @@ -225,7 +225,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/linux_ztpf_390-64.spec b/buildspecs/linux_ztpf_390-64.spec index 4d35220d98e..6fbb2d3e737 100644 --- a/buildspecs/linux_ztpf_390-64.spec +++ b/buildspecs/linux_ztpf_390-64.spec @@ -219,7 +219,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/osx_x86-64.spec b/buildspecs/osx_x86-64.spec index effd054d46f..ee25484fbb1 100644 --- a/buildspecs/osx_x86-64.spec +++ b/buildspecs/osx_x86-64.spec @@ -228,7 +228,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/osx_x86-64_cmprssptrs.spec b/buildspecs/osx_x86-64_cmprssptrs.spec index f373c340540..520bbd412b4 100644 --- a/buildspecs/osx_x86-64_cmprssptrs.spec +++ b/buildspecs/osx_x86-64_cmprssptrs.spec @@ -223,7 +223,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/win_x86-64.spec b/buildspecs/win_x86-64.spec index 6e2f88cf033..63e1caa403b 100644 --- a/buildspecs/win_x86-64.spec +++ b/buildspecs/win_x86-64.spec @@ -233,7 +233,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/win_x86-64_cmprssptrs.spec b/buildspecs/win_x86-64_cmprssptrs.spec index 36d2513824e..0679ef85f32 100644 --- a/buildspecs/win_x86-64_cmprssptrs.spec +++ b/buildspecs/win_x86-64_cmprssptrs.spec @@ -228,7 +228,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/win_x86.spec b/buildspecs/win_x86.spec index 455c50955fa..db2b32c4005 100644 --- a/buildspecs/win_x86.spec +++ b/buildspecs/win_x86.spec @@ -240,7 +240,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/zos_390-64.spec b/buildspecs/zos_390-64.spec index e8ad0ac555b..3334db65548 100644 --- a/buildspecs/zos_390-64.spec +++ b/buildspecs/zos_390-64.spec @@ -230,7 +230,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/zos_390-64_cmprssptrs.spec b/buildspecs/zos_390-64_cmprssptrs.spec index cf894b04e9b..bba6ca78697 100644 --- a/buildspecs/zos_390-64_cmprssptrs.spec +++ b/buildspecs/zos_390-64_cmprssptrs.spec @@ -230,7 +230,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/buildspecs/zos_390.spec b/buildspecs/zos_390.spec index b4e4f07d5d2..adf14a09b35 100644 --- a/buildspecs/zos_390.spec +++ b/buildspecs/zos_390.spec @@ -227,7 +227,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/debugtools/DDR_VM/data/superset-constants.dat b/debugtools/DDR_VM/data/superset-constants.dat index ab1fc9270af..b3958c75cbb 100644 --- a/debugtools/DDR_VM/data/superset-constants.dat +++ b/debugtools/DDR_VM/data/superset-constants.dat @@ -951,7 +951,6 @@ C|opt_noClassloaders C|opt_nrr C|opt_paas C|opt_packed -C|opt_panama C|opt_phpSupport C|opt_reflect C|opt_remoteConsoleSupport @@ -4154,7 +4153,6 @@ C|JCL_RTFLAG_DEFAULT C|JCL_RTFLAG_INTERP_HOT_CODE_REPLACEMENT C|JCL_RTFLAG_JIT_NEW_INSTANCE_PROTOTYPE C|JCL_RTFLAG_OPT_METHOD_HANDLE -C|JCL_RTFLAG_OPT_PANAMA C|JCL_RTFLAG_OPT_REFLECT S|J9VmlsConstants|J9VmlsConstantsPointer| C|J9VMLS_MAX_KEYS diff --git a/debugtools/DDR_VM/generate.properties b/debugtools/DDR_VM/generate.properties index 66d79339d8e..09e75d0900f 100644 --- a/debugtools/DDR_VM/generate.properties +++ b/debugtools/DDR_VM/generate.properties @@ -39,7 +39,7 @@ linux_x86-64,linux_x86-64_cmprssptrs,linux_x86-64_cmprssptrs_tarok,\ linux_x86-64_tarok,linux_x86,linux_x86_rtj,win_x86-64,win_x86-64_cmprssptrs,\ win_x86-64_cmprssptrs_tarok,win_x86-64_tarok,win_x86,win_x86_tarok,zos_390-64,\ zos_390-64_cmprssptrs,zos_390-64_cmprssptrs_tarok,zos_390-64_tarok,zos_390,\ -linux_x86-64_combo,linux_x86-64_cmprssptrs_combo,linux_x86-64_cmprssptrs_panama +linux_x86-64_combo,linux_x86-64_cmprssptrs_combo ddr.order=aix_ppc-64,aix_ppc-64_cmprssptrs,aix_ppc,\ linux_390-64,linux_390-64_cmprssptrs,linux_390,\ @@ -47,6 +47,6 @@ linux_aarch64,linux_aarch64_cmprssptrs,\ linux_arm,\ linux_ppc-64,linux_ppc-64_cmprssptrs,linux_ppc,\ linux_ppc-64_le,linux_ppc-64_cmprssptrs_le,\ -linux_x86-64,linux_x86-64_cmprssptrs,linux_x86-64_cmprssptrs_panama,\ +linux_x86-64,linux_x86-64_cmprssptrs,\ linux_x86,win_x86-64,win_x86-64_cmprssptrs,\ win_x86,zos_390-64,zos_390-64_cmprssptrs,zos_390 diff --git a/runtime/cmake/options.cmake b/runtime/cmake/options.cmake index c031f824fec..d617c02836c 100644 --- a/runtime/cmake/options.cmake +++ b/runtime/cmake/options.cmake @@ -141,7 +141,6 @@ option(J9VM_OPT_METHOD_HANDLE_COMMON "Enables common dependencies between OpenJ9 option(J9VM_OPT_MULTI_VM "Decides if multiple VMs can be created in the same address space") option(J9VM_OPT_OPENJDK_METHODHANDLE "Enables support for OpenJDK MethodHandles. J9VM_OPT_METHOD_HANDLE should be disabled.") -option(J9VM_OPT_PANAMA "Enables support for Project Panama features such as native method handles") option(J9VM_OPT_VALHALLA_VALUE_TYPES "Enables support for Project Valhalla Value Object") option(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES "Enables support for Project Valhalla Flattenable Value Types") diff --git a/runtime/gc_glue_java/configure_includes/configure_linux_x86.mk b/runtime/gc_glue_java/configure_includes/configure_linux_x86.mk index 284a504c917..336e753d022 100644 --- a/runtime/gc_glue_java/configure_includes/configure_linux_x86.mk +++ b/runtime/gc_glue_java/configure_includes/configure_linux_x86.mk @@ -43,21 +43,6 @@ ifeq (linux_x86-64_cmprssptrs, $(SPEC)) OMR_GC_POINTER_MODE=compressed endif -ifeq (linux_x86-64_cmprssptrs_panama, $(SPEC)) - CONFIGURE_ARGS += \ - --enable-OMRTHREAD_LIB_UNIX \ - --enable-OMR_ARCH_X86 \ - --enable-OMR_ENV_DATA64 \ - --enable-OMR_GC_DOUBLE_MAP_ARRAYLETS \ - --enable-OMR_ENV_LITTLE_ENDIAN \ - --enable-OMR_GC_IDLE_HEAP_MANAGER \ - --enable-OMR_GC_TLH_PREFETCH_FTA \ - --enable-OMR_PORT_CAN_RESERVE_SPECIFIC_ADDRESS \ - --enable-OMR_PORT_NUMA_SUPPORT \ - --enable-OMR_JITBUILDER \ - OMR_GC_POINTER_MODE=compressed -endif - ifeq (linux_x86-64, $(SPEC)) CONFIGURE_ARGS += \ --enable-OMRTHREAD_LIB_UNIX \ diff --git a/runtime/include/j9cfg.h.in b/runtime/include/j9cfg.h.in index 2e759db33b9..7a55c081640 100644 --- a/runtime/include/j9cfg.h.in +++ b/runtime/include/j9cfg.h.in @@ -236,7 +236,6 @@ extern "C" { #cmakedefine J9VM_OPT_NRR #cmakedefine J9VM_OPT_OPENJDK_METHODHANDLE #cmakedefine J9VM_OPT_PACKED -#cmakedefine J9VM_OPT_PANAMA #cmakedefine J9VM_OPT_PHP_SUPPORT #cmakedefine J9VM_OPT_REFLECT #cmakedefine J9VM_OPT_RESOURCE_MANAGED diff --git a/runtime/j9jitbuilder/JavaMethodCallbackGen.cpp b/runtime/j9jitbuilder/JavaMethodCallbackGen.cpp deleted file mode 100644 index 377f2862d4f..00000000000 --- a/runtime/j9jitbuilder/JavaMethodCallbackGen.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright IBM Corp. and others 2017 - * - * This program and the accompanying materials are made available under - * the terms of the Eclipse Public License 2.0 which accompanies this - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] https://openjdk.org/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 - *******************************************************************************/ - -#include "j9.h" - -#include "Jit.hpp" -#include "ilgen/TypeDictionary.hpp" -#include "ilgen/MethodBuilder.hpp" -#include "JavaMethodCallbackGen.hpp" - -JavaMethodCallbackGen::JavaMethodCallbackGen(J9VMThread *vmThread, TR::TypeDictionary *types) : MethodBuilder(types) -{ - DefineLine(LINETOSTR(__LINE__)); - DefineFile(__FILE__); - DefineName("JavaMethodCallbackGen"); -} - -bool -JavaMethodCallbackGen::buildIL() -{ - return true; -} diff --git a/runtime/j9jitbuilder/JavaMethodCallbackGen.hpp b/runtime/j9jitbuilder/JavaMethodCallbackGen.hpp deleted file mode 100644 index 92f95d23691..00000000000 --- a/runtime/j9jitbuilder/JavaMethodCallbackGen.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright IBM Corp. and others 2017 - * - * This program and the accompanying materials are made available under - * the terms of the Eclipse Public License 2.0 which accompanies this - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] https://openjdk.org/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 - *******************************************************************************/ - -#ifndef JAVAMETHODCALLBACK_HPP_ -#define JAVAMETHODCALLBACK_HPP_ - -#include "j9.h" - -#include "ilgen/MethodBuilder.hpp" - -class JavaMethodCallbackGen : public TR::MethodBuilder -{ -/* fields */ - public: - J9VMThread *vmThread; - - -/* methods */ - public: - JavaMethodCallbackGen(J9VMThread *vmThread, TR::TypeDictionary *types); - virtual bool buildIL(); -}; - - -#endif /* JAVAMETHODCALLBACK_HPP_ */ diff --git a/runtime/j9jitbuilder/module.xml b/runtime/j9jitbuilder/module.xml deleted file mode 100644 index 8a65dc03568..00000000000 --- a/runtime/j9jitbuilder/module.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - core - - - - - - - - - - - - - - - - - - - diff --git a/runtime/jcl/common/java_dyn_methodhandle.c b/runtime/jcl/common/java_dyn_methodhandle.c index f93c2db8c05..13dcd3bdcfb 100644 --- a/runtime/jcl/common/java_dyn_methodhandle.c +++ b/runtime/jcl/common/java_dyn_methodhandle.c @@ -788,27 +788,6 @@ Java_java_lang_invoke_MethodHandle_vmRefFieldOffset(JNIEnv *env, jclass clazz, j return (jint) J9VMJAVALANGCLASS_VMREF_OFFSET(((J9VMThread *) env)); } -#ifdef J9VM_OPT_PANAMA -jlong JNICALL -Java_java_lang_invoke_MethodHandles_findNativeAddress(JNIEnv *env, jclass jlClass, jstring methodName) -{ - const char *nativeMethodName = NULL; - UDATA handle = 0; - jlong func = 0; - PORT_ACCESS_FROM_ENV(env); - - nativeMethodName = (*env)->GetStringUTFChars(env, methodName, NULL); - - if(0 == j9sl_open_shared_library(NULL, &handle, FALSE)) { - if(0 != j9sl_lookup_name(handle, (char *)nativeMethodName, (UDATA *)&func, "")){ - func = 0; - } - } - - return func; -} -#endif - void JNICALL Java_java_lang_invoke_MutableCallSite_freeGlobalRef(JNIEnv *env, jclass mutableCallSite, jlong bypassOffset) { diff --git a/runtime/jcl/common/stdinit.c b/runtime/jcl/common/stdinit.c index 1b0f6493a58..8ba0bdd4261 100644 --- a/runtime/jcl/common/stdinit.c +++ b/runtime/jcl/common/stdinit.c @@ -75,10 +75,6 @@ computeJCLRuntimeFlags(J9JavaVM *vm) flags |= JCL_RTFLAG_OPT_METHOD_HANDLE; #endif /* J9VM_OPT_METHOD_HANDLE */ -#ifdef J9VM_OPT_PANAMA - flags |= JCL_RTFLAG_OPT_PANAMA; -#endif /* J9VM_OPT_PANAMA */ - #ifdef J9VM_OPT_REFLECT flags |= JCL_RTFLAG_OPT_REFLECT; #endif /* J9VM_OPT_REFLECT */ diff --git a/runtime/jcl/exports.cmake b/runtime/jcl/exports.cmake index 6b61215c7ef..b08d170e278 100644 --- a/runtime/jcl/exports.cmake +++ b/runtime/jcl/exports.cmake @@ -549,9 +549,6 @@ if(NOT JAVA_SPEC_VERSION LESS 9) Java_java_lang_invoke_FieldVarHandle_lookupField Java_java_lang_invoke_FieldVarHandle_unreflectField ) - if(J9VM_OPT_PANAMA) - omr_add_exports(jclse Java_java_lang_invoke_MethodHandles_findNativeAddress) - endif() endif() omr_add_exports(jclse diff --git a/runtime/jcl/uma/se9_exports.xml b/runtime/jcl/uma/se9_exports.xml index 3c301808b00..7f9dfa31c7d 100644 --- a/runtime/jcl/uma/se9_exports.xml +++ b/runtime/jcl/uma/se9_exports.xml @@ -65,7 +65,4 @@ - - - diff --git a/runtime/oti/VM_MethodHandleKinds.h b/runtime/oti/VM_MethodHandleKinds.h index 65a52b285cc..2a8defa583b 100644 --- a/runtime/oti/VM_MethodHandleKinds.h +++ b/runtime/oti/VM_MethodHandleKinds.h @@ -55,8 +55,5 @@ #define J9_METHOD_HANDLE_KIND_FILTER_ARGUMENTS 0x1D #define J9_METHOD_HANDLE_KIND_VARHANDLE_INVOKE_EXACT 0x1E #define J9_METHOD_HANDLE_KIND_VARHANDLE_INVOKE_GENERIC 0x1F -#ifdef J9VM_OPT_PANAMA -#define J9_METHOD_HANDLE_KIND_NATIVE 0x20 -#endif #endif /* VM_METHODHANDLEKINDS_H_ */ diff --git a/runtime/oti/jclprots.h b/runtime/oti/jclprots.h index e48370e292e..db27b9e7644 100644 --- a/runtime/oti/jclprots.h +++ b/runtime/oti/jclprots.h @@ -965,10 +965,7 @@ void JNICALL Java_java_lang_invoke_ThunkTuple_registerNatives(JNIEnv *env, jcla UDATA lookupField(JNIEnv *env, jboolean isStatic, J9Class *j9LookupClass, jstring name, J9UTF8 *sigUTF, J9Class **definingClass, UDATA *romField, jclass accessClass); void setClassLoadingConstraintLinkageError(J9VMThread *vmThread, J9Class *methodOrFieldClass, J9UTF8 *signatureUTF8); -#ifdef J9VM_OPT_PANAMA -extern J9_CFUNC jlong JNICALL -Java_java_lang_invoke_MethodHandles_findNativeAddress(JNIEnv *env, jclass jlClass, jstring methodName); -#endif + #if JAVA_SPEC_VERSION >= 15 extern J9_CFUNC void JNICALL Java_java_lang_invoke_MethodHandleNatives_checkClassBytes(JNIEnv *env, jclass jlClass, jbyteArray classRep); diff --git a/runtime/oti/vmconstantpool.xml b/runtime/oti/vmconstantpool.xml index 3bc4eb59ce1..cee04804087 100644 --- a/runtime/oti/vmconstantpool.xml +++ b/runtime/oti/vmconstantpool.xml @@ -96,7 +96,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - @@ -343,7 +342,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - diff --git a/runtime/vm/CMakeLists.txt b/runtime/vm/CMakeLists.txt index ecf055451fb..a0ceca3e09e 100644 --- a/runtime/vm/CMakeLists.txt +++ b/runtime/vm/CMakeLists.txt @@ -149,7 +149,6 @@ set(main_sources ObjectFieldInfo.cpp ObjectMonitor.cpp OutOfLineINL_com_ibm_jit_JITHelpers.cpp - OutOfLineINL_java_lang_invoke_NativeMethodHandle.cpp OutOfLineINL_jdk_internal_misc_Unsafe.cpp OutOfLineINL_openj9_internal_foreign_abi_InternalDowncallHandler.cpp OutOfLineINL_openj9_internal_foreign_abi_InternalUpcallHandler.cpp diff --git a/runtime/vm/FFITypeHelpers.cpp b/runtime/vm/FFITypeHelpers.cpp deleted file mode 100644 index d0feda25452..00000000000 --- a/runtime/vm/FFITypeHelpers.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright IBM Corp. and others 2001 - * - * This program and the accompanying materials are made available under - * the terms of the Eclipse Public License 2.0 which accompanies this - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] https://openjdk.org/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 - *******************************************************************************/ - -#include "FFITypeHelpers.hpp" - -#ifdef J9VM_OPT_PANAMA -ffi_type** -FFITypeHelpers::getStructFFITypeElements(char **layout, bool inPtr) -{ - PORT_ACCESS_FROM_JAVAVM(_vm); - - ffi_type **elements = NULL; - UDATA nElements = 0; - char *currentLayout = *layout; - bool localInPtr = inPtr; - - if (!inPtr) { - elements = (ffi_type **) j9mem_allocate_memory(sizeof(ffi_type*) * strlen(*layout), OMRMEM_CATEGORY_VM); - if (NULL == elements) { - goto doneGetStructFFITypeElements; - } - } - - while (*currentLayout != '\0') { - char symb = *currentLayout; - switch (symb) { - case '*': /* flexible array (eg. int a[];) */ - /* Fall through is intentional */ - case ':': /* start of pointer, skip the next symbol */ - localInPtr = true; - break; - case '[': { - /* start of nested struct */ - ffi_type *result = getStructFFIType(¤tLayout, localInPtr); - if (!localInPtr) { - if (NULL == result) { - freeStructFFITypeElements(elements); - elements = NULL; - goto doneGetStructFFITypeElements; - } - elements[nElements] = result; - nElements++; - } - if (!inPtr) { - localInPtr = false; - } - break; - } - case ']': /* end of struct */ - *layout = currentLayout; - if (!localInPtr) { - elements[nElements] = NULL; - } - goto doneGetStructFFITypeElements; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': { - /* number of elements in the array, followed by the type of the elements */ - UDATA nArray = getIntFromLayout(¤tLayout); - ffi_type *result = getArrayFFIType(¤tLayout, nArray, inPtr); - if (!localInPtr) { - if (NULL == result) { - freeStructFFITypeElements(elements); - elements = NULL; - goto doneGetStructFFITypeElements; - } - elements[nElements] = result; - nElements++; - } - break; - } - default: /* primitive */ - if (!localInPtr) { - elements[nElements] = getPrimativeFFITypeElement(symb); - nElements++; - } else if (!inPtr) { - localInPtr = false; - } - } - currentLayout++; - } -doneGetStructFFITypeElements: - return elements; -} - -ffi_type* -FFITypeHelpers::getStructFFIType(char **layout, bool inPtr) -{ - ffi_type *typeFFI = NULL; - /** The Layout is incremented for the '[' case in getStructFFITypeElements(char **layout, bool inPtr). - * The remaining layout string is then traversed when getStructFFITypeElements(char **layout, bool inPtr) is called again recursively. - */ - (*layout)++; - ffi_type **result = getStructFFITypeElements(layout, inPtr); - if (!inPtr) { - PORT_ACCESS_FROM_JAVAVM(_vm); - typeFFI = (ffi_type *)j9mem_allocate_memory(sizeof(ffi_type), OMRMEM_CATEGORY_VM); - if (NULL == typeFFI) { - setNativeOutOfMemoryError(_currentThread, 0, 0); - goto doneGetStructFFIType; - } - typeFFI->size = 0; - typeFFI->alignment = 0; - typeFFI->type = FFI_TYPE_STRUCT; - typeFFI->elements = result; - } else { - Assert_VM_Null(result); - } -doneGetStructFFIType: - return typeFFI; -} - -void -FFITypeHelpers::freeStructFFITypeElements(ffi_type **elements) -{ - PORT_ACCESS_FROM_JAVAVM(_vm); - if (NULL != elements) { - for (U_32 i = 0; elements[i] != NULL; i++) { - freeStructFFIType(elements[i]); - } - j9mem_free_memory(elements); - } -} - -void -FFITypeHelpers::freeStructFFIType(ffi_type *ffiType) -{ - if (NULL != ffiType) { - PORT_ACCESS_FROM_JAVAVM(_vm); - if (FFI_TYPE_STRUCT == ffiType->type) { - /* ffiType->elements is NULL weve already seen this a free'd it. - * This will occur when dealing with inlined arrays. - */ - if (NULL != ffiType->elements) { - freeStructFFITypeElements(ffiType->elements); - ffiType->elements = NULL; - j9mem_free_memory(ffiType); - /* TODO we need a better way to deal with - * inlined arrays, the current solution just makes a - * struct with identical types. We need to investigate - * whether libffi has support for arrays. - */ - } - } - } -} -#endif /* J9VM_OPT_PANAMA */ diff --git a/runtime/vm/FFITypeHelpers.hpp b/runtime/vm/FFITypeHelpers.hpp deleted file mode 100644 index 4d000115adf..00000000000 --- a/runtime/vm/FFITypeHelpers.hpp +++ /dev/null @@ -1,295 +0,0 @@ -/******************************************************************************* - * Copyright IBM Corp. and others 1991 - * - * This program and the accompanying materials are made available under - * the terms of the Eclipse Public License 2.0 which accompanies this - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] https://openjdk.org/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 - *******************************************************************************/ - -#if !defined(FFITYPEHELPERS_HPP_) -#define FFITYPEHELPERS_HPP_ - -#include "ut_j9vm.h" -#include "vm_internal.h" -#ifdef J9VM_OPT_PANAMA -#include "ffi.h" -#endif /* J9VM_OPT_PANAMA */ - -#define J9VM_LAYOUT_STRING_ON_STACK_LIMIT 128 - -#ifdef J9VM_OPT_PANAMA -typedef struct J9NativeCalloutData { - ffi_type **arguments; - ffi_cif *cif; -} J9NativeCalloutData; -#endif /* J9VM_OPT_PANAMA */ - -class FFITypeHelpers -{ -/* - * Data members - */ -private: -#ifdef J9VM_OPT_PANAMA - J9VMThread *const _currentThread; - J9JavaVM *const _vm; -#endif /* J9VM_OPT_PANAMA */ - -protected: - -public: - -/* - * Function members - */ -private: - -protected: - -public: - -#ifdef J9VM_OPT_PANAMA - /** - * @brief Convert argument or return type from J9Class to ffi_type. - * Only primitive types are currently supported. Objects will likely be passed as a pointer, so they are type long. - * @param type[in] The pointer to the J9Class of the type - * @return The pointer to the ffi_type corresponding to the J9Class - */ - const VMINLINE ffi_type* - getFFIType(J9Class *type){ - ffi_type* typeFFI = NULL; - - if (type == _vm->voidReflectClass) { - typeFFI = &ffi_type_void; - } else if (type == _vm->booleanReflectClass) { - typeFFI = &ffi_type_uint8; - } else if (type == _vm->byteReflectClass) { - typeFFI = &ffi_type_sint8; - } else if (type == _vm->charReflectClass) { - typeFFI = &ffi_type_uint16; - } else if (type == _vm->shortReflectClass) { - typeFFI = &ffi_type_sint16; - } else if (type == _vm->intReflectClass) { - typeFFI = &ffi_type_sint32; - } else if (type == _vm->floatReflectClass) { - typeFFI = &ffi_type_float; - } else if (type == _vm->longReflectClass) { - typeFFI = &ffi_type_sint64; - } else if (type == _vm->doubleReflectClass) { - typeFFI = &ffi_type_double; - } else if (J9CLASS_IS_ARRAY(type) && ((J9ArrayClass*)type)->leafComponentType == J9VMJAVALANGOBJECT_OR_NULL(_vm)) { - typeFFI = &ffi_type_pointer; - } else { - Assert_VM_unreachable(); - } - - return typeFFI; - } - - /** - * @brief Create a custom FFI type from a layout string object - * @param typeFFI[in] The custom FFI type to be created - * @param layoutStringObject[in] An object containing the layout string describing the field types - * @return The size of the struct, extracted from the layout string, UDATA_MAX if a failure occurs - */ - VMINLINE UDATA - getCustomFFIType(ffi_type** typeFFI, j9object_t layoutStringObject) { - PORT_ACCESS_FROM_JAVAVM(_vm); - - *typeFFI = NULL; - UDATA structSize = UDATA_MAX; - char layoutBuffer[J9VM_LAYOUT_STRING_ON_STACK_LIMIT]; - char* layout = copyStringToUTF8WithMemAlloc(_currentThread, layoutStringObject, J9_STR_NULL_TERMINATE_RESULT, "", 0, layoutBuffer, sizeof(layoutBuffer), NULL); - - /* Subsequent calls will modify the contents of this pointer, so preserve the original pointer for j9mem_free_memory */ - char* layoutTemp = layout; - - if (NULL == layout) { - goto doneGetCustomFFIType; - } - - structSize = getIntFromLayout(&layoutTemp); - *typeFFI = getStructFFIType(&layoutTemp, false); -doneGetCustomFFIType: - if (layout != layoutBuffer) { - j9mem_free_memory(layout); - } - return structSize; - } - - /** - * @brief Create a customFFI type describing an array that is a field in a struct - * @param layout[in] A c string describing the type of the array elements - * @param nElements[in] The number of elements in the array - * @param inPtr[in] Describes whether the current symbols are in a pointer. No ffi_type should be allocated for symbols in a pointer. - * @return A ffi_type* describing the array - */ - VMINLINE ffi_type* - getArrayFFIType(char **layout, UDATA nElements, bool inPtr) { - PORT_ACCESS_FROM_JAVAVM(_vm); - - ffi_type *typeFFI = NULL; - ffi_type *elementType = NULL; - - if (**layout == '[') { - ffi_type* result = getStructFFIType(layout, inPtr); - if (!inPtr) { - if (NULL == result) { - goto doneGetArrayFFIType; - } - elementType = result; - } - } else { - elementType = getPrimativeFFITypeElement(**layout); - } - - if (!inPtr && (elementType != NULL)) { - typeFFI = (ffi_type *)j9mem_allocate_memory(sizeof(ffi_type), OMRMEM_CATEGORY_VM); - if (NULL == typeFFI) { - freeStructFFIType(elementType); - goto doneGetArrayFFIType; - } - typeFFI->size = 0; - typeFFI->alignment = 0; - typeFFI->type = FFI_TYPE_STRUCT; - typeFFI->elements = (ffi_type **) j9mem_allocate_memory(sizeof(ffi_type*) * (nElements + 1), OMRMEM_CATEGORY_VM); - if (NULL == typeFFI->elements) { - freeStructFFIType(elementType); - j9mem_free_memory(typeFFI); - typeFFI = NULL; - goto doneGetArrayFFIType; } - - for (U_32 i = 0; i < nElements; i++) { - typeFFI->elements[i] = elementType; - } - typeFFI->elements[nElements] = NULL; - } -doneGetArrayFFIType: - return typeFFI; - } - - /** - * @brief Convert a symbol in the struct layout to ffi_type. - * @param symb[in] The symbol from the struct layout describing the type of the element - * @return The pointer to the ffi_type corresponding to the symbol - */ - VMINLINE ffi_type* - getPrimativeFFITypeElement(char symb) - { - ffi_type* typeFFI = NULL; - - switch (symb) { - case 'o': - typeFFI = &ffi_type_sint8; - break; - case 'c': - typeFFI = &ffi_type_sint8; - break; - case 's': - typeFFI = &ffi_type_sint16; - break; - case 'i': - typeFFI = &ffi_type_sint32; - break; - case 'l': - typeFFI = &ffi_type_sint64; - break; - case 'F': - typeFFI = &ffi_type_float; - break; - case 'D': - typeFFI = &ffi_type_double; - break; - case 'p': - typeFFI = &ffi_type_pointer; - break; - default: - Assert_VM_unreachable(); - } - - return typeFFI; - } - - /** - * @brief Convert the preceding integer of a layout string from string to UDATA, and put layout at the position after the integer - * @param layout[in] A pointer to a c string describing the types of the struct elements. For example: - * If layout is "16[[ii][ii]]", it becomes "[[ii][ii]]" and returns 16 - * @return The preceding integer converted from string to UDATA - */ - VMINLINE UDATA - getIntFromLayout(char **layout) - { - char *currentLayout = *layout; - UDATA n = 0; - while (*currentLayout != '\0') { - char symb = *currentLayout; - if (symb >= '0' && symb <= '9') { - n = (n * 10) + (symb - '0'); - } else { - break; - } - currentLayout++; - } - *layout = currentLayout; - return n; - } - - /** - * @brief Create an array of elements for a custom FFI type - * @param layout[in] A pointer to a c string describing the types of the struct elements - * @param inPtr[in] Describes whether the current symbols are in a pointer - * @return An array of ffi_type* which are the elements of the struct - */ - ffi_type** - getStructFFITypeElements(char **layout, bool inPtr); - - /** - * @brief Create a custom FFI type - * @param layout[in] A pointer to a c string describing the types of the struct elements. For example: - * "[liFsooD]" is a struct with primitives (long, int, float, short, byte, byte, double) - * "[p:p:cp:cip:[[ii][ii]]D]" is a struct with pointers (char**, char*, int, a struct pointer, double) - * "[[ii][ii]]" is a struct with two nested structs - * "[4i2[ii]*[ii]]" is a struct with 3 arrays: int[4], Point[2], and Point[], where Point is a struct with 2 ints - * @param inPtr[in] Describes whether the current symbols are in a pointer. No ffi_type should be allocated for symbols in a pointer. - * @return The ffi_type of type FFI_TYPE_STRUCT - */ - ffi_type* - getStructFFIType(char **layout, bool inPtr); - - /** - * @brief Frees the elements of a struct FFI type - * @param elements[in] The elements of a struct FFI type - */ - void - freeStructFFITypeElements(ffi_type **elements); - - /** - * @brief Free a custom FFI type - * @param ffi[in] A pointer to a ffi type - */ - void - freeStructFFIType(ffi_type *ffi); - - FFITypeHelpers(J9VMThread *currentThread) - : _currentThread(currentThread) - , _vm(_currentThread->javaVM) - { }; - -#endif /* J9VM_OPT_PANAMA */ -}; - -#endif /* FFITYPEHELPERS_HPP_ */ diff --git a/runtime/vm/MHInterpreter.hpp b/runtime/vm/MHInterpreter.hpp index 7f34ceceb65..253e0179d3a 100644 --- a/runtime/vm/MHInterpreter.hpp +++ b/runtime/vm/MHInterpreter.hpp @@ -41,7 +41,6 @@ #include "AtomicSupport.hpp" #include "VMHelpers.hpp" #include "BytecodeAction.hpp" -#include "FFITypeHelpers.hpp" #include "ObjectAllocationAPI.hpp" #include "ObjectAccessBarrierAPI.hpp" @@ -405,80 +404,6 @@ class VM_MHInterpreter return methodHandle; } -#ifdef J9VM_OPT_PANAMA - /** - * @brief Converts the type of the return value to the return type - * @param returnType[in] The type of the return value - * @param returnStorage[in] The pointer to the return value - * @param methodHandle[in] The methodHandle used by object return values - */ - VMINLINE void - convertJNIReturnValue(U_8 returnType, UDATA* returnStorage, j9object_t methodHandle, UDATA structSize) - { - switch (returnType) { - case J9NtcBoolean: - *returnStorage = (UDATA)(U_8)*returnStorage; - break; - case J9NtcByte: - *returnStorage = (UDATA)(IDATA)(I_8)*returnStorage; - break; - case J9NtcChar: - *returnStorage = (UDATA)(U_16)*returnStorage; - break; - case J9NtcShort: - *returnStorage = (UDATA)(IDATA)(I_16)*returnStorage; - break; - case J9NtcInt: - *returnStorage = (UDATA)(IDATA)(I_32)*returnStorage; - break; - case J9NtcFloat: - *returnStorage = (UDATA)*(U_32*)returnStorage; - break; - case J9NtcVoid: - /* Fall through is intentional */ - case J9NtcLong: - /* Fall through is intentional */ - case J9NtcDouble: - /* Fall through is intentional */ - case J9NtcClass: - break; - } - } - - /** - * @brief Convert argument or return type from J9Class to J9NativeTypeCode - * @param type[in] The pointer to the J9Class of the type - * @return The J9NativeTypeCode corresponding to the J9Class - */ - VMINLINE U_8 - getJ9NativeTypeCode(J9Class *type) - { - U_8 typeCode = 0; - if (type == _vm->voidReflectClass) { - typeCode = J9NtcVoid; - } else if (type == _vm->booleanReflectClass) { - typeCode = J9NtcBoolean; - } else if (type == _vm->charReflectClass) { - typeCode = J9NtcChar; - } else if (type == _vm->floatReflectClass) { - typeCode = J9NtcFloat; - } else if (type == _vm->doubleReflectClass) { - typeCode = J9NtcDouble; - } else if (type == _vm->byteReflectClass) { - typeCode = J9NtcByte; - } else if (type == _vm->shortReflectClass) { - typeCode = J9NtcShort; - } else if (type == _vm->intReflectClass) { - typeCode = J9NtcInt; - } else if (type == _vm->longReflectClass) { - typeCode = J9NtcLong; - } else { - Assert_VM_unreachable(); - } - return typeCode; - } -#endif /* J9VM_OPT_PANAMA */ - /** * @brief * Perform argument conversion for AsTypeHandle. @@ -611,17 +536,6 @@ class VM_MHInterpreter void mhStackValidator(j9object_t methodhandle); -#ifdef J9VM_OPT_PANAMA - VMINLINE VM_BytecodeAction - runNativeMethodHandle(j9object_t methodHandle); - - VMINLINE FFI_Return - callFunctionFromNativeMethodHandle(void * nativeMethodStartAddress, UDATA *javaArgs, U_8 *returnType, j9object_t methodHandle); - - VMINLINE FFI_Return - nativeMethodHandleCallout(void *function, UDATA *javaArgs, U_8 *returnType, j9object_t methodHandle, void *returnStorage, UDATA *structSize); -#endif /* J9VM_OPT_PANAMA */ - #if defined(ENABLE_DEBUG_FUNCTIONS) void printStack(U_32 numSlots) diff --git a/runtime/vm/MHInterpreter.inc b/runtime/vm/MHInterpreter.inc index 1e84d26f3ad..3803a19a482 100644 --- a/runtime/vm/MHInterpreter.inc +++ b/runtime/vm/MHInterpreter.inc @@ -58,12 +58,7 @@ static const char * const names[] = { "J9_METHOD_HANDLE_KIND_GUARD_WITH_TEST", "J9_METHOD_HANDLE_KIND_FILTER_ARGUMENTS", "J9_METHOD_HANDLE_KIND_VARHANDLE_INVOKE_EXACT", - "J9_METHOD_HANDLE_KIND_VARHANDLE_INVOKE_GENERIC", -#if defined(J9VM_OPT_PANAMA) - "J9_METHOD_HANDLE_KIND_NATIVE", -#else /* defined(J9VM_OPT_PANAMA) */ - "", -#endif /* defined(J9VM_OPT_PANAMA) */ + "J9_METHOD_HANDLE_KIND_VARHANDLE_INVOKE_GENERIC" }; #endif /* defined(MH_TRACE) */ @@ -202,12 +197,6 @@ VM_MHInterpreter::dispatchLoop(j9object_t methodHandle) nextAction = THROW_NPE; goto done; } -#ifdef J9VM_OPT_PANAMA - case J9_METHOD_HANDLE_KIND_NATIVE: { - runNativeMethodHandle(methodHandle); - goto done; - } -#endif /* J9VM_OPT_PANAMA */ case J9_METHOD_HANDLE_KIND_BOUND: { j9object_t type = getMethodHandleMethodType(methodHandle); U_32 slotCount = getMethodTypeArgSlots(type); @@ -2252,192 +2241,3 @@ VM_MHInterpreter::mhStackValidator(j9object_t methodhandle) } } } - -#ifdef J9VM_OPT_PANAMA -VMINLINE VM_BytecodeAction -VM_MHInterpreter::runNativeMethodHandle(j9object_t methodHandle) -{ - VM_BytecodeAction rc = GOTO_DONE; - void *nativeMethodStartAddress = (J9Method *)getVMSlot(methodHandle); - j9object_t type = getMethodHandleMethodType(methodHandle); - U_32 slotCount = getMethodTypeArgSlots(type); - U_8 returnType = 0; - UDATA *javaArgs = NULL; - FFI_Return ret = ffiFailed; - - UDATA *spPriorToFrameBuild = _currentThread->sp; - J9SFMethodTypeFrame * frame = buildMethodTypeFrame(_currentThread, type); - - javaArgs = _currentThread->arg0EA - 1; - - ret = callFunctionFromNativeMethodHandle(nativeMethodStartAddress, javaArgs, &returnType, methodHandle); - - if (ffiFailed == ret) { - setCurrentException(_currentThread, J9VMCONSTANTPOOL_JAVALANGINTERNALERROR, NULL); - } else if (ffiOOM == ret) { - setNativeOutOfMemoryError(_currentThread, 0, 0); - } - - restoreMethodTypeFrame(frame, spPriorToFrameBuild); - _currentThread->sp += slotCount; - _currentThread->pc += 3; - - if (J9NtcVoid == returnType) { - _currentThread->sp += 1; - } else if ((J9NtcLong == returnType) || (J9NtcDouble == returnType)) { -#if !defined(J9VM_ENV_DATA64) - *_currentThread->sp = (UDATA)_currentThread->returnValue2; -#endif - *--_currentThread->sp = (UDATA)_currentThread->returnValue; - } else if (J9NtcPointer == returnType || J9NtcObject == returnType) { - *_currentThread->sp = _currentThread->returnValue; - } else { - *(U_32 *)_currentThread->sp = (U_32)_currentThread->returnValue; - } - rc = EXECUTE_BYTECODE; - return rc; -} - -VMINLINE FFI_Return -VM_MHInterpreter::callFunctionFromNativeMethodHandle(void * nativeMethodStartAddress, UDATA *javaArgs, U_8 *returnType, j9object_t methodHandle) -{ - UDATA structReturnSize = 0; - FFI_Return result = nativeMethodHandleCallout(nativeMethodStartAddress, javaArgs, returnType, methodHandle, &(_currentThread->returnValue), &structReturnSize); - - if (ffiSuccess == result) { - convertJNIReturnValue(*returnType, &(_currentThread->returnValue), methodHandle, structReturnSize); - } - return result; -} - -VMINLINE FFI_Return -VM_MHInterpreter::nativeMethodHandleCallout(void *function, UDATA *javaArgs, U_8 *returnType, j9object_t methodHandle, void *returnStorage, UDATA* structReturnSize) -{ - const U_8 minimalCallout = 16; -#if !defined(J9VM_ENV_LITTLE_ENDIAN) - const U_8 extraBytesBoolAndByte = 3; - const U_8 extraBytesShortAndChar = 2; -#endif /* J9VM_ENV_LITTLE_ENDIAN */ - FFI_Return ret = ffiOOM; - void *sValues[16]; - void **values = NULL; -#if FFI_NATIVE_RAW_API - /* Make sure we can fit a double in each sValues_raw[] slot but assuring we end up - * with an int that is a multiple of sizeof(ffi_raw) - */ - const U_8 valRawWorstCaseMulFactor = ((sizeof(double) - 1U)/sizeof(ffi_raw)) + 1U; - ffi_raw sValues_raw[valRawWorstCaseMulFactor * 16]; - ffi_raw * values_raw = NULL; -#endif /* FFI_NATIVE_RAW_API */ - - j9object_t methodType = getMethodHandleMethodType(methodHandle); - j9object_t argTypesObject = getMethodTypeArguments(methodType); - UDATA argCount = getMethodTypeArgSlots(methodType); - J9Class *returnTypeClass = getMethodTypeReturnClass(methodType); - bool isMinimal = argCount <= minimalCallout; - - U_32 argTypeCount = J9INDEXABLEOBJECT_SIZE(_currentThread, argTypesObject); - - J9NativeCalloutData *nativeCalloutData = J9VMJAVALANGINVOKENATIVEMETHODHANDLE_J9NATIVECALLOUTDATAREF(_currentThread, methodHandle); - Assert_VM_notNull(nativeCalloutData); - Assert_VM_notNull(nativeCalloutData->arguments); - Assert_VM_notNull(nativeCalloutData->cif); - - ffi_type **args = nativeCalloutData->arguments; - - ffi_cif *cif = nativeCalloutData->cif; - - *returnType = getJ9NativeTypeCode(returnTypeClass); - - PORT_ACCESS_FROM_JAVAVM(_vm); - - if (isMinimal) { - values = sValues; -#if FFI_NATIVE_RAW_API - values_raw = sValues_raw; -#endif /* FFI_NATIVE_RAW_API */ - } else { - values = (void **)j9mem_allocate_memory(sizeof(void *) * argCount, OMRMEM_CATEGORY_VM); - if (NULL == values) { - goto ffi_exit; - } - -#if FFI_NATIVE_RAW_API - values_raw = (ffi_raw *)j9mem_allocate_memory((valRawWorstCaseMulFactor * sizeof(ffi_raw)) * argCount, OMRMEM_CATEGORY_VM); - if (NULL == values_raw) { - goto ffi_exit; - } -#endif /* FFI_NATIVE_RAW_API */ - } - { - IDATA offset = 0; - for (U_8 i = 0; i < argTypeCount; i++) { - bool isStructArg = false; - if (FFI_TYPE_STRUCT == args[i+1]->type) { - isStructArg = true; - } - - /** - * args[0] is the ffi_type of the return argument of the method. The remaining args array contains the ffi_type of the input arguments. - * This loop is traversing the input arguments of the method. - */ - if ((&ffi_type_sint64 == args[i+1]) || (&ffi_type_double == args[i+1]) || isStructArg) { - offset -= 1; - } - - if (0 == javaArgs[offset]) { - values[i] = &(javaArgs[offset]); - } else if (isStructArg) { - values[i] = (void *)javaArgs[offset]; - } else { - values[i] = &(javaArgs[offset]); -#if !defined(J9VM_ENV_LITTLE_ENDIAN) - if ((_vm->shortReflectClass == argTypes[i]) || (_vm->charReflectClass == argTypes[i])) { - values[i] = (void *)((UDATA)values[i] + extraBytesShortAndChar); - } else if ((_vm->byteReflectClass == argTypes[i]) || (_vm->booleanReflectClass == argTypes[i])) { - values[i] = (void *)((UDATA)values[i] + extraBytesBoolAndByte); - } -#endif /*J9VM_ENV_LITTLE_ENDIAN */ - } - offset -= 1; - } - ffi_status status = FFI_OK; - - if (FFI_TYPE_STRUCT == args[0]->type) { - size_t structSize = args[0]->size; - returnStorage = j9mem_allocate_memory(structSize, OMRMEM_CATEGORY_VM); - if (NULL == returnStorage) { - setNativeOutOfMemoryError(_currentThread, 0, 0); - goto ffi_exit; - } - *structReturnSize = structSize; - _currentThread->returnValue = (UDATA)returnStorage; - *returnType = J9NtcLong; - } - - if (FFI_OK == status) { - /* - * TODO Add ZOS support to perform the zaap offload switch. See VM_VMHelpers::beforeJNICall(_currentThread) and VM_VMHelpers::afterJNICall(_currentThread). - * In these functions, the J9Method in the J9SFJNINativeMethodFrame is incorrect for Panama native calls. - */ - VM_VMAccess::inlineExitVMToJNI(_currentThread); -#if FFI_NATIVE_RAW_API - ffi_ptrarray_to_raw(cif, values, values_raw); - ffi_raw_call(cif, FFI_FN(function), returnStorage, values_raw); -#else /* FFI_NATIVE_RAW_API */ - ffi_call(cif, FFI_FN(function), returnStorage, values); -#endif /* FFI_NATIVE_RAW_API */ - VM_VMAccess::inlineEnterVMFromJNI(_currentThread); - ret = ffiSuccess; - } - } -ffi_exit: - if (!isMinimal) { - j9mem_free_memory(values); -#if FFI_NATIVE_RAW_API - j9mem_free_memory(values_raw); -#endif /* FFI_NATIVE_RAW_API */ - } - return ret; -} -#endif /* J9VM_OPT_PANAMA */ diff --git a/runtime/vm/OutOfLineINL.hpp b/runtime/vm/OutOfLineINL.hpp index 145cfa1268c..1f17f275a21 100644 --- a/runtime/vm/OutOfLineINL.hpp +++ b/runtime/vm/OutOfLineINL.hpp @@ -38,10 +38,6 @@ J9OutOfLineINLMethod OutOfLineINL_jdk_internal_misc_Unsafe_compareAndExchangeInt J9OutOfLineINLMethod OutOfLineINL_jdk_internal_misc_Unsafe_compareAndExchangeLong; J9OutOfLineINLMethod OutOfLineINL_jdk_internal_misc_Unsafe_compareAndExchangeObject; J9OutOfLineINLMethod OutOfLineINL_com_ibm_jit_JITHelpers_acmplt; -#if defined(J9VM_OPT_PANAMA) -J9OutOfLineINLMethod OutOfLineINL_java_lang_invoke_NativeMethodHandle_initJ9NativeCalloutDataRef; -J9OutOfLineINLMethod OutOfLineINL_java_lang_invoke_NativeMethodHandle_freeJ9NativeCalloutDataRef; -#endif /* defined(J9VM_OPT_PANAMA) */ #if JAVA_SPEC_VERSION >= 16 J9OutOfLineINLMethod OutOfLineINL_openj9_internal_foreign_abi_InternalDowncallHandler_initCifNativeThunkData; diff --git a/runtime/vm/OutOfLineINL_java_lang_invoke_NativeMethodHandle.cpp b/runtime/vm/OutOfLineINL_java_lang_invoke_NativeMethodHandle.cpp deleted file mode 100644 index 731bc4d5523..00000000000 --- a/runtime/vm/OutOfLineINL_java_lang_invoke_NativeMethodHandle.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/******************************************************************************* - * Copyright IBM Corp. and others 2017 - * - * This program and the accompanying materials are made available under - * the terms of the Eclipse Public License 2.0 which accompanies this - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] https://openjdk.org/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 - *******************************************************************************/ - -#include "OutOfLineINL.hpp" - -#include "BytecodeAction.hpp" -#include "UnsafeAPI.hpp" -#include "j9vmnls.h" - -#ifdef J9VM_OPT_PANAMA -#include "FFITypeHelpers.hpp" -#endif /* J9VM_OPT_PANAMA */ - -extern "C" { - -#ifdef J9VM_OPT_PANAMA -/* java.lang.invoke.NativeMethodHandle: private native void initJ9NativeCalloutDataRef(java.lang.String[] argLayoutStrings); */ -VM_BytecodeAction -OutOfLineINL_java_lang_invoke_NativeMethodHandle_initJ9NativeCalloutDataRef(J9VMThread *currentThread, J9Method *method) -{ - VM_BytecodeAction rc = EXECUTE_BYTECODE; - J9JavaVM *vm = currentThread->javaVM; - ffi_type **args = NULL; - ffi_cif *cif = NULL; - J9NativeCalloutData *nativeCalloutData = NULL; - - j9object_t methodHandle = *(j9object_t*)(currentThread->sp + 1); - - Assert_VM_Null(J9VMJAVALANGINVOKENATIVEMETHODHANDLE_J9NATIVECALLOUTDATAREF(currentThread, methodHandle)); - - j9object_t methodType = J9VMJAVALANGINVOKEMETHODHANDLE_TYPE(currentThread, methodHandle); - J9Class *returnTypeClass = J9VM_J9CLASS_FROM_HEAPCLASS(currentThread, J9VMJAVALANGINVOKEMETHODTYPE_RTYPE(currentThread, methodType)); - j9object_t argTypesObject = J9VMJAVALANGINVOKEMETHODTYPE_PTYPES(currentThread, methodType); - - FFITypeHelpers FFIHelpers = FFITypeHelpers(currentThread); - j9object_t argLayoutStringsObject = *(j9object_t*)currentThread->sp; - bool layoutStringsExist = false; - if (NULL != argLayoutStringsObject) { - layoutStringsExist = true; - } - - PORT_ACCESS_FROM_JAVAVM(vm); - - /** - * args[0] stores the ffi_type of the return argument of the method. The remaining args array stores the ffi_type of the input arguments. - * typeCount is the number of input arguments, plus one for the return argument. - */ - U_32 typeCount = J9INDEXABLEOBJECT_SIZE(currentThread, argTypesObject) + 1; - args = (ffi_type **)j9mem_allocate_memory(sizeof(ffi_type *) * typeCount, OMRMEM_CATEGORY_VM); - - if (NULL == args) { - rc = GOTO_THROW_CURRENT_EXCEPTION; - setNativeOutOfMemoryError(currentThread, 0, 0); - goto done; - } - - /* Zero out the memory because if an error occurs before all the entries in this array are initialized then the error - * handling code at freeAllMemoryThenExit will attempt to free all the pointers, some of which will not be initialized. - */ - memset(args, 0, sizeof(ffi_type *) * typeCount); - - cif = (ffi_cif *)j9mem_allocate_memory(sizeof(ffi_cif), OMRMEM_CATEGORY_VM); - if (NULL == cif) { - rc = GOTO_THROW_CURRENT_EXCEPTION; - setNativeOutOfMemoryError(currentThread, 0, 0); - goto freeArgsThenExit; - } - - /* In the common case we expect that layoutStringsExist will be NULL, which is why args[0] is written first then layoutStringsExist is checked after */ - args[0] = (ffi_type *)FFIHelpers.getFFIType(returnTypeClass); - if (layoutStringsExist) { - j9object_t retlayoutStringObject = J9JAVAARRAYOFOBJECT_LOAD(currentThread, argLayoutStringsObject, 0); - if (NULL != retlayoutStringObject) { - UDATA structSize = FFIHelpers.getCustomFFIType(&(args[0]), retlayoutStringObject); - if ((NULL == args[0]) || (NULL == args[0]->elements) || (0 == structSize)) { - rc = GOTO_THROW_CURRENT_EXCEPTION; - setNativeOutOfMemoryError(currentThread, 0, 0); - FFIHelpers.freeStructFFIType(args[0]); - goto freeCifAndArgsThenExit; - } - } - } - - if (layoutStringsExist) { - for (U_8 i = 0; i < typeCount-1; i++) { - j9object_t layoutStringObject = J9JAVAARRAYOFOBJECT_LOAD(currentThread, argLayoutStringsObject, i+1); - if (NULL == layoutStringObject) { - args[i+1] = (ffi_type *)FFIHelpers.getFFIType(J9VM_J9CLASS_FROM_HEAPCLASS(currentThread, J9JAVAARRAYOFOBJECT_LOAD(currentThread, argTypesObject, i))); - } else { - /** - * Pointers are converted to longs before the callout so the ffi type for pointers is sint64. - * Structs are also converted to longs before the callout, and are identified by the non-null layout string of the argument. - * The struct ffi type is created after the struct layout string is parsed in getCustomFFIType(ffi_type**, j9object_t). - */ - UDATA structSize = FFIHelpers.getCustomFFIType(&(args[i+1]), layoutStringObject); - if (UDATA_MAX == structSize) { - rc = GOTO_THROW_CURRENT_EXCEPTION; - setCurrentException(currentThread, J9VMCONSTANTPOOL_JAVALANGINTERNALERROR, NULL); - goto freeAllMemoryThenExit; - } - } - } - } else { - for (U_8 i = 0; i < typeCount-1; i++) { - args[i+1] = (ffi_type *)FFIHelpers.getFFIType(J9VM_J9CLASS_FROM_HEAPCLASS(currentThread, J9JAVAARRAYOFOBJECT_LOAD(currentThread, argTypesObject, i))); - } - } - - /* typeCount-1 because ffi_prep_cif expects the number of input arguments of the method */ - if (FFI_OK != ffi_prep_cif(cif, FFI_DEFAULT_ABI, typeCount-1, args[0], &(args[1]))) { - rc = GOTO_THROW_CURRENT_EXCEPTION; - setCurrentException(currentThread, J9VMCONSTANTPOOL_JAVALANGINTERNALERROR, NULL); - goto freeAllMemoryThenExit; - } - - nativeCalloutData = (J9NativeCalloutData *)j9mem_allocate_memory(sizeof(J9NativeCalloutData), OMRMEM_CATEGORY_VM); - if (NULL == nativeCalloutData) { - rc = GOTO_THROW_CURRENT_EXCEPTION; - setNativeOutOfMemoryError(currentThread, 0, 0); - goto freeAllMemoryThenExit; - } - nativeCalloutData->arguments = args; - nativeCalloutData->cif = cif; - - J9VMJAVALANGINVOKENATIVEMETHODHANDLE_SET_J9NATIVECALLOUTDATAREF(currentThread, methodHandle, (void *)nativeCalloutData); - -done: - VM_OutOfLineINL_Helpers::returnVoid(currentThread, 2); - return rc; -freeAllMemoryThenExit: - for (U_32 i = 0; i < typeCount; i++) { - FFIHelpers.freeStructFFIType(args[i]); - } -freeCifAndArgsThenExit: - j9mem_free_memory(cif); -freeArgsThenExit: - j9mem_free_memory(args); - goto done; -} - -/* java.lang.invoke.NativeMethodHandle: private native void freeJ9NativeCalloutDataRef(); */ -VM_BytecodeAction -OutOfLineINL_java_lang_invoke_NativeMethodHandle_freeJ9NativeCalloutDataRef(J9VMThread *currentThread, J9Method *method) -{ - J9JavaVM *vm = currentThread->javaVM; - j9object_t methodHandle = *(j9object_t*)currentThread->sp; - - j9object_t methodType = J9VMJAVALANGINVOKEMETHODHANDLE_TYPE(currentThread, methodHandle); - j9object_t argTypesObject = J9VMJAVALANGINVOKEMETHODTYPE_PTYPES(currentThread, methodType); - U_32 argumentCount = J9INDEXABLEOBJECT_SIZE(currentThread, argTypesObject) + 1; - J9NativeCalloutData *nativeCalloutData = J9VMJAVALANGINVOKENATIVEMETHODHANDLE_J9NATIVECALLOUTDATAREF(currentThread, methodHandle); - - /* Manually synchronize methodHandle since declaring the method as synchronized in Java will have no effect (for all INLs). */ - j9object_t methodHandleLock = (j9object_t)objectMonitorEnter(currentThread, methodHandle); - if (J9_OBJECT_MONITOR_ENTER_FAILED(methodHandleLock)) { -#if defined(J9VM_OPT_CRIU_SUPPORT) - if (J9_OBJECT_MONITOR_CRIU_SINGLE_THREAD_MODE_THROW == (UDATA)methodHandleLock) { - setCRIUSingleThreadModeJVMCRIUException(currentThread, 0, 0); - } else -#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */ - if (J9_OBJECT_MONITOR_OOM == (UDATA)methodHandleLock) { - setNativeOutOfMemoryError(currentThread, J9NLS_VM_FAILED_TO_ALLOCATE_MONITOR); - } - goto done; - } - - J9VMJAVALANGINVOKENATIVEMETHODHANDLE_SET_J9NATIVECALLOUTDATAREF(currentThread, methodHandle, NULL); - - if (NULL != nativeCalloutData) { - PORT_ACCESS_FROM_JAVAVM(vm); - - Assert_VM_notNull(nativeCalloutData); - Assert_VM_notNull(nativeCalloutData->arguments); - Assert_VM_notNull(nativeCalloutData->cif); - - FFITypeHelpers FFIHelpers = FFITypeHelpers(currentThread); - for (U_8 i = 0; i < argumentCount; i++) { - FFIHelpers.freeStructFFIType(nativeCalloutData->arguments[i]); - } - j9mem_free_memory(nativeCalloutData->arguments); - nativeCalloutData->arguments = NULL; - - j9mem_free_memory(nativeCalloutData->cif); - nativeCalloutData->cif = NULL; - - j9mem_free_memory(nativeCalloutData); - nativeCalloutData = NULL; - } - - objectMonitorExit(currentThread, methodHandleLock); - -done: - VM_OutOfLineINL_Helpers::returnVoid(currentThread, 1); - return EXECUTE_BYTECODE; -} -#endif /* J9VM_OPT_PANAMA */ - -} diff --git a/runtime/vm/bindnatv.cpp b/runtime/vm/bindnatv.cpp index 579d3f492b4..19a68f0dbc0 100644 --- a/runtime/vm/bindnatv.cpp +++ b/runtime/vm/bindnatv.cpp @@ -323,10 +323,6 @@ static J9OutOfLineINLMapping outOfLineINLmappings[] = { { "Java_jdk_internal_misc_Unsafe_compareAndExchangeInt__Ljava_lang_Object_2JII", OutOfLineINL_jdk_internal_misc_Unsafe_compareAndExchangeInt }, { "Java_jdk_internal_misc_Unsafe_compareAndExchangeLong__Ljava_lang_Object_2JJJ", OutOfLineINL_jdk_internal_misc_Unsafe_compareAndExchangeLong }, { "Java_com_ibm_jit_JITHelpers_acmplt__Ljava_lang_Object_2Ljava_lang_Object_2", OutOfLineINL_com_ibm_jit_JITHelpers_acmplt }, -#if defined(J9VM_OPT_PANAMA) - { "Java_java_lang_invoke_NativeMethodHandle_initJ9NativeCalloutDataRef___3Ljava_lang_String_2", OutOfLineINL_java_lang_invoke_NativeMethodHandle_initJ9NativeCalloutDataRef }, - { "Java_java_lang_invoke_NativeMethodHandle_freeJ9NativeCalloutDataRef__", OutOfLineINL_java_lang_invoke_NativeMethodHandle_freeJ9NativeCalloutDataRef }, -#endif /* defined(J9VM_OPT_PANAMA) */ #if JAVA_SPEC_VERSION >= 16 { "Java_openj9_internal_foreign_abi_InternalDowncallHandler_initCifNativeThunkData___3Ljava_lang_String_2Ljava_lang_String_2ZI", OutOfLineINL_openj9_internal_foreign_abi_InternalDowncallHandler_initCifNativeThunkData }, #if JAVA_SPEC_VERSION >= 22 diff --git a/runtime/vm/module.xml b/runtime/vm/module.xml index 174e77e70b9..e29e345a3f3 100644 --- a/runtime/vm/module.xml +++ b/runtime/vm/module.xml @@ -211,9 +211,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - - - diff --git a/test/functional/Panama/.settings/org.eclipse.jdt.core.prefs b/test/functional/Panama/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 3a21537071b..00000000000 --- a/test/functional/Panama/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/test/functional/Panama/README.md b/test/functional/Panama/README.md deleted file mode 100644 index e51eba14f7f..00000000000 --- a/test/functional/Panama/README.md +++ /dev/null @@ -1,37 +0,0 @@ - - -# Panama Test -- Contains [tests](src/org/openj9/test/panama/) for native method handles -- Build with the "Build git tests - panama" job -- Run with linux_x86-64_cmprssptrs_panama.spec on the rawbuild-panama_xa64-b136 sdk -- [HigherLevelNativeMethodHandleTest](src/org/openj9/test/panama/HigherLevelNativeMethodHandleTest.java) uses [panamatest.jar](lib/panamatest.jar), created from [panamatest.c](panamatest.c) with the jextract groveller - - - * To create a libpanamatest.so, a gcc is needed: - - gcc -shared -o {$common.workspace.gittest$}/Panama/libpanamatest.so -fPIC {$common.workspace.gittest$}/Panama/panamatest.c - - * To create a file like panamatest.jar, on a machine with os:linux:ubuntu14 capability (such as ub1404x64vm1), run: - - export LD_LIBRARY_PATH=/clang/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/lib - /bin/jextract -J-Djava.library.path=/clang -t panama.test -o panamatest.jar /Panama/panamatest.c diff --git a/test/functional/Panama/build.xml b/test/functional/Panama/build.xml deleted file mode 100644 index 2be2aff2320..00000000000 --- a/test/functional/Panama/build.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - Paname project - - - - - - - - - - - - - - - - - - - - - - - - - Ant version is ${ant.version} - ============COMPILER SETTINGS============ - ===fork: yes - ===executable: ${compiler.javac} - ===debug: on - ===destdir: ${DEST} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/functional/Panama/panamatest.c b/test/functional/Panama/panamatest.c deleted file mode 100644 index 31a531edf12..00000000000 --- a/test/functional/Panama/panamatest.c +++ /dev/null @@ -1,335 +0,0 @@ -/******************************************************************************* - * Copyright IBM Corp. and others 2017 - * - * This program and the accompanying materials are made available under - * the terms of the Eclipse Public License 2.0 which accompanies this - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] https://openjdk.org/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 - *******************************************************************************/ - - -#include "stdio.h" -#include "stdbool.h" -#include "stdlib.h" - -typedef struct { - int x; - int y; -} Point; - -typedef struct { - Point st; - Point en; -} Line; - -typedef struct { - Point v; - int n; -} ScalarVector; - -typedef struct { - char *n; - Point v; -} PointerVector; - -typedef struct { - char *m; - char *n; -} PointerPointer; - -typedef struct { - int64_t a; - double b; -} Complex; - -typedef struct { - int64_t x; - int32_t y; - /* there will be 32bits of padding here */ - int64_t z; -} Padding; - -typedef struct { - char *pc; - Point *pp; - char **ppc; - Point **ppp; -} PointerStruct; - -typedef struct { - Line triangle[3]; - int arr[4]; -} ArrayStruct; - -typedef struct { - int8_t n; -} SmallStruct; - -typedef struct { - char **pp; - char *p; - int n; - void *x; - Line *ln; - Point pt; - int arr[3]; - double d; -} LargeStruct; - -char addTwoByte(char val1, char val2) { - return val1 + val2; -} - -char addTwoChar(char val1, char val2) { - return val1 + val2 - 'a' + 1; -} - -double addTwoDouble(double val1, double val2) { - return val1 + val2; -} - -float addTwoFloat(float val1, float val2) { - return val1 + val2; -} - -int addTwoInt(int val1, int val2) { - return val1 + val2; -} - -long addTwoLong(long val1, long val2) { - return val1 + val2; -} - -short addTwoShort(short val1, short val2) { - return val1 + val2; -} - -bool testBoolean(bool val1) { - return !val1; -} - -int returnFour(void) { - return 4; -} - -void voidWithArgs(int val1) { - printf("voidWithArgs(%d) success\n", val1); -} - -void voidNoArgs(void) { - printf("voidNoArgs success\n"); -} - -double manyArgs(int val1, float val2, long val3, double val4) { - return val3 + val1 * 10 + val2 * 0.1 + val4 * 0.001; -} - -int* getIntPtr(void) { - int *arr = (int*) malloc(sizeof(int) * 4); - arr[0] = 4; - arr[1] = 3; - arr[2] = 2; - arr[3] = 1; - return arr; -} - -bool checkIntPtr(int *arr) { - return (4 == arr[0] && 3 == arr[1] && 2 == arr[2] && 1 == arr[3]); -} - -void freeIntPtr(int *arr) { - free(arr); -} - -Point getPoint(int x, int y) { - Point* p = (Point*) malloc(sizeof(Point)); - p->x = x; - p->y = y; - return *p; -} - -bool checkPoint(Point p, int x, int y) { - return (p.x == x && p.y == y); -} - -Point* getPointPtr(int x, int y) { - Point* p = (Point*) malloc(sizeof(Point)); - p->x = x; - p->y = y; - return p; -} - -bool checkPointPtr(Point *p, int x, int y) { - return (p->x == x && p->y == y); -} - -void freePointPtr(Point *p) { - free(p); -} - -Line getLine(Point st, Point en) { - Line* ln = (Line*) malloc(sizeof(Line)); - ln->st = st; - ln->en = en; - return *ln; -} - -bool checkLine(Line ln, Point st, Point en) { - return (ln.st.x == st.x && ln.st.y == st.y && ln.en.x == en.x && ln.en.y == en.y); -} - -ScalarVector getScalarVector(int n, Point pt) { - ScalarVector* s = (ScalarVector*) malloc(sizeof(ScalarVector)); - s->n = n; - s->v = pt; - return *s; -} - -bool checkScalarVector(ScalarVector s, int n, Point pt) { - return (s.n == n && s.v.x == pt.x && s.v.y == pt.y); -} - -PointerVector getPointerVector(char *n, Point pt) { - PointerVector* s = (PointerVector*) malloc(sizeof(PointerVector)); - s->n = n; - s->v = pt; - return *s; -} - -bool checkPointerVector(PointerVector s, char *n, Point pt) { - return (0 == strcmp(s.n, n) && s.v.x == pt.x && s.v.y == pt.y); -} - -PointerPointer getPointerPointer(char *m, char *n) { - PointerPointer* s = (PointerPointer*) malloc(sizeof(PointerPointer)); - s->m = m; - s->n = n; - return *s; -} - -bool checkPointerPointer(PointerPointer s, char *m, char *n) { - return (0 == strcmp(s.m, m) && 0 == strcmp(s.n, n)); -} - -Complex getComplex(int64_t n, double f) { - Complex* s = (Complex*) malloc(sizeof(Complex)); - s->a = n; - s->b = f; - return *s; -} - -bool checkComplex(Complex s, int64_t n, double f) { - return (s.a == n && s.b == f); -} - -Padding getPadding(int64_t a, int32_t b, int64_t c) { - Padding* s = (Padding*) malloc(sizeof(Padding)); - s->x = a; - s->y = b; - s->z = c; - return *s; -} - -bool checkPadding(Padding s, int64_t a, int32_t b, int64_t c) { - return (s.x == a && s.y == b && s.z == c); -} - -PointerStruct getPointerStruct(char *pc, Point *pp, char **ppc, Point **ppp) { - PointerStruct* s = (PointerStruct*) malloc(sizeof(PointerStruct)); - s->pc = pc; - s->pp = pp; - s->ppc = ppc; - s->ppp = ppp; - return *s; -} - -bool checkPointerStruct(PointerStruct s, char *pc, Point pp, char *ppc, Point ppp) { - return (0 == strcmp(s.pc, pc) && 0 == strcmp(*(s.ppc), ppc) && s.pp->x == pp.x && s.pp->y == pp.y && (*s.ppp)->x == ppp.x && (*s.ppp)->y == ppp.y); -} - -ArrayStruct getArrayStruct(Line ln0, Line ln1, Line ln2, int a0, int a1, int a2, int a3) { - ArrayStruct* s = (ArrayStruct*) malloc(sizeof(ArrayStruct)); - s->triangle[0] = ln0; - s->triangle[1] = ln1; - s->triangle[2] = ln2; - - s->arr[0] = a0; - s->arr[1] = a1; - s->arr[2] = a2; - s->arr[3] = a3; - return *s; -} - -bool checkArrayStruct(ArrayStruct s, Line ln0, Line ln1, Line ln2, int a0, int a1, int a2, int a3) { - return (s.triangle[0].st.x == ln0.st.x && s.triangle[0].st.y == ln0.st.y && s.triangle[0].en.x == ln0.en.x && s.triangle[0].en.y == ln0.en.y - && s.triangle[1].st.x == ln1.st.x && s.triangle[1].st.y == ln1.st.y && s.triangle[1].en.x == ln1.en.x && s.triangle[1].en.y == ln1.en.y - && s.triangle[2].st.x == ln2.st.x && s.triangle[2].st.y == ln2.st.y && s.triangle[2].en.x == ln2.en.x && s.triangle[2].en.y == ln2.en.y - && s.arr[0] == a0 && s.arr[1] == a1 && s.arr[2] == a2 && s.arr[3] == a3 ); -} - -SmallStruct getSmallStruct(int8_t n) { - SmallStruct* s = (SmallStruct*) malloc(sizeof(SmallStruct)); - s->n = n; - return *s; -} - -bool checkSmallStruct(SmallStruct s, int8_t n) { - return (s.n == n); -} - -LargeStruct getLargeStruct(char *p, int n, Line *ln, Point pt, int a0, int a1, int a2, double d) { - LargeStruct* s = (LargeStruct*) malloc(sizeof(LargeStruct)); - s->pp = (char**) malloc(sizeof(char*)); - *(s->pp) = p; - s->p = p; - s->n = n; - s->x = (void *) p; - s->ln = ln; - s->pt = pt; - s->arr[0] = a0; - s->arr[1] = a1; - s->arr[2] = a2; - s->d = d; - return *s; -} - -bool checkLargeStruct(LargeStruct s, char *p, int n, Line ln, Point pt, int a0, int a1, int a2, double d) { - return (0 == strcmp(*(s.pp), p) && 0 == strcmp(s.p, p) && s.n == n && s.x == p - && s.ln->st.x == ln.st.x && s.ln->st.y == ln.st.y && s.ln->en.x == ln.en.x && s.ln->en.y == ln.en.y - && s.pt.x == pt.x && s.pt.y == pt.y && s.arr[0] == a0 && s.arr[1] == a1 && s.arr[2] == a2 && s.d == d); -} - -Point* getStructArray(void) { - Point* p1 = (Point*) malloc(sizeof(Point)); - Point* p2 = (Point*) malloc(sizeof(Point)); - p1->x = 2; - p1->y = 3; - p2->x = 4; - p2->y = 6; - - Point* arr = (Point*) malloc(sizeof(Point) * 2); - arr[0] = *p1; - arr[1] = *p2; - return arr; -} - -bool checkStructArray(Point *arr) { - return (2 == arr[0].x && 3 == arr[0].y && 4 == arr[1].x && 6 == arr[1].y); -} - -void freeStructArray(Point *arr) { - free(arr); -} diff --git a/test/functional/Panama/playlist.xml b/test/functional/Panama/playlist.xml deleted file mode 100644 index bd3e0846cd3..00000000000 --- a/test/functional/Panama/playlist.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - NativeMethodHandleTest - $(JAVA_COMMAND) $(JVM_OPTIONS) \ - -cp $(Q)$(RESOURCES_DIR)$(P)$(TESTNG)$(P)$(TEST_RESROOT)$(D)PanamaTests.jar$(Q) \ - org.testng.TestNG -d $(REPORTDIR) $(Q)$(TEST_RESROOT)$(D)testng.xml$(Q) -testnames NativeMethodHandleTest \ - -groups $(TEST_GROUP) \ - -excludegroups $(DEFAULT_EXCLUDE); \ - $(TEST_STATUS) - os.linux,arch.x86,bits.64 - - sanity - - - functional - - - Panama - - - - HigherLevelNativeMethodHandleTest - $(JAVA_COMMAND) $(JVM_OPTIONS) \ - -cp $(Q)$(RESOURCES_DIR)$(P)$(TESTNG)$(P)$(TEST_RESROOT)$(D)panamatest.jar$(P)$(TEST_RESROOT)$(D)PanamaTests.jar$(Q) \ - org.testng.TestNG -d $(REPORTDIR) $(Q)$(TEST_RESROOT)$(D)testng.xml$(Q) -testnames HigherLevelNativeMethodHandleTest \ - -groups $(TEST_GROUP) \ - -excludegroups $(DEFAULT_EXCLUDE); \ - $(TEST_STATUS) - os.linux,arch.x86,bits.64 - - sanity - - - functional - - - Panama - - - - CustomFFINativeMethodHandleTest - $(JAVA_COMMAND) $(JVM_OPTIONS) \ - -cp $(Q)$(RESOURCES_DIR)$(P)$(TESTNG)$(P)$(TEST_RESROOT)$(D)panamatest.jar$(P)$(TEST_RESROOT)$(D)PanamaTests.jar$(Q) \ - org.testng.TestNG -d $(REPORTDIR) $(Q)$(TEST_RESROOT)$(D)testng.xml$(Q) -testnames CustomFFINativeMethodHandleTest \ - -groups $(TEST_GROUP) \ - -excludegroups $(DEFAULT_EXCLUDE); \ - $(TEST_STATUS) - os.linux,arch.x86,bits.64 - - sanity - - - functional - - - Panama - - - diff --git a/test/functional/Panama/src/org/openj9/test/panama/CustomFFINativeMethodHandleTest.java b/test/functional/Panama/src/org/openj9/test/panama/CustomFFINativeMethodHandleTest.java deleted file mode 100644 index 15f246c6662..00000000000 --- a/test/functional/Panama/src/org/openj9/test/panama/CustomFFINativeMethodHandleTest.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright IBM Corp. and others 2017 - * - * This program and the accompanying materials are made available under - * the terms of the Eclipse Public License 2.0 which accompanies this - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] https://openjdk.org/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 - */ -package org.openj9.test.panama; - - -import org.testng.annotations.*; -import org.testng.Assert; - -import java.lang.invoke.*; -import java.nicl.*; -import java.nicl.types.Pointer; -import java.nicl.types.Transformer; - -import panama.test.panamatest; -import panama.test.panamatest.*; - -/** - * Test native method handles - * - * @author Amy Yu - * - */ -@Test(groups = { "level.sanity" }) -public class CustomFFINativeMethodHandleTest { - panamatest panama; - Scope scope; - - @Parameters({ "path" }) - public void setUp(String path) throws Exception { - Library lib = NativeLibrary.loadLibraryFile(path + "/libpanamatest.so"); - panama = NativeLibrary.bindRaw(panamatest.class, lib); - scope = new NativeScope(); - } - - @Test - public void testIntPtr() throws Throwable { - Pointer arr = panama.getIntPtr(); - Assert.assertEquals(1, panama.checkIntPtr(arr)); - panama.freeIntPtr(arr); - } - - @Test - public void testStructArray() throws Throwable { - Pointer sa = panama.getStructArray(); - Assert.assertEquals(1, panama.checkStructArray(sa)); - panama.freeStructArray(sa); - } - - @Test - public void testPoint() throws Throwable { - Point p1 = panama.getPoint(2, 3); - Point p2 = panama.getPoint(4, 6); - Assert.assertEquals(1, panama.checkPoint(p1, 2, 3)); - } - - @Test - public void testPointPtr() throws Throwable { - Pointer pptr = panama.getPointPtr(7, 8); - Assert.assertEquals(1, panama.checkPointPtr(pptr, 7, 8)); - panama.freePointPtr(pptr); - } - - @Test - public void testLine() throws Throwable { - Point p1 = panama.getPoint(2, 3); - Point p2 = panama.getPoint(4, 6); - Line ln = panama.getLine(p1, p2); - Assert.assertEquals(1, panama.checkLine(ln, p1, p2)); - } - - @Test - public void testSmallStruct() throws Throwable { - SmallStruct small = panama.getSmallStruct((byte)4); - Assert.assertEquals(1, panama.checkSmallStruct(small, (byte)4)); - } - - @Test - public void testLargeStruct() throws Throwable { - Point p1 = panama.getPoint(2, 3); - Point p2 = panama.getPoint(4, 6); - Line ln = panama.getLine(p1, p2); - Pointer str = Transformer.toCString("abcdfghijk", scope); - LargeStruct large = panama.getLargeStruct(str, 4, ln.ptr(), p1, 1, 2, 3, 2.5); - Assert.assertEquals(1, panama.checkLargeStruct(large, str, 4, ln, p1, 1, 2, 3, 2.5)); - } - - @Test - public void testPadding() throws Throwable { - Padding pad = panama.getPadding(99999999999999999L, 8, 99999999999999999L); - Assert.assertEquals(1, panama.checkPadding(pad, 99999999999999999L, 8, 99999999999999999L)); - } - - @Test - public void testComplex() throws Throwable { - Complex comp = panama.getComplex(99999999999999999L, 4.6); - Assert.assertEquals(1, panama.checkComplex(comp, 99999999999999999L, 4.6)); - } - - @Test - public void testScalarVector() throws Throwable { - Point p1 = panama.getPoint(2, 3); - ScalarVector sv = panama.getScalarVector(2, p1); - Assert.assertEquals(1, panama.checkScalarVector(sv, 2, p1)); - } - - @Test - public void testPointerVector() throws Throwable { - Point p1 = panama.getPoint(2, 3); - Pointer str1 = Transformer.toCString("qwerty", scope); - PointerVector pv = panama.getPointerVector(str1, p1); - Assert.assertEquals(1, panama.checkPointerVector(pv, str1, p1)); - } - - @Test - public void testPointerPointer() throws Throwable { - Pointer str1 = Transformer.toCString("qwerty", scope); - Pointer str2 = Transformer.toCString("yuiop", scope); - PointerPointer pp = panama.getPointerPointer(str1, str2); - Assert.assertEquals(1, panama.checkPointerPointer(pp, str1, str2)); - } - - @Test - public void testArrayStruct() throws Throwable { - Point p1 = panama.getPoint(2, 3); - Point p2 = panama.getPoint(4, 6); - Point p3 = panama.getPoint(8, 0); - Line ln1 = panama.getLine(p1, p2); - Line ln2 = panama.getLine(p1, p3); - Line ln3 = panama.getLine(p3, p2); - ArrayStruct arr = panama.getArrayStruct(ln1, ln2, ln3, 1, 2, 3, 4); - Assert.assertEquals(1, panama.checkArrayStruct(arr, ln1, ln2, ln3, 1, 2, 3, 4)); - } -} \ No newline at end of file diff --git a/test/functional/Panama/src/org/openj9/test/panama/HigherLevelNativeMethodHandleTest.java b/test/functional/Panama/src/org/openj9/test/panama/HigherLevelNativeMethodHandleTest.java deleted file mode 100644 index c17bf028e7b..00000000000 --- a/test/functional/Panama/src/org/openj9/test/panama/HigherLevelNativeMethodHandleTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright IBM Corp. and others 2017 - * - * This program and the accompanying materials are made available under - * the terms of the Eclipse Public License 2.0 which accompanies this - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] https://openjdk.org/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 - */ -package org.openj9.test.panama; - - -import org.testng.annotations.*; -import org.testng.Assert; - -import java.lang.invoke.*; -import java.nicl.*; - -import panama.test.panamatest; - -/** - * Test native method handles - * - * @author Amy Yu - * - */ -@Test(groups = { "level.sanity" }) -public class HigherLevelNativeMethodHandleTest { - panamatest panama; - - @Parameters({ "path" }) - public void setUp(String path) throws Exception { - Library lib = NativeLibrary.loadLibraryFile(path + "/libpanamatest.so"); - panama = NativeLibrary.bindRaw(panamatest.class, lib); - } - - @Test - public void testByte() throws Throwable { - byte resultByte = panama.addTwoByte((byte)2,(byte)3); - Assert.assertEquals(5, resultByte); - } - - @Test - public void testDouble() throws Throwable { - double resultDouble = panama.addTwoDouble(2.1,3.1); - Assert.assertEquals(5.2, resultDouble); - } - - @Test - public void testFloat() throws Throwable { - float resultFloat = panama.addTwoFloat(2.1f,3.1f); - Assert.assertEquals(5.2f, resultFloat); - } - - @Test - public void testInt() throws Throwable { - int resultInt = panama.addTwoInt(2,3); - Assert.assertEquals(5, resultInt); - } - - @Test - public void testLong() throws Throwable { - long resultLong = panama.addTwoLong(200000000000000L, 300000000000000L); - Assert.assertEquals(500000000000000L, resultLong); - } - - @Test - public void testShort() throws Throwable { - short resultShort = panama.addTwoShort((short)2,(short)3); - Assert.assertEquals(5, resultShort); - } - - @Test - public void testNoArgs() throws Throwable { - int resultFour = panama.returnFour(); - Assert.assertEquals(4, resultFour); - } - - @Test - public void testVoidWithArgs() throws Throwable { - panama.voidWithArgs(2); - } - - @Test - public void testVoidNoArgs() throws Throwable { - panama.voidNoArgs(); - } - - @Test - public void testManyArgs() throws Throwable { - double resultMany = panama.manyArgs(1, 2.5f, 3L, 4.5); - Assert.assertEquals(13.2545, resultMany); - } -} \ No newline at end of file diff --git a/test/functional/Panama/src/org/openj9/test/panama/NativeMethodHandleTest.java b/test/functional/Panama/src/org/openj9/test/panama/NativeMethodHandleTest.java deleted file mode 100644 index e4a5ad5b4ec..00000000000 --- a/test/functional/Panama/src/org/openj9/test/panama/NativeMethodHandleTest.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright IBM Corp. and others 2017 - * - * This program and the accompanying materials are made available under - * the terms of the Eclipse Public License 2.0 which accompanies this - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] https://openjdk.org/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 - */ -package org.openj9.test.panama; - - -import org.testng.annotations.*; -import org.testng.Assert; - -import java.lang.invoke.*; -import java.nicl.*; - -/** - * Test native method handles - * - * @author Amy Yu - * - */ -@Test(groups = { "level.sanity" }) -public class NativeMethodHandleTest { - Library lib; - - @Parameters({ "path" }) - public void setUp(String path) throws Exception { - lib = NativeLibrary.loadLibraryFile(path + "/libpanamatest.so"); - } - - @Test - public void testNoLib() throws Throwable { - /* C Standard Library */ - MethodHandle mh = MethodHandles.lookup().findNative("abs", MethodType.methodType(int.class, int.class)); - int result = (int)mh.invoke(-4); - Assert.assertEquals(4, result); - } - - @Test - public void testByte() throws Throwable { - MethodHandle mh = MethodHandles.lookup().findNative(lib, "addTwoByte", MethodType.methodType(byte.class, byte.class, byte.class)); - byte result = (byte)mh.invoke((byte)2,(byte)3); - Assert.assertEquals(5, result); - } - - @Test - public void testChar() throws Throwable { - MethodHandle mh = MethodHandles.lookup().findNative(lib, "addTwoChar", MethodType.methodType(char.class, char.class, char.class)); - char result = (char)mh.invoke('a','b'); - Assert.assertEquals('c', result); - } - - @Test - public void testDouble() throws Throwable { - MethodHandle mh = MethodHandles.lookup().findNative(lib, "addTwoDouble", MethodType.methodType(double.class, double.class, double.class)); - double result = (double)mh.invoke(2.1,3.1); - Assert.assertEquals(5.2, result); - } - - @Test - public void testFloat() throws Throwable { - MethodHandle mh = MethodHandles.lookup().findNative(lib, "addTwoFloat", MethodType.methodType(float.class, float.class, float.class)); - float result = (float)mh.invoke(2.1f,3.1f); - Assert.assertEquals(5.2f, result); - } - - @Test - public void testInt() throws Throwable { - MethodHandle mh = MethodHandles.lookup().findNative(lib, "addTwoInt", MethodType.methodType(int.class, int.class, int.class)); - int result = (int)mh.invoke(2,3); - Assert.assertEquals(5, result); - } - - @Test - public void testLong() throws Throwable { - MethodHandle mh = MethodHandles.lookup().findNative(lib, "addTwoLong", MethodType.methodType(long.class, long.class, long.class)); - long result = (long)mh.invoke(200000000000000L, 300000000000000L); - Assert.assertEquals(500000000000000L, result); - } - - @Test - public void testShort() throws Throwable { - MethodHandle mh = MethodHandles.lookup().findNative(lib, "addTwoShort", MethodType.methodType(short.class, short.class, short.class)); - short result = (short)mh.invoke((short)2,(short)3); - Assert.assertEquals(5, result); - } - - @Test - public void testBoolean() throws Throwable { - MethodHandle mh = MethodHandles.lookup().findNative(lib, "testBoolean", MethodType.methodType(boolean.class, boolean.class)); - boolean result = (boolean)mh.invoke(false); - Assert.assertEquals(true, result); - } - - @Test - public void testNoArgs() throws Throwable { - MethodHandle mh = MethodHandles.lookup().findNative(lib, "returnFour", MethodType.methodType(int.class)); - int result = (int)mh.invoke(); - Assert.assertEquals(4, result); - } - - @Test - public void testVoidWithArgs() throws Throwable { - MethodHandle mh = MethodHandles.lookup().findNative(lib, "voidWithArgs", MethodType.methodType(void.class, int.class)); - mh.invoke(2); - } - - @Test - public void testVoidNoArgs() throws Throwable { - MethodHandle mh = MethodHandles.lookup().findNative(lib, "voidNoArgs", MethodType.methodType(void.class)); - mh.invoke(); - } - - @Test - public void testManyArgs() throws Throwable { - MethodHandle mh = MethodHandles.lookup().findNative(lib, "manyArgs", MethodType.methodType(double.class, int.class, float.class, long.class, double.class)); - double result = (double)mh.invoke(1, 2.5f, 3L, 4.5); - Assert.assertEquals(13.2545, result); - } -} \ No newline at end of file diff --git a/test/functional/Panama/testng.xml b/test/functional/Panama/testng.xml deleted file mode 100644 index dee57b080cf..00000000000 --- a/test/functional/Panama/testng.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - -