1903 true); // Scale worker threads
1904
1905 shenandoah_assert_rp_isalive_not_installed();
1906 }
1907
1908 GCTracer* ShenandoahHeap::tracer() {
1909 return shenandoah_policy()->tracer();
1910 }
1911
1912 size_t ShenandoahHeap::tlab_used(Thread* thread) const {
1913 return _free_set->used();
1914 }
1915
1916 bool ShenandoahHeap::try_cancel_gc() {
1917 while (true) {
1918 jbyte prev = _cancelled_gc.cmpxchg(CANCELLED, CANCELLABLE);
1919 if (prev == CANCELLABLE) return true;
1920 else if (prev == CANCELLED) return false;
1921 assert(ShenandoahSuspendibleWorkers, "should not get here when not using suspendible workers");
1922 assert(prev == NOT_CANCELLED, "must be NOT_CANCELLED");
1923 {
1924 // We need to provide a safepoint here, otherwise we might
1925 // spin forever if a SP is pending.
1926 ThreadBlockInVM sp(JavaThread::current());
1927 SpinPause();
1928 }
1929 }
1930 }
1931
1932 void ShenandoahHeap::cancel_gc(GCCause::Cause cause) {
1933 if (try_cancel_gc()) {
1934 FormatBuffer<> msg("Cancelling GC: %s", GCCause::to_string(cause));
1935 log_info(gc)("%s", msg.buffer());
1936 Events::log(Thread::current(), "%s", msg.buffer());
1937 }
1938 }
1939
1940 uint ShenandoahHeap::max_workers() {
1941 return _max_workers;
1942 }
1943
|
1903 true); // Scale worker threads
1904
1905 shenandoah_assert_rp_isalive_not_installed();
1906 }
1907
1908 GCTracer* ShenandoahHeap::tracer() {
1909 return shenandoah_policy()->tracer();
1910 }
1911
1912 size_t ShenandoahHeap::tlab_used(Thread* thread) const {
1913 return _free_set->used();
1914 }
1915
1916 bool ShenandoahHeap::try_cancel_gc() {
1917 while (true) {
1918 jbyte prev = _cancelled_gc.cmpxchg(CANCELLED, CANCELLABLE);
1919 if (prev == CANCELLABLE) return true;
1920 else if (prev == CANCELLED) return false;
1921 assert(ShenandoahSuspendibleWorkers, "should not get here when not using suspendible workers");
1922 assert(prev == NOT_CANCELLED, "must be NOT_CANCELLED");
1923 if (Thread::current()->is_Java_thread()) {
1924 // We need to provide a safepoint here, otherwise we might
1925 // spin forever if a SP is pending.
1926 ThreadBlockInVM sp(JavaThread::current());
1927 SpinPause();
1928 }
1929 }
1930 }
1931
1932 void ShenandoahHeap::cancel_gc(GCCause::Cause cause) {
1933 if (try_cancel_gc()) {
1934 FormatBuffer<> msg("Cancelling GC: %s", GCCause::to_string(cause));
1935 log_info(gc)("%s", msg.buffer());
1936 Events::log(Thread::current(), "%s", msg.buffer());
1937 }
1938 }
1939
1940 uint ShenandoahHeap::max_workers() {
1941 return _max_workers;
1942 }
1943
|