Skip to content

Instantly share code, notes, and snippets.

View eira-fransham's full-sized avatar

Eira Fransham eira-fransham

  • Berlin
View GitHub Profile
@eira-fransham
eira-fransham / bigint-native.s
Created May 14, 2018 14:44
Disassembly of `U256::full_mul` when using `-C target-cpu=native`
libbigint.so`disassemble:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq 0x10(%rbp), %r14
@eira-fransham
eira-fransham / unsound-insert.rs
Last active November 27, 2019 03:35
Explanation of unsoundness in `SmallVec::insert_many`
extern crate smallvec;
use smallvec::SmallVec;
struct Printer(usize);
impl Drop for Printer {
fn drop(&mut self) {
println!("Dropping {}", self.0);
}
This file has been truncated, but you can view the full file.
# callgrind format
version: 1
creator: callgrind-3.13.0
pid: 6359
cmd: target/release/rustfest-5c3dd55c20998644 --bench
part: 1
desc: I1 cache: 32768 B, 64 B, 8-way associative
desc: D1 cache: 32768 B, 64 B, 8-way associative
#![feature(nll)]
extern crate pollock;
extern crate serde;
#[macro_use]
extern crate serde_derive;
use pollock::*;
#[derive(Serialize, Deserialize)]
@eira-fransham
eira-fransham / pollock.rs
Created September 26, 2018 15:05
Example of using pollock.rs to make some simple sketches
#![feature(nll)]
#[macro_use]
extern crate pollock;
extern crate serde;
#[macro_use]
extern crate serde_derive;
use pollock::*;
push rbp
mov rbp, rsp
sub rsp, 0x10
mov qword ptr [rsp + 8], rdi
mov eax, 0
push rax
mov rax, qword ptr [rsp + 0x10]
push rax
pop rax
pop rcx
@eira-fransham
eira-fransham / lightbeam-fib-comparison
Last active January 17, 2019 10:28
Lightbeam fibonacci generated code before and after #12
push rbp | push rbp
mov rbp, rsp | mov rbp, rsp
sub rsp, 0x20 | sub rsp, 0x10
mov edx, 1 | mov qword ptr [rsp + 8], rdi
xor eax, eax | mov eax, 0
cmp esi, 2 | push rax
setb al | mov rax, qword ptr [rsp + 0x10]
test eax, eax | push rax
je 0x2d | pop rax
jmp 0x8e | pop rcx
INPUT:
(module
(func
(call $assert-return (call $as-binary-operand) (i32.const 12))
(call $assert-return (call $break-bare) (i32.const 19))
(call $assert-return (call $break-value) (i32.const 18))
(call $assert-return (call $break-repeated) (i32.const 18))
(call $assert-return (call $break-inner) (i32.const 0x7))
)
(func $dummy)
fib:
push rbp
mov rbp, rsp
sub rsp, 0x10
xor eax, eax
cmp rsi, 0
sete al
test eax, eax
; If `rsi` is _not_ zero, then jump to .fib-then
je .fib_then
diff --git a/content/posts/wasm-is-not-a-stack-machine.md b/content/posts/wasm-is-not-a-stack-machine.md
index f8a944c..34bb3a5 100644
--- a/content/posts/wasm-is-not-a-stack-machine.md
+++ b/content/posts/wasm-is-not-a-stack-machine.md
@@ -7,7 +7,9 @@ draft: false
> ### Preamble
> This article assumes some familiarity with virtual machines, compilers and WebAssembly, but I'll try to link to relevant information where necessary so even if you're not you can follow along.
> <br/><br/>
-> Also, this series is going to come off as if I dislike WebAssembly. I love WebAssembly! In fact, I love it so much that I want it to be the best that it can be, and this series is me working through my complaints with the design in the hope that some or all of these issues can be addressed soon, while the ink is still fresh on the specification.
+> Also, this series is going to come off as if I dislike WebAssembly. I love WebAssembly! I wrote a [whole article about how great it is][wasm-on-the-blockchain]! In fact, I love i