18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/shared/collectedHeap.hpp"
27 #include "gc/shared/collectedHeap.inline.hpp"
28 #include "gc/shared/genCollectedHeap.hpp"
29 #include "memory/resourceArea.hpp"
30 #include "runtime/atomic.hpp"
31 #include "runtime/frame.inline.hpp"
32 #include "runtime/handles.inline.hpp"
33 #include "runtime/init.hpp"
34 #include "runtime/interfaceSupport.inline.hpp"
35 #include "runtime/orderAccess.inline.hpp"
36 #include "runtime/os.inline.hpp"
37 #include "runtime/thread.inline.hpp"
38 #include "runtime/vframe.hpp"
39 #include "runtime/vmThread.hpp"
40 #include "utilities/preserveException.hpp"
41
42 // Implementation of InterfaceSupport
43
44 #ifdef ASSERT
45 VMEntryWrapper::VMEntryWrapper() {
46 if (VerifyLastFrame) {
47 InterfaceSupport::verify_last_frame();
48 }
49 }
50
51 VMEntryWrapper::~VMEntryWrapper() {
52 InterfaceSupport::check_gc_alot();
53 if (WalkStackALot) {
54 InterfaceSupport::walk_stack();
55 }
56 #ifdef COMPILER2
57 // This option is not used by Compiler 1
281
282 void InterfaceSupport::verify_last_frame() {
283 JavaThread* thread = JavaThread::current();
284 ResourceMark rm(thread);
285 RegisterMap reg_map(thread);
286 frame fr = thread->last_frame();
287 fr.verify(®_map);
288 }
289
290
291 #endif // ASSERT
292
293
294 void InterfaceSupport_init() {
295 #ifdef ASSERT
296 if (ScavengeALot || FullGCALot) {
297 srand(ScavengeALotInterval * FullGCALotInterval);
298 }
299 #endif
300 }
|
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/shared/collectedHeap.hpp"
27 #include "gc/shared/collectedHeap.inline.hpp"
28 #include "gc/shared/genCollectedHeap.hpp"
29 #include "memory/resourceArea.hpp"
30 #include "runtime/atomic.hpp"
31 #include "runtime/frame.inline.hpp"
32 #include "runtime/handles.inline.hpp"
33 #include "runtime/init.hpp"
34 #include "runtime/interfaceSupport.inline.hpp"
35 #include "runtime/orderAccess.inline.hpp"
36 #include "runtime/os.inline.hpp"
37 #include "runtime/thread.inline.hpp"
38 #include "runtime/safepointVerifiers.hpp"
39 #include "runtime/vframe.hpp"
40 #include "runtime/vmThread.hpp"
41 #include "utilities/preserveException.hpp"
42
43 // Implementation of InterfaceSupport
44
45 #ifdef ASSERT
46 VMEntryWrapper::VMEntryWrapper() {
47 if (VerifyLastFrame) {
48 InterfaceSupport::verify_last_frame();
49 }
50 }
51
52 VMEntryWrapper::~VMEntryWrapper() {
53 InterfaceSupport::check_gc_alot();
54 if (WalkStackALot) {
55 InterfaceSupport::walk_stack();
56 }
57 #ifdef COMPILER2
58 // This option is not used by Compiler 1
282
283 void InterfaceSupport::verify_last_frame() {
284 JavaThread* thread = JavaThread::current();
285 ResourceMark rm(thread);
286 RegisterMap reg_map(thread);
287 frame fr = thread->last_frame();
288 fr.verify(®_map);
289 }
290
291
292 #endif // ASSERT
293
294
295 void InterfaceSupport_init() {
296 #ifdef ASSERT
297 if (ScavengeALot || FullGCALot) {
298 srand(ScavengeALotInterval * FullGCALotInterval);
299 }
300 #endif
301 }
302
303 #ifdef ASSERT
304 // JRT_LEAF rules:
305 // A JRT_LEAF method may not interfere with safepointing by
306 // 1) acquiring or blocking on a Mutex or JavaLock - checked
307 // 2) allocating heap memory - checked
308 // 3) executing a VM operation - checked
309 // 4) executing a system call (including malloc) that could block or grab a lock
310 // 5) invoking GC
311 // 6) reaching a safepoint
312 // 7) running too long
313 // Nor may any method it calls.
314 JRTLeafVerifier::JRTLeafVerifier()
315 : NoSafepointVerifier(true, JRTLeafVerifier::should_verify_GC())
316 {
317 }
318
319 JRTLeafVerifier::~JRTLeafVerifier()
320 {
321 }
322
323 bool JRTLeafVerifier::should_verify_GC() {
324 switch (JavaThread::current()->thread_state()) {
325 case _thread_in_Java:
326 // is in a leaf routine, there must be no safepoint.
327 return true;
328 case _thread_in_native:
329 // A native thread is not subject to safepoints.
330 // Even while it is in a leaf routine, GC is ok
331 return false;
332 default:
333 // Leaf routines cannot be called from other contexts.
334 ShouldNotReachHere();
335 return false;
336 }
337 }
338 #endif
|