mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-06-09 19:01:05 +00:00
build and runtime update
This commit is contained in:
@@ -14,4 +14,12 @@ else
|
||||
emcc $file -Os -s WASM=1 -s SIDE_MODULE=1 -o out/contract.wasm
|
||||
fi
|
||||
|
||||
# Gas injector
|
||||
cargo run --manifest-path=./../gas/Cargo.toml --release -- ./out/contract.wasm ./out/contract.wasm
|
||||
|
||||
# Allocator replacer
|
||||
cargo run --manifest-path=./../ext/Cargo.toml --release -- ./out/contract.wasm ./out/contract.wasm
|
||||
|
||||
# Symbols optimizer
|
||||
cargo run --manifest-path=./../opt/Cargo.toml --release -- ./out/contract.wasm ./out/contract.wasm
|
||||
|
||||
|
||||
+15
-2
@@ -125,12 +125,23 @@
|
||||
// todo: figure out how to do counter with multiple executables
|
||||
self.gasCounter = 0;
|
||||
|
||||
self.dynamicTopPtr = 1024;
|
||||
|
||||
self.malloc = function(size) {
|
||||
let result = self.dynamicTopPtr;
|
||||
self.dynamicTopPtr += size;
|
||||
return result;
|
||||
}
|
||||
|
||||
self.free = function() {
|
||||
}
|
||||
|
||||
self.resolveAlloc = function(instance) {
|
||||
return instance.exports._malloc;
|
||||
return self.malloc;
|
||||
}
|
||||
|
||||
self.resolveFree = function(instance) {
|
||||
return instance.exports._free;
|
||||
return self.free;
|
||||
}
|
||||
|
||||
self.gas = function(val) {
|
||||
@@ -237,6 +248,8 @@
|
||||
env._storage_write = runtime.storage.write;
|
||||
env._storage_size = runtime.storage.size;
|
||||
env.gas = runtime.gas;
|
||||
env._malloc = runtime.malloc;
|
||||
env._free = runtime.free;
|
||||
|
||||
if (!imports.env.memory) {
|
||||
imports.env.memory = runtime.memory;
|
||||
|
||||
Reference in New Issue
Block a user