< prev index next >

src/hotspot/share/interpreter/bytecode.hpp

Print this page

237  private:
238   // Helper to skip verification.   Used is_valid() to check if the result is really an invoke
239   inline friend Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci);
240 };
241 
242 inline Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci) {
243   return Bytecode_invoke(method, bci, false);
244 }
245 
246 
247 // Abstraction for all field accesses (put/get field/static)
248 class Bytecode_field: public Bytecode_member_ref {
249  public:
250   Bytecode_field(const methodHandle& method, int bci)  : Bytecode_member_ref(method, bci) { verify(); }
251 
252   // Testers
253   bool is_getfield() const                       { return java_code() == Bytecodes::_getfield; }
254   bool is_putfield() const                       { return java_code() == Bytecodes::_putfield; }
255   bool is_getstatic() const                      { return java_code() == Bytecodes::_getstatic; }
256   bool is_putstatic() const                      { return java_code() == Bytecodes::_putstatic; }

257 
258   bool is_getter() const                         { return is_getfield()  || is_getstatic(); }
259   bool is_static() const                         { return is_getstatic() || is_putstatic(); }
260 
261   bool is_valid() const                          { return is_getfield()   ||
262                                                           is_putfield()   ||
263                                                           is_getstatic()  ||
264                                                           is_putstatic(); }

265   void verify() const;
266 };
267 
268 // Abstraction for checkcast
269 class Bytecode_checkcast: public Bytecode {
270  public:
271   Bytecode_checkcast(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
272   void verify() const { assert(Bytecodes::java_code(code()) == Bytecodes::_checkcast, "check checkcast"); }
273 
274   // Returns index
275   long index() const   { return get_index_u2(Bytecodes::_checkcast); };
276 };
277 
278 // Abstraction for instanceof
279 class Bytecode_instanceof: public Bytecode {
280  public:
281   Bytecode_instanceof(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
282   void verify() const { assert(code() == Bytecodes::_instanceof, "check instanceof"); }
283 
284   // Returns index
285   long index() const   { return get_index_u2(Bytecodes::_instanceof); };
286 };
287 
288 class Bytecode_new: public Bytecode {
289  public:
290   Bytecode_new(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
291   void verify() const { assert(java_code() == Bytecodes::_new, "check new"); }
292 
293   // Returns index
294   long index() const   { return get_index_u2(Bytecodes::_new); };
295 };
296 









297 class Bytecode_multianewarray: public Bytecode {
298  public:
299   Bytecode_multianewarray(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
300   void verify() const { assert(java_code() == Bytecodes::_multianewarray, "check new"); }
301 
302   // Returns index
303   long index() const   { return get_index_u2(Bytecodes::_multianewarray); };
304 };
305 
306 class Bytecode_anewarray: public Bytecode {
307  public:
308   Bytecode_anewarray(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
309   void verify() const { assert(java_code() == Bytecodes::_anewarray, "check anewarray"); }
310 
311   // Returns index
312   long index() const   { return get_index_u2(Bytecodes::_anewarray); };
313 };
314 
315 // Abstraction for ldc, ldc_w and ldc2_w
316 class Bytecode_loadconstant: public Bytecode {

237  private:
238   // Helper to skip verification.   Used is_valid() to check if the result is really an invoke
239   inline friend Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci);
240 };
241 
242 inline Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci) {
243   return Bytecode_invoke(method, bci, false);
244 }
245 
246 
247 // Abstraction for all field accesses (put/get field/static)
248 class Bytecode_field: public Bytecode_member_ref {
249  public:
250   Bytecode_field(const methodHandle& method, int bci)  : Bytecode_member_ref(method, bci) { verify(); }
251 
252   // Testers
253   bool is_getfield() const                       { return java_code() == Bytecodes::_getfield; }
254   bool is_putfield() const                       { return java_code() == Bytecodes::_putfield; }
255   bool is_getstatic() const                      { return java_code() == Bytecodes::_getstatic; }
256   bool is_putstatic() const                      { return java_code() == Bytecodes::_putstatic; }
257   bool is_withfield() const                      { return java_code() == Bytecodes::_withfield; }
258 
259   bool is_getter() const                         { return is_getfield()  || is_getstatic(); }
260   bool is_static() const                         { return is_getstatic() || is_putstatic(); }
261 
262   bool is_valid() const                          { return is_getfield()   ||
263                                                           is_putfield()   ||
264                                                           is_getstatic()  ||
265                                                           is_putstatic()  ||
266                                                           is_withfield(); }
267   void verify() const;
268 };
269 
270 // Abstraction for checkcast
271 class Bytecode_checkcast: public Bytecode {
272  public:
273   Bytecode_checkcast(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
274   void verify() const { assert(Bytecodes::java_code(code()) == Bytecodes::_checkcast, "check checkcast"); }
275 
276   // Returns index
277   long index() const   { return get_index_u2(Bytecodes::_checkcast); };
278 };
279 
280 // Abstraction for instanceof
281 class Bytecode_instanceof: public Bytecode {
282  public:
283   Bytecode_instanceof(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
284   void verify() const { assert(code() == Bytecodes::_instanceof, "check instanceof"); }
285 
286   // Returns index
287   long index() const   { return get_index_u2(Bytecodes::_instanceof); };
288 };
289 
290 class Bytecode_new: public Bytecode {
291  public:
292   Bytecode_new(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
293   void verify() const { assert(java_code() == Bytecodes::_new, "check new"); }
294 
295   // Returns index
296   long index() const   { return get_index_u2(Bytecodes::_new); };
297 };
298 
299 class Bytecode_aconst_init: public Bytecode {
300  public:
301   Bytecode_aconst_init(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
302   void verify() const { assert(java_code() == Bytecodes::_aconst_init, "check aconst_init"); }
303 
304   // Returns index
305   long index() const   { return get_index_u2(Bytecodes::_aconst_init); };
306 };
307 
308 class Bytecode_multianewarray: public Bytecode {
309  public:
310   Bytecode_multianewarray(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
311   void verify() const { assert(java_code() == Bytecodes::_multianewarray, "check new"); }
312 
313   // Returns index
314   long index() const   { return get_index_u2(Bytecodes::_multianewarray); };
315 };
316 
317 class Bytecode_anewarray: public Bytecode {
318  public:
319   Bytecode_anewarray(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
320   void verify() const { assert(java_code() == Bytecodes::_anewarray, "check anewarray"); }
321 
322   // Returns index
323   long index() const   { return get_index_u2(Bytecodes::_anewarray); };
324 };
325 
326 // Abstraction for ldc, ldc_w and ldc2_w
327 class Bytecode_loadconstant: public Bytecode {
< prev index next >