ejrgilbert / whamm

5 stars 2 forks source link

How to target `Wizard` #54

Open ejrgilbert opened 2 weeks ago

ejrgilbert commented 2 weeks ago

The emitter that targets Wizard for instrumentation could emit a Wasm module that specifies where a probe should be attached to a program by placing the pattern matching rule in the name of a function export. All exported functions are these pattern matching rules, e.g.:

( export "wasm:bytecode:call:alt / ... /" (func #0))

Wizard will read this in and run the pattern matching rules to find all places in the program to call func 0. This means that the predicate needs to be split out to have static predication in the export name and dynamic predication in the func 0 instructions!

ahuoguo commented 1 week ago
func 0 ;; the dynamic predicate should go here
    global.get 0
    i32.const 1
    i32.add
    global.set 0

(global ($0) i32)
(export "wasm:bytecode:call:before / ... /" ;; static predicate
   (func #0)