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

Moved Instruction.Symbol and Instruction.Reference into per-instruction metadata #582

Merged
merged 1 commit into from Feb 24, 2022

Conversation

dylandreimerink
Copy link
Member

This PR is a sub-set of the changes originally presented in #567. That PR became bloated and hard to review, this PR contains less drastic changes which can be merged into master independently of the rest of the features.

Copy link
Collaborator

@ti-mo ti-mo left a comment

Choose a reason for hiding this comment

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

Thanks for splitting up the patch set, this is much more digestible! A few more changes and this is good to go.

asm/instruction.go Outdated Show resolved Hide resolved
asm/instruction.go Outdated Show resolved Hide resolved
asm/instruction.go Outdated Show resolved Hide resolved
asm/instruction.go Show resolved Hide resolved
asm/instruction.go Outdated Show resolved Hide resolved
asm/instruction.go Outdated Show resolved Hide resolved
@dylandreimerink dylandreimerink force-pushed the feature/sym-ref-as-metadata branch 2 times, most recently from a568a17 to a9e4c78 Compare February 23, 2022 13:52
@dylandreimerink dylandreimerink force-pushed the feature/sym-ref-as-metadata branch 2 times, most recently from 6ca6525 to e6d0980 Compare February 23, 2022 14:53
This commit adds per-instruction metadata, which is sparse in nature,
meaning that most instructions don't have metadata but some do. Metadata
is linked to an instruction via a pointer which is nil by default, thus
if an instruction has no metadata, at most one pointer worth of space is
unused which is desirable since we expect the size of the metadata
struct to grow in future commits.

The metadata struct is copy-on-write, so multiple instructions can share
the same metadata object after being copied, but as soon as a
modification on one of the instruction's metadata is performed, the
metadata object is copied so writes to a copied instruction doesn't
effect the original instruction.

This commit also deprecates `Instruction.Sym` in favor of
`Instruction.WithSymbol`. This follows the convention of prefixing
func names with `With...` if they have value receivers to make it clear
to callers that this doesn't modify the instruction it is being called
on.
Copy link
Collaborator

@lmb lmb left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me!

@lmb lmb merged commit f654b11 into cilium:master Feb 24, 2022
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.

None yet

3 participants