comparison src/share/vm/classfile/classLoaderData.hpp @ 18058:54bc75c144b0

Merge
author asaha
date Thu, 29 May 2014 13:14:25 -0700
parents 7384f6a12fc1
children e4a6e7f1b90b
comparison
equal deleted inserted replaced
18055:1fa005fb28f5 18058:54bc75c144b0
1 /* 1 /*
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2012, 2014, 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.
64 // All CLDs (except the null CLD) can be reached by walking _head->_next->... 64 // All CLDs (except the null CLD) can be reached by walking _head->_next->...
65 static ClassLoaderData* _head; 65 static ClassLoaderData* _head;
66 static ClassLoaderData* _unloading; 66 static ClassLoaderData* _unloading;
67 // CMS support. 67 // CMS support.
68 static ClassLoaderData* _saved_head; 68 static ClassLoaderData* _saved_head;
69 static bool _should_purge;
69 70
70 static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS); 71 static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS);
71 static void post_class_unload_events(void); 72 static void post_class_unload_events(void);
72 public: 73 public:
73 static ClassLoaderData* find_or_create(Handle class_loader, TRAPS); 74 static ClassLoaderData* find_or_create(Handle class_loader, TRAPS);
84 85
85 // CMS support. 86 // CMS support.
86 static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); } 87 static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); }
87 static GrowableArray<ClassLoaderData*>* new_clds(); 88 static GrowableArray<ClassLoaderData*>* new_clds();
88 89
90 static void set_should_purge(bool b) { _should_purge = b; }
91 static void purge_if_needed() {
92 // Only purge the CLDG for CMS if concurrent sweep is complete.
93 if (_should_purge) {
94 purge();
95 // reset for next time.
96 set_should_purge(false);
97 }
98 }
99
89 static void dump_on(outputStream * const out) PRODUCT_RETURN; 100 static void dump_on(outputStream * const out) PRODUCT_RETURN;
90 static void dump() { dump_on(tty); } 101 static void dump() { dump_on(tty); }
91 static void verify(); 102 static void verify();
92 103
93 #ifndef PRODUCT 104 #ifndef PRODUCT
94 // expensive test for pointer in metaspace for debugging
95 static bool contains(address x);
96 static bool contains_loader_data(ClassLoaderData* loader_data); 105 static bool contains_loader_data(ClassLoaderData* loader_data);
97 #endif 106 #endif
98 107
99 #if INCLUDE_TRACE 108 #if INCLUDE_TRACE
100 private: 109 private:
258 const char* loader_name(); 267 const char* loader_name();
259 268
260 jobject add_handle(Handle h); 269 jobject add_handle(Handle h);
261 void add_class(Klass* k); 270 void add_class(Klass* k);
262 void remove_class(Klass* k); 271 void remove_class(Klass* k);
272 bool contains_klass(Klass* k);
263 void record_dependency(Klass* to, TRAPS); 273 void record_dependency(Klass* to, TRAPS);
264 void init_dependencies(TRAPS); 274 void init_dependencies(TRAPS);
265 275
266 void add_to_deallocate_list(Metadata* m); 276 void add_to_deallocate_list(Metadata* m);
267 277