/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "runtime/thread.hpp"
#include "utilities/hashtable.hpp"
class PlaceholderEntry;
// Placeholder objects. These represent classes currently
// being loaded, as well as arrays of primitives.
//
friend class VMStructs;
public:
PlaceholderTable(int table_size);
PlaceholderEntry* new_entry(int hash, Symbol* name, oop loader, bool havesupername, Symbol* supername);
}
}
}
// This returns a Symbol* to match type for SystemDictionary
// caller to create a placeholder entry must enumerate an action
// caller claims ownership of that action
// For parallel classloading:
// multiple LOAD_INSTANCE threads can proceed in parallel
// multiple LOAD_SUPER threads can proceed in parallel
// LOAD_SUPER needed to check for class circularity
// DEFINE_CLASS: ultimately define class must be single threaded
// on a class/classloader basis
// so the head of that queue owns the token
// and the rest of the threads return the result the first thread gets
enum classloadAction {
};
// find_and_add returns probe pointer - old or new
// If no entry exists, add a placeholder entry and push SeenThread
// If entry exists, reuse entry and push SeenThread for classloadAction
// Remove placeholder information
// GC support.
void oops_do(OopClosure* f);
// JVMTI support
#ifndef PRODUCT
void print();
#endif
void verify();
};
// SeenThread objects represent list of threads that are
// currently performing a load action on a class.
// For class circularity, set before loading a superclass.
// For bootclasssearchpath, set before calling load_instance_class.
// Defining must be single threaded on a class/classloader basis
// For DEFINE_CLASS, the head of the queue owns the
// define token and the rest of the threads wait to return the
// result the first thread gets.
private:
public:
}
#ifndef PRODUCT
void printActionQ() {
}
}
#endif // PRODUCT
};
// Placeholder objects represent classes currently being loaded.
// All threads examining the placeholder table must hold the
// SystemDictionary_lock, so we don't need special precautions
// on store ordering here.
// The system dictionary is the only user of this class.
friend class VMStructs;
private:
// can be multiple threads if classloader object lock broken by application
// or if classloader supports parallel classloading
// including _definer
// _definer owns token
// queue waits for and returns results from _definer
public:
// Simple accessors, used only by SystemDictionary
}
}
}
// Test for equality
// Entries are unique for class/classloader name pair
}
switch (action) {
case PlaceholderTable::LOAD_INSTANCE:
break;
case PlaceholderTable::LOAD_SUPER:
break;
case PlaceholderTable::DEFINE_CLASS:
break;
default: Unimplemented();
}
return queuehead;
}
switch (action) {
case PlaceholderTable::LOAD_INSTANCE:
break;
case PlaceholderTable::LOAD_SUPER:
break;
case PlaceholderTable::DEFINE_CLASS:
break;
default: Unimplemented();
}
return;
}
bool super_load_in_progress() {
return (_superThreadQ != NULL);
}
bool instance_load_in_progress() {
return (_loadInstanceThreadQ != NULL);
}
bool define_class_in_progress() {
return (_defineThreadQ != NULL);
}
// Doubly-linked list of Threads per action for class/classloader pair
// Class circularity support: links in thread before loading superclass
// bootstrapsearchpath support: links in a thread before load_instance_class
// definers: use as queue of define requestors, including owner of
// define token. Appends for debugging of requestor order
return;
}
}
return;
}
while (seen) {
return true;
}
}
return false;
}
// returns true if seenthreadQ is now empty
// Note, caller must ensure probe still exists while holding
// SystemDictionary_lock
// ignores if cleanup has already been done
// if found, deletes SeenThread
while (seen) {
if (prev) {
} else {
}
}
delete seen;
break;
}
}
}
// GC support
// Applies "f->do_oop" to all root oops in the placeholder table.
// Print method doesn't append a cr
void verify() const;
};
#endif // SHARE_VM_CLASSFILE_PLACEHOLDERS_HPP