Skip to content

Instantly share code, notes, and snippets.

View SchrodingerZhu's full-sized avatar
✍️
Working!

Schrodinger ZHU Yifan SchrodingerZhu

✍️
Working!
View GitHub Profile
@SchrodingerZhu
SchrodingerZhu / Main.hs
Last active December 22, 2025 15:10
TypeFlow-Based Monomorphism
module Main (main) where
import Data.HashMap.Strict qualified as H
import Data.Maybe (isJust)
import Data.Graph (stronglyConnComp, SCC(..), flattenSCC)
import Data.List (intercalate, nub)
-- See: https://dl.acm.org/doi/pdf/10.1145/3720472
data Type
@SchrodingerZhu
SchrodingerZhu / wavl.cpp
Created December 16, 2025 12:33
Weak AVL
//===-- Implementation header for weak AVL tree -----------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Weak AVL tree implementation based on the algorithm described in:
// 1. https://maskray.me/blog/2025-12-14-weak-avl-tree
// 2. https://reviews.freebsd.org/D25480
@SchrodingerZhu
SchrodingerZhu / ucrt-notes.md
Last active November 26, 2024 05:53
UCRT Notes

UCRT Notes

Background

At LLVM libc, I am exploring a harder approach (than MinGW) to implement a brand new CRT. As such, I am reading the UCRT code (open sourced portion). This document is for recording some interesting findings I have come across in the codebase. I will also write down some thoughts that might be useful for future implementation, which does not restrict to the UCRT codebase.

The code is from https://www.nuget.org/packages/Microsoft.Windows.SDK.CRTSource.

@SchrodingerZhu
SchrodingerZhu / Gimple.c
Last active November 15, 2024 16:10
GCCJIT Bug?
struct Lancern;
struct QuaticCat;
struct Float;
union Union;
struct Lancern
{
@SchrodingerZhu
SchrodingerZhu / COMMIT HASH
Created November 29, 2023 01:42
SMHasher Patch
7db446a0b8d2e29cd648fb5bf4224db9aed30905
@SchrodingerZhu
SchrodingerZhu / Generated Parser Benchmark
Last active June 12, 2023 20:23
Generated Parser Benchmark
[nix-shell:~/CLionProjects/paguroidea]$ env RUSTFLAGS="-C target-cpu=native" PAG_RANDOM_SEED=0 cargo bench
Compiling snmalloc-sys v0.3.3
Compiling pag-lexer v0.1.0-alpha.1 (/home/schrodinger/CLionProjects/paguroidea/pag-lexer)
Compiling serde_derive v1.0.163
Compiling lalrpop v0.20.0
Compiling pest_meta v2.6.0
Compiling pest_generator v2.6.0
Compiling pest_derive v2.6.0
Compiling pag-parser v0.1.0-alpha.1 (/home/schrodinger/CLionProjects/paguroidea/pag-parser)
Compiling serde v1.0.163
// Type your code here, or load an example.
pub fn square(num: i32) -> i32 {
num * num
}
// If you use `main()`, declare it as `pub` to see it in the output:
// pub fn main() { ... }
pub mod parser {
extern crate alloc;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#![no_std]
extern crate alloc;
use alloc::rc::Rc;
use core::cell::UnsafeCell;
use core::ptr::NonNull;
struct Node {
tree_parent: Option<NonNull<Self>>,
tree_left: Option<NonNull<Self>>,
@SchrodingerZhu
SchrodingerZhu / test.rs
Last active April 9, 2023 02:33
dynforest
#![no_std]
extern crate alloc;
use alloc::rc::Rc;
use core::cell::UnsafeCell;
use core::ptr::NonNull;
struct Node {
tree_parent: Option<NonNull<Self>>,
tree_left: Option<NonNull<Self>>,
#![feature(core_intrinsics)]
use std::intrinsics::likely;
use std::marker::PhantomData;
use std::ptr::NonNull;
use std::rc::{Rc, Weak};
struct Node<T> {
next: NonNull<Self>,
prev: NonNull<Self>,