mirror of
https://github.com/fluencelabs/interface-types
synced 2025-07-04 09:01:42 +00:00
Merge #1362
1362: feat(interface-types) Remove allocator index from `string.lower_memory` r=Hywan a=Hywan This PR updates `string.lower_memory` to remove the allocator index. Indeed, the string pointer is assumed to be present on the stack. Also, this PR updates `string.size` to pop, and not to peek, the string to compute the length from. That way, it matches the WIT proposal. Co-authored-by: Ivan Enderlin <ivan@mnt.io>
This commit is contained in:
@ -331,10 +331,7 @@ where
|
||||
Instruction::I64FromU64 => 0x21_u8.to_bytes(writer)?,
|
||||
|
||||
Instruction::StringLiftMemory => 0x22_u8.to_bytes(writer)?,
|
||||
Instruction::StringLowerMemory { allocator_index } => {
|
||||
0x23_u8.to_bytes(writer)?;
|
||||
(*allocator_index as u64).to_bytes(writer)?;
|
||||
}
|
||||
Instruction::StringLowerMemory => 0x23_u8.to_bytes(writer)?,
|
||||
Instruction::StringSize => 0x24_u8.to_bytes(writer)?,
|
||||
|
||||
Instruction::RecordLift { type_index } => {
|
||||
@ -688,7 +685,7 @@ mod tests {
|
||||
Instruction::I64FromU32,
|
||||
Instruction::I64FromU64,
|
||||
Instruction::StringLiftMemory,
|
||||
Instruction::StringLowerMemory { allocator_index: 1 },
|
||||
Instruction::StringLowerMemory,
|
||||
Instruction::StringSize,
|
||||
Instruction::RecordLift { type_index: 1 },
|
||||
Instruction::RecordLower { type_index: 1 },
|
||||
@ -730,7 +727,7 @@ mod tests {
|
||||
0x20, // I64FromU32
|
||||
0x21, // I64FromU64
|
||||
0x22, // StringLiftMemory
|
||||
0x23, 0x01, // StringLowerMemory { allocator_index: 1 }
|
||||
0x23, // StringLowerMemory
|
||||
0x24, // StringSize
|
||||
0x025, 0x01, // RecordLift { type_index: 1 }
|
||||
0x026, 0x01, // RecordLower { type_index: 1 }
|
||||
|
Reference in New Issue
Block a user