Consider PIC for bytecode

Open
#53 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
28/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
c, wasm

Research direction

The issue names no files, tests, or entry points. Begin by locating the bytecode compiler and loader, then compare position-independent bytecode with load-time relocation for the ESP32 use case. Done would require a decided approach and an implementation validated against the stated memory and address constraints.

Written by the indexing model from the issue text.

Description

First of all thank you very much for this! I am using this on an ESP32 and I hope to distribute it to users soon with some custom device bindings.

My ESP32 is very limited in memory (320KB and much of that is consumed for program code) so I'd like to limit memory as much as possible. I am allowing users to compile (WASM :-) ) their code and upload it to a partition which is them mmap'ed to memory. To ensure true zero copy I need to relocate the memory addresses at compile time.

For the ESP32 this poses a challenge as mmap'ed virtual addresses are not guaranteed to be deterministic across firmware updates and devices.

The question is would you consider having a position independent bytecode (PIC) implementation? Or would load-time relocation be better?

Dominant language
C
Stars
6.2k
Forks
251
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bellard/mquickjs

All issues in bellard/mquickjs

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.