src/share/vm/code/stubs.hpp

Print this page
rev 4202 : 8008555: Debugging code in compiled method sometimes leaks memory
Summary: support for strings that have same life-time as code that uses them.
Reviewed-by:

*** 71,81 **** class Stub VALUE_OBJ_CLASS_SPEC { public: // Initialization/finalization void initialize(int size, ! CodeComments& comments) { ShouldNotCallThis(); } // called to initialize/specify the stub's size void finalize() { ShouldNotCallThis(); } // called before the stub is deallocated // General info/converters int size() const { ShouldNotCallThis(); return 0; } // must return the size provided by initialize static int code_size_to_size(int code_size) { ShouldNotCallThis(); return 0; } // computes the size given the code size --- 71,81 ---- class Stub VALUE_OBJ_CLASS_SPEC { public: // Initialization/finalization void initialize(int size, ! CodeStrings& strings) { ShouldNotCallThis(); } // called to initialize/specify the stub's size void finalize() { ShouldNotCallThis(); } // called before the stub is deallocated // General info/converters int size() const { ShouldNotCallThis(); return 0; } // must return the size provided by initialize static int code_size_to_size(int code_size) { ShouldNotCallThis(); return 0; } // computes the size given the code size
*** 105,115 **** class StubInterface: public CHeapObj<mtCode> { public: // Initialization/finalization virtual void initialize(Stub* self, int size, ! CodeComments& comments) = 0; // called after creation (called twice if allocated via (request, commit)) virtual void finalize(Stub* self) = 0; // called before deallocation // General info/converters virtual int size(Stub* self) const = 0; // the total size of the stub in bytes (must be a multiple of CodeEntryAlignment) virtual int code_size_to_size(int code_size) const = 0; // computes the total stub size in bytes given the code size in bytes --- 105,115 ---- class StubInterface: public CHeapObj<mtCode> { public: // Initialization/finalization virtual void initialize(Stub* self, int size, ! CodeStrings& strings) = 0; // called after creation (called twice if allocated via (request, commit)) virtual void finalize(Stub* self) = 0; // called before deallocation // General info/converters virtual int size(Stub* self) const = 0; // the total size of the stub in bytes (must be a multiple of CodeEntryAlignment) virtual int code_size_to_size(int code_size) const = 0; // computes the total stub size in bytes given the code size in bytes
*** 134,144 **** static stub* cast(Stub* self) { return (stub*)self; } \ \ public: \ /* Initialization/finalization */ \ virtual void initialize(Stub* self, int size, \ ! CodeComments& comments) { cast(self)->initialize(size, comments); } \ virtual void finalize(Stub* self) { cast(self)->finalize(); } \ \ /* General info */ \ virtual int size(Stub* self) const { return cast(self)->size(); } \ virtual int code_size_to_size(int code_size) const { return stub::code_size_to_size(code_size); } \ --- 134,144 ---- static stub* cast(Stub* self) { return (stub*)self; } \ \ public: \ /* Initialization/finalization */ \ virtual void initialize(Stub* self, int size, \ ! CodeStrings& strings) { cast(self)->initialize(size, strings); } \ virtual void finalize(Stub* self) { cast(self)->finalize(); } \ \ /* General info */ \ virtual int size(Stub* self) const { return cast(self)->size(); } \ virtual int code_size_to_size(int code_size) const { return stub::code_size_to_size(code_size); } \
*** 174,184 **** Stub* stub_at(int i) const { check_index(i); return (Stub*)(_stub_buffer + i); } Stub* current_stub() const { return stub_at(_queue_end); } // Stub functionality accessed via interface void stub_initialize(Stub* s, int size, ! CodeComments& comments) { assert(size % CodeEntryAlignment == 0, "size not aligned"); _stub_interface->initialize(s, size, comments); } void stub_finalize(Stub* s) { _stub_interface->finalize(s); } int stub_size(Stub* s) const { return _stub_interface->size(s); } bool stub_contains(Stub* s, address pc) const { return _stub_interface->code_begin(s) <= pc && pc < _stub_interface->code_end(s); } int stub_code_size_to_size(int code_size) const { return _stub_interface->code_size_to_size(code_size); } void stub_verify(Stub* s) { _stub_interface->verify(s); } --- 174,184 ---- Stub* stub_at(int i) const { check_index(i); return (Stub*)(_stub_buffer + i); } Stub* current_stub() const { return stub_at(_queue_end); } // Stub functionality accessed via interface void stub_initialize(Stub* s, int size, ! CodeStrings& strings) { assert(size % CodeEntryAlignment == 0, "size not aligned"); _stub_interface->initialize(s, size, strings); } void stub_finalize(Stub* s) { _stub_interface->finalize(s); } int stub_size(Stub* s) const { return _stub_interface->size(s); } bool stub_contains(Stub* s, address pc) const { return _stub_interface->code_begin(s) <= pc && pc < _stub_interface->code_end(s); } int stub_code_size_to_size(int code_size) const { return _stub_interface->code_size_to_size(code_size); } void stub_verify(Stub* s) { _stub_interface->verify(s); }
*** 204,214 **** // Stub allocation (atomic transactions) Stub* request_committed(int code_size); // request a stub that provides exactly code_size space for code Stub* request(int requested_code_size); // request a stub with a (maximum) code space - locks the queue void commit (int committed_code_size, ! CodeComments& comments); // commit the previously requested stub - unlocks the queue // Stub deallocation void remove_first(); // remove the first stub in the queue void remove_first(int n); // remove the first n stubs in the queue void remove_all(); // remove all stubs in the queue --- 204,214 ---- // Stub allocation (atomic transactions) Stub* request_committed(int code_size); // request a stub that provides exactly code_size space for code Stub* request(int requested_code_size); // request a stub with a (maximum) code space - locks the queue void commit (int committed_code_size, ! CodeStrings& strings); // commit the previously requested stub - unlocks the queue // Stub deallocation void remove_first(); // remove the first stub in the queue void remove_first(int n); // remove the first n stubs in the queue void remove_all(); // remove all stubs in the queue