12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25 #include "code/codeBehaviours.hpp"
26 #include "runtime/mutexLocker.hpp"
27 #include "runtime/safepoint.hpp"
28
29 CompiledICProtectionBehaviour* CompiledICProtectionBehaviour::_current = NULL;
30
31 bool DefaultICProtectionBehaviour::lock(CompiledMethod* method) {
32 if (CompiledIC_lock->owned_by_self()) {
33 return false;
34 }
35 CompiledIC_lock->lock();
36 return true;
37 }
38
39 void DefaultICProtectionBehaviour::unlock(CompiledMethod* method) {
40 CompiledIC_lock->unlock();
41 }
42
43 bool DefaultICProtectionBehaviour::is_safe(CompiledMethod* method) {
44 return SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->owned_by_self();
45 }
|
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25 #include "code/codeBehaviours.hpp"
26 #include "runtime/mutexLocker.hpp"
27 #include "runtime/safepoint.hpp"
28
29 CompiledICProtectionBehaviour* CompiledICProtectionBehaviour::_current = NULL;
30
31 bool DefaultICProtectionBehaviour::lock(CompiledMethod* method) {
32 if (is_safe(method)) {
33 return false;
34 }
35 CompiledIC_lock->lock_without_safepoint_check();
36 return true;
37 }
38
39 void DefaultICProtectionBehaviour::unlock(CompiledMethod* method) {
40 CompiledIC_lock->unlock();
41 }
42
43 bool DefaultICProtectionBehaviour::is_safe(CompiledMethod* method) {
44 return SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->owned_by_self();
45 }
|