quick and dirty pure lua webassembly interpreter
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 26 lines 524 B view raw
1local memory = {} 2 3local constants = require("constants") 4 5memory.Memory = { 6 pages = 0, 7 maxpages = -1, 8} 9 10function memory.Memory:new(pages) 11 local m = {} 12 setmetatable(m, {__index = self}) 13 m:grow(pages) 14 return m 15end 16 17function memory.Memory:grow(pages) 18 local initStart = self.pages * constants.WASM_PAGE_SIZE 19 local initEnd = ((self.pages + pages) * constants.WASM_PAGE_SIZE) - 1 20 for i = initStart, initEnd do 21 self[i] = 0 22 end 23 self.pages = self.pages + pages 24end 25 26return memory