comparison src/share/vm/runtime/vmThread.cpp @ 7630:5ce621176715

8004903: VMThread::execute() calls Thread::check_for_valid_safepoint_state() on concurrent VM ops Summary: check_for_valid_safepoint_state() only applies to blocking VM ops Reviewed-by: acorn, dholmes, dice, sspitsyn Contributed-by: karen.kinnear@oracle.com
author dcubed
date Tue, 22 Jan 2013 05:57:18 -0800
parents f34d701e952e
children f36e073d56a4
comparison
equal deleted inserted replaced
7629:22ba8c8ce6a6 7630:5ce621176715
1 /* 1 /*
2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1998, 2013, 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.
568 Thread* t = Thread::current(); 568 Thread* t = Thread::current();
569 569
570 if (!t->is_VM_thread()) { 570 if (!t->is_VM_thread()) {
571 SkipGCALot sgcalot(t); // avoid re-entrant attempts to gc-a-lot 571 SkipGCALot sgcalot(t); // avoid re-entrant attempts to gc-a-lot
572 // JavaThread or WatcherThread 572 // JavaThread or WatcherThread
573 t->check_for_valid_safepoint_state(true); 573 bool concurrent = op->evaluate_concurrently();
574 // only blocking VM operations need to verify the caller's safepoint state:
575 if (!concurrent) {
576 t->check_for_valid_safepoint_state(true);
577 }
574 578
575 // New request from Java thread, evaluate prologue 579 // New request from Java thread, evaluate prologue
576 if (!op->doit_prologue()) { 580 if (!op->doit_prologue()) {
577 return; // op was cancelled 581 return; // op was cancelled
578 } 582 }
580 // Setup VM_operations for execution 584 // Setup VM_operations for execution
581 op->set_calling_thread(t, Thread::get_priority(t)); 585 op->set_calling_thread(t, Thread::get_priority(t));
582 586
583 // It does not make sense to execute the epilogue, if the VM operation object is getting 587 // It does not make sense to execute the epilogue, if the VM operation object is getting
584 // deallocated by the VM thread. 588 // deallocated by the VM thread.
585 bool concurrent = op->evaluate_concurrently();
586 bool execute_epilog = !op->is_cheap_allocated(); 589 bool execute_epilog = !op->is_cheap_allocated();
587 assert(!concurrent || op->is_cheap_allocated(), "concurrent => cheap_allocated"); 590 assert(!concurrent || op->is_cheap_allocated(), "concurrent => cheap_allocated");
588 591
589 // Get ticket number for non-concurrent VM operations 592 // Get ticket number for non-concurrent VM operations
590 int ticket = 0; 593 int ticket = 0;