Rename allocator.init to store.string
This commit is contained in:
@@ -593,6 +593,12 @@ do
|
||||
by_offset(memory.data, addr).f64 = value
|
||||
end
|
||||
|
||||
function store.string(memory, addr, data, len)
|
||||
local start = by_offset(memory.data, addr)
|
||||
|
||||
ffi.copy(start, data, len or #data)
|
||||
end
|
||||
|
||||
local WASM_PAGE_SIZE = 65536
|
||||
|
||||
local function finalizer(memory)
|
||||
@@ -617,10 +623,6 @@ do
|
||||
return ffi.gc(memory, finalizer)
|
||||
end
|
||||
|
||||
function allocator.init(memory, addr, data)
|
||||
ffi.copy(by_offset(memory.data, addr), data, #data)
|
||||
end
|
||||
|
||||
function allocator.grow(memory, num)
|
||||
if num == 0 then
|
||||
return memory.min
|
||||
|
||||
@@ -214,7 +214,7 @@ fn write_data_list(wasm: &Module, type_info: &TypeInfo, w: &mut dyn Write) -> Re
|
||||
|
||||
write!(w, "\"")?;
|
||||
|
||||
write!(w, "rt.allocator.init(target, offset, data)")?;
|
||||
write!(w, "rt.store.string(target, offset, data)")?;
|
||||
|
||||
write!(w, "end ")?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user