12 * version 2 for more details (a copy is included in the LICENSE file that
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 #ifndef SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP
26 #define SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP
27
28 #include "memory/allocation.hpp"
29 #include "memory/memRegion.hpp"
30 #include "memory/metaspace.hpp"
31 #include "memory/metaspaceCounters.hpp"
32 #include "runtime/mutex.hpp"
33 #include "trace/traceMacros.hpp"
34 #include "utilities/growableArray.hpp"
35 #include "utilities/macros.hpp"
36 #if INCLUDE_TRACE
37 #include "utilities/ticks.hpp"
38 #endif
39
40 //
41 // A class loader represents a linkset. Conceptually, a linkset identifies
42 // the complete transitive closure of resolved links that a dynamic linker can
43 // produce.
44 //
45 // A ClassLoaderData also encapsulates the allocation space, called a metaspace,
46 // used by the dynamic linker to allocate the runtime representation of all
47 // the types it defines.
48 //
49 // ClassLoaderData are stored in the runtime representation of classes,
50 // and provides iterators for root tracing and other GC operations.
51
345
346 inline unsigned int identity_hash() const { return (unsigned int)(((intptr_t)this) >> 3); }
347
348 // Used when tracing from klasses.
349 void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim);
350
351 void classes_do(KlassClosure* klass_closure);
352 Klass* klasses() { return _klasses; }
353
354 JNIMethodBlock* jmethod_ids() const { return _jmethod_ids; }
355 void set_jmethod_ids(JNIMethodBlock* new_block) { _jmethod_ids = new_block; }
356
357 void print() { print_on(tty); }
358 void print_on(outputStream* out) const;
359 void print_value() { print_value_on(tty); }
360 void print_value_on(outputStream* out) const;
361 void dump(outputStream * const out) PRODUCT_RETURN;
362 void verify();
363 const char* loader_name();
364
365 jobject add_handle(Handle h);
366 void remove_handle_unsafe(jobject h);
367 void add_class(Klass* k, bool publicize = true);
368 void remove_class(Klass* k);
369 bool contains_klass(Klass* k);
370 void record_dependency(const Klass* to, TRAPS);
371 void init_dependencies(TRAPS);
372 PackageEntryTable* packages() { return _packages; }
373 ModuleEntry* unnamed_module() { return _unnamed_module; }
374 ModuleEntryTable* modules();
375 bool modules_defined() { return (_modules != NULL); }
376
377 // Loaded class dictionary
378 Dictionary* dictionary() const { return _dictionary; }
379
380 void add_to_deallocate_list(Metadata* m);
381
382 static ClassLoaderData* class_loader_data(oop loader);
383 static ClassLoaderData* class_loader_data_or_null(oop loader);
384 static ClassLoaderData* anonymous_class_loader_data(oop loader, TRAPS);
385 static void print_loader(ClassLoaderData *loader_data, outputStream *out);
386
|
12 * version 2 for more details (a copy is included in the LICENSE file that
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 #ifndef SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP
26 #define SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP
27
28 #include "memory/allocation.hpp"
29 #include "memory/memRegion.hpp"
30 #include "memory/metaspace.hpp"
31 #include "memory/metaspaceCounters.hpp"
32 #include "oops/oopHandle.hpp"
33 #include "runtime/mutex.hpp"
34 #include "trace/traceMacros.hpp"
35 #include "utilities/growableArray.hpp"
36 #include "utilities/macros.hpp"
37 #if INCLUDE_TRACE
38 #include "utilities/ticks.hpp"
39 #endif
40
41 //
42 // A class loader represents a linkset. Conceptually, a linkset identifies
43 // the complete transitive closure of resolved links that a dynamic linker can
44 // produce.
45 //
46 // A ClassLoaderData also encapsulates the allocation space, called a metaspace,
47 // used by the dynamic linker to allocate the runtime representation of all
48 // the types it defines.
49 //
50 // ClassLoaderData are stored in the runtime representation of classes,
51 // and provides iterators for root tracing and other GC operations.
52
346
347 inline unsigned int identity_hash() const { return (unsigned int)(((intptr_t)this) >> 3); }
348
349 // Used when tracing from klasses.
350 void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim);
351
352 void classes_do(KlassClosure* klass_closure);
353 Klass* klasses() { return _klasses; }
354
355 JNIMethodBlock* jmethod_ids() const { return _jmethod_ids; }
356 void set_jmethod_ids(JNIMethodBlock* new_block) { _jmethod_ids = new_block; }
357
358 void print() { print_on(tty); }
359 void print_on(outputStream* out) const;
360 void print_value() { print_value_on(tty); }
361 void print_value_on(outputStream* out) const;
362 void dump(outputStream * const out) PRODUCT_RETURN;
363 void verify();
364 const char* loader_name();
365
366 OopHandle add_handle(Handle h);
367 void remove_handle_unsafe(OopHandle h);
368 void add_class(Klass* k, bool publicize = true);
369 void remove_class(Klass* k);
370 bool contains_klass(Klass* k);
371 void record_dependency(const Klass* to, TRAPS);
372 void init_dependencies(TRAPS);
373 PackageEntryTable* packages() { return _packages; }
374 ModuleEntry* unnamed_module() { return _unnamed_module; }
375 ModuleEntryTable* modules();
376 bool modules_defined() { return (_modules != NULL); }
377
378 // Loaded class dictionary
379 Dictionary* dictionary() const { return _dictionary; }
380
381 void add_to_deallocate_list(Metadata* m);
382
383 static ClassLoaderData* class_loader_data(oop loader);
384 static ClassLoaderData* class_loader_data_or_null(oop loader);
385 static ClassLoaderData* anonymous_class_loader_data(oop loader, TRAPS);
386 static void print_loader(ClassLoaderData *loader_data, outputStream *out);
387
|