Skip to content

Instantly share code, notes, and snippets.

View wtholliday's full-sized avatar

Taylor Holliday wtholliday

View GitHub Profile
@wtholliday
wtholliday / Collector.cpp
Last active December 18, 2015 13:58
A simple concurrent mark-sweep garbage collector. Requires manual management of the referential graph. I'm confident it works for a single mutator thread, but not sure about multiple mutator threads. Requires boost::lockfree.
//
// Collector.cpp
// Dev
//
// Created by Taylor Holliday on 6/14/13.
// This file is in the public domain.
//
#include "gc2/Collector.hpp"
@wtholliday
wtholliday / nodes.rs
Created July 9, 2019 18:48
Exercise in graph data structure with undo/redo.
#[derive(Debug)]
struct Node { }
#[derive(Copy, Clone, Debug)]
struct Wire {
from: u32, // node index
to: u32, // node index
}
#pragma once
template<typename>
class func;
// Alternative to std::function for when compile time is
// more important than runtime performance. Doesn't pull in
// any headers.
template<typename Result, typename... Arguments>
class func<Result (Arguments...)> {
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <iostream>
#include <type_traits>
// Big stack.
static size_t stackSize = 1024*1024*10;
static thread_local uint8_t* start = nullptr;