Uh oh!
There was an error while loading. Please reload this page.
proc_macro/bridge: remove client->server &HandleCounters passing. - #98223
proc_macro/bridge: remove client->server &HandleCounters passing.#98223eddyb wants to merge 1 commit into
&HandleCounters passing.#98223Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
rust-highfive
commented
Jun 18, 2022
(rust-highfive has picked a reviewer for you, use r? to override) |
eddyb
commented
Jun 18, 2022
@bors try @rust-timer queue |
rust-timer
commented
Jun 18, 2022
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
bors
commented
Jun 18, 2022
⌛ Trying commit b251053 with merge d75ab565e15dc39a3d43092f34ca45733cf34a90... |
bors
commented
Jun 18, 2022
☔ The latest upstream changes (presumably #98186) made this pull request unmergeable. Please resolve the merge conflicts. |
bors
commented
Jun 18, 2022
☀️ Try build successful - checks-actions |
rust-timer
commented
Jun 18, 2022
Queued d75ab565e15dc39a3d43092f34ca45733cf34a90 with parent ff86b27, future comparison URL. |
mystor
left a comment
There was a problem hiding this comment.
This looks good and should make future bridge mechanism changes a bit easier :-)
FWIW this does conflict with (one of the more sketchy) ideas from my (very old) PR #86816. Specifically the handling of non-blocking RPC for calls like TokenStream::clone() or stream concatenation was implemented in that PR by atomically generating a new handle to use for the response object on the client side, and sending it to the server to use for the result.
That approach was probably not the right one either way, and there are other ways to generate non-conflicting IDs on server and client if that turns out to be valuable in the future (e.g. count down starting at u32::MAX for client-generated IDs), but I figured it was worth noting :-)
| // FIXME(eddyb) these counters are server-side, so they don't | ||
| // protect against the same proc macro dylib being used with | ||
| // multiple servers - however, that's very unlikely, and should | ||
| // be protected against through other means (e.g. forcing a | ||
| // specific proc macro dylib to always talk to the same server | ||
| // that initially loaded it). |
There was a problem hiding this comment.
Perhaps mention "the same dylib" or something like that? This could be interpreted as "the proc_macro_server::Rustc object should be the same for every invocation of a macro from each crate", which I don't think is what you're suggesting (as ideally I'd imagine that we we want to throw out HandleStore after each invocation of a proc macro, and only keep around the handle counter to avoid conflicts, which is done here by using a static for the counter).
rust-timer
commented
Jun 18, 2022
Finished benchmarking commit (d75ab565e15dc39a3d43092f34ca45733cf34a90): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Footnotes |
petrochenkov
commented
Jun 18, 2022
nnethercote
commented
Jun 19, 2022
I don't see any problems here, but I won't pretend to understand this code well enough to properly review changes, and it's clear that @mystor understands it better than I do. Having said that:
|
nnethercote
commented
Jun 19, 2022
Anyway, if @mystor is happy with this then I am happy to give r+. |
mystor
commented
Jun 22, 2022
LGTM. Only comment I have is the one I mentioned above (#98223 (comment)) about the misleading FIXME comment, but it's fine as-is. |
nnethercote
commented
Jun 22, 2022
bors
commented
Jun 22, 2022
✌️ @eddyb can now approve this pull request |
eddyb
commented
Jun 22, 2022
(FWIW there should be no need for a Also, I've been meaning to reply to #98223 (comment) - I'd already forgotten how much that PR did (I only remembered the "moving |
nnethercote
commented
Jun 22, 2022
True, but I chose to use the official delegation mechanism because it's clearer than the alternatives. |
wesleywiser
commented
Jul 14, 2022
Hello @eddyb and @nnethercote! Just checking in on how this is coming along. From reading over the PR, it sounds like this (partially?) subsumes #97445 which we visited during this PR review in this week's compiler team triage meeting. If not, we're thinking of re-rolling reviewers on that PR as it seems to be straightforward cleanups. |
nnethercote
commented
Jul 15, 2022
This PR has r+ from me, it just needs to be rebased and a couple of comments added. Once that merges I will rebase #97445. |
JohnCSimon
commented
Aug 13, 2022
eddyb
commented
Aug 14, 2022
(the merge conflicts aren't the issue) When I said "the weekend" back in #98223 (comment) that turned out to be several weeks and I still haven't been able to catch up with a lot of |
apiraino
commented
May 19, 2023
friendly ping @eddyb when you have a a chance for the last touches (IIRC we're close to merge this 🙂 ) |
JohnCSimon
commented
Dec 17, 2023
@eddyb |
JohnCSimon
commented
May 26, 2024
Triage: I'm closing this due to inactivity @rustbot label: +S-inactive |
Just like #97461, this was inspired by @nnethercote's efforts in this area (see #97004 (comment)).
The purpose of the counters was never to protect from server-side misuse, only client-side misuse (e.g. a proc macro storing a
proc_macropublic API type in TLS), so the FIXME comment should suffice for now.As this PR removes
get_handle_counters(the only non-ZSTClientfield other thanrun, since #97461), it will allow a#[repr(transparent)]Clientthat only newtypes therunC ABI entry-pointfnpointer (and in the context of e.g. wasm isolation, that's all you want, since you can reason about it from outside the wasm VM, as just a 32-bit "function table index", that you can pass to the wasm VM to call that function).However, I haven't changed any
#[repr]attributes in this PR to avoid unforseen perf interactions.cc @mystor@bjorn3