Skip to content

Instantly share code, notes, and snippets.

@abrown
abrown / Makefile
Last active December 6, 2019 04:58
Compare i8x16 shift implementations
.DEFAULT_GOAL = run
FLAGS := -Wall -Wextra
PERF := perf stat -r 10 -ddd
NUM_ITERATIONS := 10000000
# for reference of automatic variables, https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
# basic utilities
clean:
rm -rf build
@abrown
abrown / git-rebase-fixups
Last active January 4, 2021 18:38
Rebase and push fixups from a code review
#!/bin/bash
set -e
# This script automates the process of rebasing some fixed-up commits (e.g. from a PR review) on the default branch
# of a remote repository. It expects changes to have been committed with `git commit --fixup ...` and to have the
# changed branch currently checked out.
# Retrieve the default branch of the origin remote.
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
(set -x; git fetch origin $DEFAULT_BRANCH:$DEFAULT_BRANCH)
@abrown
abrown / README.md
Created May 4, 2023 15:38
How to start working on `wasm32-wasi-threads`

After merging rust-lang/compiler-team#574 I got side-tracked on other work, but here is a description of how I configured my rustc environment in order to start adding and testing the new wasm32-wasi-threads target. Don't be surprised if I forgot a step or left some TODOs in place — there was some trial-and-error involved in getting to this point!

  • First, in order to get things working locally, I build a local copy of a WASI sysroot from wasi-libc: make && make THREAD_MODEL=posix (sysroot/share should now contain files for both targets--wasm32-wasi and wasm32-wasi-threads)

  • Then, in my rust project, I point my config.toml to look at the local WASI sysroot I just built; I do this for both targets (the existing one and the one we're about to add):

    [target.wasm32-wasi]
    wasi-root = ".../wasi-libc/sysroot"
    [target.wasm32-wasi-threads]
    wasi-root = ".../w