mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
Get long string literals working in gen_wasm
This commit is contained in:
parent
a5c3809290
commit
7ac1c7a72f
3 changed files with 18 additions and 16 deletions
|
@ -9,7 +9,7 @@ use super::opcodes::{OpCode, OpCode::*};
|
|||
use super::serialize::{SerialBuffer, Serialize};
|
||||
use crate::{round_up_to_alignment, FRAME_ALIGNMENT_BYTES, STACK_POINTER_GLOBAL_ID};
|
||||
|
||||
const ENABLE_DEBUG_LOG: bool = true;
|
||||
const ENABLE_DEBUG_LOG: bool = false;
|
||||
macro_rules! log_instruction {
|
||||
($($x: expr),+) => {
|
||||
if ENABLE_DEBUG_LOG { println!($($x,)*); }
|
||||
|
@ -572,11 +572,14 @@ impl<'a> CodeBuilder<'a> {
|
|||
);
|
||||
}
|
||||
|
||||
/// Insert a linker relocation for a memory address
|
||||
pub fn insert_memory_relocation(&mut self, symbol_index: u32) {
|
||||
/// Insert a const reference to a memory address
|
||||
pub fn i32_const_mem_addr(&mut self, addr: u32, symbol_index: u32) {
|
||||
self.inst_base(I32CONST, 0, true);
|
||||
let offset = self.code.len() as u32;
|
||||
self.code.encode_padded_u32(addr);
|
||||
self.relocations.push(RelocationEntry::Offset {
|
||||
type_id: OffsetRelocType::MemoryAddrLeb,
|
||||
offset: self.code.len() as u32,
|
||||
offset,
|
||||
symbol_index,
|
||||
addend: 0,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue