提交 f79dce47 编写于 作者: Y yunyao.zxl 提交者: zhengxiaolinX

[Wisp] Fix Windows and MacOS capability

Summary: Fix build failure of the two platforms

Test Plan: Successfully generate builds of the two platforms

Reviewed-by: yuleil, shiyuexw, sanhong

Issue: https://github.com/alibaba/dragonwell8/issues/113
上级 13f9240d
......@@ -39,6 +39,7 @@
_JVM_Available
_JVM_BeforeHalt
_JVM_Bind
_JVM_CheckAndClearNativeInterruptForWisp
_JVM_CheckJWarmUpCompilationIsComplete
_JVM_ClassDepth
_JVM_ClassLoaderDepth
......@@ -167,6 +168,7 @@
_JVM_GetMethodTypeAnnotations
_JVM_GetPrimitiveArrayElement
_JVM_GetProtectionDomain
_JVM_GetProxyUnpark
_JVM_GetSockName
_JVM_GetSockOpt
_JVM_GetStackAccessControlContext
......@@ -190,6 +192,7 @@
_JVM_InvokeMethod
_JVM_IsArrayClass
_JVM_IsConstructorIx
_JVM_IsInSameNative
_JVM_IsInterface
_JVM_IsInterrupted
_JVM_IsNaN
......@@ -207,6 +210,7 @@
_JVM_LoadClass0
_JVM_LoadLibrary
_JVM_Lseek
_JVM_MarkPreempted
_JVM_MaxObjectInspectionAge
_JVM_MaxMemory
_JVM_MonitorNotify
......@@ -241,6 +245,7 @@
_JVM_SetNativeThreadName
_JVM_SetPrimitiveArrayElement
_JVM_SetSockOpt
_JVM_SetWispTask
_JVM_SetThreadPriority
_JVM_Sleep
_JVM_Socket
......
......@@ -39,6 +39,7 @@
_JVM_Available
_JVM_BeforeHalt
_JVM_Bind
_JVM_CheckAndClearNativeInterruptForWisp
_JVM_CheckJWarmUpCompilationIsComplete
_JVM_ClassDepth
_JVM_ClassLoaderDepth
......@@ -167,6 +168,7 @@
_JVM_GetMethodTypeAnnotations
_JVM_GetPrimitiveArrayElement
_JVM_GetProtectionDomain
_JVM_GetProxyUnpark
_JVM_GetSockName
_JVM_GetSockOpt
_JVM_GetStackAccessControlContext
......@@ -190,6 +192,7 @@
_JVM_InvokeMethod
_JVM_IsArrayClass
_JVM_IsConstructorIx
_JVM_IsInSameNative
_JVM_IsInterface
_JVM_IsInterrupted
_JVM_IsNaN
......@@ -207,6 +210,7 @@
_JVM_LoadClass0
_JVM_LoadLibrary
_JVM_Lseek
_JVM_MarkPreempted
_JVM_MaxObjectInspectionAge
_JVM_MaxMemory
_JVM_MonitorNotify
......@@ -241,6 +245,7 @@
_JVM_SetNativeThreadName
_JVM_SetPrimitiveArrayElement
_JVM_SetSockOpt
_JVM_SetWispTask
_JVM_SetThreadPriority
_JVM_Sleep
_JVM_Socket
......
......@@ -817,7 +817,9 @@ private:
// End avoid using directly
#ifdef _WINDOWS
public:
#endif
// Instruction prefixes
void prefix(Prefix p);
......
......@@ -4528,18 +4528,6 @@ void os::interrupt(Thread* thread) {
}
bool clear_interrupt_for_wisp(Thread* thread) {
// If we only use -XX:+EnableCoroutine and -Dcom.alibaba.transparentAsync=true, we will
// fall here, so we cannot use `assert(UseWispMonitor)` only.
if (UseWispMonitor && thread->is_Wisp_thread()) {
thread = ((WispThread *)thread)->thread();
}
bool interrupted = thread->osthread()->interrupted();
thread->osthread()->set_interrupted(false);
return interrupted;
}
bool os::is_interrupted(Thread* thread, bool clear_interrupted) {
if (UseWispMonitor && thread->is_Wisp_thread()) {
thread = ((WispThread*) thread)->thread();
......
......@@ -3413,7 +3413,7 @@ void com_alibaba_wisp_engine_WispCarrier::compute_offsets() {
compute_offset(_isInCritical_offset, k, vmSymbols::isInCritical_name(), vmSymbols::bool_signature());
}
bool com_alibaba_wisp_engine_WispCarrier::in_critical(oop obj) {
jboolean com_alibaba_wisp_engine_WispCarrier::in_critical(oop obj) {
return obj->bool_field(_isInCritical_offset);
}
......
......@@ -1504,7 +1504,7 @@ class com_alibaba_wisp_engine_WispCarrier: AllStatic {
private:
static int _isInCritical_offset;
public:
static bool in_critical(oop obj);
static jboolean in_critical(oop obj);
static void compute_offsets();
};
......
......@@ -4130,6 +4130,14 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
}
}
#ifndef LINUX
if (EnableCoroutine || UseWispMonitor) {
warning("Wisp supports Linux only"
"; ignore Wisp related flags");
EnableCoroutine = UseWispMonitor = false;
}
#endif
// Set object alignment values.
set_object_alignment();
......
......@@ -48,18 +48,12 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo);
void coroutine_start(Coroutine* coroutine, jobject coroutineObj) {
coroutine->thread()->set_thread_state(_thread_in_vm);
if (UseVectoredExceptions) {
// If we are using vectored exception we don't need to set a SEH
coroutine->run(coroutineObj);
}
else {
// Install a win32 structured exception handler around every thread created
// by VM, so VM can genrate error dump when an exception occurred in non-
// Java thread (e.g. VM thread).
__try {
coroutine->run(coroutineObj);
} __except(topLevelExceptionFilter((_EXCEPTION_POINTERS*)_exception_info())) {
}
// Install a win32 structured exception handler around every thread created
// by VM, so VM can genrate error dump when an exception occurred in non-
// Java thread (e.g. VM thread).
__try {
coroutine->run(coroutineObj);
} __except(topLevelExceptionFilter((_EXCEPTION_POINTERS*)_exception_info())) {
}
ShouldNotReachHere();
......@@ -1208,3 +1202,15 @@ WispClinitCounterMark::~WispClinitCounterMark() {
_thread->current_coroutine()->dec_clinit_call_count();
}
}
bool clear_interrupt_for_wisp(Thread* thread) {
// If we only use -XX:+EnableCoroutine and -Dcom.alibaba.transparentAsync=true, we will
// fall here, so we cannot use `assert(UseWispMonitor)` only.
if (UseWispMonitor && thread->is_Wisp_thread()) {
thread = ((WispThread *)thread)->thread();
}
bool interrupted = thread->osthread()->interrupted();
thread->osthread()->set_interrupted(false);
return interrupted;
}
\ No newline at end of file
......@@ -168,7 +168,7 @@ public:
void set_wisp_task(oop x) { _wisp_task = x; }
oop coroutine() const { return _coroutine; }
oop set_coroutine(oop x) { _coroutine = x; }
void set_coroutine(oop x) { _coroutine = x; }
WispThread* wisp_thread() const { return _wisp_thread; }
......@@ -324,8 +324,7 @@ template<class T> void DoublyLinkedList<T>::insert_into_list(pointer& list) {
}
}
template<class T> void DoublyLinkedList<T>::move(DoublyLinkedList<T>::pointer &coro,
DoublyLinkedList<T>::pointer &target) {
template<class T> void DoublyLinkedList<T>::move(pointer &coro, pointer &target) {
assert(coro != NULL, "coroutine can't be null");
assert(target != NULL, "target can't be null");
assert(coro != target, "target can't be equal to current");
......@@ -618,4 +617,6 @@ private:
JavaThread* _thread;
};
bool clear_interrupt_for_wisp(Thread *);
#endif // SHARE_VM_RUNTIME_COROUTINE_HPP
......@@ -1044,6 +1044,4 @@ class os: AllStatic {
extern "C" int SpinPause();
bool clear_interrupt_for_wisp(Thread *);
#endif // SHARE_VM_RUNTIME_OS_HPP
......@@ -22,6 +22,7 @@
/*
* @test
* @summary test a special wisp unpark case for C1 compiled method
* @requires os.family == "linux"
* @run main/othervm -XX:-UseBiasedLocking -XX:+EnableCoroutine -XX:+UseWispMonitor -Dcom.alibaba.transparentAsync=true -XX:TieredStopAtLevel=1 C1ThrowSyncExceptionTest
*/
......
......@@ -23,6 +23,7 @@
* @test
* @library /testlibrary
* @summary test fix of parallel class-loading problem when we're using coroutine
* @requires os.family == "linux"
* @run main/othervm -Xmx20m -XX:+AllowParallelDefineClass -XX:-UseBiasedLocking -XX:+EnableCoroutine -XX:+UseWispMonitor -Dcom.alibaba.wisp.transparentWispSwitch=true ClassCircularityTest
*/
......
......@@ -23,6 +23,7 @@
* @test
* @library /testlibrary
* @summary Test the optimization of direct unpark with Object.wait/notify
* @requires os.family == "linux"
* @run main/othervm -XX:-UseBiasedLocking -XX:+EnableCoroutine -XX:+UseWispMonitor -Dcom.alibaba.wisp.transparentWispSwitch=true -Dcom.alibaba.wisp.enableThreadAsWisp=true -Dcom.alibaba.wisp.version=2 -Dcom.alibaba.wisp.allThreadAsWisp=true DirectUnparkTest
*/
......
......@@ -22,6 +22,7 @@
/*
* @test
* @summary test obj.wait() could be interrupted
* @requires os.family == "linux"
* @library /testlibrary
* @run main/othervm -XX:+EnableCoroutine -XX:+UseWispMonitor -Dcom.alibaba.wisp.transparentWispSwitch=true InterruptedWaitTest
*/
......
......@@ -26,6 +26,7 @@
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -XX:-Inline -XX:+EnableCoroutine -Xmx10m -Xms10m -XX:ReservedCodeCacheSize=3m -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI Issue11230146
* @summary Issue11230146, JTreg test for D181275
* @requires os.family == "linux"
*/
import sun.hotspot.WhiteBox;
......
......@@ -23,6 +23,7 @@
* @test
* @library /testlibrary
* @summary Test jstack steal counter
* @requires os.family == "linux"
* @run main/othervm -XX:+EnableCoroutine -XX:+UseWispMonitor -Dcom.alibaba.transparentAsync=true -XX:ActiveProcessorCount=2 JStackTest
*/
......
......@@ -22,6 +22,7 @@
/*
* @test
* @summary test of memory leak while creating and destroying coroutine/thread
* @requires os.family == "linux"
* @run main/othervm -XX:+EnableCoroutine -Xmx10m -Xms10m MemLeakTest
*/
......
......@@ -23,6 +23,7 @@
* @test
* @library /testlibrary
* @summary Test jstack coroutine output
* @requires os.family == "linux"
* @run main/othervm -XX:+EnableCoroutine -Dcom.alibaba.transparentAsync=true -XX:+UseWispMonitor MultiCoroutineStackTest
*/
......
......@@ -23,6 +23,7 @@
* @test
* @library /testlibrary
* @summary test wisp preempt
* @requires os.family == "linux"
* @run main/othervm -XX:+EnableCoroutine -Dcom.alibaba.wisp.transparentWispSwitch=true -Dcom.alibaba.wisp.carrierEngines=1 -Dcom.alibaba.wisp.enableHandOff=true PreemptExceptionTest
*/
......
......@@ -22,6 +22,7 @@
/*
* @test
* @summary Verify wisp internal logic can not be preempted
* @requires os.family == "linux"
* @library /testlibrary
* @run main PreemptWispInternalBugTest
*/
......
......@@ -22,7 +22,7 @@
/*
* @test
* @summary Test the fix that unpark might not be handled in WispThread::unpark due to due to WispEngine of main thread not properly been initialized in premain().
*
* @requires os.family == "linux"
* @run shell premainWithWispMonitorTest.sh
*/
......
......@@ -26,6 +26,7 @@
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -XX:+EnableCoroutine -Xmx10m -Xms10m -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestAvoidDeoptCoroutineMethod
* @summary test avoid coroutine intrinsic method to be deoptimized
* @requires os.family == "linux"
*/
import sun.hotspot.WhiteBox;
......
......@@ -22,6 +22,7 @@
/*
* @test
* @summary Test invoke dynamic class for lambda with interrupt
* @requires os.family == "linux"
* @library /testlibrary
* @run main/othervm -XX:+EnableCoroutine -Dcom.alibaba.wisp.transparentWispSwitch=true -XX:+UseWispMonitor -Dcom.alibaba.wisp.enableHandOff=false -XX:+AllowParallelDefineClass TestInvokeDynamicInterruption
*/
......
......@@ -22,6 +22,7 @@
/*
* @test
* @summary PreserveFramePointer for coroutine stack backtrace test
* @requires os.family == "linux"
* @run main/othervm -XX:-UseBiasedLocking -XX:+EnableCoroutine -XX:+UseWispMonitor -Dcom.alibaba.wisp.transparentWispSwitch=true -Dcom.alibaba.wisp.version=2 -Xcomp -XX:TieredStopAtLevel=1 -XX:+PreserveFramePointer TestPreserveFramePointer
* @run main/othervm -XX:-UseBiasedLocking -XX:+EnableCoroutine -XX:+UseWispMonitor -Dcom.alibaba.wisp.transparentWispSwitch=true -Dcom.alibaba.wisp.version=2 -Xcomp -XX:TieredStopAtLevel=1 -XX:-PreserveFramePointer TestPreserveFramePointer
* @run main/othervm -XX:-UseBiasedLocking -XX:+EnableCoroutine -XX:+UseWispMonitor -Dcom.alibaba.wisp.transparentWispSwitch=true -Dcom.alibaba.wisp.version=2 -Xcomp -XX:-TieredCompilation -XX:+PreserveFramePointer TestPreserveFramePointer
......
......@@ -25,7 +25,7 @@ import java.io.File;
/*
* @test
* @summary Test Wisp2 flag Compatibility
*
* @requires os.family == "linux"
* @library /testlibrary
* @run main Wisp2FlagCompatibilityCheckTest
*/
......
/*
* @test
* @summary test wisp2 switch
* @requires os.family == "linux"
* @library /testlibrary
* @run main/othervm -XX:+UseWisp2 Wisp2SwitchTest
*/
......
......@@ -22,6 +22,7 @@
/*
* @test
* @summary test XX:+UseWisp2 switch with -Dcom.alibaba.wisp.allThreadAsWisp=false
* @requires os.family == "linux"
* @library /testlibrary
* @run main/othervm -XX:+UseWisp2 -Dcom.alibaba.wisp.allThreadAsWisp=false Wisp2SwitchTest2
*/
......
......@@ -23,6 +23,7 @@
* @test
* @library /testlibrary
* @summary test clinit wait in coroutine
* @requires os.family == "linux"
* @run main/othervm -XX:-UseBiasedLocking -XX:+EnableCoroutine -XX:+UseWispMonitor -Dcom.alibaba.wisp.transparentWispSwitch=true WispClinitTest
*/
......
......@@ -23,6 +23,7 @@
* @test
* @library /testlibrary
* @summary test emit_guard_for_new in C2 will add control for load
* @requires os.family == "linux"
* @run main/othervm -Xcomp -XX:-TieredCompilation -Xbatch -XX:CompileOnly=WispEmitNewGuardTest.testMethod -XX:+PrintCompilation -XX:+EnableCoroutine -XX:+UseWispMonitor -Dcom.alibaba.wisp.transparentWispSwitch=true WispEmitNewGuardTest
*/
......
......@@ -22,6 +22,7 @@
/*
* @test
* @summary verify vm not crash when we're preempted frequently
* @requires os.family == "linux"
* @run main/othervm -XX:ActiveProcessorCount=1 -XX:+UseWisp2 WispPreemptBugTest
*/
......
......@@ -22,6 +22,7 @@
/*
* @test
* @summary c2 compiler monitorenter stub steal test
* @requires os.family == "linux"
* @run main/othervm/timeout=60 -XX:+UseWisp2 -Dcom.alibaba.wisp.schedule.stealRetry=100 -Dcom.alibaba.wisp.schedule.helpStealRetry=100 WispStealMonitorC2Test
*/
......
......@@ -24,6 +24,7 @@
## @test
##
## @summary test c1 assertion failure when UseDirectUnpark is enabled (please run it in slowdebug ver.)
## @requires os.family == "linux"
## @run shell c1AssertFailTest.sh
......
......@@ -27,6 +27,7 @@
# @compile SimpleWispTest.java
#
# @summary test Coroutine SwitchTo() crash problem
# @requires os.family == "linux"
# @run shell coroutineBreakpointSwitchToTest.sh
#
......
......@@ -24,6 +24,7 @@
## @test
##
## @summary test DetachCurrentThread unpark
## @requires os.family == "linux"
## @run shell jniDetachThreadHoldingMonitorTest.sh
##
......
......@@ -24,6 +24,7 @@
## @test
##
## @summary test jni MonitorExit
## @requires os.family == "linux"
## @run shell jniMonitorExitTest.sh
##
......
......@@ -24,6 +24,7 @@
## @test
##
## @summary test jvmti and wispMonitor could work together
## @requires os.family == "linux"
## @run shell jvmtiWispMonitorTest.sh
......
......@@ -27,6 +27,7 @@
# @compile SimpleWispTest.java
#
# @summary test coroutine and -XX:+LogCompilation could work together
# @requires os.family == "linux"
# @run shell logCompilationTest.sh
#
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册