Skip to content

Cross-platform embedding of HVM4 #54

Description

@lancejpollard

It would be wonderful to make HVM4 compilable as an embedded library on WASM, iOS, Android, and Linux/macOS/Windows by adding minimal #ifdef guards to the system abstraction layer. Zero changes to the core evaluation engine.

Made 5 independent PRs/updates to do this, each on its own branch, would be great if you could take a look:

  1. Configurable HEAP_CAP and MAX_THREADS - Allow tuning for constrained environments (WASM linear memory, mobile address spaces).
  2. Platform-abstract mmap/munmap - Compile on platforms without POSIX mmap (WASM, embedded).
  3. Guard dlopen/dlsym - Compile on platforms without dynamic linking (WASM, iOS App Store).
  4. Guard fork/execvp in AOT builder - Compile on sandboxed platforms that prohibit process spawning (WASM, iOS, Android).
  5. Add lib.c library entry point - Expose HVM4 internals as real linker symbols so external code can call into the runtime.

Scope

  • ~50 lines changed across 5 files, plus 1 new file (lib.c)
  • All guards default to existing behavior
  • All existing tests pass unchanged
  • Only the system abstraction layer is touched
  • Core evaluation is completely untouched

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions