Mercurial > hg > graal-compiler
comparison src/share/vm/code/stubs.hpp @ 8151:b8f261ba79c6
Minimize diff to plain HotSpot version.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 07 Mar 2013 21:00:29 +0100 |
parents | a7a93887b4c4 |
children | b9a918201d47 |
comparison
equal
deleted
inserted
replaced
8150:b66f831ac5ab | 8151:b8f261ba79c6 |
---|---|
105 | 105 |
106 class StubInterface: public CHeapObj<mtCode> { | 106 class StubInterface: public CHeapObj<mtCode> { |
107 public: | 107 public: |
108 // Initialization/finalization | 108 // Initialization/finalization |
109 virtual void initialize(Stub* self, int size, | 109 virtual void initialize(Stub* self, int size, |
110 CodeComments& comments) = 0; // called after creation (called twice if allocated via (request, commit)) | 110 CodeComments& comments) = 0; // called after creation (called twice if allocated via (request, commit)) |
111 virtual void finalize(Stub* self) = 0; // called before deallocation | 111 virtual void finalize(Stub* self) = 0; // called before deallocation |
112 | 112 |
113 // General info/converters | 113 // General info/converters |
114 virtual int size(Stub* self) const = 0; // the total size of the stub in bytes (must be a multiple of CodeEntryAlignment) | 114 virtual int size(Stub* self) const = 0; // the total size of the stub in bytes (must be a multiple of CodeEntryAlignment) |
115 virtual int code_size_to_size(int code_size) const = 0; // computes the total stub size in bytes given the code size in bytes | 115 virtual int code_size_to_size(int code_size) const = 0; // computes the total stub size in bytes given the code size in bytes |
116 | 116 |
117 // Code info | 117 // Code info |
118 virtual address code_begin(Stub* self) const = 0; // points to the first code byte | 118 virtual address code_begin(Stub* self) const = 0; // points to the first code byte |
119 virtual address code_end(Stub* self) const = 0; // points to the first byte after the code | 119 virtual address code_end(Stub* self) const = 0; // points to the first byte after the code |
120 | 120 |
121 // Debugging | 121 // Debugging |
122 virtual void verify(Stub* self) const = 0; // verifies the stub | 122 virtual void verify(Stub* self) = 0; // verifies the stub |
123 NOT_PRODUCT(using AllocatedObj::print_on;) | 123 virtual void print(Stub* self) = 0; // prints information about the stub |
124 virtual void print_on(Stub* self, outputStream* st) const = 0; // prints information about the stub | |
125 }; | 124 }; |
126 | 125 |
127 | 126 |
128 // DEF_STUB_INTERFACE is used to create a concrete stub interface | 127 // DEF_STUB_INTERFACE is used to create a concrete stub interface |
129 // class, forwarding stub interface calls to the corresponding | 128 // class, forwarding stub interface calls to the corresponding |
130 // stub calls. | 129 // stub calls. |
131 | 130 |
132 #define DEF_STUB_INTERFACE(stub) \ | 131 #define DEF_STUB_INTERFACE(stub) \ |
133 class stub##Interface: public StubInterface { \ | 132 class stub##Interface: public StubInterface { \ |
134 private: \ | 133 private: \ |
135 static stub* cast(Stub* self) { return (stub*)self; } \ | 134 static stub* cast(Stub* self) { return (stub*)self; } \ |
136 \ | 135 \ |
137 public: \ | 136 public: \ |
138 /* Initialization/finalization */ \ | 137 /* Initialization/finalization */ \ |
139 virtual void initialize(Stub* self, int size, \ | 138 virtual void initialize(Stub* self, int size, \ |
140 CodeComments& comments) { cast(self)->initialize(size, comments); } \ | 139 CodeComments& comments) { cast(self)->initialize(size, comments); } \ |
141 virtual void finalize(Stub* self) { cast(self)->finalize(); } \ | 140 virtual void finalize(Stub* self) { cast(self)->finalize(); } \ |
142 \ | 141 \ |
143 /* General info */ \ | 142 /* General info */ \ |
144 virtual int size(Stub* self) const { return cast(self)->size(); } \ | 143 virtual int size(Stub* self) const { return cast(self)->size(); } \ |
145 virtual int code_size_to_size(int code_size) const { return stub::code_size_to_size(code_size); } \ | 144 virtual int code_size_to_size(int code_size) const { return stub::code_size_to_size(code_size); } \ |
146 \ | 145 \ |
147 /* Code info */ \ | 146 /* Code info */ \ |
148 virtual address code_begin(Stub* self) const { return cast(self)->code_begin(); } \ | 147 virtual address code_begin(Stub* self) const { return cast(self)->code_begin(); } \ |
149 virtual address code_end(Stub* self) const { return cast(self)->code_end(); } \ | 148 virtual address code_end(Stub* self) const { return cast(self)->code_end(); } \ |
150 \ | 149 \ |
151 /* Debugging */ \ | 150 /* Debugging */ \ |
152 virtual void verify(Stub* self) const { cast(self)->verify(); } \ | 151 virtual void verify(Stub* self) { cast(self)->verify(); } \ |
153 NOT_PRODUCT(using AllocatedObj::print_on;) \ | 152 virtual void print(Stub* self) { cast(self)->print(); } \ |
154 virtual void print_on(Stub* self, outputStream* st) const { cast(self)->print_on(st); } \ | |
155 }; | 153 }; |
156 | 154 |
157 | 155 |
158 // A StubQueue maintains a queue of stubs. | 156 // A StubQueue maintains a queue of stubs. |
159 // Note: All sizes (spaces) are given in bytes. | 157 // Note: All sizes (spaces) are given in bytes. |
182 void stub_finalize(Stub* s) { _stub_interface->finalize(s); } | 180 void stub_finalize(Stub* s) { _stub_interface->finalize(s); } |
183 int stub_size(Stub* s) const { return _stub_interface->size(s); } | 181 int stub_size(Stub* s) const { return _stub_interface->size(s); } |
184 bool stub_contains(Stub* s, address pc) const { return _stub_interface->code_begin(s) <= pc && pc < _stub_interface->code_end(s); } | 182 bool stub_contains(Stub* s, address pc) const { return _stub_interface->code_begin(s) <= pc && pc < _stub_interface->code_end(s); } |
185 int stub_code_size_to_size(int code_size) const { return _stub_interface->code_size_to_size(code_size); } | 183 int stub_code_size_to_size(int code_size) const { return _stub_interface->code_size_to_size(code_size); } |
186 void stub_verify(Stub* s) { _stub_interface->verify(s); } | 184 void stub_verify(Stub* s) { _stub_interface->verify(s); } |
187 void stub_print(Stub* s, outputStream* st) const { _stub_interface->print_on(s, st); } | 185 void stub_print(Stub* s) { _stub_interface->print(s); } |
188 | 186 |
189 static void register_queue(StubQueue*); | 187 static void register_queue(StubQueue*); |
190 | 188 |
191 public: | 189 public: |
192 StubQueue(StubInterface* stub_interface, int buffer_size, Mutex* lock, | 190 StubQueue(StubInterface* stub_interface, int buffer_size, Mutex* lock, |
226 | 224 |
227 address stub_code_begin(Stub* s) const { return _stub_interface->code_begin(s); } | 225 address stub_code_begin(Stub* s) const { return _stub_interface->code_begin(s); } |
228 address stub_code_end(Stub* s) const { return _stub_interface->code_end(s); } | 226 address stub_code_end(Stub* s) const { return _stub_interface->code_end(s); } |
229 | 227 |
230 // Debugging/printing | 228 // Debugging/printing |
231 void verify(); // verifies the stub queue | 229 void verify(); // verifies the stub queue |
232 virtual void print() const { print_on(tty); } | 230 void print(); // prints information about the stub queue |
233 virtual void print_on(outputStream* st) const; | |
234 }; | 231 }; |
235 | 232 |
236 #endif // SHARE_VM_CODE_STUBS_HPP | 233 #endif // SHARE_VM_CODE_STUBS_HPP |