File tree Expand file tree Collapse file tree 2 files changed +7
-18
lines changed
Expand file tree Collapse file tree 2 files changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -126,22 +126,11 @@ pub fn align_allocation_inner<VM: VMBinding>(
126126}
127127
128128/// Fill the specified region with the alignment value.
129- pub fn fill_alignment_gap < VM : VMBinding > ( immut_start : Address , end : Address ) {
130- let mut start = immut_start;
131-
132- if VM :: MAX_ALIGNMENT - VM :: MIN_ALIGNMENT == BYTES_IN_INT {
133- // At most a single hole
134- if end - start != 0 {
135- unsafe {
136- start. store ( VM :: ALIGNMENT_VALUE ) ;
137- }
138- }
139- } else {
140- while start < end {
141- unsafe {
142- start. store ( VM :: ALIGNMENT_VALUE ) ;
143- }
144- start += BYTES_IN_INT ;
129+ pub fn fill_alignment_gap < VM : VMBinding > ( start : Address , end : Address ) {
130+ if VM :: ALIGNMENT_VALUE != 0 {
131+ let start_ptr = start. to_mut_ptr :: < u8 > ( ) ;
132+ unsafe {
133+ std:: ptr:: write_bytes ( start_ptr, VM :: ALIGNMENT_VALUE , end - start) ;
145134 }
146135 }
147136}
Original file line number Diff line number Diff line change 6363 /// The type of heap memory slice in this VM.
6464 type VMMemorySlice : slot:: MemorySlice < SlotType = Self :: VMSlot > ;
6565
66- /// A value to fill in alignment gaps. This value can be used for debugging.
67- const ALIGNMENT_VALUE : usize = 0xdead_beef ;
66+ /// A value to fill in alignment gaps. This value can be used for debugging. Set this value to 0 to skip filling alignment gaps.
67+ const ALIGNMENT_VALUE : u8 = 0xab ;
6868 /// Allowed minimal alignment in bytes.
6969 const MIN_ALIGNMENT : usize = 1 << DEFAULT_LOG_MIN_ALIGNMENT ;
7070 /// Allowed maximum alignment in bytes.
You can’t perform that action at this time.
0 commit comments