164 int make_flags(TosState state, int option_bits, int field_index_or_method_params);
165 void set_flags(intx flags) { _flags = flags; }
166 void set_field_flags(TosState field_type, int option_bits, int field_index) {
167 assert((field_index & field_index_mask) == field_index, "field_index in range");
168 set_flags(make_flags(field_type, option_bits | (1 << is_field_entry_shift), field_index));
169 }
170 void set_method_flags(TosState return_type, int option_bits, int method_params) {
171 assert((method_params & parameter_size_mask) == method_params, "method_params in range");
172 set_flags(make_flags(return_type, option_bits, method_params));
173 }
174
175 public:
176 // specific bit definitions for the flags field:
177 // (Note: the interpreter must use these definitions to access the CP cache.)
178 enum {
179 // high order bits are the TosState corresponding to field type or method return type
180 tos_state_bits = 4,
181 tos_state_mask = right_n_bits(tos_state_bits),
182 tos_state_shift = BitsPerInt - tos_state_bits, // see verify_tos_state_shift below
183 // misc. option bits; can be any bit position in [16..27]
184 is_field_entry_shift = 26, // (F) is it a field or a method?
185 has_local_signature_shift = 25, // (S) does the call site have a per-site signature (sig-poly methods)?
186 has_appendix_shift = 24, // (A) does the call site have an appendix argument?
187 is_forced_virtual_shift = 23, // (I) is the interface reference forced to virtual mode?
188 is_final_shift = 22, // (f) is the field or method final?
189 is_volatile_shift = 21, // (v) is the field volatile?
190 is_vfinal_shift = 20, // (vf) did the call resolve to a final method?
191 indy_resolution_failed_shift= 19, // (indy_rf) did call site specifier resolution fail ?
192 // low order bits give field index (for FieldInfo) or method parameter size:
193 field_index_bits = 16,
194 field_index_mask = right_n_bits(field_index_bits),
195 parameter_size_bits = 8, // subset of field_index_mask, range is 0..255
196 parameter_size_mask = right_n_bits(parameter_size_bits),
197 option_bits_mask = ~(((~0u) << tos_state_shift) | (field_index_mask | parameter_size_mask))
198 };
199
200 // specific bit definitions for the indices field:
201 enum {
202 cp_index_bits = 2*BitsPerByte,
203 cp_index_mask = right_n_bits(cp_index_bits),
207 bytecode_2_mask = right_n_bits(BitsPerByte) // == (u1)0xFF
208 };
209
210
211 // Initialization
212 void initialize_entry(int original_index); // initialize primary entry
213 void initialize_resolved_reference_index(int ref_index) {
214 assert(_f2 == 0, "set once"); // note: ref_index might be zero also
215 _f2 = ref_index;
216 }
217
218 void set_field( // sets entry to resolved field state
219 Bytecodes::Code get_code, // the bytecode used for reading the field
220 Bytecodes::Code put_code, // the bytecode used for writing the field
221 Klass* field_holder, // the object/klass holding the field
222 int orig_field_index, // the original field index in the field holder
223 int field_offset, // the field offset in words in the field holder
224 TosState field_type, // the (machine) field type
225 bool is_final, // the field is final
226 bool is_volatile, // the field is volatile
227 Klass* root_klass // needed by the GC to dirty the klass
228 );
229
230 private:
231 void set_direct_or_vtable_call(
232 Bytecodes::Code invoke_code, // the bytecode used for invoking the method
233 const methodHandle& method, // the method/prototype if any (NULL, otherwise)
234 int vtable_index, // the vtable index if any, else negative
235 bool sender_is_interface
236 );
237
238 public:
239 void set_direct_call( // sets entry to exact concrete method entry
240 Bytecodes::Code invoke_code, // the bytecode used for invoking the method
241 const methodHandle& method, // the method to call
242 bool sender_is_interface
243 );
244
245 void set_vtable_call( // sets entry to vtable index
246 Bytecodes::Code invoke_code, // the bytecode used for invoking the method
|
164 int make_flags(TosState state, int option_bits, int field_index_or_method_params);
165 void set_flags(intx flags) { _flags = flags; }
166 void set_field_flags(TosState field_type, int option_bits, int field_index) {
167 assert((field_index & field_index_mask) == field_index, "field_index in range");
168 set_flags(make_flags(field_type, option_bits | (1 << is_field_entry_shift), field_index));
169 }
170 void set_method_flags(TosState return_type, int option_bits, int method_params) {
171 assert((method_params & parameter_size_mask) == method_params, "method_params in range");
172 set_flags(make_flags(return_type, option_bits, method_params));
173 }
174
175 public:
176 // specific bit definitions for the flags field:
177 // (Note: the interpreter must use these definitions to access the CP cache.)
178 enum {
179 // high order bits are the TosState corresponding to field type or method return type
180 tos_state_bits = 4,
181 tos_state_mask = right_n_bits(tos_state_bits),
182 tos_state_shift = BitsPerInt - tos_state_bits, // see verify_tos_state_shift below
183 // misc. option bits; can be any bit position in [16..27]
184 is_tsan_ignore_shift = 27, // Should the field be ignored by TSAN?
185 is_field_entry_shift = 26, // (F) is it a field or a method?
186 has_local_signature_shift = 25, // (S) does the call site have a per-site signature (sig-poly methods)?
187 has_appendix_shift = 24, // (A) does the call site have an appendix argument?
188 is_forced_virtual_shift = 23, // (I) is the interface reference forced to virtual mode?
189 is_final_shift = 22, // (f) is the field or method final?
190 is_volatile_shift = 21, // (v) is the field volatile?
191 is_vfinal_shift = 20, // (vf) did the call resolve to a final method?
192 indy_resolution_failed_shift= 19, // (indy_rf) did call site specifier resolution fail ?
193 // low order bits give field index (for FieldInfo) or method parameter size:
194 field_index_bits = 16,
195 field_index_mask = right_n_bits(field_index_bits),
196 parameter_size_bits = 8, // subset of field_index_mask, range is 0..255
197 parameter_size_mask = right_n_bits(parameter_size_bits),
198 option_bits_mask = ~(((~0u) << tos_state_shift) | (field_index_mask | parameter_size_mask))
199 };
200
201 // specific bit definitions for the indices field:
202 enum {
203 cp_index_bits = 2*BitsPerByte,
204 cp_index_mask = right_n_bits(cp_index_bits),
208 bytecode_2_mask = right_n_bits(BitsPerByte) // == (u1)0xFF
209 };
210
211
212 // Initialization
213 void initialize_entry(int original_index); // initialize primary entry
214 void initialize_resolved_reference_index(int ref_index) {
215 assert(_f2 == 0, "set once"); // note: ref_index might be zero also
216 _f2 = ref_index;
217 }
218
219 void set_field( // sets entry to resolved field state
220 Bytecodes::Code get_code, // the bytecode used for reading the field
221 Bytecodes::Code put_code, // the bytecode used for writing the field
222 Klass* field_holder, // the object/klass holding the field
223 int orig_field_index, // the original field index in the field holder
224 int field_offset, // the field offset in words in the field holder
225 TosState field_type, // the (machine) field type
226 bool is_final, // the field is final
227 bool is_volatile, // the field is volatile
228 bool is_tsan_ignore, // the field should be ignored by TSAN
229 Klass* root_klass // needed by the GC to dirty the klass
230 );
231
232 private:
233 void set_direct_or_vtable_call(
234 Bytecodes::Code invoke_code, // the bytecode used for invoking the method
235 const methodHandle& method, // the method/prototype if any (NULL, otherwise)
236 int vtable_index, // the vtable index if any, else negative
237 bool sender_is_interface
238 );
239
240 public:
241 void set_direct_call( // sets entry to exact concrete method entry
242 Bytecodes::Code invoke_code, // the bytecode used for invoking the method
243 const methodHandle& method, // the method to call
244 bool sender_is_interface
245 );
246
247 void set_vtable_call( // sets entry to vtable index
248 Bytecodes::Code invoke_code, // the bytecode used for invoking the method
|