// ------------------------------------------------------------------ // ciKlass::least_common_ancestor // // Get the shared parent of two klasses. // // Implementation note: this method currently goes "over the wall" // and does all of the work on the VM side. It could be rewritten // to use the super() method and do all of the work (aside from the // lazy computation of super()) in native mode. This may be // worthwhile if the compiler is repeatedly requesting the same lca // computation or possibly if most of the superklasses have already // been created as ciObjects anyway. Something to think about...
ciKlass*
ciKlass::least_common_ancestor(ciKlass* that) {
assert(is_loaded() && that->is_loaded(), "must be loaded"); // Check to see if the klasses are identical. if (this == that) { returnthis;
}
// Many times the LCA will be either this_klass or that_klass. // Treat these as special cases. if (lca == that_klass) {
assert(this->is_subtype_of(that), "sanity"); return that;
} if (this_klass == lca) {
assert(that->is_subtype_of(this), "sanity"); returnthis;
}
// Create the ciInstanceKlass for the lca.
ciKlass* result =
CURRENT_THREAD_ENV->get_klass(lca);
// ------------------------------------------------------------------ // ciKlass::find_klass // // Find a klass using this klass's class loader.
ciKlass* ciKlass::find_klass(ciSymbol* klass_name) {
assert(is_loaded(), "cannot find_klass through an unloaded klass"); return CURRENT_ENV->get_klass_by_name(this,
klass_name, false);
}
// ------------------------------------------------------------------ // ciKlass::java_mirror // // Get the instance of java.lang.Class corresponding to this klass. // If it is an unloaded instance or array klass, return an unloaded // mirror object of type Class.
ciInstance* ciKlass::java_mirror() {
GUARDED_VM_ENTRY( if (!is_loaded()) return ciEnv::current()->get_unloaded_klass_mirror(this);
oop java_mirror = get_Klass()->java_mirror(); return CURRENT_ENV->get_instance(java_mirror);
)
}
// ------------------------------------------------------------------ // ciKlass::print_name // // Print the name of this klass void ciKlass::print_name_on(outputStream* st) {
name()->print_symbol_on(st);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.