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

Rework TracedAOTBlock enum. #978

Merged
merged 9 commits into from
Feb 20, 2024
Merged

Rework TracedAOTBlock enum. #978

merged 9 commits into from
Feb 20, 2024

Conversation

ltratt
Copy link
Contributor

@ltratt ltratt commented Feb 17, 2024

This PR reworks (and renames) the TracedAOTBlock enum. My initial aim was to make it plausible for this to record in-band promotion (e.g . PTWRITE) but as I looked in more depth I realised there were more things we could improve, including extra documentation (63589b9) and improving static guarantees (cb56456).

We will soon be recording not just "blocks", so rename the enum to
something a little less inaccurate. This is a mechanical renaming with
no effect on behaviour.
This is a mechanical renaming with no effect on behaviour.
This reflects the change of the enum element.
This is a mechanical renaming with no effect on behaviour.
This reflects the change of the enum element.
We don't use this currently, but we know that one day we might, so
forcing us to think about this now will make it more likely that adding
it later will be relatively simple.
These methods undermine the type safety of enums, turning what should be
static checks into run-time panics.
@@ -79,7 +79,7 @@ impl JITCLLVM {
Arc::new(JITCLLVM)
}

fn encode_trace(&self, irtrace: &Vec<TracedAOTBlock>) -> (Vec<*const i8>, Vec<usize>, usize) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProcessedItem is such a generic name.

At least with TracedAOTBlock we know the granularity of what we are working with (blocks).

Honestly, I'd rather keep the old name and just know that when you trace an AOT block it can include promotions, although I'm guessing that you will object.

Copy link
Contributor

@vext01 vext01 Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I see that later ProcessedItem will become an enum. I this case I agree that TracedAOTBlock is no longer a good name, but I still think ProcessedItem is not a good name.

How about one of the following:

  • AOTObservation
  • AOTTraceEvent
  • AOTEvent
  • TraceEvent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe call the enum TraceAction or similar, and give the variants verb names, like ExecuteBlock and ObservePromotion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enum can't have "AOT" in the name. TraceAction could work with Block and Promotion? [Execute and in particular Observe seem like padding to me.]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that would be more descriptive than ProcessedItem, so if you are happy, so am I :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a92f1fe changes the enum name (I think the enum variant names are probably OK for now as-is). If you do like this, it'll have to stay as a separate commit as rebasing this earlier will be a nightmare. [In other words: this PR could be merged as-is if -- and only if! -- you like the PR.]

@vext01
Copy link
Contributor

vext01 commented Feb 19, 2024

This LGTM.

Ready for merge I think then?

@ltratt
Copy link
Contributor Author

ltratt commented Feb 19, 2024

Yes merge as-is please.

@vext01 vext01 added this pull request to the merge queue Feb 20, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 20, 2024
@vext01
Copy link
Contributor

vext01 commented Feb 20, 2024

10:00:37 warning: the item `libc` is imported redundantly
10:00:37  --> ykaddr/src/addr.rs:5:12
10:00:37   |
10:00:37 5 | use libc::{self, c_void, dlsym, Dl_info, RTLD_DEFAULT};
10:00:37   |            ^^^^ the item `libc` is already defined here
10:00:37   |
10:00:37   = note: `#[warn(unused_imports)]` on by default
10:00:37 
10:00:37 warning: the item `From` is imported redundantly
10:00:37  --> ykaddr/src/addr.rs:7:15
10:00:37   |
10:00:37 7 |     convert::{From, TryFrom},
10:00:37   |               ^^^^
10:00:37  --> /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/std/src/prelude/mod.rs:129:13
10:00:37   |
10:00:37   = note: the item `From` is already defined here
10:00:37 
10:00:37 warning: the item `TryFrom` is imported redundantly
10:00:37  --> ykaddr/src/addr.rs:7:21
10:00:37   |
10:00:37 7 |     convert::{From, TryFrom},
10:00:37   |                     ^^^^^^^
10:00:37  --> /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/std/src/prelude/mod.rs:129:13
10:00:37   |
10:00:37   = note: the item `TryFrom` is already defined here
10:00:37 
10:00:37 warning: the item `memmap2` is imported redundantly
10:00:37  --> ykaddr/src/obj.rs:9:5
10:00:37   |
10:00:37 9 | use memmap2;
10:00:37   |     ^^^^^^^ the item `memmap2` is already defined here
10:00:37 
10:00:37 warning: the item `phdrs` is imported redundantly
10:00:37   --> ykaddr/src/obj.rs:10:5
10:00:37    |
10:00:37 10 | use phdrs;
10:00:37    |     ^^^^^ the item `phdrs` is already defined here
10:00:37 
10:00:37 warning: `ykaddr` (lib) generated 5 warnings
...

@ptersilie this is what you were seeing yesterday?

I think maybe the import semantics changed and/or rustc now reports more unused imports than before? Is it just a matter of killing the imports?

@ptersilie
Copy link
Contributor

Yes these are the same errors I got on my PR #975. I couldn't reproduce them locally but maybe that's because my rust version isn't up to date. Will try again with a newer rust.

@ptersilie
Copy link
Contributor

Can confirm that after updating rust this fails on my local machine too.

@vext01
Copy link
Contributor

vext01 commented Feb 20, 2024

OK, so someone should raise a PR that fixes this in isolation. Any takers?

@ptersilie
Copy link
Contributor

Working on it.

@ptersilie
Copy link
Contributor

@ltratt
Copy link
Contributor Author

ltratt commented Feb 20, 2024

Can someone kick this one?

@vext01 vext01 added this pull request to the merge queue Feb 20, 2024
Merged via the queue into ykjit:master with commit df8e373 Feb 20, 2024
2 checks passed
@ltratt ltratt deleted the rework_trace_enum branch March 30, 2024 09:14
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

Successfully merging this pull request may close these issues.

3 participants