git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 18c73fcab36d8356ed6384cceb0fa31e40c3895c

getMemory -> get8Memory

Norton Wang committed on 3/5/2018, 11:18:40 PM
Parent: a2c3cdf53481b4f87fc6fa54cbd9947efc9c6985

Files changed

tests/wasmContainer.jschanged
wasmContainer.jschanged
tests/wasmContainer.jsView
@@ -209,10 +209,10 @@
209209 const funcRef = module.getFuncRef('test')
210210 funcRef.gas = 10000
211211
212212 const message = new Message({funcRef}).on('done', actor => {
213- const a = actor.container.getMemory(0, 5)
214- const b = actor.container.getMemory(5, 5)
213+ const a = actor.container.get8Memory(0, 5)
214+ const b = actor.container.get8Memory(5, 5)
215215 t.deepEquals(a, b, 'should copy memory correctly')
216216 })
217217 hypervisor.send(message)
218218 })
@@ -233,10 +233,10 @@
233233 const funcRef = module.getFuncRef('test')
234234 funcRef.gas = 10000
235235
236236 const message = new Message({funcRef}).on('done', actor => {
237- const a = actor.container.getMemory(0, 8)
238- const b = actor.container.getMemory(8, 8)
237+ const a = actor.container.get8Memory(0, 8)
238+ const b = actor.container.get8Memory(8, 8)
239239 t.deepEquals(a, b, 'should copy memory correctly')
240240 })
241241 hypervisor.send(message)
242242 })
@@ -272,9 +272,9 @@
272272 const message = new Message({
273273 funcRef
274274 }).on('done', actor => {
275275 resolve()
276- const b = actor.container.getMemory(5, 4)
276+ const b = actor.container.get8Memory(5, 4)
277277 const result = Buffer.from(b).toString()
278278 t.deepEquals(result, 'test', 'should copy memory correctly')
279279 })
280280 hypervisor.send(message)
wasmContainer.jsView
@@ -148,13 +148,13 @@
148148 }
149149 },
150150 module: {
151151 new: dataRef => {
152-
152+
153153 },
154154 exports: (modRef, offset, length) => {
155155 const mod = this.refs.get(modRef, 'mod')
156- let name = this.getMemory(offset, length)
156+ let name = this.get8Memory(offset, length)
157157 name = Buffer.from(name).toString()
158158 const funcRef = mod.getFuncRef(name)
159159 return this.refs.add(funcRef, 'func')
160160 },
@@ -163,15 +163,15 @@
163163 }
164164 },
165165 memory: {
166166 externalize: (index, length) => {
167- const buf = Buffer.from(this.getMemory(index, length))
167+ const buf = Buffer.from(this.get8Memory(index, length))
168168 return this.refs.add(buf, 'buf')
169169 },
170170 internalize: (dataRef, srcOffset, sinkOffset, length) => {
171171 let buf = this.refs.get(dataRef, 'buf')
172172 buf = buf.subarray(srcOffset, length)
173- const mem = this.getMemory(sinkOffset, buf.length)
173+ const mem = this.get8Memory(sinkOffset, buf.length)
174174 mem.set(buf)
175175 },
176176 length (dataRef) {
177177 let buf = this.refs.get(dataRef, 'buf')
@@ -179,9 +179,9 @@
179179 }
180180 },
181181 table: {
182182 externalize: (index, length) => {
183- const mem = Buffer.from(this.getMemory(index, length * 4))
183+ const mem = Buffer.from(this.get8Memory(index, length * 4))
184184 const objects = []
185185 while (length--) {
186186 const ref = mem.readUInt32LE(length * 4)
187187 const obj = this.refs.get(ref)

Built with git-ssb-web