13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
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 "classfile/metadataOnStackMark.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "code/codeCache.hpp"
29 #include "code/debugInfoRec.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "gc/shared/gcLocker.hpp"
32 #include "gc/shared/generation.hpp"
33 #include "gc/shared/referencePendingListLocker.hpp"
34 #include "interpreter/bytecodeStream.hpp"
35 #include "interpreter/bytecodeTracer.hpp"
36 #include "interpreter/bytecodes.hpp"
37 #include "interpreter/interpreter.hpp"
38 #include "interpreter/oopMapCache.hpp"
39 #include "memory/heapInspection.hpp"
40 #include "memory/metadataFactory.hpp"
41 #include "memory/metaspaceShared.hpp"
42 #include "memory/oopFactory.hpp"
43 #include "memory/resourceArea.hpp"
44 #include "oops/constMethod.hpp"
45 #include "oops/method.hpp"
46 #include "oops/methodData.hpp"
47 #include "oops/objArrayOop.inline.hpp"
48 #include "oops/oop.inline.hpp"
49 #include "oops/symbol.hpp"
50 #include "prims/jvmtiExport.hpp"
51 #include "prims/methodHandles.hpp"
52 #include "prims/nativeLookup.hpp"
53 #include "runtime/arguments.hpp"
379 }
380 tty->cr();
381
382 tty->print_cr (" interpreter_invocation_count: %8d ", interpreter_invocation_count());
383 tty->print_cr (" invocation_counter: %8d ", invocation_count());
384 tty->print_cr (" backedge_counter: %8d ", backedge_count());
385 #ifndef PRODUCT
386 if (CountCompiledCalls) {
387 tty->print_cr (" compiled_invocation_count: %8d ", compiled_invocation_count());
388 }
389 #endif
390 }
391
392 // Build a MethodData* object to hold information about this method
393 // collected in the interpreter.
394 void Method::build_interpreter_method_data(const methodHandle& method, TRAPS) {
395 // Do not profile the method if metaspace has hit an OOM previously
396 // allocating profiling data. Callers clear pending exception so don't
397 // add one here.
398 if (ClassLoaderDataGraph::has_metaspace_oom()) {
399 return;
400 }
401
402 // Do not profile method if current thread holds the pending list lock,
403 // which avoids deadlock for acquiring the MethodData_lock.
404 if (ReferencePendingListLocker::is_locked_by_self()) {
405 return;
406 }
407
408 // Grab a lock here to prevent multiple
409 // MethodData*s from being created.
410 MutexLocker ml(MethodData_lock, THREAD);
411 if (method->method_data() == NULL) {
412 ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
413 MethodData* method_data = MethodData::allocate(loader_data, method, THREAD);
414 if (HAS_PENDING_EXCEPTION) {
415 CompileBroker::log_metaspace_failure();
416 ClassLoaderDataGraph::set_metaspace_oom(true);
417 return; // return the exception (which is cleared)
418 }
419
420 method->set_method_data(method_data);
421 if (PrintMethodData && (Verbose || WizardMode)) {
422 ResourceMark rm(THREAD);
423 tty->print("build_interpreter_method_data for ");
424 method->print_name(tty);
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
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 "classfile/metadataOnStackMark.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "code/codeCache.hpp"
29 #include "code/debugInfoRec.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "gc/shared/gcLocker.hpp"
32 #include "gc/shared/generation.hpp"
33 #include "interpreter/bytecodeStream.hpp"
34 #include "interpreter/bytecodeTracer.hpp"
35 #include "interpreter/bytecodes.hpp"
36 #include "interpreter/interpreter.hpp"
37 #include "interpreter/oopMapCache.hpp"
38 #include "memory/heapInspection.hpp"
39 #include "memory/metadataFactory.hpp"
40 #include "memory/metaspaceShared.hpp"
41 #include "memory/oopFactory.hpp"
42 #include "memory/resourceArea.hpp"
43 #include "oops/constMethod.hpp"
44 #include "oops/method.hpp"
45 #include "oops/methodData.hpp"
46 #include "oops/objArrayOop.inline.hpp"
47 #include "oops/oop.inline.hpp"
48 #include "oops/symbol.hpp"
49 #include "prims/jvmtiExport.hpp"
50 #include "prims/methodHandles.hpp"
51 #include "prims/nativeLookup.hpp"
52 #include "runtime/arguments.hpp"
378 }
379 tty->cr();
380
381 tty->print_cr (" interpreter_invocation_count: %8d ", interpreter_invocation_count());
382 tty->print_cr (" invocation_counter: %8d ", invocation_count());
383 tty->print_cr (" backedge_counter: %8d ", backedge_count());
384 #ifndef PRODUCT
385 if (CountCompiledCalls) {
386 tty->print_cr (" compiled_invocation_count: %8d ", compiled_invocation_count());
387 }
388 #endif
389 }
390
391 // Build a MethodData* object to hold information about this method
392 // collected in the interpreter.
393 void Method::build_interpreter_method_data(const methodHandle& method, TRAPS) {
394 // Do not profile the method if metaspace has hit an OOM previously
395 // allocating profiling data. Callers clear pending exception so don't
396 // add one here.
397 if (ClassLoaderDataGraph::has_metaspace_oom()) {
398 return;
399 }
400
401 // Grab a lock here to prevent multiple
402 // MethodData*s from being created.
403 MutexLocker ml(MethodData_lock, THREAD);
404 if (method->method_data() == NULL) {
405 ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
406 MethodData* method_data = MethodData::allocate(loader_data, method, THREAD);
407 if (HAS_PENDING_EXCEPTION) {
408 CompileBroker::log_metaspace_failure();
409 ClassLoaderDataGraph::set_metaspace_oom(true);
410 return; // return the exception (which is cleared)
411 }
412
413 method->set_method_data(method_data);
414 if (PrintMethodData && (Verbose || WizardMode)) {
415 ResourceMark rm(THREAD);
416 tty->print("build_interpreter_method_data for ");
417 method->print_name(tty);
|