equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
71 if (VerifyStack) { |
71 if (VerifyStack) { |
72 InterfaceSupport::verify_stack(); |
72 InterfaceSupport::verify_stack(); |
73 } |
73 } |
74 } |
74 } |
75 |
75 |
|
76 VMNativeEntryWrapper::VMNativeEntryWrapper() { |
|
77 if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot(); |
|
78 } |
|
79 |
|
80 VMNativeEntryWrapper::~VMNativeEntryWrapper() { |
|
81 if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot(); |
|
82 } |
|
83 |
76 long InterfaceSupport::_number_of_calls = 0; |
84 long InterfaceSupport::_number_of_calls = 0; |
77 long InterfaceSupport::_scavenge_alot_counter = 1; |
85 long InterfaceSupport::_scavenge_alot_counter = 1; |
78 long InterfaceSupport::_fullgc_alot_counter = 1; |
86 long InterfaceSupport::_fullgc_alot_counter = 1; |
79 long InterfaceSupport::_fullgc_alot_invocation = 0; |
87 long InterfaceSupport::_fullgc_alot_invocation = 0; |
80 |
88 |
290 if (ScavengeALot || FullGCALot) { |
298 if (ScavengeALot || FullGCALot) { |
291 srand(ScavengeALotInterval * FullGCALotInterval); |
299 srand(ScavengeALotInterval * FullGCALotInterval); |
292 } |
300 } |
293 #endif |
301 #endif |
294 } |
302 } |
295 |
|
296 #ifdef ASSERT |
|
297 // JRT_LEAF rules: |
|
298 // A JRT_LEAF method may not interfere with safepointing by |
|
299 // 1) acquiring or blocking on a Mutex or JavaLock - checked |
|
300 // 2) allocating heap memory - checked |
|
301 // 3) executing a VM operation - checked |
|
302 // 4) executing a system call (including malloc) that could block or grab a lock |
|
303 // 5) invoking GC |
|
304 // 6) reaching a safepoint |
|
305 // 7) running too long |
|
306 // Nor may any method it calls. |
|
307 JRTLeafVerifier::JRTLeafVerifier() |
|
308 : NoSafepointVerifier(true, JRTLeafVerifier::should_verify_GC()) |
|
309 { |
|
310 } |
|
311 |
|
312 JRTLeafVerifier::~JRTLeafVerifier() |
|
313 { |
|
314 } |
|
315 |
|
316 bool JRTLeafVerifier::should_verify_GC() { |
|
317 switch (JavaThread::current()->thread_state()) { |
|
318 case _thread_in_Java: |
|
319 // is in a leaf routine, there must be no safepoint. |
|
320 return true; |
|
321 case _thread_in_native: |
|
322 // A native thread is not subject to safepoints. |
|
323 // Even while it is in a leaf routine, GC is ok |
|
324 return false; |
|
325 default: |
|
326 // Leaf routines cannot be called from other contexts. |
|
327 ShouldNotReachHere(); |
|
328 return false; |
|
329 } |
|
330 } |
|
331 #endif // ASSERT |
|