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/oopFactory.hpp"
41 #include "oops/constMethod.hpp"
42 #include "oops/method.hpp"
43 #include "oops/methodData.hpp"
44 #include "oops/objArrayOop.inline.hpp"
45 #include "oops/oop.inline.hpp"
46 #include "oops/symbol.hpp"
47 #include "prims/jvmtiExport.hpp"
48 #include "prims/methodHandles.hpp"
49 #include "prims/nativeLookup.hpp"
50 #include "runtime/arguments.hpp"
51 #include "runtime/compilationPolicy.hpp"
52 #include "runtime/frame.inline.hpp"
357 tty->print_cr (" backedge_counter: %8d ", backedge_count());
358 #ifndef PRODUCT
359 if (CountCompiledCalls) {
360 tty->print_cr (" compiled_invocation_count: %8d ", compiled_invocation_count());
361 }
362 #endif
363 }
364
365 // Build a MethodData* object to hold information about this method
366 // collected in the interpreter.
367 void Method::build_interpreter_method_data(const methodHandle& method, TRAPS) {
368 // Do not profile the method if metaspace has hit an OOM previously
369 // allocating profiling data. Callers clear pending exception so don't
370 // add one here.
371 if (ClassLoaderDataGraph::has_metaspace_oom()) {
372 return;
373 }
374
375 // Do not profile method if current thread holds the pending list lock,
376 // which avoids deadlock for acquiring the MethodData_lock.
377 if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) {
378 return;
379 }
380
381 // Grab a lock here to prevent multiple
382 // MethodData*s from being created.
383 MutexLocker ml(MethodData_lock, THREAD);
384 if (method->method_data() == NULL) {
385 ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
386 MethodData* method_data = MethodData::allocate(loader_data, method, THREAD);
387 if (HAS_PENDING_EXCEPTION) {
388 CompileBroker::log_metaspace_failure();
389 ClassLoaderDataGraph::set_metaspace_oom(true);
390 return; // return the exception (which is cleared)
391 }
392
393 method->set_method_data(method_data);
394 if (PrintMethodData && (Verbose || WizardMode)) {
395 ResourceMark rm(THREAD);
396 tty->print("build_interpreter_method_data for ");
397 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 "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/oopFactory.hpp"
42 #include "oops/constMethod.hpp"
43 #include "oops/method.hpp"
44 #include "oops/methodData.hpp"
45 #include "oops/objArrayOop.inline.hpp"
46 #include "oops/oop.inline.hpp"
47 #include "oops/symbol.hpp"
48 #include "prims/jvmtiExport.hpp"
49 #include "prims/methodHandles.hpp"
50 #include "prims/nativeLookup.hpp"
51 #include "runtime/arguments.hpp"
52 #include "runtime/compilationPolicy.hpp"
53 #include "runtime/frame.inline.hpp"
358 tty->print_cr (" backedge_counter: %8d ", backedge_count());
359 #ifndef PRODUCT
360 if (CountCompiledCalls) {
361 tty->print_cr (" compiled_invocation_count: %8d ", compiled_invocation_count());
362 }
363 #endif
364 }
365
366 // Build a MethodData* object to hold information about this method
367 // collected in the interpreter.
368 void Method::build_interpreter_method_data(const methodHandle& method, TRAPS) {
369 // Do not profile the method if metaspace has hit an OOM previously
370 // allocating profiling data. Callers clear pending exception so don't
371 // add one here.
372 if (ClassLoaderDataGraph::has_metaspace_oom()) {
373 return;
374 }
375
376 // Do not profile method if current thread holds the pending list lock,
377 // which avoids deadlock for acquiring the MethodData_lock.
378 if (ReferencePendingListLocker::is_locked_by_self()) {
379 return;
380 }
381
382 // Grab a lock here to prevent multiple
383 // MethodData*s from being created.
384 MutexLocker ml(MethodData_lock, THREAD);
385 if (method->method_data() == NULL) {
386 ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
387 MethodData* method_data = MethodData::allocate(loader_data, method, THREAD);
388 if (HAS_PENDING_EXCEPTION) {
389 CompileBroker::log_metaspace_failure();
390 ClassLoaderDataGraph::set_metaspace_oom(true);
391 return; // return the exception (which is cleared)
392 }
393
394 method->set_method_data(method_data);
395 if (PrintMethodData && (Verbose || WizardMode)) {
396 ResourceMark rm(THREAD);
397 tty->print("build_interpreter_method_data for ");
398 method->print_name(tty);
|