Skip to content

Instantly share code, notes, and snippets.

View pnkfelix's full-sized avatar
🍩
re-pat; ex-🥐

Felix S Klock II pnkfelix

🍩
re-pat; ex-🥐
View GitHub Profile
@pnkfelix
pnkfelix / gist:4162480
Created November 28, 2012 16:52
Disassembly of ParLambda initialization
(gdb) disassem $pc $pc+300
Dump of assembler code from 0x1014c790e to 0x1014c7a3a:
0x00000001014c790e: nop
0x00000001014c790f: mov $0x103d0a1c8,%r11
0x00000001014c7919: mov %r11,(%rax)
0x00000001014c791c: mov $0x103d081f0,%r11
0x00000001014c7926: mov %r11,0x8(%rax)
0x00000001014c792a: mov $0x0,%r11
0x00000001014c7934: mov %r11,0x10(%rax)
0x00000001014c7938: mov $0x100941b90,%r11
@pnkfelix
pnkfelix / gist:4169488
Created November 29, 2012 14:37
repeated expression at repl is sometimes disqualified
(gdb) show env
MANPATH=
SHELL=/bin/bash
TERM=dumb
TMPDIR=/var/folders/k3/378c5t615d747q30wd1ps4pw0000gn/T/
Apple_PubSub_Socket_Render=/tmp/launch-n8TMSQ/Render
EMACSDATA=/Applications/Emacs.app/Contents/Resources/etc
EMACSPATH=/Applications/Emacs.app/Contents/MacOS/bin
USER=fklock
EMACS=t
@pnkfelix
pnkfelix / gist:4170608
Created November 29, 2012 17:29
closure creation with >16 vars
function testClosureCreationAndInvocation() {
var a = [1,2,3,4,5,21];
var p = new ParallelArray(a);
function makeaddv(v) {
var u = v - 1;
var t = v - 2;
var s = v - 3;
var r = v - 4;
var q = v - 5;
var p = v - 6;
function ComputeSliceBounds(len, id, n) {
// Computes the bounds for slice |id| of |len| items, assuming |n|
// total slices. If len is not evenly divisible by n, then the
// initial threads may have a bit more work.
var slice = ((len + n - 1) / n) | 0; // i.e. ceil(len / n).
var prevDone = slice * id; // work distributed to threads before this one.
var start = (prevDone >= len) ? len : prevDone; // clamp start by len.
var end = (start + slice) > len ? len : (start + slice); // clamp end by len.
return [start, end];
}
(gdb) bt
#0 nsXPConnect::GetXPConnect () at nsXPConnect.cpp:140
#1 0x0000000102c946a0 in XPCCallContext::XPCCallContext (this=0x149397d30, callerLanguage=XPCContext::LANG_JS, cx=0x11af2fdb0, obj=0x10eef3310, funobj=0x0, name={asBits = 2}, argc=4294967295, argv=0x0, rval=0x0) at XPCCallContext.cpp:24
#2 0x0000000102c94628 in XPCCallContext::XPCCallContext (this=0x149397d30, callerLanguage=XPCContext::LANG_JS, cx=0x11af2fdb0, obj=0x10eef3310, funobj=0x0, name={asBits = 2}, argc=4294967295, argv=0x0, rval=0x0) at XPCCallContext.cpp:33
#3 0x0000000102d26280 in XPC_WN_Helper_NewResolve (cx=0x11af2fdb0, obj={<js::HandleBase<JSObject *>> = {<No data fields>}, ptr = 0x149398158}, id={<js::HandleBase<jsid>> = {<No data fields>}, ptr = 0x1493987e0}, flags=0, objp={<js::MutableHandleBase<JSObject *>> = {<No data fields>}, ptr = 0x149397f48}) at XPCWrappedNativeJSOps.cpp:1054
#4 0x0000000104ae10e2 in CallResolveOp (cx=0x11af2fdb0, obj={<js::HandleBase<JSObject *>> = {<No data fields>}, ptr = 0x149398158}, id={<js::H
Assertion failure: hasParallelIonScript(), at ../../../js/src/jsscript.h:607
Assertion failure: hasParallelIonScript(), at ../../../js/src/jsscript.h:607
Assertion failure: hasParallelIonScript(), at ../../../js/src/jsscript.h:607
Assertion failure: hasParallelIonScript(), at ../../../js/src/jsscript.h:607
Assertion failure: hasParallelIonScript(), at ../../../js/src/jsscript.h:607
Assertion failure: hasParallelIonScript(), at ../../../js/src/jsscript.h:607
Assertion failure: hasParallelIonScript(), at ../../../js/src/jsscript.h:607
Assertion failure: hasParallelIonScript(), at ../../../js/src/jsscript.h:607
Program received signal EXC_BAD_ACCESS, Could not access memory.
@pnkfelix
pnkfelix / gist:4704081
Created February 3, 2013 22:50
rustc ICE with by-value self
% rustc -v
rustc 0.6 (77ee858 2013-02-02 11:54:29 +0100)
host: x86_64-apple-darwin
% cat bug3.rs
pub trait Op<T> { fn call(self, T,T) -> T; }
impl<T> fn(T,T) -> T : Op<T> {
fn call(self, a:T, b:T) -> T { self(a,b) }
}
@pnkfelix
pnkfelix / gist:4723099
Created February 6, 2013 15:00
elisp code to ease firing off my local pjs-enabled builds of firefox using an isolated profile (and thus be able to run it in parallel with my main Firefox instance).
(defun gud-pjs (command-line)
"Wrapper around gud-gdb that runs firefox using my pjs-alpha profile."
;; --P pjs-alpha
(interactive (list (gud-query-cmdline 'gud-gdb)))
(let ((new-command-line
(cond ((string-match " --args " command-line)
(concat command-line " --P pjs-alpha"))
(t
(concat command-line " --args firefox --P pjs-alpha")))))
(gud-gdb new-command-line)))
@pnkfelix
pnkfelix / gist:4754621
Created February 11, 2013 14:13
semi-minimal test case
gczeal(9, 2)
function testScatterConflict() {
var p = new ParallelArray([1,2]);
function foo() true;
function bar() true;
var r = p.scatter([0,1]);
}
testScatterConflict();
* liquid-resize benchmark, version at:
http://pnkfelix.github.com/pjs-examples/liquid-resize/resize-demo.html
* (But with smaller versions of the source image; tower-small is 25% of tower, and tower-tiny is 25% of tower-small. I think.)
* Okay, in Firefox 18.0.2, here are the full times:
tower-tiny (Firefox 18.0.2)
* Seq JS Array: 0.42s
* Seq JS Typed Array: 0.24s