mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
rename code_builder
This commit is contained in:
parent
8164a14dfa
commit
c5ee41af25
2 changed files with 48 additions and 48 deletions
|
@ -132,29 +132,29 @@ pub struct CopyMemoryConfig {
|
|||
alignment_bytes: u32,
|
||||
}
|
||||
|
||||
pub fn copy_memory(instructions: &mut CodeBuilder, config: CopyMemoryConfig) {
|
||||
pub fn copy_memory(code_builder: &mut CodeBuilder, config: CopyMemoryConfig) {
|
||||
debug_assert!(config.from_ptr != config.to_ptr || config.from_offset != config.to_offset);
|
||||
let alignment_flag = encode_alignment(config.alignment_bytes);
|
||||
let mut i = 0;
|
||||
while config.size - i >= 8 {
|
||||
instructions.push(GetLocal(config.to_ptr.0));
|
||||
instructions.push(GetLocal(config.from_ptr.0));
|
||||
instructions.push(I64Load(alignment_flag, i + config.from_offset));
|
||||
instructions.push(I64Store(alignment_flag, i + config.to_offset));
|
||||
code_builder.push(GetLocal(config.to_ptr.0));
|
||||
code_builder.push(GetLocal(config.from_ptr.0));
|
||||
code_builder.push(I64Load(alignment_flag, i + config.from_offset));
|
||||
code_builder.push(I64Store(alignment_flag, i + config.to_offset));
|
||||
i += 8;
|
||||
}
|
||||
if config.size - i >= 4 {
|
||||
instructions.push(GetLocal(config.to_ptr.0));
|
||||
instructions.push(GetLocal(config.from_ptr.0));
|
||||
instructions.push(I32Load(alignment_flag, i + config.from_offset));
|
||||
instructions.push(I32Store(alignment_flag, i + config.to_offset));
|
||||
code_builder.push(GetLocal(config.to_ptr.0));
|
||||
code_builder.push(GetLocal(config.from_ptr.0));
|
||||
code_builder.push(I32Load(alignment_flag, i + config.from_offset));
|
||||
code_builder.push(I32Store(alignment_flag, i + config.to_offset));
|
||||
i += 4;
|
||||
}
|
||||
while config.size - i > 0 {
|
||||
instructions.push(GetLocal(config.to_ptr.0));
|
||||
instructions.push(GetLocal(config.from_ptr.0));
|
||||
instructions.push(I32Load8U(alignment_flag, i + config.from_offset));
|
||||
instructions.push(I32Store8(alignment_flag, i + config.to_offset));
|
||||
code_builder.push(GetLocal(config.to_ptr.0));
|
||||
code_builder.push(GetLocal(config.from_ptr.0));
|
||||
code_builder.push(I32Load8U(alignment_flag, i + config.from_offset));
|
||||
code_builder.push(I32Store8(alignment_flag, i + config.to_offset));
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue