Mercurial > hg > graal-compiler
diff src/share/vm/oops/instanceKlass.hpp @ 4137:04b9a2566eec
Merge with hsx23/hotspot.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 17 Dec 2011 21:40:27 +0100 |
parents | f198b24093f3 f6f3bb0ee072 |
children | 33df1aeaebbf |
line wrap: on
line diff
--- a/src/share/vm/oops/instanceKlass.hpp Sat Dec 17 20:50:09 2011 +0100 +++ b/src/share/vm/oops/instanceKlass.hpp Sat Dec 17 21:40:27 2011 +0100 @@ -27,6 +27,7 @@ #include "oops/constMethodOop.hpp" #include "oops/constantPoolOop.hpp" +#include "oops/fieldInfo.hpp" #include "oops/instanceOop.hpp" #include "oops/klassOop.hpp" #include "oops/klassVtable.hpp" @@ -228,6 +229,7 @@ int _static_field_size; // number words used by static fields (oop and non-oop) in this klass int _static_oop_field_count;// number of static oop fields in this klass int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks + int _java_fields_count; // The number of declared Java fields bool _is_marked_dependent; // used for marking during flushing and deoptimization bool _rewritten; // methods rewritten. bool _has_nonstatic_fields; // for sizing with UseCompressedOops @@ -307,28 +309,29 @@ objArrayOop transitive_interfaces() const { return _transitive_interfaces; } void set_transitive_interfaces(objArrayOop a) { oop_store_without_check((oop*) &_transitive_interfaces, (oop) a); } - // fields - // Field info extracted from the class file and stored - // as an array of 7 shorts - enum FieldOffset { - access_flags_offset = 0, - name_index_offset = 1, - signature_index_offset = 2, - initval_index_offset = 3, - low_offset = 4, - high_offset = 5, - generic_signature_offset = 6, - next_offset = 7 - }; + private: + friend class fieldDescriptor; + FieldInfo* field(int index) const { return FieldInfo::from_field_array(_fields, index); } + + public: + int field_offset (int index) const { return field(index)->offset(); } + int field_access_flags(int index) const { return field(index)->access_flags(); } + Symbol* field_name (int index) const { return field(index)->name(constants()); } + Symbol* field_signature (int index) const { return field(index)->signature(constants()); } + + // Number of Java declared fields + int java_fields_count() const { return _java_fields_count; } + + // Number of fields including any injected fields + int all_fields_count() const { return _fields->length() / sizeof(FieldInfo::field_slots); } typeArrayOop fields() const { return _fields; } - int offset_from_fields( int index ) const { - return build_int_from_shorts( fields()->ushort_at(index + low_offset), - fields()->ushort_at(index + high_offset) ); + + void set_fields(typeArrayOop f, int java_fields_count) { + oop_store_without_check((oop*) &_fields, (oop) f); + _java_fields_count = java_fields_count; } - void set_fields(typeArrayOop f) { oop_store_without_check((oop*) &_fields, (oop) f); } - // inner classes typeArrayOop inner_classes() const { return _inner_classes; } void set_inner_classes(typeArrayOop f) { oop_store_without_check((oop*) &_inner_classes, (oop) f); } @@ -841,10 +844,6 @@ // Verification const char* internal_name() const; void oop_verify_on(oop obj, outputStream* st); - -#ifndef PRODUCT - static void verify_class_klass_nonstatic_oop_maps(klassOop k) PRODUCT_RETURN; -#endif }; inline methodOop instanceKlass::method_at_vtable(int index) { @@ -1012,4 +1011,36 @@ PreviousVersionInfo* next_previous_version(); }; + +// +// nmethodBucket is used to record dependent nmethods for +// deoptimization. nmethod dependencies are actually <klass, method> +// pairs but we really only care about the klass part for purposes of +// finding nmethods which might need to be deoptimized. Instead of +// recording the method, a count of how many times a particular nmethod +// was recorded is kept. This ensures that any recording errors are +// noticed since an nmethod should be removed as many times are it's +// added. +// +class nmethodBucket: public CHeapObj { + friend class VMStructs; + private: + nmethod* _nmethod; + int _count; + nmethodBucket* _next; + + public: + nmethodBucket(nmethod* nmethod, nmethodBucket* next) { + _nmethod = nmethod; + _next = next; + _count = 1; + } + int count() { return _count; } + int increment() { _count += 1; return _count; } + int decrement() { _count -= 1; assert(_count >= 0, "don't underflow"); return _count; } + nmethodBucket* next() { return _next; } + void set_next(nmethodBucket* b) { _next = b; } + nmethod* get_nmethod() { return _nmethod; } +}; + #endif // SHARE_VM_OOPS_INSTANCEKLASS_HPP