This repository is an open-source artifact of WarCache. WarCache is an automated code refactoring framework based on specific runtime cache features.
- Install the required WebAssembly environment. You can refer to the following links to install the environment one by one.
- Clone the repository
git clone https://github.com/lianzhilu/warcache.git
cd warcache- Install the required dependencies
pip install -r requirements.txt- Set the environment variables
export API_KEY=your_api_key
export WASI_PATH=/path/to/wasi-sdk/binRun the program in the crs_benchmark/ directory under the target WASM runtime. The shortest time-consuming strategy can be confirmed as the best feature of the runtime.
To score programs based on a specific cache feature, run the following command:
python score.py --feature <cache_feature> --input <program_dir> --output <score_output_dir>- <cache_feature>: The cache feature to evaluate against (e.g., "lru", "lfu", "mru", "fifo").
- <program_dir>: The directory containing the programs to be scored.
- <score_output_dir>: The directory to store the scoring results.
To refactor programs to be more cache-friendly and compatible with a specific WASM runtime, run the following command:
python refactor.py --feature <cache_feature> --runtime <wasm_runtime> --input <program_dir> --output <refactor_output_dir>- <cache_feature>: The cache feature to optimize for (e.g., "lru", "lfu", "mru", "fifo").
- <wasm_runtime>: The target WASM runtime (e.g., "wasmer", "wasmtime", "wasm3", "wamr", "wasmedge").
- <program_dir>: The directory containing the programs to be refactored.
- <refactor_output_dir>: The directory to store the refactored programs and response files.