< prev index next >

src/hotspot/share/interpreter/bytecode.hpp

Print this page

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

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

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









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

235  private:
236   // Helper to skip verification.   Used is_valid() to check if the result is really an invoke
237   inline friend Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci);
238 };
239 
240 inline Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci) {
241   return Bytecode_invoke(method, bci, false);
242 }
243 
244 
245 // Abstraction for all field accesses (put/get field/static)
246 class Bytecode_field: public Bytecode_member_ref {
247  public:
248   Bytecode_field(const methodHandle& method, int bci)  : Bytecode_member_ref(method, bci) { verify(); }
249 
250   // Testers
251   bool is_getfield() const                       { return java_code() == Bytecodes::_getfield; }
252   bool is_putfield() const                       { return java_code() == Bytecodes::_putfield; }
253   bool is_getstatic() const                      { return java_code() == Bytecodes::_getstatic; }
254   bool is_putstatic() const                      { return java_code() == Bytecodes::_putstatic; }
255   bool is_withfield() const                      { return java_code() == Bytecodes::_withfield; }
256 
257   bool is_getter() const                         { return is_getfield()  || is_getstatic(); }
258   bool is_static() const                         { return is_getstatic() || is_putstatic(); }
259 
260   bool is_valid() const                          { return is_getfield()   ||
261                                                           is_putfield()   ||
262                                                           is_getstatic()  ||
263                                                           is_putstatic()  ||
264                                                           is_withfield(); }
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_defaultvalue: public Bytecode {
298  public:
299   Bytecode_defaultvalue(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
300   void verify() const { assert(java_code() == Bytecodes::_defaultvalue, "check defaultvalue"); }
301 
302   // Returns index
303   long index() const   { return get_index_u2(Bytecodes::_defaultvalue); };
304 };
305 
306 class Bytecode_multianewarray: public Bytecode {
307  public:
308   Bytecode_multianewarray(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
309   void verify() const { assert(java_code() == Bytecodes::_multianewarray, "check new"); }
310 
311   // Returns index
312   long index() const   { return get_index_u2(Bytecodes::_multianewarray); };
313 };
314 
315 class Bytecode_anewarray: public Bytecode {
316  public:
317   Bytecode_anewarray(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
318   void verify() const { assert(java_code() == Bytecodes::_anewarray, "check anewarray"); }
319 
320   // Returns index
321   long index() const   { return get_index_u2(Bytecodes::_anewarray); };
322 };
323 
324 // Abstraction for ldc, ldc_w and ldc2_w
325 class Bytecode_loadconstant: public Bytecode {
< prev index next >