mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
7086585: make Java field injection more flexible
Reviewed-by: jrose, twisti, kvn, coleenp
This commit is contained in:
parent
1ebca30d26
commit
e39ba1a5fe
39 changed files with 1073 additions and 991 deletions
|
@ -40,29 +40,40 @@
|
|||
class fieldDescriptor VALUE_OBJ_CLASS_SPEC {
|
||||
private:
|
||||
AccessFlags _access_flags;
|
||||
int _name_index;
|
||||
int _signature_index;
|
||||
int _initial_value_index;
|
||||
int _offset;
|
||||
int _generic_signature_index;
|
||||
int _index; // index into fields() array
|
||||
int _index; // the field index
|
||||
constantPoolHandle _cp;
|
||||
|
||||
// update the access_flags for the field in the klass
|
||||
void update_klass_field_access_flag() {
|
||||
instanceKlass* ik = instanceKlass::cast(field_holder());
|
||||
ik->field(index())->set_access_flags(_access_flags.as_short());
|
||||
}
|
||||
|
||||
FieldInfo* field() const {
|
||||
instanceKlass* ik = instanceKlass::cast(field_holder());
|
||||
return ik->field(_index);
|
||||
}
|
||||
|
||||
public:
|
||||
Symbol* name() const { return _cp->symbol_at(_name_index); }
|
||||
Symbol* signature() const { return _cp->symbol_at(_signature_index); }
|
||||
Symbol* name() const {
|
||||
return field()->name(_cp);
|
||||
}
|
||||
Symbol* signature() const {
|
||||
return field()->signature(_cp);
|
||||
}
|
||||
klassOop field_holder() const { return _cp->pool_holder(); }
|
||||
constantPoolOop constants() const { return _cp(); }
|
||||
AccessFlags access_flags() const { return _access_flags; }
|
||||
oop loader() const;
|
||||
// Offset (in words) of field from start of instanceOop / klassOop
|
||||
int offset() const { return _offset; }
|
||||
Symbol* generic_signature() const { return (_generic_signature_index > 0 ? _cp->symbol_at(_generic_signature_index) : (Symbol*)NULL); }
|
||||
int offset() const { return field()->offset(); }
|
||||
Symbol* generic_signature() const { return field()->generic_signature(_cp); }
|
||||
int index() const { return _index; }
|
||||
typeArrayOop annotations() const;
|
||||
|
||||
// Initial field value
|
||||
bool has_initial_value() const { return _initial_value_index != 0; }
|
||||
bool has_initial_value() const { return field()->initval_index() != 0; }
|
||||
int initial_value_index() const { return field()->initval_index(); }
|
||||
constantTag initial_value_tag() const; // The tag will return true on one of is_int(), is_long(), is_single(), is_double()
|
||||
jint int_initial_value() const;
|
||||
jlong long_initial_value() const;
|
||||
|
@ -74,25 +85,31 @@ class fieldDescriptor VALUE_OBJ_CLASS_SPEC {
|
|||
BasicType field_type() const { return FieldType::basic_type(signature()); }
|
||||
|
||||
// Access flags
|
||||
bool is_public() const { return _access_flags.is_public(); }
|
||||
bool is_private() const { return _access_flags.is_private(); }
|
||||
bool is_protected() const { return _access_flags.is_protected(); }
|
||||
bool is_public() const { return access_flags().is_public(); }
|
||||
bool is_private() const { return access_flags().is_private(); }
|
||||
bool is_protected() const { return access_flags().is_protected(); }
|
||||
bool is_package_private() const { return !is_public() && !is_private() && !is_protected(); }
|
||||
|
||||
bool is_static() const { return _access_flags.is_static(); }
|
||||
bool is_final() const { return _access_flags.is_final(); }
|
||||
bool is_volatile() const { return _access_flags.is_volatile(); }
|
||||
bool is_transient() const { return _access_flags.is_transient(); }
|
||||
bool is_static() const { return access_flags().is_static(); }
|
||||
bool is_final() const { return access_flags().is_final(); }
|
||||
bool is_volatile() const { return access_flags().is_volatile(); }
|
||||
bool is_transient() const { return access_flags().is_transient(); }
|
||||
|
||||
bool is_synthetic() const { return _access_flags.is_synthetic(); }
|
||||
bool is_synthetic() const { return access_flags().is_synthetic(); }
|
||||
|
||||
bool is_field_access_watched() const { return _access_flags.is_field_access_watched(); }
|
||||
bool is_field_access_watched() const { return access_flags().is_field_access_watched(); }
|
||||
bool is_field_modification_watched() const
|
||||
{ return _access_flags.is_field_modification_watched(); }
|
||||
void set_is_field_access_watched(const bool value)
|
||||
{ _access_flags.set_is_field_access_watched(value); }
|
||||
void set_is_field_modification_watched(const bool value)
|
||||
{ _access_flags.set_is_field_modification_watched(value); }
|
||||
{ return access_flags().is_field_modification_watched(); }
|
||||
|
||||
void set_is_field_access_watched(const bool value) {
|
||||
_access_flags.set_is_field_access_watched(value);
|
||||
update_klass_field_access_flag();
|
||||
}
|
||||
|
||||
void set_is_field_modification_watched(const bool value) {
|
||||
_access_flags.set_is_field_modification_watched(value);
|
||||
update_klass_field_access_flag();
|
||||
}
|
||||
|
||||
// Initialization
|
||||
void initialize(klassOop k, int index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue