bnjbvr edited PR #4540 from move-emit-to-memory-to-mach-compile-result
to main
:
This small refactoring makes it clearer to me that emitting to memory
doesn't require anything else from the compilationContext
. While it's
a trivial change, it's a small public API change that shouldn't cause
too much trouble, and doesn't seem RFC-worthy. Happy to hear different
opinions about this, though!
cfallin submitted PR review.
cfallin submitted PR review.
cfallin created PR review comment:
This is the last bit of the refactor I had in mind I think: could we turn this
emit_to_memory
into just an accessor onself.buffer.data()
, and let the embedder do the unsafe dump-the-data-into-a-raw-pointer if they desire?The major thing we get out of that is to remove the one remaining
unsafe
API fromcranelift-codegen
; and it feels more idiomatic to me now that we have a typeCompiledCode
that wraps up the result to have an accessor providing access to a part of it, rather than a method that splats that content somewhere (noun rather than verb basically). Does that make sense?
bnjbvr updated PR #4540 from move-emit-to-memory-to-mach-compile-result
to main
.
bnjbvr submitted PR review.
bnjbvr created PR review comment:
Nice, it even leads to more beautiful call sites which sometimes don't even have to use
unsafe
:+1:
bnjbvr requested cfallin for a review on PR #4540.
bjorn3 created PR review comment:
Why is this made private?
bjorn3 submitted PR review.
bjorn3 edited PR review comment.
bnjbvr created PR review comment:
Is there such an instance of an out-of-tree backend? Thought a getter would be sufficient, as suggested previously.
bnjbvr submitted PR review.
bjorn3 submitted PR review.
bjorn3 submitted PR review.
bjorn3 created PR review comment:
Not that I know of. It might exist in the future. Also there may be benefits to moving all existing backends to a separate crate to make compilation of cranelift itself faster by allowing more parallism.
bnjbvr created PR review comment:
Then it makes sense to add some kind of setter whenever it is required. (Good point about moving Cranelift backends to other crates, though; that would certainly help compiling it faster.)
bnjbvr submitted PR review.
cfallin submitted PR review.
cfallin merged PR #4540.
Last updated: Dec 23 2024 at 12:05 UTC