48 name_index_offset = 1, |
48 name_index_offset = 1, |
49 signature_index_offset = 2, |
49 signature_index_offset = 2, |
50 initval_index_offset = 3, |
50 initval_index_offset = 3, |
51 low_offset = 4, |
51 low_offset = 4, |
52 high_offset = 5, |
52 high_offset = 5, |
53 generic_signature_offset = 6, |
53 field_slots = 6 |
54 field_slots = 7 |
|
55 }; |
54 }; |
56 |
55 |
57 private: |
56 private: |
58 u2 _shorts[field_slots]; |
57 u2 _shorts[field_slots]; |
59 |
58 |
60 void set_name_index(u2 val) { _shorts[name_index_offset] = val; } |
59 void set_name_index(u2 val) { _shorts[name_index_offset] = val; } |
61 void set_signature_index(u2 val) { _shorts[signature_index_offset] = val; } |
60 void set_signature_index(u2 val) { _shorts[signature_index_offset] = val; } |
62 void set_initval_index(u2 val) { _shorts[initval_index_offset] = val; } |
61 void set_initval_index(u2 val) { _shorts[initval_index_offset] = val; } |
63 void set_generic_signature_index(u2 val) { _shorts[generic_signature_offset] = val; } |
|
64 |
62 |
65 u2 name_index() const { return _shorts[name_index_offset]; } |
63 u2 name_index() const { return _shorts[name_index_offset]; } |
66 u2 signature_index() const { return _shorts[signature_index_offset]; } |
64 u2 signature_index() const { return _shorts[signature_index_offset]; } |
67 u2 initval_index() const { return _shorts[initval_index_offset]; } |
65 u2 initval_index() const { return _shorts[initval_index_offset]; } |
68 u2 generic_signature_index() const { return _shorts[generic_signature_offset]; } |
|
69 |
66 |
70 public: |
67 public: |
71 static FieldInfo* from_field_array(typeArrayOop fields, int index) { |
68 static FieldInfo* from_field_array(typeArrayOop fields, int index) { |
72 return ((FieldInfo*)fields->short_at_addr(index * field_slots)); |
69 return ((FieldInfo*)fields->short_at_addr(index * field_slots)); |
|
70 } |
|
71 static FieldInfo* from_field_array(u2* fields, int index) { |
|
72 return ((FieldInfo*)(fields + index * field_slots)); |
73 } |
73 } |
74 |
74 |
75 void initialize(u2 access_flags, |
75 void initialize(u2 access_flags, |
76 u2 name_index, |
76 u2 name_index, |
77 u2 signature_index, |
77 u2 signature_index, |
78 u2 initval_index, |
78 u2 initval_index, |
79 u2 generic_signature_index, |
|
80 u4 offset) { |
79 u4 offset) { |
81 _shorts[access_flags_offset] = access_flags; |
80 _shorts[access_flags_offset] = access_flags; |
82 _shorts[name_index_offset] = name_index; |
81 _shorts[name_index_offset] = name_index; |
83 _shorts[signature_index_offset] = signature_index; |
82 _shorts[signature_index_offset] = signature_index; |
84 _shorts[initval_index_offset] = initval_index; |
83 _shorts[initval_index_offset] = initval_index; |
85 _shorts[generic_signature_offset] = generic_signature_index; |
|
86 set_offset(offset); |
84 set_offset(offset); |
87 } |
85 } |
88 |
86 |
89 u2 access_flags() const { return _shorts[access_flags_offset]; } |
87 u2 access_flags() const { return _shorts[access_flags_offset]; } |
90 u4 offset() const { return build_int_from_shorts(_shorts[low_offset], _shorts[high_offset]); } |
88 u4 offset() const { return build_int_from_shorts(_shorts[low_offset], _shorts[high_offset]); } |
103 return lookup_symbol(index); |
101 return lookup_symbol(index); |
104 } |
102 } |
105 return cp->symbol_at(index); |
103 return cp->symbol_at(index); |
106 } |
104 } |
107 |
105 |
108 Symbol* generic_signature(constantPoolHandle cp) const { |
|
109 int index = generic_signature_index(); |
|
110 if (index == 0) { |
|
111 return NULL; |
|
112 } |
|
113 return cp->symbol_at(index); |
|
114 } |
|
115 |
|
116 void set_access_flags(u2 val) { _shorts[access_flags_offset] = val; } |
106 void set_access_flags(u2 val) { _shorts[access_flags_offset] = val; } |
117 void set_offset(u4 val) { |
107 void set_offset(u4 val) { |
118 _shorts[low_offset] = extract_low_short_from_int(val); |
108 _shorts[low_offset] = extract_low_short_from_int(val); |
119 _shorts[high_offset] = extract_high_short_from_int(val); |
109 _shorts[high_offset] = extract_high_short_from_int(val); |
120 } |
110 } |