Mercurial > hg > truffle
diff src/share/vm/oops/instanceKlass.cpp @ 14909:4ca6dc0799b6
Backout jdk9 merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 01 Apr 2014 13:57:07 +0200 |
parents | 8762b6b8fbb6 |
children | 5e6f29f287d6 |
line wrap: on
line diff
--- a/src/share/vm/oops/instanceKlass.cpp Tue Apr 01 14:09:03 2014 +0200 +++ b/src/share/vm/oops/instanceKlass.cpp Tue Apr 01 13:57:07 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, 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 @@ -49,7 +49,6 @@ #include "prims/jvmtiExport.hpp" #include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/jvmtiRedefineClasses.hpp" -#include "prims/jvmtiThreadState.hpp" #include "prims/methodComparator.hpp" #include "runtime/fieldDescriptor.hpp" #include "runtime/handles.inline.hpp" @@ -78,6 +77,51 @@ #ifdef DTRACE_ENABLED +#ifndef USDT2 + +HS_DTRACE_PROBE_DECL4(hotspot, class__initialization__required, + char*, intptr_t, oop, intptr_t); +HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__recursive, + char*, intptr_t, oop, intptr_t, int); +HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__concurrent, + char*, intptr_t, oop, intptr_t, int); +HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__erroneous, + char*, intptr_t, oop, intptr_t, int); +HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__super__failed, + char*, intptr_t, oop, intptr_t, int); +HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__clinit, + char*, intptr_t, oop, intptr_t, int); +HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__error, + char*, intptr_t, oop, intptr_t, int); +HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__end, + char*, intptr_t, oop, intptr_t, int); + +#define DTRACE_CLASSINIT_PROBE(type, clss, thread_type) \ + { \ + char* data = NULL; \ + int len = 0; \ + Symbol* name = (clss)->name(); \ + if (name != NULL) { \ + data = (char*)name->bytes(); \ + len = name->utf8_length(); \ + } \ + HS_DTRACE_PROBE4(hotspot, class__initialization__##type, \ + data, len, SOLARIS_ONLY((void *))(clss)->class_loader(), thread_type); \ + } + +#define DTRACE_CLASSINIT_PROBE_WAIT(type, clss, thread_type, wait) \ + { \ + char* data = NULL; \ + int len = 0; \ + Symbol* name = (clss)->name(); \ + if (name != NULL) { \ + data = (char*)name->bytes(); \ + len = name->utf8_length(); \ + } \ + HS_DTRACE_PROBE5(hotspot, class__initialization__##type, \ + data, len, SOLARIS_ONLY((void *))(clss)->class_loader(), thread_type, wait); \ + } +#else /* USDT2 */ #define HOTSPOT_CLASS_INITIALIZATION_required HOTSPOT_CLASS_INITIALIZATION_REQUIRED #define HOTSPOT_CLASS_INITIALIZATION_recursive HOTSPOT_CLASS_INITIALIZATION_RECURSIVE @@ -112,6 +156,7 @@ HOTSPOT_CLASS_INITIALIZATION_##type( \ data, len, (clss)->class_loader(), thread_type, wait); \ } +#endif /* USDT2 */ #else // ndef DTRACE_ENABLED @@ -863,16 +908,10 @@ // Step 10 and 11 Handle e(THREAD, PENDING_EXCEPTION); CLEAR_PENDING_EXCEPTION; - // JVMTI has already reported the pending exception - // JVMTI internal flag reset is needed in order to report ExceptionInInitializerError - JvmtiExport::clear_detected_exception((JavaThread*)THREAD); { EXCEPTION_MARK; this_oop->set_initialization_state_and_notify(initialization_error, THREAD); CLEAR_PENDING_EXCEPTION; // ignore any exception thrown, class initialization error is thrown below - // JVMTI has already reported the pending exception - // JVMTI internal flag reset is needed in order to report ExceptionInInitializerError - JvmtiExport::clear_detected_exception((JavaThread*)THREAD); } DTRACE_CLASSINIT_PROBE_WAIT(error, InstanceKlass::cast(this_oop()), -1,wait); if (e->is_a(SystemDictionary::Error_klass())) { @@ -1164,11 +1203,7 @@ MutexLocker x(OopMapCacheAlloc_lock); // First time use. Allocate a cache in C heap if (_oop_map_cache == NULL) { - // Release stores from OopMapCache constructor before assignment - // to _oop_map_cache. C++ compilers on ppc do not emit the - // required memory barrier only because of the volatile - // qualifier of _oop_map_cache. - OrderAccess::release_store_ptr(&_oop_map_cache, new OopMapCache()); + _oop_map_cache = new OopMapCache(); } } // _oop_map_cache is constant after init; lookup below does is own locking. @@ -1463,18 +1498,13 @@ return -1; } -// uncached_lookup_method searches both the local class methods array and all -// superclasses methods arrays, skipping any overpass methods in superclasses. +// lookup_method searches both the local methods array and all superclasses methods arrays Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const { Klass* klass = const_cast<InstanceKlass*>(this); - bool dont_ignore_overpasses = true; // For the class being searched, find its overpasses. while (klass != NULL) { Method* method = InstanceKlass::cast(klass)->find_method(name, signature); - if ((method != NULL) && (dont_ignore_overpasses || !method->is_overpass())) { - return method; - } + if (method != NULL) return method; klass = InstanceKlass::cast(klass)->super(); - dont_ignore_overpasses = false; // Ignore overpass methods in all superclasses. } return NULL; } @@ -1489,7 +1519,7 @@ } // Look up interfaces if (m == NULL) { - m = lookup_method_in_all_interfaces(name, signature, false); + m = lookup_method_in_all_interfaces(name, signature); } return m; } @@ -1498,16 +1528,14 @@ // Do NOT return private or static methods, new in JDK8 which are not externally visible // They should only be found in the initial InterfaceMethodRef Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name, - Symbol* signature, - bool skip_default_methods) const { + Symbol* signature) const { Array<Klass*>* all_ifs = transitive_interfaces(); int num_ifs = all_ifs->length(); InstanceKlass *ik = NULL; for (int i = 0; i < num_ifs; i++) { ik = InstanceKlass::cast(all_ifs->at(i)); Method* m = ik->lookup_method(name, signature); - if (m != NULL && m->is_public() && !m->is_static() && - (!skip_default_methods || !m->is_default_method())) { + if (m != NULL && m->is_public() && !m->is_static()) { return m; } } @@ -2199,7 +2227,15 @@ for (int m = 0; m < methods()->length(); m++) { MethodData* mdo = methods()->at(m)->method_data(); if (mdo != NULL) { - mdo->clean_method_data(is_alive); + for (ProfileData* data = mdo->first_data(); + mdo->is_valid(data); + data = mdo->next_data(data)) { + data->clean_weak_klass_links(is_alive); + } + ParametersTypeData* parameters = mdo->parameters_type_data(); + if (parameters != NULL) { + parameters->clean_weak_klass_links(is_alive); + } } } } @@ -2718,7 +2754,7 @@ Method* m = n->method(); // Search for match while(cur != NULL && cur != n) { - if (TieredCompilation && m == cur->method()) { + if (TieredCompilation) { // Find max level before n max_level = MAX2(max_level, cur->comp_level()); } @@ -2740,9 +2776,7 @@ cur = next; while (cur != NULL) { // Find max level after n - if (m == cur->method()) { - max_level = MAX2(max_level, cur->comp_level()); - } + max_level = MAX2(max_level, cur->comp_level()); cur = cur->osr_link(); } m->set_highest_osr_comp_level(max_level); @@ -2988,7 +3022,8 @@ offset <= (juint) value->length() && offset + length <= (juint) value->length()) { st->print(BULLET"string: "); - java_lang_String::print(obj, st); + Handle h_obj(obj); + java_lang_String::print(h_obj, st); st->cr(); if (!WizardMode) return; // that is enough } @@ -3139,7 +3174,7 @@ virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); } }; -void InstanceKlass::verify_on(outputStream* st) { +void InstanceKlass::verify_on(outputStream* st, bool check_dictionary) { #ifndef PRODUCT // Avoid redundant verifies, this really should be in product. if (_verify_count == Universe::verify_count()) return; @@ -3147,11 +3182,14 @@ #endif // Verify Klass - Klass::verify_on(st); - - // Verify that klass is present in ClassLoaderData - guarantee(class_loader_data()->contains_klass(this), - "this class isn't found in class loader data"); + Klass::verify_on(st, check_dictionary); + + // Verify that klass is present in SystemDictionary if not already + // verifying the SystemDictionary. + if (is_loaded() && !is_anonymous() && check_dictionary) { + Symbol* h_name = name(); + SystemDictionary::verify_obj_klass_present(h_name, class_loader_data()); + } // Verify vtables if (is_linked()) {