Mercurial > hg > truffle
comparison src/share/vm/services/threadService.cpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | d2a62e0f25eb |
children | d8ce2825b193 |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2003, 2012, 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. |
247 VMThread::execute(&op); | 247 VMThread::execute(&op); |
248 | 248 |
249 // Allocate the resulting StackTraceElement[][] object | 249 // Allocate the resulting StackTraceElement[][] object |
250 | 250 |
251 ResourceMark rm(THREAD); | 251 ResourceMark rm(THREAD); |
252 klassOop k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_StackTraceElement_array(), true, CHECK_NH); | 252 Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_StackTraceElement_array(), true, CHECK_NH); |
253 objArrayKlassHandle ik (THREAD, k); | 253 objArrayKlass* ik = objArrayKlass::cast(k); |
254 objArrayOop r = oopFactory::new_objArray(ik(), num_threads, CHECK_NH); | 254 objArrayOop r = oopFactory::new_objArray(ik, num_threads, CHECK_NH); |
255 objArrayHandle result_obj(THREAD, r); | 255 objArrayHandle result_obj(THREAD, r); |
256 | 256 |
257 int num_snapshots = dump_result.num_snapshots(); | 257 int num_snapshots = dump_result.num_snapshots(); |
258 assert(num_snapshots == num_threads, "Must have num_threads thread snapshots"); | 258 assert(num_snapshots == num_threads, "Must have num_threads thread snapshots"); |
259 int i = 0; | 259 int i = 0; |
382 } | 382 } |
383 | 383 |
384 ThreadDumpResult::ThreadDumpResult() : _num_threads(0), _num_snapshots(0), _snapshots(NULL), _next(NULL), _last(NULL) { | 384 ThreadDumpResult::ThreadDumpResult() : _num_threads(0), _num_snapshots(0), _snapshots(NULL), _next(NULL), _last(NULL) { |
385 | 385 |
386 // Create a new ThreadDumpResult object and append to the list. | 386 // Create a new ThreadDumpResult object and append to the list. |
387 // If GC happens before this function returns, methodOop | 387 // If GC happens before this function returns, Method* |
388 // in the stack trace will be visited. | 388 // in the stack trace will be visited. |
389 ThreadService::add_thread_dump(this); | 389 ThreadService::add_thread_dump(this); |
390 } | 390 } |
391 | 391 |
392 ThreadDumpResult::ThreadDumpResult(int num_threads) : _num_threads(num_threads), _num_snapshots(0), _snapshots(NULL), _next(NULL), _last(NULL) { | 392 ThreadDumpResult::ThreadDumpResult(int num_threads) : _num_threads(num_threads), _num_snapshots(0), _snapshots(NULL), _next(NULL), _last(NULL) { |
446 } | 446 } |
447 } | 447 } |
448 } | 448 } |
449 | 449 |
450 void StackFrameInfo::oops_do(OopClosure* f) { | 450 void StackFrameInfo::oops_do(OopClosure* f) { |
451 f->do_oop((oop*) &_method); | |
452 if (_locked_monitors != NULL) { | 451 if (_locked_monitors != NULL) { |
453 int length = _locked_monitors->length(); | 452 int length = _locked_monitors->length(); |
454 for (int i = 0; i < length; i++) { | 453 for (int i = 0; i < length; i++) { |
455 f->do_oop((oop*) _locked_monitors->adr_at(i)); | 454 f->do_oop((oop*) _locked_monitors->adr_at(i)); |
456 } | 455 } |
461 ResourceMark rm; | 460 ResourceMark rm; |
462 java_lang_Throwable::print_stack_element(st, method(), bci()); | 461 java_lang_Throwable::print_stack_element(st, method(), bci()); |
463 int len = (_locked_monitors != NULL ? _locked_monitors->length() : 0); | 462 int len = (_locked_monitors != NULL ? _locked_monitors->length() : 0); |
464 for (int i = 0; i < len; i++) { | 463 for (int i = 0; i < len; i++) { |
465 oop o = _locked_monitors->at(i); | 464 oop o = _locked_monitors->at(i); |
466 instanceKlass* ik = instanceKlass::cast(o->klass()); | 465 InstanceKlass* ik = InstanceKlass::cast(o->klass()); |
467 st->print_cr("\t- locked <" INTPTR_FORMAT "> (a %s)", (address)o, ik->external_name()); | 466 st->print_cr("\t- locked <" INTPTR_FORMAT "> (a %s)", (address)o, ik->external_name()); |
468 } | 467 } |
469 | 468 |
470 } | 469 } |
471 | 470 |
562 } | 561 } |
563 return found; | 562 return found; |
564 } | 563 } |
565 | 564 |
566 Handle ThreadStackTrace::allocate_fill_stack_trace_element_array(TRAPS) { | 565 Handle ThreadStackTrace::allocate_fill_stack_trace_element_array(TRAPS) { |
567 klassOop k = SystemDictionary::StackTraceElement_klass(); | 566 Klass* k = SystemDictionary::StackTraceElement_klass(); |
568 assert(k != NULL, "must be loaded in 1.4+"); | 567 assert(k != NULL, "must be loaded in 1.4+"); |
569 instanceKlassHandle ik(THREAD, k); | 568 instanceKlassHandle ik(THREAD, k); |
570 | 569 |
571 // Allocate an array of java/lang/StackTraceElement object | 570 // Allocate an array of java/lang/StackTraceElement object |
572 objArrayOop ste = oopFactory::new_objArray(ik(), _depth, CHECK_NH); | 571 objArrayOop ste = oopFactory::new_objArray(ik(), _depth, CHECK_NH); |
679 return; | 678 return; |
680 } | 679 } |
681 | 680 |
682 for (int i = 0; i < locks->length(); i++) { | 681 for (int i = 0; i < locks->length(); i++) { |
683 instanceOop obj = locks->at(i); | 682 instanceOop obj = locks->at(i); |
684 instanceKlass* ik = instanceKlass::cast(obj->klass()); | 683 InstanceKlass* ik = InstanceKlass::cast(obj->klass()); |
685 st->print_cr("\t- <" INTPTR_FORMAT "> (a %s)", (address)obj, ik->external_name()); | 684 st->print_cr("\t- <" INTPTR_FORMAT "> (a %s)", (address)obj, ik->external_name()); |
686 } | 685 } |
687 st->cr(); | 686 st->cr(); |
688 } | 687 } |
689 | 688 |
830 if (waitingToLockMonitor != NULL) { | 829 if (waitingToLockMonitor != NULL) { |
831 st->print(" waiting to lock monitor " INTPTR_FORMAT, waitingToLockMonitor); | 830 st->print(" waiting to lock monitor " INTPTR_FORMAT, waitingToLockMonitor); |
832 oop obj = (oop)waitingToLockMonitor->object(); | 831 oop obj = (oop)waitingToLockMonitor->object(); |
833 if (obj != NULL) { | 832 if (obj != NULL) { |
834 st->print(" (object "INTPTR_FORMAT ", a %s)", (address)obj, | 833 st->print(" (object "INTPTR_FORMAT ", a %s)", (address)obj, |
835 (instanceKlass::cast(obj->klass()))->external_name()); | 834 (InstanceKlass::cast(obj->klass()))->external_name()); |
836 | 835 |
837 if (!currentThread->current_pending_monitor_is_from_java()) { | 836 if (!currentThread->current_pending_monitor_is_from_java()) { |
838 owner_desc = "\n in JNI, which is held by"; | 837 owner_desc = "\n in JNI, which is held by"; |
839 } | 838 } |
840 } else { | 839 } else { |
844 currentThread = Threads::owning_thread_from_monitor_owner( | 843 currentThread = Threads::owning_thread_from_monitor_owner( |
845 (address)waitingToLockMonitor->owner(), false /* no locking needed */); | 844 (address)waitingToLockMonitor->owner(), false /* no locking needed */); |
846 } else { | 845 } else { |
847 st->print(" waiting for ownable synchronizer " INTPTR_FORMAT ", (a %s)", | 846 st->print(" waiting for ownable synchronizer " INTPTR_FORMAT ", (a %s)", |
848 (address)waitingToLockBlocker, | 847 (address)waitingToLockBlocker, |
849 (instanceKlass::cast(waitingToLockBlocker->klass()))->external_name()); | 848 (InstanceKlass::cast(waitingToLockBlocker->klass()))->external_name()); |
850 assert(waitingToLockBlocker->is_a(SystemDictionary::abstract_ownable_synchronizer_klass()), | 849 assert(waitingToLockBlocker->is_a(SystemDictionary::abstract_ownable_synchronizer_klass()), |
851 "Must be an AbstractOwnableSynchronizer"); | 850 "Must be an AbstractOwnableSynchronizer"); |
852 oop ownerObj = java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(waitingToLockBlocker); | 851 oop ownerObj = java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(waitingToLockBlocker); |
853 currentThread = java_lang_Thread::thread(ownerObj); | 852 currentThread = java_lang_Thread::thread(ownerObj); |
854 } | 853 } |