Skip to content

Commit eef73b7

Browse files
committed
Preparing version 0.7.1
1 parent 614cff7 commit eef73b7

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

workspace/assembler/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ exclude = ["*"]
1515
include = ["README.md", "LICENSE", "COPYRIGHT", "src/**/*.rs", "Cargo.toml", "rustfmt.toml", "clippy.toml"]
1616
readme = "README.md"
1717
publish = true
18-
version = "0.7.0"
18+
version = "0.7.1"
1919

2020
[dependencies]
2121
libc = "^0.2"

workspace/assembler/src/InstructionStream.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,28 @@ impl<'a> InstructionStream<'a>
986986
BM::statically_relative_address(self, array_location_in_memory, index_register, scale, base_register_holding_start_of_instructions_pointer)
987987
}
988988

989+
/// Use as follows with `Memory::relative_instruction_pointer_relative()`:-
990+
///
991+
/// ```
992+
/// instruction_stream.vmovdqa_YMM_Any256BitMemory(ymm_register, Any256BitMemory::relative_instruction_pointer_relative());
993+
/// instruction_stream.overwrite_last_displacement_with_relative_address_to(absolute_address);
994+
/// ```
995+
///
996+
/// Will panic in debug builds if the required displacement is more than 2Gb (such a displacement is extremely unlikely).
997+
#[inline(always)]
998+
pub fn overwrite_last_32bit_displacement_with_relative_address_to(&mut self, location_in_memory: InstructionPointer)
999+
{
1000+
debug_assert!(location_in_memory <= ::std::isize::MAX as usize, "location_in_memory is larger than ::std::isize::MAX");
1001+
1002+
let instruction_pointer = self.instruction_pointer();
1003+
debug_assert!(instruction_pointer <= ::std::isize::MAX as usize, "instruction_pointer is larger than ::std::isize::MAX");
1004+
1005+
let offset = (location_in_memory as isize) - (instruction_pointer as isize);
1006+
debug_assert!(offset <= (::std::i32::MAX as isize) && offset >= (::std::i32::MIN as isize), "offset to location_in_memory is bigger than a 32-bit displacement can hold");
1007+
1008+
self.rewind_to_emit_double_word(offset as i32 as u32);
1009+
}
1010+
9891011
/// Emits a block of a fixed size (blocks are padded to the desired size).
9901012
///
9911013
/// Panics in debug builds if the block is too large.

0 commit comments

Comments
 (0)