Mercurial > hg > graal-compiler
comparison src/share/vm/code/stubs.hpp @ 7735:a7a93887b4c4
fix Solaris build and initial SPARC support
author | twisti |
---|---|
date | Wed, 06 Feb 2013 18:01:07 -0800 |
parents | 7d815d842ee0 |
children | b8f261ba79c6 |
comparison
equal
deleted
inserted
replaced
7734:a0cfabe195c6 | 7735:a7a93887b4c4 |
---|---|
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) = 0; // verifies the stub | 122 virtual void verify(Stub* self) const = 0; // verifies the stub |
123 virtual void print_on(Stub* self, outputStream* st) = 0; // prints information about the stub | 123 NOT_PRODUCT(using AllocatedObj::print_on;) |
124 virtual void print_on(Stub* self, outputStream* st) const = 0; // prints information about the stub | |
124 }; | 125 }; |
125 | 126 |
126 | 127 |
127 // DEF_STUB_INTERFACE is used to create a concrete stub interface | 128 // DEF_STUB_INTERFACE is used to create a concrete stub interface |
128 // class, forwarding stub interface calls to the corresponding | 129 // class, forwarding stub interface calls to the corresponding |
129 // stub calls. | 130 // stub calls. |
130 | 131 |
131 #define DEF_STUB_INTERFACE(stub) \ | 132 #define DEF_STUB_INTERFACE(stub) \ |
132 class stub##Interface: public StubInterface { \ | 133 class stub##Interface: public StubInterface { \ |
133 private: \ | 134 private: \ |
134 static stub* cast(Stub* self) { return (stub*)self; } \ | 135 static stub* cast(Stub* self) { return (stub*)self; } \ |
135 \ | 136 \ |
136 public: \ | 137 public: \ |
137 /* Initialization/finalization */ \ | 138 /* Initialization/finalization */ \ |
138 virtual void initialize(Stub* self, int size, \ | 139 virtual void initialize(Stub* self, int size, \ |
139 CodeComments& comments) { cast(self)->initialize(size, comments); } \ | 140 CodeComments& comments) { cast(self)->initialize(size, comments); } \ |
140 virtual void finalize(Stub* self) { cast(self)->finalize(); } \ | 141 virtual void finalize(Stub* self) { cast(self)->finalize(); } \ |
141 \ | 142 \ |
142 /* General info */ \ | 143 /* General info */ \ |
143 virtual int size(Stub* self) const { return cast(self)->size(); } \ | 144 virtual int size(Stub* self) const { return cast(self)->size(); } \ |
144 virtual int code_size_to_size(int code_size) const { return stub::code_size_to_size(code_size); } \ | 145 virtual int code_size_to_size(int code_size) const { return stub::code_size_to_size(code_size); } \ |
145 \ | 146 \ |
146 /* Code info */ \ | 147 /* Code info */ \ |
147 virtual address code_begin(Stub* self) const { return cast(self)->code_begin(); } \ | 148 virtual address code_begin(Stub* self) const { return cast(self)->code_begin(); } \ |
148 virtual address code_end(Stub* self) const { return cast(self)->code_end(); } \ | 149 virtual address code_end(Stub* self) const { return cast(self)->code_end(); } \ |
149 \ | 150 \ |
150 /* Debugging */ \ | 151 /* Debugging */ \ |
151 virtual void verify(Stub* self) { cast(self)->verify(); } \ | 152 virtual void verify(Stub* self) const { cast(self)->verify(); } \ |
152 virtual void print_on(Stub* self, outputStream* st) { cast(self)->print_on(st); } \ | 153 NOT_PRODUCT(using AllocatedObj::print_on;) \ |
154 virtual void print_on(Stub* self, outputStream* st) const { cast(self)->print_on(st); } \ | |
153 }; | 155 }; |
154 | 156 |
155 | 157 |
156 // A StubQueue maintains a queue of stubs. | 158 // A StubQueue maintains a queue of stubs. |
157 // Note: All sizes (spaces) are given in bytes. | 159 // Note: All sizes (spaces) are given in bytes. |
180 void stub_finalize(Stub* s) { _stub_interface->finalize(s); } | 182 void stub_finalize(Stub* s) { _stub_interface->finalize(s); } |
181 int stub_size(Stub* s) const { return _stub_interface->size(s); } | 183 int stub_size(Stub* s) const { return _stub_interface->size(s); } |
182 bool stub_contains(Stub* s, address pc) const { return _stub_interface->code_begin(s) <= pc && pc < _stub_interface->code_end(s); } | 184 bool stub_contains(Stub* s, address pc) const { return _stub_interface->code_begin(s) <= pc && pc < _stub_interface->code_end(s); } |
183 int stub_code_size_to_size(int code_size) const { return _stub_interface->code_size_to_size(code_size); } | 185 int stub_code_size_to_size(int code_size) const { return _stub_interface->code_size_to_size(code_size); } |
184 void stub_verify(Stub* s) { _stub_interface->verify(s); } | 186 void stub_verify(Stub* s) { _stub_interface->verify(s); } |
185 void stub_print(Stub* s, outputStream* st) { _stub_interface->print_on(s, st); } | 187 void stub_print(Stub* s, outputStream* st) const { _stub_interface->print_on(s, st); } |
186 | 188 |
187 static void register_queue(StubQueue*); | 189 static void register_queue(StubQueue*); |
188 | 190 |
189 public: | 191 public: |
190 StubQueue(StubInterface* stub_interface, int buffer_size, Mutex* lock, | 192 StubQueue(StubInterface* stub_interface, int buffer_size, Mutex* lock, |
224 | 226 |
225 address stub_code_begin(Stub* s) const { return _stub_interface->code_begin(s); } | 227 address stub_code_begin(Stub* s) const { return _stub_interface->code_begin(s); } |
226 address stub_code_end(Stub* s) const { return _stub_interface->code_end(s); } | 228 address stub_code_end(Stub* s) const { return _stub_interface->code_end(s); } |
227 | 229 |
228 // Debugging/printing | 230 // Debugging/printing |
229 void verify(); // verifies the stub queue | 231 void verify(); // verifies the stub queue |
230 void print() { print_on(tty); } | 232 virtual void print() const { print_on(tty); } |
231 void print_on(outputStream* st); | 233 virtual void print_on(outputStream* st) const; |
232 }; | 234 }; |
233 | 235 |
234 #endif // SHARE_VM_CODE_STUBS_HPP | 236 #endif // SHARE_VM_CODE_STUBS_HPP |