Skip to content

Instantly share code, notes, and snippets.

Irreducible control flow in Wasm

This is a summary of current discussions, and a follow-up to our recent meetings, prompted by the issue here. Anyone who's been following along with the last few weeks of discussions and presentations might wish to skip directly to the follow-up part.

What is irreducible control flow?

Reducible control flow is the control flow directly representable through semi-structured control flow constructs (loops, conditionals, and break/continue). It can be characterised in terms of a property of the control flow graph that all loops are single-entry. For more details, see the diagram and "Reducibility" subsection here.

Irreducible control flow is roughly "everything else". For example, goto into the middle of a loop would result in irreducible

@bakkot
bakkot / horrifying.js
Last active February 11, 2025 21:17
Various really bad JavaScript
(function x(){"use strict"; x = 1;}()); // TypeError
(function x(){x = 1; return x !== 1;}()); // write fails silently; function returns true
(function x(){"use strict"; x = (function(){throw 0;})();})() // Error 0
// These three lines rely on ES6.
(function x(){const x = 1;})() // No-op. In particular, not a redeclaration of x.
(function (){"use strict"; const x = 1; x = 2;})() // TypeError
(function (){const x = 1; x = 2;})() // TypeError. contrast (function x(){x = 2;}());
@paf31
paf31 / unsession.md
Last active August 29, 2015 14:06
PureScript Unsession
@dherman
dherman / node.c
Created July 18, 2013 23:48
A lightweight implementation of node.js
#include <stdio.h>
int main() {
int *p = 0;
char line[1024];
printf("> ");
fgets(line, 1024, stdin);
*p = 12;
@michaelficarra
michaelficarra / levels.coffee
Last active December 17, 2015 00:49
identifier-only scope colouring levels
fs = require 'fs'
esprima = require 'esprima'
escope = require 'escope'
eslevels = require 'eslevels'
js = (fs.readFileSync './input.js').toString()
ast = esprima.parse js, {range: yes}
scopes = (escope.analyze ast).scopes
@michaelficarra
michaelficarra / task.coffee
Created December 6, 2012 06:03
comonadic futures on top of Q
Q = require './q'
class exports.Task
constructor: (@promise) ->
value: null
reason: null
result: ->
unless @promise.isResolved()
@alexspeller
alexspeller / source_maps.rb
Created September 16, 2012 00:03
Coffeescript Source Maps in Rails
# config/initializers/source_maps.rb
if Rails.env.development?
require 'open3'
module CoffeeScript
class SourceMapError < StandardError; end;
class << self
def map_dir
var module = (function (exports) {
var NameSequence,
ZeroSequenceCache;
NameSequence = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
ZeroSequenceCache = [];
function stringRepeat(str, num) {
var result = '';
@michaelficarra
michaelficarra / CoffeeScriptIdioms.vim
Created May 17, 2012 22:47
vim substitutions for cleaning up coffeescript projects
:%s/[\r \t]\+$//
:%s/() ->/->/c
:%s/if \!/unless /c
:%s/;$//c
:%s/^\(\s*\)\(@\?[a-z0-9$_]\+\)()/\1do \2/ic
:%s/\!==?/isnt/c
:%s/===\?/is/c
:%s/\([a-z0-9$_]\)(\([^)]\+\))$/\1 \2/ic
:%s/true/yes/c
:%s/false/no/c
@paulmillr
paulmillr / active.md
Last active March 2, 2025 12:41
Most active GitHub users (by contributions). https://paulmillr.com

Most active GitHub users (git.io/top)

The list would not be updated for now. Don't write comments.

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Because of GitHub search limitations, only 1000 first users according to amount of followers are included. If you are not in the list you don't have enough followers. See raw data and source code. Algorithm in pseudocode:

githubUsers