Skip to main content

Hyper-optimized, multi-language polyglot JIT framework for Python.

Project description

⚡ janky-sys

"Because choosing a single programming language is a sign of weakness."

janky-sys is a hyper-optimized, low-level polyglot JIT framework for Python. It bypasses traditional runtime overhead by embedding 12 language JIT/compilation engines directly inside native C Python Extensions. By combining mmap, dlopen, dlsym, and raw machine code execution, it allows you to compile and execute any language inline inside Python at raw bare-metal speeds.


🛠️ The Janky Toolchain Lineup

The runtime framework consists of 12 unified engine extensions:

Extension Language Execution Strategy Target Requirements
jasm / jasm86 Intel Assembly Inline Bytecode Pipeline System nasm / Native Kernel
jinary Raw Bytecode mmap + mprotect Page Injection None (Pure Hex Opcodes)
jc / jcpp C / C++ Dynamic .so JIT via GCC/Clang gcc / clang
just Rust Cargo Dynamic Cdylib Engine rustc / cargo
jig Zig Blazing-fast native compilation zig
jnim Nim Transpiled C binary emission nim
jgo Go Embedded runtime shared links go
jortran Fortran Numerical optimization backend gfortran
jython Inline CPython Sub-interpreter bypass strings Python Development Headers
jbrainfuck Brainfuck Esoteric bytecode array VM None (Built-in interpreter)

🚀 Architectural Blueprint

Every compiler engine utilizes an optimized, secure dual-pass pipeline to guarantee zero-overhead execution states:

  1. SHA-256 Content Validation: Incoming code block strings are securely hashed via OpenSSL (libcrypto) and compared against cached structural artifacts inside .janky_cache/.
  2. Dynamic Compilation: On cache misses, sub-process toolchains are cleanly invoked with local file boundaries.
  3. Memory Execution Map: Binaries are loaded via dlopen/dlsym or locked inside page-aligned memory slots using kernel-level mprotect(PROT_READ | PROT_EXEC).
  4. Unified Register Calling Bridge: Arguments are mapped straight into low-level registers (rdi, rsi, rdx...) using a unified Box type tag system.

💎 The Unified Type Tag Registry

To pass floating-point numbers or configure return pathways across standard system calling conventions, append the following register map integer tags to .compile(source, symbol, type_id):

  • 0: Standard Integer / Array Buffer Address Pointer (uint64_t) [Default]
  • 1: IEEE 754 Double Precision Floating Point (double -> xmm0)
  • 2: IEEE 754 Single Precision Floating Point (float -> xmm0)

💻 Elite Code Showcases

1. Zig (jig)

from janky.compiler import jig

jig.set_flags("-mcpu=native")
src = """
export fn zig_multiply(x: f64, y: f64) f64 {
    return x * y;
}
"""
# Type ID 1 explicitly configures double-precision float return maps
fn = jig.compile(src, "zig_multiply", 1)
print(fn(3.5, 2.0))  # Output: 7.0

2. Pure Binary (jbinary)

from janky.compiler import jbinary

# Layout pure hex opcodes. Supports comments (#) and spacing!
bytecode = """
48 89 f8    # mov rax, rdi (Move 1st argument register to return register)
48 01 f0    # add rax, rsi (Add 2nd argument register to rax)
c3          # ret
"""
fn = jbinary.compile(bytecode, "pure_jit")
print(fn(40, 2))  # Output: 42

3. Rust (just)

from janky.compiler import just

src = """
#[no_mangle]
pub extern "C" fn rust_max(a: u64, b: u64) -> u64 {
    if a > b { a } else { b }
}
"""
fn = just.compile(src, "rust_max")
print(fn(99, 1000))  # Output: 1000

4. Fortran (jortran)

from janky.compiler import jortran

src = """
double precision function fort_add(a, b)
    double precision, intent(in) :: a, b
    fort_add = a + b
end function fort_add
"""
fn = jortran.compile(src, "fort_add", 1)
print(fn(1.23, 4.56))  # Output: 5.79

5. Go (jgo)

from janky.compiler import jgo

src = """
package main
import "C"

//export GoSub
func GoSub(a, b int64) int64 {
    return a - b
}
func main() {}
"""
fn = jgo.compile(src, "GoSub")
print(fn(100, 30))  # Output: 70

📦 Installation

To build and hook all 12 native extensions into your local environment workspace:

# Clone the repository
git clone [https://github.com/GUGUGAGA/janky-sys.git](https://github.com/GUGUGAGA/janky-sys.git)
cd janky-sys

# Perform an editable developer link compilation
pip install -e .

Note: Ensure system-level binary dependencies (gcc, nasm, zig, nim, go, gfortran) and OpenSSL development components are pre-configured inside your POSIX environment loop path variables.


📜 License

The Janky Framework is forged under the MIT License. Use at your own hardware risk.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

janky_sys-1.0.5.tar.gz (20.5 kB view details)

Uploaded Source

File details

Details for the file janky_sys-1.0.5.tar.gz.

File metadata

  • Download URL: janky_sys-1.0.5.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for janky_sys-1.0.5.tar.gz
Algorithm Hash digest
SHA256 f4c748ca13ca1880ca210e58616016ea0e8c2b79e2b06fc78f17a186271b6f4d
MD5 62c91e00486752c7fdcb6491045a9e0e
BLAKE2b-256 c991c69b4eb8a4e64543c3b8ad21976166fdf95fd459fcf243a784b180b4b6c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page