MCPcopy Create free account
hub / github.com/GamerHack/GamerHack.github.io / constructor

Method constructor

g2all/700/module/mem.js:170–203  ·  view source on GitHub ↗
(main, worker, obj, addr_addr, fake_addr)

Source from the content-addressed store, hash-verified

168// integer
169export class Memory {
170 constructor(main, worker, obj, addr_addr, fake_addr) {
171 this._main = main;
172 this._worker = worker;
173 this._obj = obj;
174 this._addr_low = addr_addr.lo;
175 this._addr_high = addr_addr.hi;
176 this._fake_low = fake_addr.lo;
177 this._fake_high = fake_addr.hi;
178
179 main[view_m_length / 4] = 0xffffffff;
180
181 init_module(this);
182
183 const off_mvec = view_m_vector;
184 // use this to create WastefulTypedArrays to avoid a GC crash
185 const buf = new ArrayBuffer(0);
186
187 const src = new Uint8Array(buf);
188 const sset = new Uint32Array(buf);
189 const sset_p = this.addrof(sset);
190 sset_p.write64(off_mvec, this.addrof(src).add(off_mvec));
191 sset_p.write32(view_m_length, 3);
192 this._cpysrc = src;
193 this._src_setter = sset;
194
195 const dst = new Uint8Array(buf);
196 const dset = new Uint32Array(buf);
197 const dset_p = this.addrof(dset);
198 dset_p.write64(off_mvec, this.addrof(dst).add(off_mvec));
199 dset_p.write32(view_m_length, 3);
200 dset[2] = 0xffffffff;
201 this._cpydst = dst;
202 this._dst_setter = dset;
203 }
204
205 // dst and src may overlap
206 cpy(dst, src, len) {

Callers

nothing calls this directly

Calls 5

addrofMethod · 0.95
init_moduleFunction · 0.70
write64Method · 0.45
addMethod · 0.45
write32Method · 0.45

Tested by

no test coverage detected