Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use literal pools for capabilities #8

Open
jacobbramley opened this issue Nov 16, 2022 · 0 comments
Open

Use literal pools for capabilities #8

jacobbramley opened this issue Nov 16, 2022 · 0 comments
Assignees

Comments

@jacobbramley
Copy link
Collaborator

JSC often needs to move a literal capability into a register. For plain address pointers, it uses a movz/movk sequence, but this can't work for capabilities, so instead it puts a whole capability in the instruction stream, jumps over it, then loads the capability using a PCC-relative load:

    b       after
    brk     #0     // Alignment padding.
    ...
    capability<127:96>
    capability<95:64>
    capability<63:32>
    capability<31:0>
after:
    ldr     c0, [pc, #-16]

This, in effect, is a one-entry literal pool.

A much better technique would be to batch them up and dump them (resolving ldr-literal offsets) at a convenient time. This is a standard technique for AArch64 (and AArch32) assembly, but JSC doesn't seem to use them today (for AArch64).

The AArch64 ldr-literal range is probably large enough that for research purposes we can reasonably implement this naively, dumping pools at the end of their respective functions, and aborting if any ldr can't reach its literal.

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

No branches or pull requests

1 participant