Skip to content

Improve handling of top-level names with new ResolveBehaviour system#270

Merged
IsaacWoods merged 2 commits intorust-osdev:mainfrom
IsaacWoods:main
Mar 8, 2026
Merged

Improve handling of top-level names with new ResolveBehaviour system#270
IsaacWoods merged 2 commits intorust-osdev:mainfrom
IsaacWoods:main

Conversation

@IsaacWoods
Copy link
Member

@IsaacWoods IsaacWoods commented Mar 7, 2026

This PR aims to improve handling of names at the operand level by encoding the expected resolution behaviour for each argument to an operation that is in-flight. This replaces the ad-hoc behaviour we had before, which was not sufficient to handle SuperName operands correctly.

This should be a definitive fix for #262, replacing the previous solution in db2ac63 which only handled DefStore.

Fixes #262


pub fn new_with(op: Opcode, arguments: Vec<Argument>, more: usize) -> OpInFlight {
OpInFlight { op, expected_arguments: arguments.len() + more, arguments }
fn resolve_behaviour(&self) -> ResolveBehaviour {
Copy link
Contributor

Choose a reason for hiding this comment

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

Purely for my own benefit, I'd like to check my understanding here... Is this function effectively "get the resolve behaviour for the next argument to be pushed into this op"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes exactly - I've added a comment to make this clearer.

@martin-hughes
Copy link
Contributor

I'm not sure whether or not you're looking for a second pair of eyes, but I thought I'd take a look just to help my understanding of your parser. I haven't checked whether all the ResolveBehaviours are correct but the concept of what you've done makes sense to me, and I couldn't think of any real suggestions.

(I'd love to get rid of the numeric expected_arguments parameter because it's almost always the same as the number of resolve behaviours... except the one time it isn't!)

Plus I've done a quick test and it seems to work. Thanks again for all your work on this crate!

Kudos on the British spellings BTW 🫡

@IsaacWoods
Copy link
Member Author

Second pair of eyes is always very welcome - easy to make silly mistakes. I tend to leave PRs for a day or two and come back for a re-review anyways.

I was very tempted to get rid of expected_arguments but it is unfortunately necessary - it differs from the new number of ResolveBehaviours for Package, VarPackage, and also around parsing method invocations. However, these are rare enough that I've re-jigged the constructors to be able to infer expected_arguments most of the time - thanks for the suggestion!

Kudos on the British spellings BTW

Haha, yes I seem to have settled on a half-way house where I use color but am firmly on the side of behaviour and maths...

@IsaacWoods
Copy link
Member Author

🚀 Published as acpi v6.1.1

@IsaacWoods IsaacWoods merged commit 12fb020 into rust-osdev:main Mar 8, 2026
5 checks passed
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.

AML: EC memory store target gets resolved to value

2 participants