From f91cbf28ac81c1f59d8ac70a9b3e3878893d90ad Mon Sep 17 00:00:00 2001 From: Chuansheng Lu Date: Tue, 7 Apr 2020 17:31:52 +0800 Subject: [PATCH] [MultiTenant] Fixed build failure on Windows Summary: Fixed build failure on Windows by disabling CPU related features Test Plan: hotspot/test/sanity Reviewed-by: kuaiwei, yuleil Issue: https://github.com/alibaba/dragonwell8/issues/92 --- src/share/vm/classfile/javaClasses.cpp | 3 ++- src/share/vm/gc_implementation/g1/g1AllocationContext.cpp | 1 + src/share/vm/prims/jvm.h | 2 +- src/share/vm/prims/tenantenv.cpp | 1 + src/share/vm/runtime/arguments_ext.cpp | 7 +++++++ src/share/vm/runtime/thread.cpp | 2 ++ test/multi-tenant/TestContainerOf.java | 2 ++ test/multi-tenant/TestHeapIsolation.java | 2 ++ test/multi-tenant/TestParGCAllocatorLeak.sh | 2 ++ test/multi-tenant/TestPerTenantTLAB.java | 2 ++ test/multi-tenant/TestTenantHeapLimit.java | 2 ++ test/multi-tenant/TestTenantJVMOptions.sh | 2 ++ test/multi-tenant/TestTenantMemoryMTSafe.java | 2 ++ test/multi-tenant/TestTenantNMTSupport.java | 2 ++ 14 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/share/vm/classfile/javaClasses.cpp b/src/share/vm/classfile/javaClasses.cpp index 19ea06926..b98761e58 100644 --- a/src/share/vm/classfile/javaClasses.cpp +++ b/src/share/vm/classfile/javaClasses.cpp @@ -3353,7 +3353,7 @@ bool com_alibaba_tenant_TenantContainer::is_dead(oop obj) { oop com_alibaba_tenant_TenantContainer::get_tenant_state(oop obj) { assert(obj != NULL, "TenantContainer object cannot be NULL"); - obj->obj_field(_tenant_state_offset); + return obj->obj_field(_tenant_state_offset); } // Support for com.alibaba.tenant.TenantState @@ -3380,6 +3380,7 @@ int com_alibaba_tenant_TenantState::state_of(oop tenant_obj) { } ShouldNotReachHere(); + return -1; } #endif // INCLUDE_ALL_GCS diff --git a/src/share/vm/gc_implementation/g1/g1AllocationContext.cpp b/src/share/vm/gc_implementation/g1/g1AllocationContext.cpp index 648ff6534..c57581cc4 100644 --- a/src/share/vm/gc_implementation/g1/g1AllocationContext.cpp +++ b/src/share/vm/gc_implementation/g1/g1AllocationContext.cpp @@ -20,6 +20,7 @@ * */ +#include "precompiled.hpp" #include "gc_implementation/g1/g1AllocationContext.hpp" #include "runtime/thread.hpp" diff --git a/src/share/vm/prims/jvm.h b/src/share/vm/prims/jvm.h index d694d4bfb..8644c5419 100644 --- a/src/share/vm/prims/jvm.h +++ b/src/share/vm/prims/jvm.h @@ -372,7 +372,7 @@ JVM_DestroyTenantAllocationContext(JNIEnv *env, jobject ignored, jlong context); JNIEXPORT jobject JNICALL JVM_TenantContainerOf(JNIEnv *env, jclass tenantContainerClass, jobject obj); -JNIEXPORT long JNICALL +JNIEXPORT jlong JNICALL JVM_GetTenantOccupiedMemory(JNIEnv *env, jobject ignored, jlong context); /* diff --git a/src/share/vm/prims/tenantenv.cpp b/src/share/vm/prims/tenantenv.cpp index 07c2d88aa..d44569ff6 100644 --- a/src/share/vm/prims/tenantenv.cpp +++ b/src/share/vm/prims/tenantenv.cpp @@ -19,6 +19,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "precompiled.hpp" #include "prims/tenantenv.h" #include "runtime/globals.hpp" diff --git a/src/share/vm/runtime/arguments_ext.cpp b/src/share/vm/runtime/arguments_ext.cpp index dfcedebe0..1737e5f2e 100644 --- a/src/share/vm/runtime/arguments_ext.cpp +++ b/src/share/vm/runtime/arguments_ext.cpp @@ -20,11 +20,18 @@ * */ +#include "precompiled.hpp" #include "runtime/arguments_ext.hpp" #include "runtime/java.hpp" void ArgumentsExt::set_tenant_flags() { // order is critical here, please be careful +#if !(defined(LINUX) && defined(AMD64)) + if (TenantCpuThrottling || TenantCpuAccounting + || TenantHeapIsolation || TenantHeapThrottling || MultiTenant) { + vm_exit_during_initialization("MultiTenant only works on Linux x64 platform"); + } +#endif // TenantHeapThrottling directly depends on TenantHeapIsolation if (TenantHeapThrottling) { diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp index 1b5f4473b..2a16a9718 100644 --- a/src/share/vm/runtime/thread.cpp +++ b/src/share/vm/runtime/thread.cpp @@ -3974,11 +3974,13 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { } } +#if (defined(LINUX) && defined(AMD64)) if (MultiTenant && (TenantCpuThrottling || TenantCpuAccounting)) { // JGroup initialization may involve complex steps // have to do that after full JVM initialization call_initializeJGroupClass(CHECK_0); } +#endif create_vm_timer.end(); #ifdef ASSERT diff --git a/test/multi-tenant/TestContainerOf.java b/test/multi-tenant/TestContainerOf.java index bfe9c1942..dd83c5d25 100644 --- a/test/multi-tenant/TestContainerOf.java +++ b/test/multi-tenant/TestContainerOf.java @@ -22,6 +22,8 @@ /* * @test + * @requires os.family == "Linux" + * @requires os.arch == "amd64" * @summary Test TenantContainer.containOf() to retrieve tenant container of a Java object * @library /testlibrary * @build TestContainerOf diff --git a/test/multi-tenant/TestHeapIsolation.java b/test/multi-tenant/TestHeapIsolation.java index deecf6f80..6922712aa 100644 --- a/test/multi-tenant/TestHeapIsolation.java +++ b/test/multi-tenant/TestHeapIsolation.java @@ -23,6 +23,8 @@ /* * @test + * @requires os.family == "Linux" + * @requires os.arch == "amd64" * @summary Test isolation of per-tenant Java heap space * @library /testlibrary /testlibrary/whitebox * @build TestHeapIsolation diff --git a/test/multi-tenant/TestParGCAllocatorLeak.sh b/test/multi-tenant/TestParGCAllocatorLeak.sh index e939a2002..c766a8c6c 100644 --- a/test/multi-tenant/TestParGCAllocatorLeak.sh +++ b/test/multi-tenant/TestParGCAllocatorLeak.sh @@ -22,6 +22,8 @@ # # @test TestParGCAllocatorLeak.sh +# @requires os.family == "Linux" +# @requires os.arch == "amd64" # @summary test memory leak of G1ParGCAllocator # @run shell TestParGCAllocatorLeak.sh # diff --git a/test/multi-tenant/TestPerTenantTLAB.java b/test/multi-tenant/TestPerTenantTLAB.java index 7285c5c36..b0daea5f9 100644 --- a/test/multi-tenant/TestPerTenantTLAB.java +++ b/test/multi-tenant/TestPerTenantTLAB.java @@ -22,6 +22,8 @@ /* * @test + * @requires os.family == "Linux" + * @requires os.arch == "amd64" * @summary Test retain and reuse of TLAB * @library /testlibrary /testlibrary/whitebox * @build TestPerTenantTLAB diff --git a/test/multi-tenant/TestTenantHeapLimit.java b/test/multi-tenant/TestTenantHeapLimit.java index 8a46f56a2..970f6c616 100644 --- a/test/multi-tenant/TestTenantHeapLimit.java +++ b/test/multi-tenant/TestTenantHeapLimit.java @@ -23,6 +23,8 @@ /* * @test + * @requires os.family == "Linux" + * @requires os.arch == "amd64" * @summary Test heap limit on tenant * @library /testlibrary /testlibrary/whitebox * @build TestTenantHeapLimit diff --git a/test/multi-tenant/TestTenantJVMOptions.sh b/test/multi-tenant/TestTenantJVMOptions.sh index d6cba5557..83d5a6d28 100644 --- a/test/multi-tenant/TestTenantJVMOptions.sh +++ b/test/multi-tenant/TestTenantJVMOptions.sh @@ -22,6 +22,8 @@ # # @test TestTenantJVMOptions +# @requires os.family == "Linux" +# @requires os.arch == "amd64" # @summary Test the dependencies of multi-tenant JVM options # @run shell TestTenantJVMOptions.sh # diff --git a/test/multi-tenant/TestTenantMemoryMTSafe.java b/test/multi-tenant/TestTenantMemoryMTSafe.java index e068936de..e0fd78018 100644 --- a/test/multi-tenant/TestTenantMemoryMTSafe.java +++ b/test/multi-tenant/TestTenantMemoryMTSafe.java @@ -23,6 +23,8 @@ /* * @test + * @requires os.family == "Linux" + * @requires os.arch == "amd64" * @summary TestTenantMemoryMTSafe * @library /testlibrary /testlibrary/whitebox * @build TestTenantMemoryMTSafe sun.hotspot.WhiteBox diff --git a/test/multi-tenant/TestTenantNMTSupport.java b/test/multi-tenant/TestTenantNMTSupport.java index 8181ef6af..d8c1ae4d7 100644 --- a/test/multi-tenant/TestTenantNMTSupport.java +++ b/test/multi-tenant/TestTenantNMTSupport.java @@ -23,6 +23,8 @@ /* * @test + * @requires os.family == "Linux" + * @requires os.arch == "amd64" * @summary Verify PrintNMTStatistics with TenantHeapThrottling enabled * @library /testlibrary */ -- GitLab