Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8ffe4a2
Add bytecode VM implementation plan and core headers
claude Dec 26, 2025
1b3fc8a
Merge remote-tracking branch 'origin/main' into claude/bytecode-vm-1cezj
claude Dec 27, 2025
082c11b
Implement bytecode VM core execution engine
claude Dec 27, 2025
2f43923
Add VM binaries to .gitignore
claude Dec 27, 2025
6c729d1
Add more opcode implementations to bytecode VM
claude Dec 28, 2025
4d6cb15
Implement user-defined functions and fix continue statement
claude Dec 28, 2025
cd6d26c
Implement for-in loops and fix nested closure upvalues
claude Dec 28, 2025
b681a49
Implement switch statements in bytecode VM
claude Dec 28, 2025
7c15787
Fix continue in for-in loops
claude Dec 28, 2025
73103b9
Fix switch break inside loops in bytecode VM
claude Dec 28, 2025
8e48f09
Implement array methods (map, filter, reduce) and method calls
claude Dec 28, 2025
9e2c023
Add object method calls and BC_CLOSE_UPVALUE opcode
claude Dec 28, 2025
4da5c81
Add divi/modi builtins for integer division
claude Dec 28, 2025
f0daf5c
Add increment/decrement operators and stack manipulation opcodes
claude Dec 28, 2025
ba11a82
Add string interpolation support to bytecode VM
claude Dec 28, 2025
33f9cf2
Add exception handling compilation (try/catch/throw)
claude Dec 28, 2025
71597d9
Add defer, optional params, optional chaining, null coalescing
claude Dec 29, 2025
0d6ac81
Add self keyword support for object methods
claude Dec 29, 2025
c6ffa43
Add rest params, enums, for-in objects, and string methods
claude Dec 29, 2025
1c02bcf
Add type annotations, type promotion, and custom type names
claude Dec 30, 2025
894cd09
Add VM parity tests to GitHub Actions workflow
claude Dec 30, 2025
7baad6f
Add comprehensive array and string methods to VM
claude Dec 30, 2025
6871c8d
Add JSON deserialize and to_bytes methods to VM
claude Dec 30, 2025
4c01651
Add eprint builtin and fix panic default message
claude Dec 30, 2025
185f40a
Add string_concat_many builtin to VM
claude Dec 30, 2025
bc3e160
Add catchable runtime errors to VM
claude Dec 30, 2025
15de2f1
Add file I/O support to VM
claude Dec 30, 2025
c4f1d06
Add proper UTF-8 and rune support to VM
claude Dec 30, 2025
ae5cbc4
Add async/await and channel support to VM
claude Dec 30, 2025
ef08b0c
Add memory, pointer, and atomic builtins to VM
claude Dec 30, 2025
0c232d1
Merge main into bytecode-vm branch
claude Dec 30, 2025
986a9e8
Fix apply() builtin crash and merge main
claude Dec 30, 2025
604a152
Add remaining VM builtins: select, raise, exec, ptr_to_buffer
claude Dec 30, 2025
715b89a
Add module system, args support, and root build integration to VM
claude Dec 30, 2025
901fc25
Add hemlockvm to .gitignore
claude Dec 30, 2025
c7996a9
Add many stdlib builtins to VM for improved parity
claude Dec 30, 2025
80fe3af
Merge main into bytecode-vm branch
claude Dec 31, 2025
a40d39e
Add type constructor functions and fix type conversions in VM
claude Dec 31, 2025
bd7d260
Fix global shadowing of builtins in VM compiler
claude Dec 31, 2025
c08faa1
Fix segfault in typeof(object) - initialize type_name to NULL
claude Dec 31, 2025
0a9b530
Improve bytecode VM parity: 87/106 tests passing (82%)
claude Jan 28, 2026
94858ce
Fix split() and serialize() for better parity (89/106 tests passing)
claude Jan 28, 2026
69e054c
VM: Add type registry for define defaults, fix user method priority
claude Jan 28, 2026
78871c8
VM: Add missing builtins for stdlib_encoding and stdlib_fs
claude Jan 28, 2026
4e95c7d
Fix VM local variable storage model - 97/106 tests passing
claude Jan 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@ jobs:
- name: Run parity tests
run: make parity

# Bytecode VM parity tests
vm-parity:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential gcc make

- name: Build bytecode VM
run: make vm

- name: Run VM parity tests
run: make test-vm

# Compile check - verify interpreter tests compile with hemlockc
compile-check:
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Compiled executables
/hemlock
/hemlockc
/hemlockvm
hemlock.exe
*.out
*.app
Expand Down Expand Up @@ -86,4 +87,7 @@ docs/docs.html
# Hemlock bytecode/bundle files
*.hmlc
*.hmlb
*.hmlp
*.hmlp
# VM binaries
src/backends/vm/hemlockvm
src/backends/vm/hemlockvm_asan
44 changes: 42 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ runtime-clean:
compiler-clean:
rm -f $(COMPILER_TARGET) $(COMPILER_OBJS)

# Full clean including compiler, runtime, and release
fullclean: clean compiler-clean runtime-clean release-clean
# Full clean including compiler, runtime, VM, and release
fullclean: clean compiler-clean runtime-clean vm-clean release-clean

# Run compiler test suite
.PHONY: test-compiler
Expand All @@ -303,6 +303,46 @@ parity: $(TARGET) compiler stdlib
parity-full: $(TARGET) compiler stdlib
@bash tests/run_full_parity.sh

# ========== BYTECODE VM ==========

VM_TARGET = hemlockvm

# Build the bytecode VM (output to root directory like hemlock and hemlockc)
.PHONY: vm
vm:
@echo "Building bytecode VM..."
$(MAKE) -C src/backends/vm
@cp src/backends/vm/hemlockvm ./$(VM_TARGET)
@echo "✓ Bytecode VM built: $(VM_TARGET)"

# Clean the bytecode VM
.PHONY: vm-clean
vm-clean:
$(MAKE) -C src/backends/vm clean
rm -f $(VM_TARGET)

# Run VM parity tests
.PHONY: test-vm
test-vm: vm
@echo "Running VM parity tests..."
@passed=0; failed=0; \
for test in tests/parity/language/*.hml tests/parity/builtins/*.hml tests/parity/methods/*.hml tests/parity/modules/*.hml; do \
expected="$${test%.hml}.expected"; \
if [ -f "$$expected" ]; then \
output=$$(timeout 5 ./$(VM_TARGET) "$$test" 2>&1); \
expected_content=$$(cat "$$expected"); \
if [ "$$output" = "$$expected_content" ]; then \
echo "✓ PASS: $$(basename $$test)"; \
passed=$$((passed + 1)); \
else \
echo "✗ FAIL: $$(basename $$test)"; \
failed=$$((failed + 1)); \
fi; \
fi; \
done; \
echo ""; \
echo "VM Parity: $$passed passed, $$failed failed"

# Run bundler test suite
.PHONY: test-bundler
test-bundler: $(TARGET)
Expand Down
Loading