Mercurial > hg > truffle
diff src/share/vm/runtime/safepoint.hpp @ 4867:1a2723f7ad8e
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
Reviewed-by: kvn, iveresov, dholmes
author | never |
---|---|
date | Sun, 29 Jan 2012 16:46:04 -0800 |
parents | f95d63e2154a |
children | 0382d2b469b2 |
line wrap: on
line diff
--- a/src/share/vm/runtime/safepoint.hpp Thu Jan 26 19:39:08 2012 -0800 +++ b/src/share/vm/runtime/safepoint.hpp Sun Jan 29 16:46:04 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,7 @@ #include "code/nmethod.hpp" #include "memory/allocation.hpp" #include "runtime/extendedPC.hpp" +#include "runtime/mutexLocker.hpp" #include "runtime/os.hpp" #include "utilities/ostream.hpp" @@ -92,6 +93,7 @@ private: static volatile SynchronizeState _state; // Threads might read this flag directly, without acquireing the Threads_lock static volatile int _waiting_to_block; // number of threads we are waiting for to block + static int _current_jni_active_count; // Counts the number of active critical natives during the safepoint // This counter is used for fast versions of jni_Get<Primitive>Field. // An even value means there is no ongoing safepoint operations. @@ -146,6 +148,11 @@ return (_state != _not_synchronized); } + inline static void increment_jni_active_count() { + assert_locked_or_safepoint(Safepoint_lock); + _current_jni_active_count++; + } + // Called when a thread volantary blocks static void block(JavaThread *thread); static void signal_thread_at_safepoint() { _waiting_to_block--; }