192 }
193
194 // Code emission
195 void emit_int8 ( int8_t x) { *((int8_t*) end()) = x; set_end(end() + sizeof(int8_t)); }
196 void emit_int16( int16_t x) { *((int16_t*) end()) = x; set_end(end() + sizeof(int16_t)); }
197 void emit_int32( int32_t x) { *((int32_t*) end()) = x; set_end(end() + sizeof(int32_t)); }
198 void emit_int64( int64_t x) { *((int64_t*) end()) = x; set_end(end() + sizeof(int64_t)); }
199
200 void emit_float( jfloat x) { *((jfloat*) end()) = x; set_end(end() + sizeof(jfloat)); }
201 void emit_double(jdouble x) { *((jdouble*) end()) = x; set_end(end() + sizeof(jdouble)); }
202 void emit_address(address x) { *((address*) end()) = x; set_end(end() + sizeof(address)); }
203
204 // Share a scratch buffer for relocinfo. (Hacky; saves a resource allocation.)
205 void initialize_shared_locs(relocInfo* buf, int length);
206
207 // Manage labels and their addresses.
208 address target(Label& L, address branch_pc);
209
210 // Emit a relocation.
211 void relocate(address at, RelocationHolder const& rspec, int format = 0);
212 void relocate(address at, relocInfo::relocType rtype, int format = 0) {
213 if (rtype != relocInfo::none)
214 relocate(at, Relocation::spec_simple(rtype), format);
215 }
216
217 // alignment requirement for starting offset
218 // Requirements are that the instruction area and the
219 // stubs area must start on CodeEntryAlignment, and
220 // the ctable on sizeof(jdouble)
221 int alignment() const { return MAX2((int)sizeof(jdouble), (int)CodeEntryAlignment); }
222
223 // Slop between sections, used only when allocating temporary BufferBlob buffers.
224 static csize_t end_slop() { return MAX2((int)sizeof(jdouble), (int)CodeEntryAlignment); }
225
226 csize_t align_at_start(csize_t off) const { return (csize_t) align_size_up(off, alignment()); }
227
228 // Mark a section frozen. Assign its remaining space to
229 // the following section. It will never expand after this point.
230 inline void freeze(); // { _outer->freeze_section(this); }
231
232 // Ensure there's enough space left in the current section.
233 // Return true if there was an expansion.
234 bool maybe_expand_to_ensure_remaining(csize_t amount);
235
|
192 }
193
194 // Code emission
195 void emit_int8 ( int8_t x) { *((int8_t*) end()) = x; set_end(end() + sizeof(int8_t)); }
196 void emit_int16( int16_t x) { *((int16_t*) end()) = x; set_end(end() + sizeof(int16_t)); }
197 void emit_int32( int32_t x) { *((int32_t*) end()) = x; set_end(end() + sizeof(int32_t)); }
198 void emit_int64( int64_t x) { *((int64_t*) end()) = x; set_end(end() + sizeof(int64_t)); }
199
200 void emit_float( jfloat x) { *((jfloat*) end()) = x; set_end(end() + sizeof(jfloat)); }
201 void emit_double(jdouble x) { *((jdouble*) end()) = x; set_end(end() + sizeof(jdouble)); }
202 void emit_address(address x) { *((address*) end()) = x; set_end(end() + sizeof(address)); }
203
204 // Share a scratch buffer for relocinfo. (Hacky; saves a resource allocation.)
205 void initialize_shared_locs(relocInfo* buf, int length);
206
207 // Manage labels and their addresses.
208 address target(Label& L, address branch_pc);
209
210 // Emit a relocation.
211 void relocate(address at, RelocationHolder const& rspec, int format = 0);
212 void relocate(address at, relocInfo::relocType rtype, int format = 0, jint method_index = 0);
213
214 // alignment requirement for starting offset
215 // Requirements are that the instruction area and the
216 // stubs area must start on CodeEntryAlignment, and
217 // the ctable on sizeof(jdouble)
218 int alignment() const { return MAX2((int)sizeof(jdouble), (int)CodeEntryAlignment); }
219
220 // Slop between sections, used only when allocating temporary BufferBlob buffers.
221 static csize_t end_slop() { return MAX2((int)sizeof(jdouble), (int)CodeEntryAlignment); }
222
223 csize_t align_at_start(csize_t off) const { return (csize_t) align_size_up(off, alignment()); }
224
225 // Mark a section frozen. Assign its remaining space to
226 // the following section. It will never expand after this point.
227 inline void freeze(); // { _outer->freeze_section(this); }
228
229 // Ensure there's enough space left in the current section.
230 // Return true if there was an expansion.
231 bool maybe_expand_to_ensure_remaining(csize_t amount);
232
|