comparison src/share/vm/code/codeBlob.hpp @ 3363:167b70ff3abc

6939861: JVM should handle more conversion operations Reviewed-by: twisti, jrose
author never
date Fri, 06 May 2011 16:33:13 -0700
parents f95d63e2154a
children be4ca325525a 1d7922586cf6
comparison
equal deleted inserted replaced
3362:d4c1fbc3de95 3363:167b70ff3abc
33 // CodeBlob - superclass for all entries in the CodeCache. 33 // CodeBlob - superclass for all entries in the CodeCache.
34 // 34 //
35 // Suptypes are: 35 // Suptypes are:
36 // nmethod : Compiled Java methods (include method that calls to native code) 36 // nmethod : Compiled Java methods (include method that calls to native code)
37 // RuntimeStub : Call to VM runtime methods 37 // RuntimeStub : Call to VM runtime methods
38 // RicochetBlob : Used for blocking MethodHandle adapters
38 // DeoptimizationBlob : Used for deoptimizatation 39 // DeoptimizationBlob : Used for deoptimizatation
39 // ExceptionBlob : Used for stack unrolling 40 // ExceptionBlob : Used for stack unrolling
40 // SafepointBlob : Used to handle illegal instruction exceptions 41 // SafepointBlob : Used to handle illegal instruction exceptions
41 // 42 //
42 // 43 //
93 94
94 // Deletion 95 // Deletion
95 void flush(); 96 void flush();
96 97
97 // Typing 98 // Typing
98 virtual bool is_buffer_blob() const { return false; } 99 virtual bool is_buffer_blob() const { return false; }
99 virtual bool is_nmethod() const { return false; } 100 virtual bool is_nmethod() const { return false; }
100 virtual bool is_runtime_stub() const { return false; } 101 virtual bool is_runtime_stub() const { return false; }
101 virtual bool is_deoptimization_stub() const { return false; } 102 virtual bool is_ricochet_stub() const { return false; }
102 virtual bool is_uncommon_trap_stub() const { return false; } 103 virtual bool is_deoptimization_stub() const { return false; }
103 virtual bool is_exception_stub() const { return false; } 104 virtual bool is_uncommon_trap_stub() const { return false; }
105 virtual bool is_exception_stub() const { return false; }
104 virtual bool is_safepoint_stub() const { return false; } 106 virtual bool is_safepoint_stub() const { return false; }
105 virtual bool is_adapter_blob() const { return false; } 107 virtual bool is_adapter_blob() const { return false; }
106 virtual bool is_method_handles_adapter_blob() const { return false; } 108 virtual bool is_method_handles_adapter_blob() const { return false; }
107 109
108 virtual bool is_compiled_by_c2() const { return false; } 110 virtual bool is_compiled_by_c2() const { return false; }
180 virtual void verify(); 182 virtual void verify();
181 void print() const { print_on(tty); } 183 void print() const { print_on(tty); }
182 virtual void print_on(outputStream* st) const; 184 virtual void print_on(outputStream* st) const;
183 virtual void print_value_on(outputStream* st) const; 185 virtual void print_value_on(outputStream* st) const;
184 186
187 // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService.
188 static void trace_new_stub(CodeBlob* blob, const char* name1, const char* name2 = "");
189
185 // Print the comment associated with offset on stream, if there is one 190 // Print the comment associated with offset on stream, if there is one
186 virtual void print_block_comment(outputStream* stream, address block_begin) { 191 virtual void print_block_comment(outputStream* stream, address block_begin) {
187 intptr_t offset = (intptr_t)(block_begin - code_begin()); 192 intptr_t offset = (intptr_t)(block_begin - code_begin());
188 _comments.print_block_comment(stream, offset); 193 _comments.print_block_comment(stream, offset);
189 } 194 }
316 //---------------------------------------------------------------------------------------------------- 321 //----------------------------------------------------------------------------------------------------
317 // Super-class for all blobs that exist in only one instance. Implements default behaviour. 322 // Super-class for all blobs that exist in only one instance. Implements default behaviour.
318 323
319 class SingletonBlob: public CodeBlob { 324 class SingletonBlob: public CodeBlob {
320 friend class VMStructs; 325 friend class VMStructs;
321 public: 326
327 protected:
328 void* operator new(size_t s, unsigned size);
329
330 public:
322 SingletonBlob( 331 SingletonBlob(
323 const char* name, 332 const char* name,
324 CodeBuffer* cb, 333 CodeBuffer* cb,
325 int header_size, 334 int header_size,
326 int size, 335 int size,
339 void print_value_on(outputStream* st) const; 348 void print_value_on(outputStream* st) const;
340 }; 349 };
341 350
342 351
343 //---------------------------------------------------------------------------------------------------- 352 //----------------------------------------------------------------------------------------------------
353 // RicochetBlob
354 // Holds an arbitrary argument list indefinitely while Java code executes recursively.
355
356 class RicochetBlob: public SingletonBlob {
357 friend class VMStructs;
358 private:
359
360 int _bounce_offset;
361 int _exception_offset;
362
363 // Creation support
364 RicochetBlob(
365 CodeBuffer* cb,
366 int size,
367 int bounce_offset,
368 int exception_offset,
369 int frame_size
370 );
371
372 public:
373 // Creation
374 static RicochetBlob* create(
375 CodeBuffer* cb,
376 int bounce_offset,
377 int exception_offset,
378 int frame_size
379 );
380
381 // Typing
382 bool is_ricochet_stub() const { return true; }
383
384 // GC for args
385 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ }
386
387 address bounce_addr() const { return code_begin() + _bounce_offset; }
388 address exception_addr() const { return code_begin() + _exception_offset; }
389 bool returns_to_bounce_addr(address pc) const {
390 address bounce_pc = bounce_addr();
391 return (pc == bounce_pc || (pc + frame::pc_return_offset) == bounce_pc);
392 }
393 };
394
395
396 //----------------------------------------------------------------------------------------------------
344 // DeoptimizationBlob 397 // DeoptimizationBlob
345 398
346 class DeoptimizationBlob: public SingletonBlob { 399 class DeoptimizationBlob: public SingletonBlob {
347 friend class VMStructs; 400 friend class VMStructs;
348 private: 401 private:
361 int unpack_with_exception_offset, 414 int unpack_with_exception_offset,
362 int unpack_with_reexecution_offset, 415 int unpack_with_reexecution_offset,
363 int frame_size 416 int frame_size
364 ); 417 );
365 418
366 void* operator new(size_t s, unsigned size);
367
368 public: 419 public:
369 // Creation 420 // Creation
370 static DeoptimizationBlob* create( 421 static DeoptimizationBlob* create(
371 CodeBuffer* cb, 422 CodeBuffer* cb,
372 OopMapSet* oop_maps, 423 OopMapSet* oop_maps,
376 int frame_size 427 int frame_size
377 ); 428 );
378 429
379 // Typing 430 // Typing
380 bool is_deoptimization_stub() const { return true; } 431 bool is_deoptimization_stub() const { return true; }
381 const DeoptimizationBlob *as_deoptimization_stub() const { return this; }
382 bool exception_address_is_unpack_entry(address pc) const { 432 bool exception_address_is_unpack_entry(address pc) const {
383 address unpack_pc = unpack(); 433 address unpack_pc = unpack();
384 return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc); 434 return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc);
385 } 435 }
386 436
424 int size, 474 int size,
425 OopMapSet* oop_maps, 475 OopMapSet* oop_maps,
426 int frame_size 476 int frame_size
427 ); 477 );
428 478
429 void* operator new(size_t s, unsigned size);
430
431 public: 479 public:
432 // Creation 480 // Creation
433 static UncommonTrapBlob* create( 481 static UncommonTrapBlob* create(
434 CodeBuffer* cb, 482 CodeBuffer* cb,
435 OopMapSet* oop_maps, 483 OopMapSet* oop_maps,
456 int size, 504 int size,
457 OopMapSet* oop_maps, 505 OopMapSet* oop_maps,
458 int frame_size 506 int frame_size
459 ); 507 );
460 508
461 void* operator new(size_t s, unsigned size);
462
463 public: 509 public:
464 // Creation 510 // Creation
465 static ExceptionBlob* create( 511 static ExceptionBlob* create(
466 CodeBuffer* cb, 512 CodeBuffer* cb,
467 OopMapSet* oop_maps, 513 OopMapSet* oop_maps,
489 int size, 535 int size,
490 OopMapSet* oop_maps, 536 OopMapSet* oop_maps,
491 int frame_size 537 int frame_size
492 ); 538 );
493 539
494 void* operator new(size_t s, unsigned size);
495
496 public: 540 public:
497 // Creation 541 // Creation
498 static SafepointBlob* create( 542 static SafepointBlob* create(
499 CodeBuffer* cb, 543 CodeBuffer* cb,
500 OopMapSet* oop_maps, 544 OopMapSet* oop_maps,