25 #include "precompiled.hpp" 26 #include "interpreter/interpreter.hpp" 27 #include "oops/oop.inline.hpp" 28 #include "oops/fieldStreams.hpp" 29 #include "oops/method.hpp" 30 #include "oops/objArrayKlass.hpp" 31 #include "oops/valueKlass.hpp" 32 #include "oops/valueArrayKlass.hpp" 33 34 Method* ValueKlass::factory_method() const { 35 for (int i = 0; i < methods()->length(); i++) { 36 ConstMethod* cm = methods()->at(i)->constMethod(); 37 if (cm->has_valuefactory_parameter_mapping()) { 38 return methods()->at(i); 39 } 40 } 41 return NULL; 42 } 43 44 int ValueKlass::first_field_offset() { 45 // Really inefficient, should be cached somewhere 46 instanceKlassHandle k(this); 47 int first_offset = INT_MAX; 48 for (JavaFieldStream fs(k()); !fs.done(); fs.next()) { 49 if (fs.offset() < first_offset) first_offset= fs.offset(); 50 } 51 return first_offset; 52 } 53 54 bool ValueKlass::is_atomic() { 55 return (nonstatic_field_size() * heapOopSize) <= longSize; 56 } 57 58 int ValueKlass::nonstatic_oop_count() { 59 int oops = 0; 60 int map_count = nonstatic_oop_map_count(); 61 OopMapBlock* block = start_of_nonstatic_oop_maps(); 62 OopMapBlock* end = block + map_count; 63 while (block != end) { 64 oops += block->count(); 65 block++; 66 } 67 return oops; 68 } 69 70 // Arrays of... 71 | 25 #include "precompiled.hpp" 26 #include "interpreter/interpreter.hpp" 27 #include "oops/oop.inline.hpp" 28 #include "oops/fieldStreams.hpp" 29 #include "oops/method.hpp" 30 #include "oops/objArrayKlass.hpp" 31 #include "oops/valueKlass.hpp" 32 #include "oops/valueArrayKlass.hpp" 33 34 Method* ValueKlass::factory_method() const { 35 for (int i = 0; i < methods()->length(); i++) { 36 ConstMethod* cm = methods()->at(i)->constMethod(); 37 if (cm->has_valuefactory_parameter_mapping()) { 38 return methods()->at(i); 39 } 40 } 41 return NULL; 42 } 43 44 int ValueKlass::first_field_offset() { 45 #ifdef ASSERT 46 instanceKlassHandle k(this); 47 int first_offset = INT_MAX; 48 for (JavaFieldStream fs(k()); !fs.done(); fs.next()) { 49 if (fs.offset() < first_offset) first_offset= fs.offset(); 50 } 51 #endif 52 int base_offset = instanceOopDesc::base_offset_in_bytes(); 53 // The first field of value types is aligned on a long boundary 54 base_offset = align_size_up(base_offset, BytesPerLong); 55 assert(base_offset = first_offset, "inconsistent offsets"); 56 return base_offset; 57 } 58 59 bool ValueKlass::is_atomic() { 60 return (nonstatic_field_size() * heapOopSize) <= longSize; 61 } 62 63 int ValueKlass::nonstatic_oop_count() { 64 int oops = 0; 65 int map_count = nonstatic_oop_map_count(); 66 OopMapBlock* block = start_of_nonstatic_oop_maps(); 67 OopMapBlock* end = block + map_count; 68 while (block != end) { 69 oops += block->count(); 70 block++; 71 } 72 return oops; 73 } 74 75 // Arrays of... 76 |