-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
proposal: x/arch/arm64/arm64asm: all fields of potential Args structs should be exported #51517
Comments
CC @cherrymui |
I'm not against exporting these fields, but I think it's better for you to define a set of data structures yourself to represent Instructions and parameters, because the format of Instructions won't change, but these internal data structures may. |
I believe Instructions and the Args are direct representation of the instruction set encoding. I don't see these data structures changing unless someone changes the ARM opcode encoding. |
FWIW it was definitely the intent of the other disassemblers to have these be "pure data" that could be directly manipulated. Is there a reason not to do the same for arm64? |
This proposal has been added to the active column of the proposals project |
Does anyone object to accepting this proposal? |
I'm still a little concerned about this. There are two points:
|
I think it is fine to export the fields. But we probably want to polish the names a little bit. For example, currently we have
When exported, maybe they should be Alternatively we can keep fields unexported but add accessor methods (it doesn't seem necessary to set the fields in user code, just read them). But that doesn't sound very Go-like. |
It sounds like we want to work on field names and maybe also introduce some new registers for things like ELR_EL1. |
If the new API will take a while to design, we can always put this on hold until it is ready. |
Should we put this on hold? |
Is anything needed on my part? Or is this waiting still internal decision? |
I think we need to put up the names for exported types/fields/methods/etc. @fabled feel free to propose a list. Thanks. |
Will put this on hold; feel free to take off hold once there is a concrete proposal for the new fields. Thanks! |
Placed on hold. |
Exporting these would be very useful for some tool I'm toying with to test BoringSSL's assembly code. (I'm more using it as an instruction decoder than a disassembler, but it seems to do the trick!) For now I'm just parsing the string representation of the unexported structs back out, which is rather tedious. Beyond field names, the From the discussion, it sounds like there's some question as to whether the system registers are done right, and also issues with some names. The system registers are less commonly used (and, not coincidentally, I'm less familiar with them 😄 ), so perhaps we should leave those unexported in the first iteration and leave that for later? I would then propose:
How does that sound to folks? |
Sounds good to me. I'll update the draft PR accordingly to get things forward. |
This does not work: arm64/arm64asm/tables.go:29:2: ASR redeclared in this block |
Other parts updated to https://go-review.googlesource.com/c/arch/+/388714/. I also changed |
Oh right, those are also instructions! Alright, how about |
Sounds good. Patch updated accordingly. @rsc could you remove the Hold label, and have this reviewed? Thanks! |
Ah I guess one interesting point about Should there be separate |
Or perhaps s/ |
@rsc Gentle ping. Any suggestions how to get this forward? |
Hi @fabled , I am refactoring the arm64 assembler, see #44734, and I also plan to refactor the disassembler based on the new instruction table, so many data structures may be changed, and more argument structs will be supported. In the new code I will export all fields. But I don’t have a clear timeline yet. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What did you do?
I would like to programmatically access all fields of the arm64 disassembler Instruction Args.
What did you expect to see?
To be able to access programmatically instruction arguments. This would be consistent with the other disassemblers: x86, arm32 and ppc. All of them have all
Args
field exported (or be typedef to a basic type). It seems arm64 is the only exception where some fields are not exported.What did you see instead?
Build error, as several fields are unexported.
Change https://go.dev/cl/388714 contains suggested change.
The text was updated successfully, but these errors were encountered: