Skip to content

Instantly share code, notes, and snippets.

View MattAlp's full-sized avatar

Matt MattAlp

View GitHub Profile
@MattAlp
MattAlp / ClassInit.java
Created February 11, 2025 21:29 — forked from simonis/ClassInit.java
Concurrent class initialization
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
public class ClassInit {
static final int CLASSLOADERS = Integer.getInteger("classloaders", 3);
static final int THREADS = Integer.getInteger("threads", 3);
static class MyClassLoader extends URLClassLoader {
public MyClassLoader() {
@MattAlp
MattAlp / llvm_jit.cr
Created February 3, 2026 15:50 — forked from Papierkorb/llvm_jit.cr
LLVM JIT example in Crystal
require "llvm"
# Initialize LLVM. There's also `LLVM.init_arm` if that's what you use.
LLVM.init_x86
# The context of everything we'll do. Main book-keeping structure.
ctx = LLVM::Context.new
# Code can be separated in different modules. A module can't directly interact
# with another module. If you'd do that, you'd have to link them.