27
27
28
28
#include " code/oopRecorder.hpp"
29
29
#include " code/relocInfo.hpp"
30
+ #include " compiler/compiler_globals.hpp"
30
31
#include " utilities/align.hpp"
31
32
#include " utilities/debug.hpp"
32
33
#include " utilities/growableArray.hpp"
@@ -256,18 +257,13 @@ class CodeSection {
256
257
void relocate (address at, RelocationHolder const & rspec, int format = 0 );
257
258
void relocate (address at, relocInfo::relocType rtype, int format = 0 , jint method_index = 0 );
258
259
259
- static int alignment (int section);
260
- int alignment () { return alignment (_index); }
260
+ int alignment () const ;
261
261
262
262
// Slop between sections, used only when allocating temporary BufferBlob buffers.
263
263
static csize_t end_slop () { return MAX2 ((int )sizeof (jdouble), (int )CodeEntryAlignment); }
264
264
265
- static csize_t align_at_start (csize_t off, int section) {
266
- return (csize_t ) align_up (off, alignment (section));
267
- }
268
-
269
265
csize_t align_at_start (csize_t off) const {
270
- return align_at_start ( off, _index );
266
+ return ( csize_t ) align_up ( off, alignment () );
271
267
}
272
268
273
269
// Ensure there's enough space left in the current section.
@@ -431,6 +427,8 @@ class CodeBuffer: public StackObj DEBUG_ONLY(COMMA private Scrubber) {
431
427
SharedTrampolineRequests* _shared_trampoline_requests; // used to collect requests for shared trampolines
432
428
bool _finalize_stubs; // Indicate if we need to finalize stubs to make CodeBuffer final.
433
429
430
+ int _const_section_alignment;
431
+
434
432
#ifndef PRODUCT
435
433
AsmRemarks _asm_remarks;
436
434
DbgStrings _dbg_strings;
@@ -456,6 +454,10 @@ class CodeBuffer: public StackObj DEBUG_ONLY(COMMA private Scrubber) {
456
454
_insts.initialize_outer (this , SECT_INSTS);
457
455
_stubs.initialize_outer (this , SECT_STUBS);
458
456
457
+ // Default is to align on 8 bytes. A compiler can change this
458
+ // if larger alignment (e.g., 32-byte vector masks) is required.
459
+ _const_section_alignment = (int ) sizeof (jdouble);
460
+
459
461
#ifndef PRODUCT
460
462
_decode_begin = NULL ;
461
463
// Collect block comments, but restrict collection to cases where a disassembly is output.
@@ -709,6 +711,10 @@ class CodeBuffer: public StackObj DEBUG_ONLY(COMMA private Scrubber) {
709
711
// Request for a shared stub to the interpreter
710
712
void shared_stub_to_interp_for (ciMethod* callee, csize_t call_offset);
711
713
714
+ void set_const_section_alignment (int align) {
715
+ _const_section_alignment = align_up (align, HeapWordSize);
716
+ }
717
+
712
718
#ifndef PRODUCT
713
719
public:
714
720
// Printing / Decoding
@@ -746,19 +752,4 @@ inline bool CodeSection::maybe_expand_to_ensure_remaining(csize_t amount) {
746
752
return false ;
747
753
}
748
754
749
- inline int CodeSection::alignment (int section) {
750
- if (section == CodeBuffer::SECT_CONSTS) {
751
- return (int ) sizeof (jdouble);
752
- }
753
- if (section == CodeBuffer::SECT_INSTS) {
754
- return (int ) CodeEntryAlignment;
755
- }
756
- if (section == CodeBuffer::SECT_STUBS) {
757
- // CodeBuffer installer expects sections to be HeapWordSize aligned
758
- return HeapWordSize;
759
- }
760
- ShouldNotReachHere ();
761
- return 0 ;
762
- }
763
-
764
755
#endif // SHARE_ASM_CODEBUFFER_HPP
0 commit comments