diff --git a/buildenv/jenkins/variables/defaults.yml b/buildenv/jenkins/variables/defaults.yml index 77e99e4a727..5c8898be894 100644 --- a/buildenv/jenkins/variables/defaults.yml +++ b/buildenv/jenkins/variables/defaults.yml @@ -132,7 +132,7 @@ jitserver: # OpenSSL #========================================# openssl: - extra_getsource_options: '--openssl-version=1.1.1e' + extra_getsource_options: '--openssl-version=1.1.1f' extra_configure_options: '--with-openssl=fetched' #========================================# # OpenSSL Bundling diff --git a/runtime/bcutil/jimageintf.c b/runtime/bcutil/jimageintf.c index 29f103b6bf5..1f77d05739e 100644 --- a/runtime/bcutil/jimageintf.c +++ b/runtime/bcutil/jimageintf.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2017 IBM Corp. and others + * Copyright (c) 2015, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -320,7 +320,7 @@ jimageFindResource(J9JImageIntf *jimageIntf, UDATA handle, const char *moduleNam if (jimageIntf->libJImageHandle) { JImageFile *jimage = (JImageFile *)handle; - JImageLocationRef *locationRef = (JImageLocationRef *)j9mem_allocate_memory(sizeof(JImageLocationRef), J9MEM_CATEGORY_CLASSES);; + JImageLocationRef *locationRef = (JImageLocationRef *)j9mem_allocate_memory(sizeof(JImageLocationRef), J9MEM_CATEGORY_CLASSES); if (NULL != locationRef) { *locationRef = libJImageFindResource(jimage, moduleName, JIMAGE_VERSION_NUMBER, name, (jlong *)size); diff --git a/runtime/bcutil/test/dyntest/misc_tests.cpp b/runtime/bcutil/test/dyntest/misc_tests.cpp index 4251339eb31..fd16ee68a44 100644 --- a/runtime/bcutil/test/dyntest/misc_tests.cpp +++ b/runtime/bcutil/test/dyntest/misc_tests.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2017 IBM Corp. and others + * Copyright (c) 2001, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -95,7 +95,7 @@ testGetNextStackMapFrame(J9PortLibrary *portLib, const char *classFileName) UDATA *frame = NULL; UDATA *prevFrame = NULL; U_16 stackFrameIndex = 0; - U_16 stackFrameCount = GET_BE_U16((((U_8*)stackMap)+sizeof(U_32)));; + U_16 stackFrameCount = GET_BE_U16((((U_8 *)stackMap) + sizeof(U_32))); /* get the first stack frame */ frame = getNextStackMapFrame(stackMap, frame); while(stackFrameIndex < stackFrameCount) { diff --git a/runtime/cmake/caches/aix_ppc-64.cmake b/runtime/cmake/caches/aix_ppc-64.cmake index e23638bc692..03d8ad0d31b 100644 --- a/runtime/cmake/caches/aix_ppc-64.cmake +++ b/runtime/cmake/caches/aix_ppc-64.cmake @@ -29,6 +29,7 @@ set(J9VM_ENV_SHARED_LIBS_CALLEE_GLOBAL_TABLE_SETUP OFF CACHE BOOL "") set(J9VM_ENV_SHARED_LIBS_USE_GLOBAL_TABLE ON CACHE BOOL "") set(OMR_GC_TLH_PREFETCH_FTA OFF CACHE BOOL "") +set(J9VM_JIT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "") set(J9VM_PORT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "") set(J9VM_MODULE_CODEGEN_PPC ON CACHE BOOL "") set(J9VM_GC_IDLE_HEAP_MANAGER OFF CACHE BOOL "") diff --git a/runtime/cmake/caches/linux_ppc-64_le_gcc.cmake b/runtime/cmake/caches/linux_ppc-64_le_gcc.cmake index af0d8166f42..2b3eaa736e2 100644 --- a/runtime/cmake/caches/linux_ppc-64_le_gcc.cmake +++ b/runtime/cmake/caches/linux_ppc-64_le_gcc.cmake @@ -31,6 +31,7 @@ set(J9VM_ENV_USE_GCC ON CACHE BOOL "") set(OMR_GC_IDLE_HEAP_MANAGER OFF CACHE BOOL "") set(OMR_GC_TLH_PREFETCH_FTA OFF CACHE BOOL "") +set(J9VM_JIT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "") set(J9VM_PORT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "") set(J9VM_MODULE_CODEGEN_PPC ON CACHE BOOL "") set(J9VM_MODULE_THRTRACE ON CACHE BOOL "") diff --git a/runtime/cmake/platform.cmake b/runtime/cmake/platform.cmake index 31fa69a42cc..f3e79e8a32a 100644 --- a/runtime/cmake/platform.cmake +++ b/runtime/cmake/platform.cmake @@ -1,5 +1,5 @@ ################################################################################ -# Copyright (c) 2017, 2019 IBM Corp. and others +# Copyright (c) 2017, 2020 IBM Corp. and others # # This program and the accompanying materials are made available under # the terms of the Eclipse Public License 2.0 which accompanies this @@ -20,57 +20,18 @@ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception ################################################################################ +# Get OMR's platform config include(OmrPlatform) -# Note: we need to inject WIN32 et al, as OMR no longer uses them -if(OMR_OS_WINDOWS) - list(APPEND OMR_PLATFORM_DEFINITIONS - -DWIN32 - -D_WIN32 - ) - if(OMR_ENV_DATA64) - list(APPEND OMR_PLATFORM_DEFINITIONS - -DWIN64 - -D_WIN64 - ) - endif() -endif() -omr_platform_global_setup() -if(OMR_TOOLCONFIG STREQUAL "gnu") - set(CMAKE_CXX_FLAGS " -g -fno-rtti -fno-exceptions ${CMAKE_CXX_FLAGS}") - set(CMAKE_C_FLAGS "-g ${CMAKE_C_FLAGS}") - - # Raise an error if a shared library has any unresolved symbols. - # This flag isn't supported on OSX, but it has this behaviour by default - if(NOT OMR_OS_OSX) - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,defs ${CMAKE_SHARED_LINKER_FLAGS}") - endif() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -O3 -fno-strict-aliasing") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -O3 -fno-strict-aliasing -fno-exceptions -fno-rtti -fno-threadsafe-statics") -elseif(OMR_TOOLCONFIG STREQUAL "xlc") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -qalias=noansi") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -qalias=noansi -qnortti -qnoeh -qsuppress=1540-1087:1540-1088:1540-1090") - set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -qpic=large") -endif() +# Add our own platform specific config if we have any +include("${CMAKE_CURRENT_LIST_DIR}/platform/os/${OMR_HOST_OS}.cmake" OPTIONAL) +include("${CMAKE_CURRENT_LIST_DIR}/platform/arch/${OMR_HOST_ARCH}.cmake" OPTIONAL) +include("${CMAKE_CURRENT_LIST_DIR}/platform/toolcfg/${OMR_TOOLCONFIG}.cmake" OPTIONAL) -if(OMR_ARCH_POWER) - #TODO do based on toolchain stuff - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - add_definitions(-DOMR_ENV_GCC) - endif() - #TODO this is a hack - set(J9VM_JIT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "") - set(J9VM_PORT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "") -endif() -if(OMR_OS_AIX) - # Override cmake default of ".a" for shared libs on aix - set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") -endif() +# Apply the combined platform config +omr_platform_global_setup() if(NOT OMR_OS_OSX) add_definitions(-DIPv6_FUNCTION_SUPPORT) endif() - -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1") diff --git a/runtime/cmake/platform/arch/power.cmake b/runtime/cmake/platform/arch/power.cmake new file mode 100644 index 00000000000..86ecafeb101 --- /dev/null +++ b/runtime/cmake/platform/arch/power.cmake @@ -0,0 +1,25 @@ +################################################################################ +# Copyright (c) 2020, 2020 IBM Corp. and others +# +# 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] http://openjdk.java.net/legal/assembly-exception.html +# +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception +################################################################################ + +if(OMR_TOOLCONFIG STREQUAL "GNU") + add_definitions(-DOMR_ENV_GCC) +endif() diff --git a/runtime/cmake/platform/os/aix.cmake b/runtime/cmake/platform/os/aix.cmake new file mode 100644 index 00000000000..21fafee99aa --- /dev/null +++ b/runtime/cmake/platform/os/aix.cmake @@ -0,0 +1,24 @@ +################################################################################ +# Copyright (c) 2020, 2020 IBM Corp. and others +# +# 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] http://openjdk.java.net/legal/assembly-exception.html +# +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception +################################################################################ + +# Override cmake default of ".a" for shared libs on aix +set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") diff --git a/runtime/cmake/platform/os/win.cmake b/runtime/cmake/platform/os/win.cmake new file mode 100644 index 00000000000..c0db6e61d4b --- /dev/null +++ b/runtime/cmake/platform/os/win.cmake @@ -0,0 +1,34 @@ +################################################################################ +# Copyright (c) 2020, 2020 IBM Corp. and others +# +# 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] http://openjdk.java.net/legal/assembly-exception.html +# +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception +################################################################################ + +# Note: we need to inject WIN32 et al, as OMR no longer uses them + +list(APPEND OMR_PLATFORM_DEFINITIONS + -DWIN32 + -D_WIN32 +) +if(OMR_ENV_DATA64) + list(APPEND OMR_PLATFORM_DEFINITIONS + -DWIN64 + -D_WIN64 + ) +endif() diff --git a/runtime/cmake/platform/toolcfg/gnu.cmake b/runtime/cmake/platform/toolcfg/gnu.cmake new file mode 100644 index 00000000000..ae10fb3fd90 --- /dev/null +++ b/runtime/cmake/platform/toolcfg/gnu.cmake @@ -0,0 +1,39 @@ +################################################################################ +# Copyright (c) 2020, 2020 IBM Corp. and others +# +# 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] http://openjdk.java.net/legal/assembly-exception.html +# +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception +################################################################################ + +list(APPEND OMR_PLATFORM_COMPILE_OPTIONS -O3 -g) + +# Add these +list(APPEND OMR_PLATFORM_CXX_COMPILE_OPTIONS -fno-threadsafe-statics) + +# OMR_PLATFORM_CXX_COMPILE_OPTIONS gets applied to the jit (which needs exceptions), +# so we put these in the CMAKE_CXX_FLAGS instead +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti") + +# Raise an error if a shared library has any unresolved symbols. +# This flag isn't supported on OSX, but it has this behaviour by default +if(NOT OMR_OS_OSX) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,defs ${CMAKE_SHARED_LINKER_FLAGS}") +endif() + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1") diff --git a/runtime/cmake/platform/toolcfg/xlc.cmake b/runtime/cmake/platform/toolcfg/xlc.cmake new file mode 100644 index 00000000000..d5b7e87414d --- /dev/null +++ b/runtime/cmake/platform/toolcfg/xlc.cmake @@ -0,0 +1,31 @@ +################################################################################ +# Copyright (c) 2020, 2020 IBM Corp. and others +# +# 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] http://openjdk.java.net/legal/assembly-exception.html +# +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception +################################################################################ + +list(APPEND OMR_PLATFORM_COMPILE_OPTIONS -O3) + +list(APPEND OMR_PLATFORM_CXX_COMPILE_OPTIONS -qsuppress=1540-1087:1540-1088:1540-1090) + +# OMR_PLATFORM_CXX_COMPILE_OPTIONS gets applied to the jit (which needs exceptions), +# so we put these in the CMAKE_CXX_FLAGS instead +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qnortti -qnoeh") + +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -qpic=large") diff --git a/runtime/compiler/aarch64/codegen/CallSnippet.cpp b/runtime/compiler/aarch64/codegen/CallSnippet.cpp index 9a94f441172..7329951af97 100644 --- a/runtime/compiler/aarch64/codegen/CallSnippet.cpp +++ b/runtime/compiler/aarch64/codegen/CallSnippet.cpp @@ -304,7 +304,7 @@ void TR_Debug::print(TR::FILE *pOutFile, TR::ARM64CallSnippet * snippet) { TR::Node *callNode = snippet->getNode(); - TR::SymbolReference *glueRef = _cg->getSymRef(snippet->getHelper());; + TR::SymbolReference *glueRef = _cg->getSymRef(snippet->getHelper()); TR::SymbolReference *methodSymRef = callNode->getSymbolReference(); TR::MethodSymbol *methodSymbol = methodSymRef->getSymbol()->castToMethodSymbol(); diff --git a/runtime/compiler/aarch64/runtime/ARM64RelocationTarget.cpp b/runtime/compiler/aarch64/runtime/ARM64RelocationTarget.cpp index 69f0c0fd664..0860f42cd94 100644 --- a/runtime/compiler/aarch64/runtime/ARM64RelocationTarget.cpp +++ b/runtime/compiler/aarch64/runtime/ARM64RelocationTarget.cpp @@ -35,7 +35,7 @@ void TR_ARM64RelocationTarget::storeCallTarget(uintptr_t callTarget, uint8_t *reloLocation) { // reloLocation points at the start of the call offset, so just store the uint8_t * at reloLocation - storePointer((uint8_t *)callTarget, reloLocation);; + storePointer((uint8_t *)callTarget, reloLocation); } uint32_t diff --git a/runtime/compiler/control/CassandraLogger.cpp b/runtime/compiler/control/CassandraLogger.cpp index b2b3a52b003..f505ac8a361 100644 --- a/runtime/compiler/control/CassandraLogger.cpp +++ b/runtime/compiler/control/CassandraLogger.cpp @@ -23,8 +23,8 @@ CassandraLogger::CassandraLogger(const char *databaseIP, uint32_t databasePort, bool CassandraLogger::createKeySpace() { - char queryString[1024]; - sprintf(queryString, "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = {'class':'SimpleStrategy','replication_factor':1};", _databaseName); + char queryString[256]; + snprintf(queryString, 256, "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = {'class':'SimpleStrategy','replication_factor':1};", _databaseName); OCassStatement* statement = Ocass_statement_new(queryString, 0); OCassFuture* queryFuture = Ocass_session_execute(_session, statement); @@ -35,7 +35,7 @@ bool CassandraLogger::createKeySpace() const char* message; size_t messageLength; Ocass_future_error_message(queryFuture, &message, &messageLength); - fprintf(stderr, "PersistentLogging: Cassandra Database Keyspace Creation Error: '%.*s'\n", (int)messageLength, message); + fprintf(stderr, "PersistentLogging - Cassandra Database Keyspace Creation Error: '%.*s'\n", (int)messageLength, message); Ocass_future_free(queryFuture); return false; @@ -47,8 +47,8 @@ bool CassandraLogger::createKeySpace() } bool CassandraLogger::createTable(const char *tableName) { - char queryString[1024]; - sprintf(queryString, "CREATE TABLE IF NOT EXISTS %s.%s (clientID text, methodName text, logContent text, insertionDate date,insertionTime time, primary key (clientID, methodName, insertionDate, insertionTime));", _databaseName, tableName); + char queryString[256]; + snprintf(queryString, 256, "CREATE TABLE IF NOT EXISTS %s.%s (clientID text, methodName text, logContent text, insertionDate date,insertionTime time, primary key (clientID, methodName, insertionDate, insertionTime));", _databaseName, tableName); OCassStatement* statement = Ocass_statement_new(queryString, 0); OCassFuture* queryFuture = Ocass_session_execute(_session, statement); Ocass_statement_free(statement); @@ -58,7 +58,7 @@ bool CassandraLogger::createTable(const char *tableName) const char* message; size_t messageLength; Ocass_future_error_message(queryFuture, &message, &messageLength); - fprintf(stderr, "Persistent Logging: Cassandra Database Table Creation Error: '%.*s'\n", (int)messageLength, message); + fprintf(stderr, "Persistent Logging - Cassandra Database Table Creation Error: '%.*s'\n", (int)messageLength, message); Ocass_future_free(queryFuture); return false; @@ -78,7 +78,7 @@ bool CassandraLogger::connect() int rc_set_protocol = Ocass_cluster_set_protocol_version(_cluster, 4); if (rc_set_protocol != 0) { - printf("Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_protocol)); + fprintf(stderr, "Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_protocol)); Ocass_session_free(_session); Ocass_cluster_free(_cluster); return false; @@ -89,7 +89,7 @@ bool CassandraLogger::connect() int rc_set_ip = Ocass_cluster_set_contact_points(_cluster, _databaseIP); if (rc_set_ip != 0) { - printf("Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_ip)); + fprintf(stderr, "Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_ip)); Ocass_session_free(_session); Ocass_cluster_free(_cluster); return false; @@ -100,7 +100,7 @@ bool CassandraLogger::connect() int rc_set_port = Ocass_cluster_set_port(_cluster, _databasePort); if (rc_set_port != 0) { - printf("Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_port)); + fprintf(stderr, "Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_port)); Ocass_session_free(_session); Ocass_cluster_free(_cluster); @@ -117,7 +117,7 @@ bool CassandraLogger::connect() const char* message; size_t messageLength; Ocass_future_error_message(_connectFuture, &message, &messageLength); - fprintf(stderr, "Persistent Logging: Cassandra Database Connection Error: '%.*s'\n", (int)messageLength, message); + fprintf(stderr, "Persistent Logging - Cassandra Database Connection Error: '%.*s'\n", (int)messageLength, message); Ocass_session_free(_session); Ocass_cluster_free(_cluster); Ocass_future_free(_connectFuture); @@ -135,19 +135,19 @@ bool CassandraLogger::logMethod(const char *method, uint64_t clientID, const cha if (!createKeySpace()) return false; const char* tableName = "logs"; if (!createTable(tableName)) return false; - char queryString[1024]; + char queryString[256]; - sprintf(queryString, "INSERT INTO %s.%s (clientID, methodName, logContent, insertionDate, insertionTime) VALUES (?, ?, ?, ?, ?)", _databaseName,tableName); + snprintf(queryString, 256, "INSERT INTO %s.%s (clientID, methodName, logContent, insertionDate, insertionTime) VALUES (?, ?, ?, ?, ?)", _databaseName,tableName); OCassStatement* statement = Ocass_statement_new(queryString, 5); /* Bind the values using the indices of the bind variables */ char strClientID[64]; - sprintf(strClientID, "%lu", clientID); + snprintf(strClientID, 64, "%lu", clientID); int rc_set_bind_pk = Ocass_statement_bind_string(statement, 0, strClientID); if (rc_set_bind_pk != 0) { - printf("Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_bind_pk)); + fprintf(stderr, "Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_bind_pk)); Ocass_statement_free(statement); return false; } @@ -155,7 +155,7 @@ bool CassandraLogger::logMethod(const char *method, uint64_t clientID, const cha int rc_set_bind_method = Ocass_statement_bind_string(statement, 1, method); if (rc_set_bind_pk != 0) { - printf("Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_bind_method)); + fprintf(stderr, "Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_bind_method)); Ocass_statement_free(statement); return false; } @@ -163,7 +163,7 @@ bool CassandraLogger::logMethod(const char *method, uint64_t clientID, const cha if (rc_set_bind_log_content != 0) { - printf("Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_bind_log_content)); + fprintf(stderr, "Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_bind_log_content)); Ocass_statement_free(statement); return false; } @@ -179,7 +179,7 @@ bool CassandraLogger::logMethod(const char *method, uint64_t clientID, const cha if (rc_set_bind_insertion_date != 0) { - printf("Persistent Logging - Cassandra Database Error: %s\n", Ocass_error_desc(rc_set_bind_insertion_date)); + fprintf(stderr, "Persistent Logging - Cassandra Database Error: %s\n", Ocass_error_desc(rc_set_bind_insertion_date)); Ocass_statement_free(statement); return false; } @@ -187,7 +187,7 @@ bool CassandraLogger::logMethod(const char *method, uint64_t clientID, const cha int rc_set_bind_insertion_time = Ocass_statement_bind_int64(statement, 4, time_of_insertion); if (rc_set_bind_insertion_time != 0) { - printf("Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_bind_insertion_time)); + fprintf(stderr ,"Persistent Logging - Cassandra Database Error: %s\n",Ocass_error_desc(rc_set_bind_insertion_time)); Ocass_statement_free(statement); return false; } @@ -202,7 +202,7 @@ bool CassandraLogger::logMethod(const char *method, uint64_t clientID, const cha const char* message; size_t messageLength; Ocass_future_error_message(queryFuture, &message, &messageLength); - fprintf(stderr, "query execution error: '%.*s'\n", (int)messageLength, message); + fprintf(stderr, "Persistent Logging - Cassandra Database Query Execution Error: '%.*s'\n", (int)messageLength, message); Ocass_future_free(queryFuture); return false; } diff --git a/runtime/compiler/control/CompilationThread.cpp b/runtime/compiler/control/CompilationThread.cpp index 531d69efb56..4abb064876d 100644 --- a/runtime/compiler/control/CompilationThread.cpp +++ b/runtime/compiler/control/CompilationThread.cpp @@ -11036,6 +11036,10 @@ TR::CompilationInfoPerThreadBase::processException( { _methodBeingCompiled->_compErrCode = compilationILGenFailure; } + catch (const TR::UnsupportedValueTypeOperation &e) + { + _methodBeingCompiled->_compErrCode = compilationILGenUnsupportedValueTypeOperationFailure; + } /* IL Gen Exceptions End */ /* Runtime Failure Exceptions Start */ diff --git a/runtime/compiler/control/HookedByTheJit.cpp b/runtime/compiler/control/HookedByTheJit.cpp index f2798dcdcef..4111ac97642 100644 --- a/runtime/compiler/control/HookedByTheJit.cpp +++ b/runtime/compiler/control/HookedByTheJit.cpp @@ -6082,7 +6082,7 @@ void samplerThreadStateLogic(TR::CompilationInfo *compInfo, TR_FrontEnd *fe, int newVMState = J9VM_RUNTIME_STATE_IDLE; } // Enter DEEPIDLE - newSamplerState = TR::CompilationInfo::SAMPLER_DEEPIDLE;; + newSamplerState = TR::CompilationInfo::SAMPLER_DEEPIDLE; jitConfig->samplingFrequency = TR::Options::getSamplingFrequencyInDeepIdleMode(); } else diff --git a/runtime/compiler/control/rossa.cpp b/runtime/compiler/control/rossa.cpp index fb68ee5fcbe..f62593628cb 100644 --- a/runtime/compiler/control/rossa.cpp +++ b/runtime/compiler/control/rossa.cpp @@ -210,12 +210,13 @@ char *compilationErrorNames[]={ "compilationSymbolValidationManagerFailure", //50 "compilationAOTNoSupportForAOTFailure", //51 "compilationAOTValidateTMFailure", //52 + "compilationILGenUnsupportedValueTypeOperationFailure", //53 #if defined(J9VM_OPT_JITSERVER) - "compilationStreamFailure", //53 - "compilationStreamLostMessage", // 54 - "compilationStreamMessageTypeMismatch", // 55 - "compilationStreamVersionIncompatible", // 56 - "compilationStreamInterrupted", // 57 + "compilationStreamFailure", //54 + "compilationStreamLostMessage", // 55 + "compilationStreamMessageTypeMismatch", // 56 + "compilationStreamVersionIncompatible", // 57 + "compilationStreamInterrupted", // 58 #endif /* defined(J9VM_OPT_JITSERVER) */ "compilationMaxError" }; diff --git a/runtime/compiler/control/rossa.h b/runtime/compiler/control/rossa.h index 07dacd7a5e8..589979a66f8 100644 --- a/runtime/compiler/control/rossa.h +++ b/runtime/compiler/control/rossa.h @@ -76,12 +76,14 @@ typedef enum { compilationSymbolValidationManagerFailure = 50, compilationAOTNoSupportForAOTFailure = 51, compilationAOTValidateTMFailure = 52, + compilationILGenUnsupportedValueTypeOperationFailure = 53, #if defined(J9VM_OPT_JITSERVER) - compilationStreamFailure = 53, - compilationStreamLostMessage = 54, - compilationStreamMessageTypeMismatch = 55, - compilationStreamVersionIncompatible = 56, - compilationStreamInterrupted = 57, + compilationFirstJITServerFailure, + compilationStreamFailure = compilationFirstJITServerFailure, + compilationStreamLostMessage = compilationFirstJITServerFailure+1, + compilationStreamMessageTypeMismatch = compilationFirstJITServerFailure+2, + compilationStreamVersionIncompatible = compilationFirstJITServerFailure+3, + compilationStreamInterrupted = compilationFirstJITServerFailure+4, #endif /* defined(J9VM_OPT_JITSERVER) */ /* please insert new codes before compilationMaxError which is used in jar2jxe to test the error codes range */ /* If new codes are added then add the corresponding names in compilationErrorNames table in rossa.cpp */ diff --git a/runtime/compiler/env/J9ClassEnv.cpp b/runtime/compiler/env/J9ClassEnv.cpp index e70ccca4f97..a3d8ae7b6d6 100644 --- a/runtime/compiler/env/J9ClassEnv.cpp +++ b/runtime/compiler/env/J9ClassEnv.cpp @@ -449,7 +449,9 @@ J9::ClassEnv::enumerateFields(TR::Region& region, TR_OpaqueClassBlock * opaqueCl dataType = TR::Double; break; } - case 'L': +// VALHALLA_TODO: Might require different TR::DataType for value types (Q) + case 'L': + case 'Q': case '[': { dataType = TR::Address; @@ -629,7 +631,7 @@ J9::ClassEnv::isValueTypeClass(TR_OpaqueClassBlock *clazz) uintptr_t classFlags = 0; JITServerHelpers::getAndCacheRAMClassInfo((J9Class *)clazz, TR::compInfoPT->getClientData(), stream, JITServerHelpers::CLASSINFO_CLASS_FLAGS, (void *)&classFlags); #ifdef DEBUG - stream->write(JITServer::MessageType::ClassEnv_classFlagsValue, classPointer); + stream->write(JITServer::MessageType::ClassEnv_classFlagsValue, clazz); uintptr_t classFlagsRemote = std::get<0>(stream->read()); // Check that class flags from remote call is equal to the cached ones classFlags = classFlags & J9ClassIsValueType; diff --git a/runtime/compiler/env/VMJ9.cpp b/runtime/compiler/env/VMJ9.cpp index 2a66f1799bb..34c444b6012 100644 --- a/runtime/compiler/env/VMJ9.cpp +++ b/runtime/compiler/env/VMJ9.cpp @@ -7006,7 +7006,7 @@ TR_J9VM::getClassFromSignature(const char * sig, int32_t sigLength, J9ConstantPo // For a non-array class type, strip off the first 'L' and last ';' of the // signature // - if (* sig == 'L' && sigLength > 2) + if ((*sig == 'L' || *sig == 'Q') && sigLength > 2) { sig += 1; sigLength -= 2; @@ -8880,7 +8880,7 @@ TR_J9SharedCacheVM::isPrimitiveClass(TR_OpaqueClassBlock * classPointer) TR_ASSERT(comp, "Should be called only within a compilation"); bool validated = false; - bool isPrimClass = TR_J9VMBase::isPrimitiveClass(classPointer);; + bool isPrimClass = TR_J9VMBase::isPrimitiveClass(classPointer); if (comp->getOption(TR_UseSymbolValidationManager)) { diff --git a/runtime/compiler/ilgen/J9ByteCodeIlGenerator.hpp b/runtime/compiler/ilgen/J9ByteCodeIlGenerator.hpp index 396733d73fb..cdb46927cae 100644 --- a/runtime/compiler/ilgen/J9ByteCodeIlGenerator.hpp +++ b/runtime/compiler/ilgen/J9ByteCodeIlGenerator.hpp @@ -229,6 +229,7 @@ class TR_J9ByteCodeIlGenerator : public TR_IlGenerator, public TR_J9ByteCodeIter void genMonitorExit(bool); TR_OpaqueClassBlock *loadValueClass(int32_t classCpIndex); void genDefaultValue(uint16_t classCpIndex); + void genDefaultValue(TR_OpaqueClassBlock *valueTypeClass); void genWithField(uint16_t fieldCpIndex); void genFlush(int32_t nargs); void genFullFence(TR::Node *node); diff --git a/runtime/compiler/ilgen/J9ByteCodeIterator.cpp b/runtime/compiler/ilgen/J9ByteCodeIterator.cpp index 24708919f47..e5cdbce5c25 100644 --- a/runtime/compiler/ilgen/J9ByteCodeIterator.cpp +++ b/runtime/compiler/ilgen/J9ByteCodeIterator.cpp @@ -358,14 +358,8 @@ const TR_J9ByteCode TR_J9ByteCodeIterator::_opCodeToByteCodeEnum[] = /* 198 */ J9BCifnull, J9BCifnonnull, /* 200 */ J9BCgotow, J9BCunknown, /* 202 */ J9BCbreakpoint, - -#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) /* 203 */ J9BCdefaultvalue, /* 204 */ J9BCwithfield, -#else /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ - /* 203 */ J9BCunknown, - /* 204 */ J9BCunknown, -#endif /* 205 */ J9BCunknown, J9BCunknown, J9BCunknown, J9BCunknown, /* 209 */ J9BCunknown, J9BCunknown, J9BCunknown, J9BCunknown, /* 213 */ J9BCiincw, J9BCunknown, @@ -826,6 +820,9 @@ const uint8_t TR_J9ByteCodeIterator::_estimatedCodeSize[] = 25, // J9BCmonitorenter 25, // J9BCmonitorexit 0, // J9BCwide + 0, // J9BCasyncCheck + 1, // J9BCdefaultvalue + 1, // J9BCwithfield 0, // J9BCunknown }; diff --git a/runtime/compiler/ilgen/Walker.cpp b/runtime/compiler/ilgen/Walker.cpp index 0ab6f77e688..5c5d94180ac 100644 --- a/runtime/compiler/ilgen/Walker.cpp +++ b/runtime/compiler/ilgen/Walker.cpp @@ -30,6 +30,7 @@ #include "env/CompilerEnv.hpp" #include "env/PersistentCHTable.hpp" #include "env/StackMemoryRegion.hpp" +#include "env/TypeLayout.hpp" #include "env/jittypes.h" #include "env/VMAccessCriticalSection.hpp" #include "exceptions/AOTFailure.hpp" @@ -546,6 +547,18 @@ TR::Block * TR_J9ByteCodeIlGenerator::walker(TR::Block * prevBlock) break; case J9BCdefaultvalue: + { + if (TR::Compiler->om.areValueTypesEnabled()) + { + genDefaultValue(next2Bytes()); + _bcIndex += 3; + } + else + { + fej9()->unsupportedByteCode(comp(), opcode); + } + break; + } case J9BCwithfield: case J9BCbreakpoint: fej9()->unsupportedByteCode(comp(), opcode); @@ -5687,7 +5700,7 @@ TR_J9ByteCodeIlGenerator::loadFromCP(TR::DataType type, int32_t cpIndex) } break; default: - break; + break; } } @@ -5968,6 +5981,173 @@ TR_J9ByteCodeIlGenerator::genNew(TR::ILOpCodes opCode) genFlush(0); } +void +TR_J9ByteCodeIlGenerator::genDefaultValue(uint16_t cpIndex) + { + TR_OpaqueClassBlock *valueTypeClass = method()->getClassFromConstantPool(comp(), cpIndex); + genDefaultValue(valueTypeClass); + } + +void +TR_J9ByteCodeIlGenerator::genDefaultValue(TR_OpaqueClassBlock *valueTypeClass) + { + // valueTypeClass will be NULL if it is unresolved. Abort the compilation and + // track the failure with a static debug counter + if (valueTypeClass == NULL) + { + const int32_t bcIndex = currentByteCodeIndex(); + if (isOutermostMethod()) + { + TR::DebugCounter::incStaticDebugCounter(comp(), + TR::DebugCounter::debugCounterName(comp(), + "ilgen.abort/unresolved/defaultvalue/(%s)/bc=%d", + comp()->signature(), + bcIndex)); + } + else + { + TR::DebugCounter::incStaticDebugCounter(comp(), + TR::DebugCounter::debugCounterName(comp(), + "ilgen.abort/unresolved/defaultvalue/(%s)/bc=%d/root=(%s)", + _method->signature(comp()->trMemory()), + bcIndex, + comp()->signature())); + } + + comp()->failCompilation("Unresolved class encountered for defaultvalue bytecode instruction"); + } + + TR::SymbolReference *valueClassSymRef = symRefTab()->findOrCreateClassSymbol(_methodSymbol, 0, valueTypeClass); + + if (comp()->getOption(TR_TraceILGen)) + { + traceMsg(comp(), "Handling defaultvalue for valueClass %s\n", comp()->getDebug()->getName(valueClassSymRef)); + } + + loadSymbol(TR::loadaddr, valueClassSymRef); + + TR::Node *newValueNode = NULL; + + if (valueClassSymRef->isUnresolved()) + { + // IL generation for defaultvalue is currently only able to handle value type classes that have been resolved. + // If the class is still unresolved, abort the compilation and track the failure with a static debug counter. + const int32_t bcIndex = currentByteCodeIndex(); + if (isOutermostMethod()) + { + TR::DebugCounter::incStaticDebugCounter(comp(), + TR::DebugCounter::debugCounterName(comp(), + "ilgen.abort/unresolved/defaultvalue/(%s)/bc=%d", + comp()->signature(), + bcIndex)); + } + else + { + TR::DebugCounter::incStaticDebugCounter(comp(), + TR::DebugCounter::debugCounterName(comp(), + "ilgen.abort/unresolved/defaultvalue/(%s)/bc=%d/root=(%s)", + _method->signature(comp()->trMemory()), + bcIndex, + comp()->signature())); + } + + comp()->failCompilation("Unresolved class encountered for defaultvalue bytecode instruction"); + } + else + { + const TR::TypeLayout *typeLayout = comp()->typeLayout(valueTypeClass); + size_t fieldCount = typeLayout->count(); + + for (size_t idx = 0; idx < fieldCount; idx++) + { + const TR::TypeLayoutEntry &entry = typeLayout->entry(idx); + + if (comp()->getOption(TR_TraceILGen)) + { + traceMsg(comp(), "Handling defaultvalue for valueClass %s\n - field[%d] name %s type %d offset %d\n", comp()->getDebug()->getName(valueClassSymRef), idx, entry._fieldname, entry._datatype.getDataType(), entry._offset); + } + + // Supply default value that is appropriate for the type of the corresponding field + // All these are gathered up as operands of a newvalue instruction. + // + // For example, if a value type class "Val" has fields of type int, long, double, LIdent; + // and Qval2;, where value type class "Val2" has a field of type boolean, the following + // IL will be generated: + // + // newvalue jitNewValue // Default value of type Val + // loadaddr Val + // iconst 0 // int default value + // lconst 0 // long default value + // dconst 0.0 // double default value + // aconst 0 // default value (null reference) for class Ident + // newvalue jitNewValue // Default value of type Val2 + // loadaddr Val2 + // iconst 0 // boolean default value + // + switch (entry._datatype.getDataType()) + { + case TR::Int8: + case TR::Int16: + case TR::Int32: + { + loadConstant(TR::iconst, 0); + break; + } + case TR::Int64: + { + loadConstant(TR::lconst, (int64_t) 0ll); + break; + } + case TR::Float: + { + loadConstant(TR::fconst, 0.0f); + break; + } + case TR::Double: + { + loadConstant(TR::dconst, 0.0); + break; + } + case TR::Address: + { + const char *fieldSignature = entry._typeSignature; + + // If the field's signature begins with a Q, it is a value type and should be initialized with a default value + // for that value type. That's handled with a recursive call to genDefaultValue. + // If the signature does not begin with a Q, the field is an identity type whose default value is a Java null + /// reference. + if (fieldSignature[0] == 'Q') + { + TR_OpaqueClassBlock *fieldClass = fej9()->getClassFromSignature(fieldSignature, (int32_t)strlen(fieldSignature), + comp()->getCurrentMethod()); + genDefaultValue(fieldClass); + } + else if (comp()->target().is64Bit()) + { + loadConstant(TR::aconst, (int64_t)0); + } + else + { + loadConstant(TR::aconst, (int32_t)0); + } + break; + } + default: + { + TR_ASSERT_FATAL(false, "Unexpected type for defaultvalue field\n"); + } + } + } + + newValueNode = genNodeAndPopChildren(TR::newvalue, fieldCount+1, symRefTab()->findOrCreateNewValueSymbolRef(_methodSymbol)); + newValueNode->setIdentityless(true); + } + + genTreeTop(newValueNode); + push(newValueNode); + genFlush(0); + } + void TR_J9ByteCodeIlGenerator::genNewArray(int32_t typeIndex) { diff --git a/runtime/compiler/optimizer/DataAccessAccelerator.cpp b/runtime/compiler/optimizer/DataAccessAccelerator.cpp index 6212a9d2d77..e7031d71679 100644 --- a/runtime/compiler/optimizer/DataAccessAccelerator.cpp +++ b/runtime/compiler/optimizer/DataAccessAccelerator.cpp @@ -633,7 +633,7 @@ bool TR_DataAccessAccelerator::inlineCheckPackedDecimal(TR::TreeTop* callTreeTop TR::Node* precisionNode = callNode->getChild(2); TR::Node* ignoreHighNibbleForEvenPrecisionNode = callNode->getChild(3); TR::Node* canOverwriteHighNibbleForEvenPrecisionNode = callNode->getChild(4); - int32_t precision = precisionNode->getInt();; + int32_t precision = precisionNode->getInt(); char* failMsg = NULL; if (!precisionNode->getOpCode().isLoadConst()) diff --git a/runtime/compiler/optimizer/J9RecognizedCallTransformer.cpp b/runtime/compiler/optimizer/J9RecognizedCallTransformer.cpp index b8e5b97991d..0dc9aa78449 100644 --- a/runtime/compiler/optimizer/J9RecognizedCallTransformer.cpp +++ b/runtime/compiler/optimizer/J9RecognizedCallTransformer.cpp @@ -386,7 +386,7 @@ bool J9::RecognizedCallTransformer::isInlineable(TR::TreeTop* treetop) return !comp()->compileRelocatableCode(); case TR::java_lang_StrictMath_sqrt: case TR::java_lang_Math_sqrt: - return comp()->target().cpu.getSupportsHardwareSQRT();; + return comp()->target().cpu.getSupportsHardwareSQRT(); default: return false; } diff --git a/runtime/compiler/optimizer/J9ValuePropagation.cpp b/runtime/compiler/optimizer/J9ValuePropagation.cpp index 4c7724ac1c6..d057d8ea199 100644 --- a/runtime/compiler/optimizer/J9ValuePropagation.cpp +++ b/runtime/compiler/optimizer/J9ValuePropagation.cpp @@ -1433,7 +1433,7 @@ J9::ValuePropagation::innerConstrainAcall(TR::Node *node) if (trace()) traceMsg(comp(), "Object Clone: Resolved Class of node %p array clone\n", node); _arrayCloneCalls.add(_curTree); - _arrayCloneTypes.add(new (trStackMemory()) OMR::ValuePropagation::ArrayCloneInfo(constraint->getClass(), false));; + _arrayCloneTypes.add(new (trStackMemory()) OMR::ValuePropagation::ArrayCloneInfo(constraint->getClass(), false)); } } #endif diff --git a/runtime/compiler/optimizer/SignExtendLoads.cpp b/runtime/compiler/optimizer/SignExtendLoads.cpp index a8fd8b1959a..7ae2d147fb1 100644 --- a/runtime/compiler/optimizer/SignExtendLoads.cpp +++ b/runtime/compiler/optimizer/SignExtendLoads.cpp @@ -115,7 +115,7 @@ void TR_SignExtendLoads::emptyHashTable() { if(false)traceMsg(comp(), "emptying the hash table\n"); for(int i=0; i < _sharedNodesHash._numBuckets;++i) - _sharedNodesHash._buckets[i] = NULL;; + _sharedNodesHash._buckets[i] = NULL; } // ------------------------------------------------------------------------------------------- diff --git a/runtime/compiler/runtime/ClassUnloadAssumption.cpp b/runtime/compiler/runtime/ClassUnloadAssumption.cpp index 3cc4b281716..3117749abec 100644 --- a/runtime/compiler/runtime/ClassUnloadAssumption.cpp +++ b/runtime/compiler/runtime/ClassUnloadAssumption.cpp @@ -716,6 +716,11 @@ void TR_UnloadedClassPicSite::compensate(TR_FrontEnd *, bool isSMP, void *) value |= 0x03a00001; *((uint32_t *)_picLocation) = value; armCodeSync(_picLocation, 4); +#elif defined(TR_HOST_ARM64) + // On aarch64, we use constant data snippet for class unloading pic site + extern void arm64CodeSync(unsigned char *codeStart, unsigned int codeSize); + *(int64_t *)_picLocation = -1; + arm64CodeSync(_picLocation, 8); #else // TR_ASSERT(0, "unloaded class PIC patching is not implemented on this platform yet"); #endif @@ -983,10 +988,10 @@ TR_RuntimeAssumptionTable::notifyClassRedefinitionEvent(TR_FrontEnd *vm, bool is TR_VerboseLog::writeLineLocked(TR_Vlog_RA, "o=%p @ %p r=%p %p %p %p", initialKey, pic_cursor->getPicLocation(), resolvedKey1, resolvedKey2, resolvedKey3, resolvedKey4); - *(uint32_t *)(pic_cursor->getPicLocation()) = resolvedKey1 & 0xffff0000 | (uint32_t)((uintptr_t)newKey >> 48);; - *(uint32_t *)(pic_cursor->getPicLocation()+4) = resolvedKey2 & 0xffff0000 | (uint32_t)((uintptr_t)newKey >> 32 & 0xffff);; - *(uint32_t *)(pic_cursor->getPicLocation()+12) = resolvedKey3 & 0xffff0000 | (uint32_t)((uintptr_t)newKey >> 16 & 0xffff);; - *(uint32_t *)(pic_cursor->getPicLocation()+16) = resolvedKey4 & 0xffff0000 | (uint32_t)((uintptr_t)newKey & 0xffff);; + *(uint32_t *)(pic_cursor->getPicLocation()) = resolvedKey1 & 0xffff0000 | (uint32_t)((uintptr_t)newKey >> 48); + *(uint32_t *)(pic_cursor->getPicLocation()+4) = resolvedKey2 & 0xffff0000 | (uint32_t)((uintptr_t)newKey >> 32 & 0xffff); + *(uint32_t *)(pic_cursor->getPicLocation()+12) = resolvedKey3 & 0xffff0000 | (uint32_t)((uintptr_t)newKey >> 16 & 0xffff); + *(uint32_t *)(pic_cursor->getPicLocation()+16) = resolvedKey4 & 0xffff0000 | (uint32_t)((uintptr_t)newKey & 0xffff); if (reportDetails) { TR_VerboseLog::vlogAcquire(); diff --git a/runtime/compiler/runtime/RelocationRecord.cpp b/runtime/compiler/runtime/RelocationRecord.cpp index 7ddffaa23d0..ba630955e41 100644 --- a/runtime/compiler/runtime/RelocationRecord.cpp +++ b/runtime/compiler/runtime/RelocationRecord.cpp @@ -3841,7 +3841,7 @@ TR_RelocationRecordValidateMethodFromSingleImpl::applyRelocation(TR_RelocationRu uint16_t thisClassID = reloTarget->loadUnsigned16b((uint8_t *) &((TR_RelocationRecordValidateMethodFromSingleImplBinaryTemplate *)_record)->_thisClassID); int32_t cpIndexOrVftSlot = reloTarget->loadSigned32b((uint8_t *) &((TR_RelocationRecordValidateMethodFromSingleImplBinaryTemplate *)_record)->_cpIndexOrVftSlot); uint16_t callerMethodID = reloTarget->loadUnsigned16b((uint8_t *) &((TR_RelocationRecordValidateMethodFromSingleImplBinaryTemplate *)_record)->_callerMethodID); - uint16_t useGetResolvedInterfaceMethod = reloTarget->loadUnsigned16b((uint8_t *) &((TR_RelocationRecordValidateMethodFromSingleImplBinaryTemplate *)_record)->_useGetResolvedInterfaceMethod);; + uint16_t useGetResolvedInterfaceMethod = reloTarget->loadUnsigned16b((uint8_t *) &((TR_RelocationRecordValidateMethodFromSingleImplBinaryTemplate *)_record)->_useGetResolvedInterfaceMethod); if (reloRuntime->reloLogger()->logEnabled()) { diff --git a/runtime/compiler/x/codegen/X86HelperLinkage.hpp b/runtime/compiler/x/codegen/X86HelperLinkage.hpp index f7309518097..b5865fe52e5 100644 --- a/runtime/compiler/x/codegen/X86HelperLinkage.hpp +++ b/runtime/compiler/x/codegen/X86HelperLinkage.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2019 IBM Corp. and others + * Copyright (c) 2000, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -80,7 +80,7 @@ class HelperCallSite static const bool CalleeCleanup; static const bool RegisterParameterShadowOnStack; static const size_t StackSlotSize; - static const size_t NumberOfIntParamRegisters;; + static const size_t NumberOfIntParamRegisters; static const size_t StackIndexAdjustment; static const TR::RealRegister::RegNum IntParamRegisters[]; static const TR::RealRegister::RegNum CallerSavedRegisters[]; diff --git a/runtime/gc_glue_java/FlattenedArrayObjectScanner.hpp b/runtime/gc_glue_java/FlattenedArrayObjectScanner.hpp new file mode 100644 index 00000000000..b11080f8fdc --- /dev/null +++ b/runtime/gc_glue_java/FlattenedArrayObjectScanner.hpp @@ -0,0 +1,255 @@ +/******************************************************************************* + * Copyright (c) 2020, 2020 IBM Corp. and others + * + * 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] http://openjdk.java.net/legal/assembly-exception.html + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception + *******************************************************************************/ + +#if !defined(FLATTENEDARRAYOBJECTSCANNER_HPP_) +#define FLATTENEDARRAYOBJECTSCANNER_HPP_ + +#include "j9.h" +#include "j9cfg.h" +#include "modron.h" + +#include "objectdescription.h" +#include "ArrayObjectModel.hpp" +#include "GCExtensionsBase.hpp" +#include "HeadlessMixedObjectScanner.hpp" +#include "IndexableObjectScanner.hpp" + +class GC_FlattenedArrayObjectScanner : public GC_HeadlessMixedObjectScanner +{ + /* Data Members */ +private: + + MM_EnvironmentBase *_env; + uintptr_t _elementSizeWithoutPadding; /**< Size of the flattened element, without padding */ + uintptr_t *_descriptionBasePtr; /**< Pointer to the description base */ +#if defined(OMR_GC_LEAF_BITS) + uintptr_t *_leafBasePtr; /**< Pointer to the leaf description base */ +#endif /* defined(OMR_GC_LEAF_BITS) */ + GC_IndexableObjectScanner _indexableScanner; /**< Used to iterate the array by element */ + +protected: + +public: + + /* Methods */ +private: + +protected: + + /** + * @param env The scanning thread environment + * @param arrayPtr pointer to the array to be processed + * @param basePtr pointer to the first contiguous array cell + * @param limitPtr pointer to end of last contiguous array cell + * @param scanPtr pointer to the array cell where scanning will start + * @param endPtr pointer to the array cell where scanning will stop + * @param scanMap The first scan map + * @param elementSize The size of each element, without padding + * @param elementStride The stride of each element, including element padding + * @param flags Scanning context flags + */ + MMINLINE GC_FlattenedArrayObjectScanner( + MM_EnvironmentBase *env + , omrobjectptr_t arrayPtr + , fomrobject_t *basePtr + , fomrobject_t *limitPtr + , fomrobject_t *scanPtr + , fomrobject_t *endPtr + , uintptr_t elementSize + , uintptr_t elementStride + , uintptr_t *descriptionBasePtr +#if defined(OMR_GC_LEAF_BITS) + , uintptr_t *leafBasePtr +#endif /* defined(OMR_GC_LEAF_BITS) */ + , uintptr_t flags) + : GC_HeadlessMixedObjectScanner(env, scanPtr, elementSize, flags | GC_ObjectScanner::indexableObject) + , _env(env) + , _elementSizeWithoutPadding(elementSize) + , _descriptionBasePtr(descriptionBasePtr) +#if defined(OMR_GC_LEAF_BITS) + , _leafBasePtr(leafBasePtr) +#endif /* defined(OMR_GC_LEAF_BITS) */ + /* Pass 0 for scanMap, as the indexable iterator does not use the scanMap */ + , _indexableScanner(env, arrayPtr, basePtr, limitPtr, scanPtr, endPtr, 0, elementStride, flags) + { + _typeId = __FUNCTION__; + } + + MMINLINE void + initialize(MM_EnvironmentBase *env) + { +#if defined(OMR_GC_LEAF_BITS) + GC_HeadlessMixedObjectScanner::initialize(env, _descriptionBasePtr, _leafBasePtr); +#else /* defined(OMR_GC_LEAF_BITS) */ + GC_HeadlessMixedObjectScanner::initialize(env, _descriptionBasePtr); +#endif /* defined(OMR_GC_LEAF_BITS) */ + + _indexableScanner.initialize(env); + + /* The HeadlessMixedObjectScanner will setNoMoreSlots() causing us + * to miss other elements of the array + */ + setMoreSlots(); + } + +public: + + /** + * @param[in] env The scanning thread environment + * @param[in] objectPtr pointer to the array to be processed + * @param[in] allocSpace pointer to space within which the scanner should be instantiated (in-place) + * @param[in] flags Scanning context flags + * @param[in] splitAmount If >0, the number of elements to include for this scanner instance; if 0, include all elements + * @param[in] startIndex The index of the first element to scan + */ + MMINLINE static GC_FlattenedArrayObjectScanner * + newInstance(MM_EnvironmentBase *env, omrobjectptr_t objectPtr, void *allocSpace, uintptr_t flags, uintptr_t splitAmount, uintptr_t startIndex = 0) + { + GC_FlattenedArrayObjectScanner *objectScanner = (GC_FlattenedArrayObjectScanner *)allocSpace; + GC_ArrayObjectModel *arrayObjectModel = &(env->getExtensions()->indexableObjectModel); + J9Class *clazzPtr = J9GC_J9OBJECT_CLAZZ(objectPtr, env); + J9ArrayClass *j9ArrayClass = (J9ArrayClass *) clazzPtr; + + /* TODO are these always the same? */ + Assert_MM_true(j9ArrayClass->componentType == j9ArrayClass->leafComponentType); + + J9Class *elementClass = j9ArrayClass->componentType; + omrarrayptr_t arrayPtr = (omrarrayptr_t)objectPtr; + + uintptr_t sizeInElements = arrayObjectModel->getSizeInElements(arrayPtr); + uintptr_t elementSize = J9_VALUETYPE_FLATTENED_SIZE(elementClass); + uintptr_t elementStride = J9ARRAYCLASS_GET_STRIDE(clazzPtr); + fomrobject_t *basePtr = (fomrobject_t *)arrayObjectModel->getDataPointerForContiguous(arrayPtr); + fomrobject_t *limitPtr = (fomrobject_t *)((uintptr_t)basePtr + (sizeInElements * elementStride)); + fomrobject_t *scanPtr = (fomrobject_t *)((uintptr_t)basePtr + (startIndex * elementStride)); + fomrobject_t *endPtr = limitPtr; + if (!GC_ObjectScanner::isIndexableObjectNoSplit(flags) && (splitAmount != 0)) { + Assert_MM_unreachable(); + endPtr = (fomrobject_t *)((uintptr_t)scanPtr + (splitAmount * elementStride)); + if (endPtr > limitPtr) { + endPtr = limitPtr; + } + } + uintptr_t *instanceDescription = elementClass->instanceDescription; +#if defined(OMR_GC_LEAF_BITS) + uintptr_t *leafDescription = elementClass->instanceLeafDescription; + new(objectScanner) GC_FlattenedArrayObjectScanner(env, objectPtr, basePtr, limitPtr, scanPtr, endPtr, elementSize, elementStride, instanceDescription, leafDescription, flags); +#else /* defined(OMR_GC_LEAF_BITS) */ + new(objectScanner) GC_FlattenedArrayObjectScanner(env, objectPtr, basePtr, limitPtr, scanPtr, endPtr, elementSize, elementStride, instanceDescription, flags); +#endif /* defined(OMR_GC_LEAF_BITS) */ + + objectScanner->initialize(env); + if (0 != startIndex) { + objectScanner->clearHeadObjectScanner(); + } + return objectScanner; + } + + MMINLINE uintptr_t getBytesRemaining() { return sizeof(fomrobject_t) * (_endPtr - _scanPtr); } + + /** + * @param env The scanning thread environment + * @param allocSpace pointer to space within which the scanner should be instantiated (in-place) + * @param splitAmount The maximum number of array elements to include + * @return Pointer to split scanner in allocSpace + */ + GC_IndexableObjectScanner * + splitTo(MM_EnvironmentBase *env, void *allocSpace, uintptr_t splitAmount) + { + Assert_MM_unimplemented(); + } + + /** + * Return base pointer and slot bit map for next block of contiguous slots to be scanned. The + * base pointer must be fomrobject_t-aligned. Bits in the bit map are scanned in order of + * increasing significance, and the least significant bit maps to the slot at the returned + * base pointer. + * + * @param[out] scanMap the bit map for the slots contiguous with the returned base pointer + * @param[out] hasNextSlotMap set this to true if this method should be called again, false if this map is known to be last + * @return a pointer to the first slot mapped by the least significant bit of the map, or NULL if no more slots + */ + virtual fomrobject_t * + getNextSlotMap(uintptr_t *slotMap, bool *hasNextSlotMap) + { + fomrobject_t *result = GC_HeadlessMixedObjectScanner::getNextSlotMap(slotMap, hasNextSlotMap); + /* Ignore hasNextSlotMap from HeadLess, we want to always report that there is another element */ + *hasNextSlotMap = true; + if (result == NULL) { + /* No more slots in the current element, get the next element of the array */ + result = _indexableScanner.nextIndexableElement(); + if (result == NULL) { + /* There are no elements in the array */ + *hasNextSlotMap = false; + } else { + _mapPtr = result; + _endPtr = (fomrobject_t *)((uintptr_t)_mapPtr + _elementSizeWithoutPadding); + GC_HeadlessMixedObjectScanner::initialize(_env, _descriptionBasePtr, _leafBasePtr); + /* GC_HeadlessMixedObjectScanner::initialize() may setNoMoreSlots(), so set it back to true. + * We must also return (hasNextSlotMap = true) on top of this + */ + setMoreSlots(); + } + } + return result; + } + +#if defined(OMR_GC_LEAF_BITS) + /** + * Return base pointer and slot bit map for next block of contiguous slots to be scanned. The + * base pointer must be fomrobject_t-aligned. Bits in the bit map are scanned in order of + * increasing significance, and the least significant bit maps to the slot at the returned + * base pointer. + * + * @param[out] scanMap the bit map for the slots contiguous with the returned base pointer + * @param[out] leafMap the leaf bit map for the slots contiguous with the returned base pointer + * @param[out] hasNextSlotMap set this to true if this method should be called again, false if this map is known to be last + * @return a pointer to the first slot mapped by the least significant bit of the map, or NULL if no more slots + */ + virtual fomrobject_t * + getNextSlotMap(uintptr_t *slotMap, uintptr_t *leafMap, bool *hasNextSlotMap) + { + fomrobject_t *result = GC_HeadlessMixedObjectScanner::getNextSlotMap(slotMap, leafMap, hasNextSlotMap); + /* Ignore hasNextSlotMap from HeadLess, we want to always report that there is another element */ + *hasNextSlotMap = true; + if (result == NULL) { + /* No more slots in the current element, get the next element of the array */ + result = _indexableScanner.nextIndexableElement(); + if (result == NULL) { + /* There are no elements in the array */ + *hasNextSlotMap = false; + } else { + _mapPtr = result; + _endPtr = (fomrobject_t *)((uintptr_t)_mapPtr + _elementSizeWithoutPadding); + GC_HeadlessMixedObjectScanner::initialize(_env, _descriptionBasePtr, _leafBasePtr); + /* GC_HeadlessMixedObjectScanner::initialize() may setNoMoreSlots(), so set it back to true. + * We must also return (hasNextSlotMap = true) on top of this + */ + setMoreSlots(); + } + } + return result; + } +#endif /* defined(OMR_GC_LEAF_BITS) */ +}; + +#endif /* FLATTENEDARRAYOBJECTSCANNER_HPP_ */ diff --git a/runtime/gc_glue_java/HeadlessMixedObjectScanner.hpp b/runtime/gc_glue_java/HeadlessMixedObjectScanner.hpp index ce2319a5ddb..e01182e11ac 100644 --- a/runtime/gc_glue_java/HeadlessMixedObjectScanner.hpp +++ b/runtime/gc_glue_java/HeadlessMixedObjectScanner.hpp @@ -31,15 +31,15 @@ class GC_HeadlessMixedObjectScanner : public GC_ObjectScanner { /* Data Members */ private: - fomrobject_t * const _endPtr; /**< end scan pointer */ + +protected: + fomrobject_t *_endPtr; /**< end scan pointer */ fomrobject_t *_mapPtr; /**< pointer to first slot in current scan segment */ uintptr_t *_descriptionPtr; /**< current description pointer */ #if defined(J9VM_GC_LEAF_BITS) uintptr_t *_leafPtr; /**< current leaf description pointer */ #endif /* J9VM_GC_LEAF_BITS */ -protected: - public: /* Member Functions */ @@ -51,13 +51,14 @@ class GC_HeadlessMixedObjectScanner : public GC_ObjectScanner /** * @param env The scanning thread environment - * @param[in] objectPtr the object to be processed - * @param[in] flags Scanning context flags + * @param scanPtr Pointer to the start of the object + * @param size The instance size + * @param flags Scanning context flags */ - MMINLINE GC_HeadlessMixedObjectScanner(MM_EnvironmentBase *env, J9Class *clazzPtr, fomrobject_t *scanPtr, uintptr_t flags) + MMINLINE GC_HeadlessMixedObjectScanner(MM_EnvironmentBase *env, fomrobject_t *scanPtr, uintptr_t size, uintptr_t flags) : GC_ObjectScanner(env, scanPtr, 0, flags) - , _endPtr((fomrobject_t *)((uint8_t*)_scanPtr + env->getExtensions()->mixedObjectModel.getSizeInBytesWithoutHeader(clazzPtr))) - , _mapPtr(_scanPtr) + , _endPtr((fomrobject_t *)((uintptr_t)scanPtr + size)) + , _mapPtr(scanPtr) , _descriptionPtr(NULL) #if defined(J9VM_GC_LEAF_BITS) , _leafPtr(NULL) @@ -66,19 +67,15 @@ class GC_HeadlessMixedObjectScanner : public GC_ObjectScanner _typeId = __FUNCTION__; } - /** - * Subclasses must call this method to set up the instance description bits and description pointer. - * @param[in] env The scanning thread environment - */ MMINLINE void - initialize(MM_EnvironmentBase *env, J9Class *clazzPtr) + initialize(MM_EnvironmentBase *env, uintptr_t *descriptionPtr, uintptr_t *leafPtr) { GC_ObjectScanner::initialize(env); /* Initialize the slot map from description bits */ - _scanMap = (uintptr_t)clazzPtr->instanceDescription; + _scanMap = (uintptr_t)descriptionPtr; #if defined(J9VM_GC_LEAF_BITS) - _leafMap = (uintptr_t)clazzPtr->instanceLeafDescription; + _leafMap = (uintptr_t)leafPtr; #endif /* J9VM_GC_LEAF_BITS */ if (_scanMap & 1) { _scanMap >>= 1; @@ -99,7 +96,13 @@ class GC_HeadlessMixedObjectScanner : public GC_ObjectScanner #endif /* J9VM_GC_LEAF_BITS */ } } - + + MMINLINE void + initialize(MM_EnvironmentBase *env, uintptr_t *descriptionPtr) + { + initialize(env, descriptionPtr, NULL); + } + MMINLINE uintptr_t getBytesRemaining() { return (uintptr_t)_endPtr - (uintptr_t)_scanPtr; } /** diff --git a/runtime/gc_glue_java/MarkingDelegate.hpp b/runtime/gc_glue_java/MarkingDelegate.hpp index faa690d4236..a2b6794e959 100644 --- a/runtime/gc_glue_java/MarkingDelegate.hpp +++ b/runtime/gc_glue_java/MarkingDelegate.hpp @@ -26,6 +26,7 @@ #include "j9nonbuilder.h" #include "objectdescription.h" +#include "FlattenedArrayObjectScanner.hpp" #include "GCExtensions.hpp" #if defined(J9VM_GC_DYNAMIC_CLASS_UNLOADING) #include "MarkMap.hpp" @@ -137,8 +138,10 @@ class MM_MarkingDelegate } case GC_ObjectModel::SCAN_FLATTENED_ARRAY_OBJECT: { - Assert_MM_true(J9_IS_J9CLASS_FLATTENED(clazz)); - Assert_MM_unimplemented(); + /* TODO: Flattened arrays do not support array splitting */ + uintptr_t slotsToDo = 0; + uintptr_t startIndex = 0; + objectScanner = GC_FlattenedArrayObjectScanner::newInstance(env, objectPtr, scannerSpace, GC_ObjectScanner::indexableObject, slotsToDo, startIndex); break; } case GC_ObjectModel::SCAN_REFERENCE_MIXED_OBJECT: diff --git a/runtime/gc_glue_java/MixedObjectScanner.hpp b/runtime/gc_glue_java/MixedObjectScanner.hpp index 56a7a6838a1..90a2cc58ce6 100644 --- a/runtime/gc_glue_java/MixedObjectScanner.hpp +++ b/runtime/gc_glue_java/MixedObjectScanner.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2019 IBM Corp. and others + * Copyright (c) 2016, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -53,11 +53,11 @@ class GC_MixedObjectScanner : public GC_HeadlessMixedObjectScanner protected: /** * @param env The scanning thread environment - * @param[in] objectPtr the object to be processed - * @param[in] flags Scanning context flags + * @param objectPtr the object to be processed + * @param flags Scanning context flags */ MMINLINE GC_MixedObjectScanner(MM_EnvironmentBase *env, omrobjectptr_t objectPtr, uintptr_t flags) - : GC_HeadlessMixedObjectScanner(env, J9GC_J9OBJECT_CLAZZ(objectPtr, env), env->getExtensions()->mixedObjectModel.getHeadlessObject(objectPtr), flags) + : GC_HeadlessMixedObjectScanner(env, env->getExtensions()->mixedObjectModel.getHeadlessObject(objectPtr), env->getExtensions()->mixedObjectModel.getSizeInBytesWithoutHeader(J9GC_J9OBJECT_CLAZZ(objectPtr, env)), flags) { _typeId = __FUNCTION__; } @@ -69,7 +69,11 @@ class GC_MixedObjectScanner : public GC_HeadlessMixedObjectScanner MMINLINE void initialize(MM_EnvironmentBase *env, J9Class *clazzPtr) { - GC_HeadlessMixedObjectScanner::initialize(env, clazzPtr); +#if defined(J9VM_GC_LEAF_BITS) + GC_HeadlessMixedObjectScanner::initialize(env, clazzPtr->instanceDescription, clazzPtr->instanceLeafDescription); +#else /* J9VM_GC_LEAF_BITS */ + GC_HeadlessMixedObjectScanner::initialize(env, clazzPtr->instanceDescription); +#endif /* J9VM_GC_LEAF_BITS */ } public: @@ -85,8 +89,10 @@ class GC_MixedObjectScanner : public GC_HeadlessMixedObjectScanner newInstance(MM_EnvironmentBase *env, omrobjectptr_t objectPtr, void *allocSpace, uintptr_t flags) { GC_MixedObjectScanner *objectScanner = (GC_MixedObjectScanner *)allocSpace; + J9Class *classPtr = J9GC_J9OBJECT_CLAZZ(objectPtr, env); + new(objectScanner) GC_MixedObjectScanner(env, objectPtr, flags); - objectScanner->initialize(env, J9GC_J9OBJECT_CLAZZ(objectPtr, env)); + objectScanner->initialize(env, classPtr); return objectScanner; } }; diff --git a/runtime/gc_glue_java/ObjectScannerState.hpp b/runtime/gc_glue_java/ObjectScannerState.hpp index df7391c17e9..10b4348d118 100644 --- a/runtime/gc_glue_java/ObjectScannerState.hpp +++ b/runtime/gc_glue_java/ObjectScannerState.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2014 IBM Corp. and others + * Copyright (c) 1991, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -28,6 +28,7 @@ #if !defined(OBJECTSCANNERSTATE_HPP_) #define OBJECTSCANNERSTATE_HPP_ +#include "FlattenedArrayObjectScanner.hpp" #include "MixedObjectScanner.hpp" #include "PointerArrayObjectScanner.hpp" #include "ReferenceObjectScanner.hpp" @@ -42,6 +43,7 @@ typedef union GC_ObjectScannerState uint8_t mixed[sizeof(GC_MixedObjectScanner)]; uint8_t reference[sizeof(GC_ReferenceObjectScanner)]; uint8_t pointerArray[sizeof(GC_PointerArrayObjectScanner)]; + uint8_t flattenedArray[sizeof(GC_FlattenedArrayObjectScanner)]; } GC_ObjectScannerState; #endif /* OBJECTSCANNERSTATE_HPP_ */ diff --git a/runtime/gc_vlhgc/EnvironmentVLHGC.cpp b/runtime/gc_vlhgc/EnvironmentVLHGC.cpp index 6556cb434bf..199d7333ac8 100644 --- a/runtime/gc_vlhgc/EnvironmentVLHGC.cpp +++ b/runtime/gc_vlhgc/EnvironmentVLHGC.cpp @@ -1,6 +1,5 @@ - /******************************************************************************* - * Copyright (c) 1991, 2019 IBM Corp. and others + * Copyright (c) 1991, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -85,7 +84,7 @@ MM_EnvironmentVLHGC::newInstance(MM_GCExtensionsBase *extensions, OMR_VMThread * void MM_EnvironmentVLHGC::kill() { - MM_EnvironmentBase::kill();; + MM_EnvironmentBase::kill(); } bool diff --git a/runtime/jcl/common/sun_reflect_ConstantPool.c b/runtime/jcl/common/sun_reflect_ConstantPool.c index 3d26ca4a048..fcdaad55acc 100644 --- a/runtime/jcl/common/sun_reflect_ConstantPool.c +++ b/runtime/jcl/common/sun_reflect_ConstantPool.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1998, 2019 IBM Corp. and others + * Copyright (c) 1998, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -779,7 +779,7 @@ Java_java_lang_invoke_MethodHandle_getCPConstantDynamicAt(JNIEnv *env, jclass un result = getRAMConstantRef(vmThread, constantPoolOop, cpIndex, J9CPTYPE_CONSTANT_DYNAMIC, (J9RAMConstantRef **) &ramConstantDynamicRef); if (OK == result) { J9Class *ramClass = J9CLASS_FROMCPINTERNALRAMCLASS(vmThread, constantPoolOop); - j9object_t value = J9STATIC_OBJECT_LOAD(vmThread, ramClass, &ramConstantDynamicRef->value);; + j9object_t value = J9STATIC_OBJECT_LOAD(vmThread, ramClass, &ramConstantDynamicRef->value); /* Check if the value is resolved, Void.Class exception represents a valid null reference */ if ((NULL == value) && (ramConstantDynamicRef->exception != vmThread->javaVM->voidReflectClass->classObject)) { diff --git a/runtime/jit_vm/ctsupport.cpp b/runtime/jit_vm/ctsupport.cpp index c454750ceed..b28162e1ac5 100644 --- a/runtime/jit_vm/ctsupport.cpp +++ b/runtime/jit_vm/ctsupport.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2019 IBM Corp. and others + * Copyright (c) 2008, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -202,6 +202,9 @@ jitParseSignature (const J9UTF8 *signature, U_8 *paramBuffer, UDATA *paramElemen state = returnValue; } else { switch (*sigChar) { + case 'Q': + /* VALHALLA_TODO: Need to return a J9_NATIVE_TYPE_VALUE for 'Q' in future */ + /* FALLTHROUGH */ case 'L': next = J9_NATIVE_TYPE_OBJECT; break; case '[': next = J9_NATIVE_TYPE_OBJECT; @@ -228,7 +231,7 @@ jitParseSignature (const J9UTF8 *signature, U_8 *paramBuffer, UDATA *paramElemen case 'V': next = J9_NATIVE_TYPE_VOID; break; } - if ('L' == *sigChar) { + if ('L' == *sigChar || 'Q' == *sigChar) { /* flush the name of the class */ while (';' != *sigChar) { ++sigChar; @@ -717,4 +720,4 @@ jitGetDeclaringClassOfROMField(J9VMThread *vmStruct, J9Class *clazz, J9ROMFieldS return currentClass; } -} /* extern "C" */ \ No newline at end of file +} /* extern "C" */ diff --git a/runtime/port/sysvipc/j9shmem.c b/runtime/port/sysvipc/j9shmem.c index 62ee896bf81..f90d1291c9c 100644 --- a/runtime/port/sysvipc/j9shmem.c +++ b/runtime/port/sysvipc/j9shmem.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2019 IBM Corp. and others + * Copyright (c) 1991, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -537,7 +537,7 @@ j9shmem_open (J9PortLibrary *portLibrary, const char* cacheDirName, uintptr_t gr Trc_PRT_shmem_j9shmem_open_ExitWithMsg("Error: Created shared memory, but could not attach."); } else { rc = J9PORT_ERROR_SHMEM_OPEN_ATTACHED_FAILED; - Trc_PRT_shmem_j9shmem_open_ExitWithMsg("Error: Opened shared memory, but could not attach.");; + Trc_PRT_shmem_j9shmem_open_ExitWithMsg("Error: Opened shared memory, but could not attach."); } *handle = tmphandle; return rc; diff --git a/runtime/port/win32/j9process.c b/runtime/port/win32/j9process.c index f767a34a3d8..9ddd2c8e26e 100644 --- a/runtime/port/win32/j9process.c +++ b/runtime/port/win32/j9process.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2019 IBM Corp. and others + * Copyright (c) 1991, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -269,7 +269,7 @@ j9process_create(struct J9PortLibrary *portLibrary, const char *command[], uintp if ( FLAG_IS_SET(J9PORT_PROCESS_INHERIT_STDIN, options) ) { processHandleStruct->inHandle = J9PORT_INVALID_FD; if (sinfo.dwFlags == STARTF_USESTDHANDLES) { - sinfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);; + sinfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE); } } else if ( J9PORT_INVALID_FD != j9fdInput ) { processHandleStruct->inHandle = J9PORT_INVALID_FD; @@ -303,7 +303,7 @@ j9process_create(struct J9PortLibrary *portLibrary, const char *command[], uintp if ( FLAG_IS_SET(J9PORT_PROCESS_INHERIT_STDOUT, options) ) { processHandleStruct->outHandle = J9PORT_INVALID_FD; if (sinfo.dwFlags == STARTF_USESTDHANDLES) { - sinfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);; + sinfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); } } else if ( J9PORT_INVALID_FD != j9fdOutput ) { if ( FLAG_IS_NOT_SET(J9PORT_PROCESS_IGNORE_OUTPUT, options) ) { diff --git a/runtime/rastrace/trccomponent.c b/runtime/rastrace/trccomponent.c index 942e53b2506..40f0943148a 100644 --- a/runtime/rastrace/trccomponent.c +++ b/runtime/rastrace/trccomponent.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1998, 2019 IBM Corp. and others + * Copyright (c) 1998, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -1029,7 +1029,7 @@ openFileFromDirectorySearchList(char *searchPath, char *fileName, int32_t flags, } offset += currentPathEntryEndsAt + 1; - nextPathEntry += currentPathEntryEndsAt + 1;; + nextPathEntry += currentPathEntryEndsAt + 1; } return fileHandle; diff --git a/runtime/shared_common/CacheLifecycleManager.cpp b/runtime/shared_common/CacheLifecycleManager.cpp index f5b8ed99297..3f59f504d08 100644 --- a/runtime/shared_common/CacheLifecycleManager.cpp +++ b/runtime/shared_common/CacheLifecycleManager.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2019 IBM Corp. and others + * Copyright (c) 2001, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -916,7 +916,7 @@ deleteSnapshot(struct J9JavaVM* vm, UDATA verboseFlags, const char* pathFileName CLM_ERR_TRACE1(J9NLS_SHRC_ERROR_SNAPSHOT_FILE_OPEN, pathFileName); rc = -2; } - goto done;; + goto done; } /* Get the length of the file, acquire file lock and delete the file in the lock */ fileSize = j9file_flength(fd); diff --git a/runtime/shared_common/CacheMap.cpp b/runtime/shared_common/CacheMap.cpp index b088f0f6b15..e2f4986ad6e 100644 --- a/runtime/shared_common/CacheMap.cpp +++ b/runtime/shared_common/CacheMap.cpp @@ -6846,7 +6846,7 @@ SH_CacheMap::appendCacheDescriptorList(J9VMThread* currentThread, J9SharedClassC J9SharedClassCacheDescriptor* cacheDescriptorTail = sharedClassConfig->cacheDescriptorList->previous; cacheDesc->cacheStartAddress = ccToUse->getCacheHeaderAddress(); cacheDesc->romclassStartAddress = ccToUse->getFirstROMClassAddress(_runningNested); - cacheDesc->metadataStartAddress = (U_8*)ccToUse->getClassDebugDataStartAddress() - sizeof(ShcItemHdr);; + cacheDesc->metadataStartAddress = (U_8*)ccToUse->getClassDebugDataStartAddress() - sizeof(ShcItemHdr); cacheDesc->cacheSizeBytes = ccToUse->getCacheMemorySize(); cacheDescriptorTail->next = cacheDesc; diff --git a/runtime/shared_common/SCImplementedAPI.cpp b/runtime/shared_common/SCImplementedAPI.cpp index f56aeef17a3..a5b163afdf3 100644 --- a/runtime/shared_common/SCImplementedAPI.cpp +++ b/runtime/shared_common/SCImplementedAPI.cpp @@ -627,23 +627,23 @@ IDATA j9shr_classStoreTransaction_stop(void * tobj) { IDATA retval = SCCLASS_STORE_STOP_NOTHING_STORED; - const char * fname = "j9shr_classStoreTransaction_stop"; - J9SharedClassTransaction * obj = (J9SharedClassTransaction *) tobj; - J9VMThread* currentThread = obj->ownerThread; + const char *fname = "j9shr_classStoreTransaction_stop"; + J9SharedClassTransaction *obj = (J9SharedClassTransaction *)tobj; + J9VMThread *currentThread = obj->ownerThread; J9JavaVM *vm = currentThread->javaVM; - J9SharedClassConfig * sconfig = vm->sharedClassConfig; - SH_CacheMap* cachemap = (SH_CacheMap*) (sconfig->sharedClassCache); + J9SharedClassConfig *sconfig = vm->sharedClassConfig; + SH_CacheMap *cachemap = (SH_CacheMap *)sconfig->sharedClassCache; bool releaseWriteMutex; bool releaseReadWriteMutex; bool releaseSegmentMutex; UDATA oldVMState = obj->oldVMState; - ClasspathWrapper* cpw = NULL;; - ClasspathItem* classpath = NULL;; + ClasspathWrapper *cpw = NULL; + ClasspathItem *classpath = NULL; IDATA didWeStore = 0; bool modifiedNoContext = ((obj->isModifiedClassfile == 1) && (NULL == obj->modContextInCache)); - J9ROMClass * storedClass = NULL; - J9UTF8 * storedClassName = NULL; - J9SharedInvariantInternTable* table = currentThread->javaVM->sharedInvariantInternTable; + J9ROMClass *storedClass = NULL; + J9UTF8 *storedClassName = NULL; + J9SharedInvariantInternTable *table = currentThread->javaVM->sharedInvariantInternTable; Trc_SHR_API_j9shr_classStoreTransaction_stop_Entry(currentThread, obj->transactionState); diff --git a/runtime/tests/jvmtitests/src/com/ibm/jvmti/tests/fieldwatch/fw001.c b/runtime/tests/jvmtitests/src/com/ibm/jvmti/tests/fieldwatch/fw001.c index ef9da8a52bd..2dc8634e3ce 100644 --- a/runtime/tests/jvmtitests/src/com/ibm/jvmti/tests/fieldwatch/fw001.c +++ b/runtime/tests/jvmtitests/src/com/ibm/jvmti/tests/fieldwatch/fw001.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2019 IBM Corp. and others + * Copyright (c) 2019, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -187,7 +187,7 @@ Java_com_ibm_jvmti_tests_fieldwatch_fw001_modifyWatches(JNIEnv *env, jclass rcv, if (isAdd) { err = (*globalEnv)->SetFieldAccessWatch(globalEnv, rcv, fid); } else { - err = (*globalEnv)->ClearFieldAccessWatch(globalEnv, rcv, fid);; + err = (*globalEnv)->ClearFieldAccessWatch(globalEnv, rcv, fid); } if (JVMTI_ERROR_NONE != err) { diff --git a/runtime/tests/jvmtitests/src/com/ibm/jvmti/tests/modularityTests/mt001.c b/runtime/tests/jvmtitests/src/com/ibm/jvmti/tests/modularityTests/mt001.c index 92ad3d39290..b7c129c99e8 100644 --- a/runtime/tests/jvmtitests/src/com/ibm/jvmti/tests/modularityTests/mt001.c +++ b/runtime/tests/jvmtitests/src/com/ibm/jvmti/tests/modularityTests/mt001.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2019 IBM Corp. and others + * Copyright (c) 2001, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -40,7 +40,7 @@ Java_com_ibm_jvmti_tests_modularityTests_mt001_addModuleReads(JNIEnv * jni_env, { JVMTI_ACCESS_FROM_AGENT(env); - return (jint) (*jvmti_env)->AddModuleReads(jvmti_env, fromMod, toMod);; + return (jint) (*jvmti_env)->AddModuleReads(jvmti_env, fromMod, toMod); } jint JNICALL @@ -101,6 +101,6 @@ Java_com_ibm_jvmti_tests_modularityTests_mt001_addModuleProvides(JNIEnv * jni_en { JVMTI_ACCESS_FROM_AGENT(env); - return (jint) (*jvmti_env)->AddModuleProvides(jvmti_env, module, service, implClass);; + return (jint) (*jvmti_env)->AddModuleProvides(jvmti_env, module, service, implClass); } #endif /* JAVA_SPEC_VERSION >= 9 */ diff --git a/runtime/tests/port/shmem.c b/runtime/tests/port/shmem.c index 903dc06e642..e02f565fb22 100644 --- a/runtime/tests/port/shmem.c +++ b/runtime/tests/port/shmem.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2019 IBM Corp. and others + * Copyright (c) 1991, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -390,7 +390,7 @@ j9shmem_test4(J9PortLibrary *portLibrary, char* argv0) j9shmem_destroy(cacheDir, 0, &mem0); } - return reportTestExit(portLibrary, testName);; + return reportTestExit(portLibrary, testName); } int diff --git a/runtime/verbose/errormessageframeworkrtv.c b/runtime/verbose/errormessageframeworkrtv.c index 5dcfdbdc909..2b1b8bc760d 100644 --- a/runtime/verbose/errormessageframeworkrtv.c +++ b/runtime/verbose/errormessageframeworkrtv.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2019 IBM Corp. and others + * Copyright (c) 2015, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -826,7 +826,7 @@ generateJ9RtvExceptionDetails(J9BytecodeVerificationData* verifyData, U_8* initM if ('[' == methodInfo.signature.bytes[methodInfo.signature.length - 2]) { returnType = ';'; } else { - returnType = methodInfo.signature.bytes[methodInfo.signature.length - 1];; + returnType = methodInfo.signature.bytes[methodInfo.signature.length - 1]; } bcName = sunJavaBCNames[convertToOracleOpcodeString(methodInfo.code[errorPC], returnType)]; diff --git a/runtime/vm/BytecodeInterpreter.hpp b/runtime/vm/BytecodeInterpreter.hpp index 6992a9926d7..7b3f98eda5c 100644 --- a/runtime/vm/BytecodeInterpreter.hpp +++ b/runtime/vm/BytecodeInterpreter.hpp @@ -2021,7 +2021,7 @@ obj:; VMINLINE VM_BytecodeAction bindNative(REGISTER_ARGS_LIST) { - VM_BytecodeAction rc = GOTO_RUN_METHOD;; + VM_BytecodeAction rc = GOTO_RUN_METHOD; buildMethodFrame(REGISTER_ARGS, _sendMethod, jitStackFrameFlags(REGISTER_ARGS, 0)); updateVMStruct(REGISTER_ARGS); UDATA bindRC = resolveNativeAddress(_currentThread, _sendMethod, TRUE); @@ -7876,7 +7876,7 @@ done:; genericReturn(REGISTER_ARGS_LIST) { VM_BytecodeAction rc = EXECUTE_BYTECODE; - J9ROMMethod *romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(_literals);; + J9ROMMethod *romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(_literals); UDATA isConstructor = FALSE; UDATA isObjectConstructor = FALSE; J9UTF8 *sig = NULL; diff --git a/runtime/vm/jvminit.c b/runtime/vm/jvminit.c index d7d6696c637..79929fe9688 100644 --- a/runtime/vm/jvminit.c +++ b/runtime/vm/jvminit.c @@ -296,13 +296,6 @@ const U_8 J9Impdep1PC[] = { 0xFE, 0x00, 0x00, 0xFE }; /* impdep1, parm, parm, im static jint (JNICALL * vprintfHookFunction)(FILE *fp, const char *format, va_list args) = NULL; static IDATA (* portLibrary_file_write_text) (struct OMRPortLibrary *portLibrary, IDATA fd, const char *buf, IDATA nbytes) = NULL; -#if defined(WIN32) && !defined(OPENJ9_BUILD) -/* Remove the "shutDownHookWrapper" once IBMJ9 uses the JVM_*Signal native functions - * in the sun.misc.Signal class. OpenJ9 does not depend on the "shutDownHookWrapper". - */ -static UDATA shutDownHookWrapper(struct J9PortLibrary* portLibrary, U_32 gpType, void* gpInfo, void* userData); -#endif /* defined(WIN32) && !defined(OPENJ9_BUILD) */ - #if !defined(WIN32) static UDATA sigxfszHandler(struct J9PortLibrary* portLibrary, U_32 gpType, void* gpInfo, void* userData); #endif /* !defined(WIN32) */ @@ -614,23 +607,9 @@ freeJavaVM(J9JavaVM * vm) PORT_ACCESS_FROM_JAVAVM(vm); J9VMThread *currentThread = currentVMThread(vm); IDATA traceDescriptor = 0; -#if defined(WIN32) -#if !defined(OPENJ9_BUILD) - /* Remove the "shutDownHookWrapper" once IBMJ9 uses the JVM_*Signal native functions - * in the sun.misc.Signal class. OpenJ9 does not depend on the "shutDownHookWrapper". - * - * Install the handler for running the shutdown hooks when the console window is closed - * J2SE/Sidecar builds: - * This applies to Windows only. Shutdown hooks for all other platforms are handled by the Hursley JCLs - * - * J2ME/Embedded builds: - * This applies to Windows only for now. Since we don't have Hursley JCLs for this, we will need to provide our own support for all other cases/platforms. - */ - j9sig_set_async_signal_handler(shutDownHookWrapper, vm, 0); -#endif /* !defined(OPENJ9_BUILD) */ -#else /* defined(WIN32) */ +#if !defined(WIN32) j9sig_set_async_signal_handler(sigxfszHandler, NULL, 0); -#endif /* defined(WIN32) */ +#endif /* !defined(WIN32) */ /* Remove the predefinedHandlerWrapper. */ j9sig_set_single_async_signal_handler(predefinedHandlerWrapper, vm, 0, NULL); @@ -6009,29 +5988,6 @@ protectedInitializeJavaVM(J9PortLibrary* portLibrary, void * userData) goto error; } -#if defined(WIN32) && !defined(OPENJ9_BUILD) - /* Remove the "shutDownHookWrapper" once IBMJ9 uses the JVM_*Signal native functions - * in the sun.misc.Signal class. OpenJ9 does not depend on the "shutDownHookWrapper". - * - * Install the handler for running the shutdown hooks when the console window is closed - * J2SE/Sidecar builds: - * This applies to Windows only. Shutdown hooks for all other platforms are handled by the Hursley JCLs - * - * J2ME/Embedded builds: - * This applies to Windows only for now. Since we don't have Hursley JCLs for this, we will need to provide our own support for all other cases/platforms. - */ - if (J9_ARE_NO_BITS_SET(vm->sigFlags, J9_SIG_XRS_ASYNC)) { - /* Only register the handler if -Xrs is not present. This is a temporary hack, - * which will be removed once the required OMR signal API has been implemented. - * The following OMR issue needs to be closed before removing this hack: - * https://github.com/eclipse/omr/issues/2332. - */ - if (0 != j9sig_set_async_signal_handler(shutDownHookWrapper, vm, J9PORT_SIG_FLAG_SIGTERM | J9PORT_SIG_FLAG_SIGINT)) { - goto error; - } - } -#endif /* defined(WIN32) && !defined(OPENJ9_BUILD) */ - #ifndef J9VM_SIZE_SMALL_CODE if (NULL == fieldIndexTableNew(vm, portLibrary)) { goto error; @@ -6751,37 +6707,6 @@ freeClassNativeMemory(J9HookInterface** hook, UDATA eventNum, void* eventData, v #endif /* GC_DYNAMIC_CLASS_UNLOADING */ -#if defined(WIN32) && !defined(OPENJ9_BUILD) -/* Remove the "shutDownHookWrapper" once IBMJ9 uses the JVM_*Signal native functions - * in the sun.misc.Signal class. OpenJ9 does not depend on the "shutDownHookWrapper". - */ -static UDATA -shutDownHookWrapper(struct J9PortLibrary* portLibrary, U_32 gpType, void* gpInfo, void* userData) -{ - J9JavaVM* vm = (J9JavaVM *) userData; - J9JavaVMAttachArgs thr_args; - J9VMThread * vmThread; - - PORT_ACCESS_FROM_JAVAVM(vm); - - thr_args.version = JNI_VERSION_1_2; - thr_args.name = "ShutDownHook helper thread"; - thr_args.group = vm->systemThreadGroupRef; - if (AttachCurrentThread((JavaVM *) vm, (void **) &vmThread, &thr_args) != JNI_OK) { - /* We won't be able to run the shutdown hooks so just exit */ - j9nls_printf(PORTLIB, J9NLS_INFO, J9NLS_CANNOT_ATTACH_THREAD); - j9exit_shutdown_and_exit(-1); - } - - /* run exit hooks */ - sidecarExit(vmThread); - - /* Shouldn't hit this */ - return 0; - -} -#endif /* defined(WIN32) && !defined(OPENJ9_BUILD) */ - /** * Invoke jdk.internal.misc.Signal.dispatch(int number) in Java 9 and * onwards. Invoke sun.misc.Signal.dispatch(int number) in Java 8. diff --git a/runtime/vm/stringhelpers.cpp b/runtime/vm/stringhelpers.cpp index 504085809da..eb5ddd59f8d 100644 --- a/runtime/vm/stringhelpers.cpp +++ b/runtime/vm/stringhelpers.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2019 IBM Corp. and others + * Copyright (c) 1991, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -386,10 +386,10 @@ verifyQualifiedName(J9VMThread *vmThread, j9object_t string) return CLASSNAME_INVALID; } - classNameInfo.slot1 = (U_32)unicodeLength; classNameInfo.bytes = (U_8*)copyStringToUTF8WithMemAlloc(vmThread, string, J9_STR_NULL_TERMINATE_RESULT, "", 0, - utf8NameStackBuffer, J9VM_PACKAGE_NAME_BUFFER_LENGTH, NULL); + utf8NameStackBuffer, J9VM_PACKAGE_NAME_BUFFER_LENGTH, &unicodeLength); + classNameInfo.slot1 = (U_32)unicodeLength; if (NULL == classNameInfo.bytes) { vmFuncs->setNativeOutOfMemoryError(vmThread, 0, 0); return CLASSNAME_INVALID; diff --git a/test/functional/Valhalla/playlist.xml b/test/functional/Valhalla/playlist.xml index 6f4446d81c5..66e209c7591 100644 --- a/test/functional/Valhalla/playlist.xml +++ b/test/functional/Valhalla/playlist.xml @@ -27,6 +27,7 @@ NoOptions -Xgcpolicy:nogc -XX:ValueTypeFlatteningThreshold=99999 + -Xgcpolicy:optthruput -Xnocompactgc -XX:ValueTypeFlatteningThreshold=99999 $(JAVA_COMMAND) $(JVM_OPTIONS) \ -Xverify:none \ diff --git a/test/functional/Valhalla/src/org/openj9/test/lworld/ValueTypeTests.java b/test/functional/Valhalla/src/org/openj9/test/lworld/ValueTypeTests.java index 1a218e7c9aa..899243728f1 100644 --- a/test/functional/Valhalla/src/org/openj9/test/lworld/ValueTypeTests.java +++ b/test/functional/Valhalla/src/org/openj9/test/lworld/ValueTypeTests.java @@ -107,6 +107,9 @@ public class ValueTypeTests { static Class largeObjectValueClass = null; static MethodHandle makeLargeObjectValue = null; static MethodHandle[] getObjects = null; + /* megaObject */ + static Class megaObjectValueClass = null; + static MethodHandle makeMegaObjectValue = null; /* assortedRefWithLongAlignment */ static Class assortedRefWithLongAlignmentClass = null; static MethodHandle makeAssortedRefWithLongAlignment = null; @@ -252,6 +255,107 @@ static public void testCreateArrayPoint2D() throws Throwable { assertEquals(getY.invoke(point2D_2_check), getY.invoke(point2D_2)); } + @Test(priority=5) + static public void testGCFlattenedPoint2DArray() throws Throwable { + int x1 = 0xFFEEFFEE; + int y1 = 0xAABBAABB; + Object point2D = makePoint2D.invoke(x1, y1); + Object arrayObject = Array.newInstance(point2DClass, 8); + + for (int i = 0; i < 8; i++) { + Array.set(arrayObject, i, point2D); + } + + System.gc(); + System.gc(); + + Object value = Array.get(arrayObject, 0); + } + + @Test(priority=5) + static public void testGCFlattenedValueArrayWithSingleAlignment() throws Throwable { + Object array = Array.newInstance(assortedValueWithSingleAlignmentClass, 4); + + for (int i = 0; i < 4; i++) { + Object object = createAssorted(makeAssortedValueWithSingleAlignment, typeWithSingleAlignmentFields); + Array.set(array, i, object); + } + + System.gc(); + System.gc(); + + for (int i = 0; i < 4; i++) { + checkFieldAccessMHOfAssortedType(assortedValueWithSingleAlignmentGetterAndWither, Array.get(array, i), typeWithSingleAlignmentFields, true); + } + } + + @Test(priority=5) + static public void testGCFlattenedValueArrayWithObjectAlignment() throws Throwable { + Object array = Array.newInstance(assortedValueWithObjectAlignmentClass, 4); + + for (int i = 0; i < 4; i++) { + Object object = createAssorted(makeAssortedValueWithObjectAlignment, typeWithObjectAlignmentFields); + Array.set(array, i, object); + } + + System.gc(); + System.gc(); + + for (int i = 0; i < 4; i++) { + checkFieldAccessMHOfAssortedType(assortedValueWithObjectAlignmentGetterAndWither, Array.get(array, i), typeWithObjectAlignmentFields, true); + } + } + + @Test(priority=5) + static public void testGCFlattenedValueArrayWithLongAlignment() throws Throwable { + Object array = Array.newInstance(assortedValueWithLongAlignmentClass, 4); + + for (int i = 0; i < 4; i++) { + Object object = createAssorted(makeAssortedValueWithLongAlignment, typeWithLongAlignmentFields); + Array.set(array, i, object); + } + + System.gc(); + System.gc(); + + for (int i = 0; i < 4; i++) { + checkFieldAccessMHOfAssortedType(assortedValueWithLongAlignmentGetterAndWither, Array.get(array, i), typeWithLongAlignmentFields, true); + } + } + + @Test(priority=5) + static public void testGCFlattenedLargeObjectArray() throws Throwable { + Object arrayObject = Array.newInstance(largeObjectValueClass, 4); + Object largeObjectRef = createLargeObject(new Object()); + + for (int i = 0; i < 4; i++) { + Array.set(arrayObject, i, largeObjectRef); + } + + System.gc(); + System.gc(); + + Object value = Array.get(arrayObject, 0); + } + + @Test(priority=5) + static public void testGCFlattenedMegaObjectArray() throws Throwable { + Object arrayObject = Array.newInstance(megaObjectValueClass, 4); + Object megaObjectRef = createMegaObject(new Object()); + + System.gc(); + System.gc(); + + for (int i = 0; i < 4; i++) { + Array.set(arrayObject, i, megaObjectRef); + } + System.gc(); + System.gc(); + + Object value = Array.get(arrayObject, 0); + } + + /* * Create a value type with double slot primitive members * @@ -1233,9 +1337,10 @@ static public void testCreateLargeObjectAndMegaValue() throws Throwable { "val14:QLargeObject;:value", "val15:QLargeObject;:value", "val16:QLargeObject;:value"}; - Class megaObjectClass = ValueTypeGenerator.generateValueClass("MegaObject", megaFields); - MethodHandle makeMega = lookup.findStatic(megaObjectClass, "makeValueGeneric", - MethodType.methodType(megaObjectClass, Object.class, Object.class, Object.class, Object.class, + + megaObjectValueClass = ValueTypeGenerator.generateValueClass("MegaObject", megaFields); + makeMegaObjectValue = lookup.findStatic(megaObjectValueClass, "makeValueGeneric", + MethodType.methodType(megaObjectValueClass, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class)); @@ -1243,8 +1348,8 @@ static public void testCreateLargeObjectAndMegaValue() throws Throwable { * Getters are created in array getterAndWither[i][0] according to the order of fields i * Withers are created in array getterAndWither[i][1] according to the order of fields i */ - MethodHandle[][] megaGetterAndWither = generateGenericGetterAndWither(megaObjectClass, megaFields); - Object megaObject = createAssorted(makeMega, megaFields); + MethodHandle[][] megaGetterAndWither = generateGenericGetterAndWither(megaObjectValueClass, megaFields); + Object megaObject = createAssorted(makeMegaObjectValue, megaFields); checkFieldAccessMHOfAssortedType(megaGetterAndWither, megaObject, megaFields, true); } @@ -1831,6 +1936,15 @@ static Object createLargeObject(Object arg) throws Throwable { return makeLargeObjectValue.invokeWithArguments(args); } + static Object createMegaObject(Object arg) throws Throwable { + Object[] args = new Object[16]; + for(int i = 0; i < 16; i++) { + Object valueObject = createLargeObject(arg); + args[i] = valueObject; + } + return makeMegaObjectValue.invokeWithArguments(args); + } + static Object createAssorted(MethodHandle makeMethod, String[] fields) throws Throwable { return createAssorted(makeMethod, fields, null); } diff --git a/test/functional/cmdLineTests/build.xml b/test/functional/cmdLineTests/build.xml index 112adf19f66..27583a1538f 100644 --- a/test/functional/cmdLineTests/build.xml +++ b/test/functional/cmdLineTests/build.xml @@ -1,7 +1,7 @@