Skip to content

Instantly share code, notes, and snippets.

@jart
jart / blc.S
Last active June 10, 2023 06:58
Binary Lambda Calculus Virtual Machine for x64 Linux in 400 bytes
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
│vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│
╞══════════════════════════════════════════════════════════════════════════════╡
│ Copyright 2022 Justine Alexandra Roberts Tunney │
│ │
│ Permission to use, copy, modify, and/or distribute this software for │
│ any purpose with or without fee is hereby granted, provided that the │
│ above copyright notice and this permission notice appear in all copies. │
│ │
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
@Glavo
Glavo / PanamaJIT.java
Last active November 23, 2021 10:43
PanamaJIT Demo
import jdk.incubator.foreign.*;
import java.lang.invoke.*;
// Original code (C++): https://stackoverflow.com/a/40937610/7659948
public class PanamaJIT {
public static final int MEM_COMMIT = 0x00001000;
public static final int PAGE_READWRITE = 0x04;
public static final int PAGE_EXECUTE_READ = 0x20;