Skip to content

feat: Add support for various integer and floating-point operations in the interpreter#72

Merged
siyul-park merged 3 commits into
mainfrom
feature/expend_opcode
Jun 14, 2026
Merged

feat: Add support for various integer and floating-point operations in the interpreter#72
siyul-park merged 3 commits into
mainfrom
feature/expend_opcode

Conversation

@siyul-park

Copy link
Copy Markdown
Owner
  • Implemented I32 and I64 bitwise operations: XOR, AND, OR, CLZ, CTZ, POPCNT, ROTL, ROTR, and sign-extension operations.
  • Added floating-point operations: ABS, NEG, SQRT, CEIL, FLOOR, TRUNC, NEAREST, MIN, MAX, and COPYSIGN for F32 and F64 types.
  • Introduced reinterpretation functions for converting between integer and floating-point types.
  • Implemented saturation functions for converting floating-point values to integer types, handling out-of-range values and NaN.
  • Added tests for new instructions to ensure correctness of implementations.

Changes Made

Related Issues

Additional Information

…n the interpreter

- Implemented I32 and I64 bitwise operations: XOR, AND, OR, CLZ, CTZ, POPCNT, ROTL, ROTR, and sign-extension operations.
- Added floating-point operations: ABS, NEG, SQRT, CEIL, FLOOR, TRUNC, NEAREST, MIN, MAX, and COPYSIGN for F32 and F64 types.
- Introduced reinterpretation functions for converting between integer and floating-point types.
- Implemented saturation functions for converting floating-point values to integer types, handling out-of-range values and NaN.
- Added tests for new instructions to ensure correctness of implementations.

Copy link
Copy Markdown
Owner Author

PR Review — feat: Add support for various integer and floating-point operations in the interpreter

Status: Needs Changes (Compilation Error)

This PR adds comprehensive support for integer and floating-point bitwise/arithmetic operations, tail call optimization (RETURN_CALL), and a MAP_KEYS instruction. The implementation is well-scoped with good test coverage. However, the code fails to compile due to missing updates to interp.go.

Blocking Issue: Missing newCompiler() Call Updates

Problem:
The main branch has changed newCompiler() signature from newCompiler() (no args) to newCompiler(int) (requires int arg) in jit_stub.go. However, this PR does not update the call sites in interp.go at lines 619 and 657.

CI Error:

interp/interp.go:619:20: not enough arguments in call to newCompiler
	have ()
	want (int)
interp/interp.go:657:19: not enough arguments in call to newCompiler
	have ()
	want (int)

Required Fix:
Update both call sites in interp.go:

  • Line 619: compiler, err := newCompiler()compiler, err := newCompiler(<arg>)
  • Line 657: compiler, err := newCompiler()compiler, err := newCompiler(<arg>)

Where <arg> should be determined based on the jit_stub.go signature change. This is likely the function address or a similar context value (e.g., addr parameter if available, or 0).

Review Summary

Scope: ✅ Well-defined, minimal changes focused on instruction additions
Tests: ✅ Comprehensive new tests for all new operations
Implementation Quality: ✅ Code follows existing patterns, correct stack handling
Merge Readiness:Blocked by compilation error

Minimal Path to Merge

  1. Identify what value should be passed to newCompiler(int) (check the recent jit_stub.go commit)
  2. Update the two call sites in interp.go (lines 619, 657)
  3. Verify CI passes
  4. Ready to merge

Once the compilation issue is fixed, this PR should merge cleanly.


Generated by Claude Code

- Added support for new instructions: I32_ROTL, I32_ROTR, I64_ROTL, I64_ROTR, I32_CLZ, I32_CTZ, I64_CLZ, I64_CTZ, I32_POPCNT, I64_POPCNT, F32_MIN, F32_MAX, F32_COPYSIGN, F64_MIN, F64_MAX, F64_COPYSIGN.
- Enhanced the threaded compiler to handle RETURN_CALL for both functions and closures.
- Updated the ARM64 lowerer to support new binary operations and unary operations for floating-point types.
- Improved test coverage for new operations in the interpreter's JIT compilation path.
- Marked RETURN_CALL and CLOSURE_NEW as unrecordable in the tracer to optimize performance.
@siyul-park siyul-park merged commit db6e838 into main Jun 14, 2026
1 of 2 checks passed
@siyul-park siyul-park deleted the feature/expend_opcode branch June 14, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant