1.1 --- a/src/share/vm/oops/klassVtable.hpp Fri Aug 31 16:39:35 2012 -0700 1.2 +++ b/src/share/vm/oops/klassVtable.hpp Sat Sep 01 13:25:18 2012 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -30,7 +30,7 @@ 1.11 #include "runtime/handles.hpp" 1.12 #include "utilities/growableArray.hpp" 1.13 1.14 -// A klassVtable abstracts the variable-length vtable that is embedded in instanceKlass 1.15 +// A klassVtable abstracts the variable-length vtable that is embedded in InstanceKlass 1.16 // and arrayKlass. klassVtable objects are used just as convenient transient accessors to the vtable, 1.17 // not to actually hold the vtable data. 1.18 // Note: the klassVtable should not be accessed before the class has been verified 1.19 @@ -65,12 +65,12 @@ 1.20 vtableEntry* table() const { return (vtableEntry*)(address(_klass()) + _tableOffset); } 1.21 KlassHandle klass() const { return _klass; } 1.22 int length() const { return _length; } 1.23 - inline methodOop method_at(int i) const; 1.24 - inline methodOop unchecked_method_at(int i) const; 1.25 - inline oop* adr_method_at(int i) const; 1.26 + inline Method* method_at(int i) const; 1.27 + inline Method* unchecked_method_at(int i) const; 1.28 + inline Method** adr_method_at(int i) const; 1.29 1.30 // searching; all methods return -1 if not found 1.31 - int index_of(methodOop m) const { return index_of(m, _length); } 1.32 + int index_of(Method* m) const { return index_of(m, _length); } 1.33 int index_of_miranda(Symbol* name, Symbol* signature); 1.34 1.35 void initialize_vtable(bool checkconstraints, TRAPS); // initialize vtable of a new klass 1.36 @@ -85,9 +85,9 @@ 1.37 1.38 // computes vtable length (in words) and the number of miranda methods 1.39 static void compute_vtable_size_and_num_mirandas(int &vtable_length, int &num_miranda_methods, 1.40 - klassOop super, objArrayOop methods, 1.41 + Klass* super, Array<Method*>* methods, 1.42 AccessFlags class_flags, Handle classloader, 1.43 - Symbol* classname, objArrayOop local_interfaces, 1.44 + Symbol* classname, Array<Klass*>* local_interfaces, 1.45 TRAPS); 1.46 1.47 // RedefineClasses() API support: 1.48 @@ -96,23 +96,9 @@ 1.49 // trace_name_printed is set to true if the current call has 1.50 // printed the klass name so that other routines in the adjust_* 1.51 // group don't print the klass name. 1.52 - void adjust_method_entries(methodOop* old_methods, methodOop* new_methods, 1.53 + void adjust_method_entries(Method** old_methods, Method** new_methods, 1.54 int methods_length, bool * trace_name_printed); 1.55 1.56 - // Garbage collection 1.57 - void oop_follow_contents(); 1.58 - void oop_adjust_pointers(); 1.59 - 1.60 -#ifndef SERIALGC 1.61 - // Parallel Old 1.62 - void oop_follow_contents(ParCompactionManager* cm); 1.63 - void oop_update_pointers(ParCompactionManager* cm); 1.64 -#endif // SERIALGC 1.65 - 1.66 - // Iterators 1.67 - void oop_oop_iterate(OopClosure* blk); 1.68 - void oop_oop_iterate_m(OopClosure* blk, MemRegion mr); 1.69 - 1.70 // Debugging code 1.71 void print() PRODUCT_RETURN; 1.72 void verify(outputStream* st, bool force = false); 1.73 @@ -129,25 +115,25 @@ 1.74 enum { VTABLE_TRANSITIVE_OVERRIDE_VERSION = 51 } ; 1.75 void copy_vtable_to(vtableEntry* start); 1.76 int initialize_from_super(KlassHandle super); 1.77 - int index_of(methodOop m, int len) const; // same as index_of, but search only up to len 1.78 - void put_method_at(methodOop m, int index); 1.79 - static bool needs_new_vtable_entry(methodHandle m, klassOop super, Handle classloader, Symbol* classname, AccessFlags access_flags, TRAPS); 1.80 + int index_of(Method* m, int len) const; // same as index_of, but search only up to len 1.81 + void put_method_at(Method* m, int index); 1.82 + static bool needs_new_vtable_entry(methodHandle m, Klass* super, Handle classloader, Symbol* classname, AccessFlags access_flags, TRAPS); 1.83 1.84 - bool update_inherited_vtable(instanceKlass* klass, methodHandle target_method, int super_vtable_len, bool checkconstraints, TRAPS); 1.85 - instanceKlass* find_transitive_override(instanceKlass* initialsuper, methodHandle target_method, int vtable_index, 1.86 + bool update_inherited_vtable(InstanceKlass* klass, methodHandle target_method, int super_vtable_len, bool checkconstraints, TRAPS); 1.87 + InstanceKlass* find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method, int vtable_index, 1.88 Handle target_loader, Symbol* target_classname, Thread* THREAD); 1.89 1.90 // support for miranda methods 1.91 bool is_miranda_entry_at(int i); 1.92 void fill_in_mirandas(int& initialized); 1.93 - static bool is_miranda(methodOop m, objArrayOop class_methods, klassOop super); 1.94 - static void add_new_mirandas_to_list(GrowableArray<methodOop>* list_of_current_mirandas, objArrayOop current_interface_methods, objArrayOop class_methods, klassOop super); 1.95 - static void get_mirandas(GrowableArray<methodOop>* mirandas, klassOop super, objArrayOop class_methods, objArrayOop local_interfaces); 1.96 - static int get_num_mirandas(klassOop super, objArrayOop class_methods, objArrayOop local_interfaces); 1.97 + static bool is_miranda(Method* m, Array<Method*>* class_methods, Klass* super); 1.98 + static void add_new_mirandas_to_list(GrowableArray<Method*>* list_of_current_mirandas, Array<Method*>* current_interface_methods, Array<Method*>* class_methods, Klass* super); 1.99 + static void get_mirandas(GrowableArray<Method*>* mirandas, Klass* super, Array<Method*>* class_methods, Array<Klass*>* local_interfaces); 1.100 + static int get_num_mirandas(Klass* super, Array<Method*>* class_methods, Array<Klass*>* local_interfaces); 1.101 1.102 1.103 void verify_against(outputStream* st, klassVtable* vt, int index); 1.104 - inline instanceKlass* ik() const; 1.105 + inline InstanceKlass* ik() const; 1.106 }; 1.107 1.108 1.109 @@ -166,11 +152,11 @@ 1.110 return sizeof(vtableEntry) / sizeof(HeapWord); 1.111 } 1.112 static int method_offset_in_bytes() { return offset_of(vtableEntry, _method); } 1.113 - methodOop method() const { return _method; } 1.114 + Method* method() const { return _method; } 1.115 1.116 private: 1.117 - methodOop _method; 1.118 - void set(methodOop method) { assert(method != NULL, "use clear"); _method = method; } 1.119 + Method* _method; 1.120 + void set(Method* method) { assert(method != NULL, "use clear"); _method = method; } 1.121 void clear() { _method = NULL; } 1.122 void print() PRODUCT_RETURN; 1.123 void verify(klassVtable* vt, outputStream* st); 1.124 @@ -179,22 +165,22 @@ 1.125 }; 1.126 1.127 1.128 -inline methodOop klassVtable::method_at(int i) const { 1.129 +inline Method* klassVtable::method_at(int i) const { 1.130 assert(i >= 0 && i < _length, "index out of bounds"); 1.131 assert(table()[i].method() != NULL, "should not be null"); 1.132 - assert(oop(table()[i].method())->is_method(), "should be method"); 1.133 + assert(((Metadata*)table()[i].method())->is_method(), "should be method"); 1.134 return table()[i].method(); 1.135 } 1.136 1.137 -inline methodOop klassVtable::unchecked_method_at(int i) const { 1.138 +inline Method* klassVtable::unchecked_method_at(int i) const { 1.139 assert(i >= 0 && i < _length, "index out of bounds"); 1.140 return table()[i].method(); 1.141 } 1.142 1.143 -inline oop* klassVtable::adr_method_at(int i) const { 1.144 +inline Method** klassVtable::adr_method_at(int i) const { 1.145 // Allow one past the last entry to be referenced; useful for loop bounds. 1.146 assert(i >= 0 && i <= _length, "index out of bounds"); 1.147 - return (oop*)(address(table() + i) + vtableEntry::method_offset_in_bytes()); 1.148 + return (Method**)(address(table() + i) + vtableEntry::method_offset_in_bytes()); 1.149 } 1.150 1.151 // -------------------------------------------------------------------------------- 1.152 @@ -203,16 +189,16 @@ 1.153 1.154 class itableOffsetEntry VALUE_OBJ_CLASS_SPEC { 1.155 private: 1.156 - klassOop _interface; 1.157 + Klass* _interface; 1.158 int _offset; 1.159 public: 1.160 - klassOop interface_klass() const { return _interface; } 1.161 + Klass* interface_klass() const { return _interface; } 1.162 int offset() const { return _offset; } 1.163 1.164 - static itableMethodEntry* method_entry(klassOop k, int offset) { return (itableMethodEntry*)(((address)k) + offset); } 1.165 - itableMethodEntry* first_method_entry(klassOop k) { return method_entry(k, _offset); } 1.166 + static itableMethodEntry* method_entry(Klass* k, int offset) { return (itableMethodEntry*)(((address)k) + offset); } 1.167 + itableMethodEntry* first_method_entry(Klass* k) { return method_entry(k, _offset); } 1.168 1.169 - void initialize(klassOop interf, int offset) { _interface = interf; _offset = offset; } 1.170 + void initialize(Klass* interf, int offset) { _interface = interf; _offset = offset; } 1.171 1.172 // Static size and offset accessors 1.173 static int size() { return sizeof(itableOffsetEntry) / HeapWordSize; } // size in words 1.174 @@ -225,14 +211,14 @@ 1.175 1.176 class itableMethodEntry VALUE_OBJ_CLASS_SPEC { 1.177 private: 1.178 - methodOop _method; 1.179 + Method* _method; 1.180 1.181 public: 1.182 - methodOop method() const { return _method; } 1.183 + Method* method() const { return _method; } 1.184 1.185 void clear() { _method = NULL; } 1.186 1.187 - void initialize(methodOop method); 1.188 + void initialize(Method* method); 1.189 1.190 // Static size and offset accessors 1.191 static int size() { return sizeof(itableMethodEntry) / HeapWordSize; } // size in words 1.192 @@ -245,16 +231,16 @@ 1.193 // Format of an itable 1.194 // 1.195 // ---- offset table --- 1.196 -// klassOop of interface 1 \ 1.197 +// Klass* of interface 1 \ 1.198 // offset to vtable from start of oop / offset table entry 1.199 // ... 1.200 -// klassOop of interface n \ 1.201 +// Klass* of interface n \ 1.202 // offset to vtable from start of oop / offset table entry 1.203 // --- vtable for interface 1 --- 1.204 -// methodOop \ 1.205 +// Method* \ 1.206 // compiler entry point / method table entry 1.207 // ... 1.208 -// methodOop \ 1.209 +// Method* \ 1.210 // compiler entry point / method table entry 1.211 // -- vtable for interface 2 --- 1.212 // ... 1.213 @@ -282,7 +268,7 @@ 1.214 void initialize_itable(bool checkconstraints, TRAPS); 1.215 1.216 // Updates 1.217 - void initialize_with_method(methodOop m); 1.218 + void initialize_with_method(Method* m); 1.219 1.220 // RedefineClasses() API support: 1.221 // if any entry of this itable points to any of old_methods, 1.222 @@ -290,31 +276,17 @@ 1.223 // trace_name_printed is set to true if the current call has 1.224 // printed the klass name so that other routines in the adjust_* 1.225 // group don't print the klass name. 1.226 - void adjust_method_entries(methodOop* old_methods, methodOop* new_methods, 1.227 + void adjust_method_entries(Method** old_methods, Method** new_methods, 1.228 int methods_length, bool * trace_name_printed); 1.229 1.230 - // Garbage collection 1.231 - void oop_follow_contents(); 1.232 - void oop_adjust_pointers(); 1.233 - 1.234 -#ifndef SERIALGC 1.235 - // Parallel Old 1.236 - void oop_follow_contents(ParCompactionManager* cm); 1.237 - void oop_update_pointers(ParCompactionManager* cm); 1.238 -#endif // SERIALGC 1.239 - 1.240 - // Iterators 1.241 - void oop_oop_iterate(OopClosure* blk); 1.242 - void oop_oop_iterate_m(OopClosure* blk, MemRegion mr); 1.243 - 1.244 // Setup of itable 1.245 - static int compute_itable_size(objArrayHandle transitive_interfaces); 1.246 + static int compute_itable_size(Array<Klass*>* transitive_interfaces); 1.247 static void setup_itable_offset_table(instanceKlassHandle klass); 1.248 1.249 // Resolving of method to index 1.250 - static int compute_itable_index(methodOop m); 1.251 + static int compute_itable_index(Method* m); 1.252 // ...and back again: 1.253 - static methodOop method_for_itable_index(klassOop klass, int itable_index); 1.254 + static Method* method_for_itable_index(Klass* klass, int itable_index); 1.255 1.256 // Debugging/Statistics 1.257 static void print_statistics() PRODUCT_RETURN; 1.258 @@ -330,6 +302,11 @@ 1.259 NOT_PRODUCT(static long _total_size;) // Total no. of bytes used for itables 1.260 1.261 static void update_stats(int size) PRODUCT_RETURN NOT_PRODUCT({ _total_classes++; _total_size += size; }) 1.262 + 1.263 + public: 1.264 +#ifndef PRODUCT 1.265 + bool check_no_old_entries(); 1.266 +#endif 1.267 }; 1.268 1.269 #endif // SHARE_VM_OOPS_KLASSVTABLE_HPP