diff -r 81de17a33575 -r 2d012a75d35c src/hotspot/share/runtime/thread.cpp --- a/src/hotspot/share/runtime/thread.cpp Tue May 07 10:21:04 2019 +0800 +++ b/src/hotspot/share/runtime/thread.cpp Mon May 06 20:05:19 2019 -0700 @@ -1575,18 +1575,15 @@ return !JVMCICountersExcludeCompiler || !thread->is_Compiler_thread(); } -void JavaThread::collect_counters(JVMCIEnv* jvmci_env, JVMCIPrimitiveArray array) { - if (JVMCICounterSize > 0) { - JavaThreadIteratorWithHandle jtiwh; - int len = jvmci_env->get_length(array); - for (int i = 0; i < len; i++) { - jvmci_env->put_long_at(array, i, _jvmci_old_thread_counters[i]); - } - for (; JavaThread *tp = jtiwh.next(); ) { - if (jvmci_counters_include(tp)) { - for (int i = 0; i < len; i++) { - jvmci_env->put_long_at(array, i, jvmci_env->get_long_at(array, i) + tp->_jvmci_counters[i]); - } +void JavaThread::collect_counters(jlong* array, int length) { + assert(length == JVMCICounterSize, "wrong value"); + for (int i = 0; i < length; i++) { + array[i] = _jvmci_old_thread_counters[i]; + } + for (JavaThreadIteratorWithHandle jtiwh; JavaThread *tp = jtiwh.next(); ) { + if (jvmci_counters_include(tp)) { + for (int i = 0; i < length; i++) { + array[i] += tp->_jvmci_counters[i]; } } }