-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Assembly export API - Classes #4
Comments
How do you think you can get the class string to the MIR? Afaik there's no preservation of any sort of attribute built in in the rust compiler, and it might require a hard fork of the entirety of the compiler rather than just the backend plugin. I'd love to be proven wrong though. |
While I would like to just use attributes (and will look for a solution involving them), not having them is not the end of the world. I will take an analogous approach to any other data that I can't pass directly. I call those constants "magic" because users will never see them. They will be hidden behind a macro, and from the perspective of a user, everything will just work. There is one issue with this approach: I need to ensure those constants are never removed by the compiler. They might appear dead, and be removed before I can read them. I have an idea on how to prevent that, but I will need to ensure it always works. |
I would propose this way of passing data about classes: pub(crate) struct ClassInfo {
name: IString,
fields: Vec<(IString, VariableType)>,
explicit_field_offsets:Option<Vec<u8>>,
extends:(Option<IString>,IString), //First, optional name of the assembly it comes form, then, type string
//"Future" stuff, can be ignored for now
access_modifier:AccessModifer,
member_functions:Vec<Method>,
generic_args:Vec<GenericArgument>,
attribute:Vec<Attribute>,
}
|
One idea I have for banning their removal, that I think would work, is That type def info seems a bit small; I tried to write a full one out and it was so long I gave up before I even ran out of the hardcoded bitmask type attributes on a |
Used seems like a perfect solution - I don't see a problem with using statics instead of consts. As for the Currently, I am writing and asking for feedback on the API between So, this is the generic API, which is not aware of any particular assembly creator. And I wanted to know if this generic API could also work with this emitter. The proposition with the Type API seems more than fine - I can then translate my generic |
ahh, so |
This is just the minimal amount of info needed by Did not think about other types. I assumed types like A bit of a tangent question: would passing a name of a struct be enough to identify it (for example, in a function signature)? Or should I keep track of things like the order structs are emitted at? |
Structs are just types that inherit from Strictly speaking, I think numeric primitives are implemented as value types, so they're "structs", sort of. But I'm not sure if that means they're "normal enough" to not hardcode. |
Thinking more about it, I feel like this idea was probably the best one. This way, you could create an API that works well for the emitter. I can then just use whatever API you will end up with, and use a bit of glue code to translate my representation of a type to your one. The overhead would be negligible, compared to gains coming from not having to launch a separate This way, if there is a need to change something on the codegen side, I can then just change my glue layer - and there is no need to change anything on your part. Likewise, if you wanted to change something, all changes on my side would be in this gule layer. I feel like the approach I originally proposed was likely the wrong option - it coupled the emitter to the internals of the codegen way too much, making the whole process far harder for a performance gain that would be negligible at best. I am sorry for being a bit indecisive - this is the first time I am not working alone, so coordinating work is very new to me. So, In summary, I believe the API for types you originally proposed is a far better option than what I suggested. Besides being better suited for the job, it also seems like it would be pretty easy to integrate. I suggest we go with it, but if it does not exactly suit you, it can be changed. Let me know what you think. |
That sounds like the best option to me right now, yeah. And it can always be changed if it becomes obvious that there's a better way. |
This issue is related to the design of the Assembly Export API, and the new CLI exporter.
There will also be a ILASM exporter, created manly for manual debugging.
What needs to be supported:
System.ValueType
, ability to specify any parent class, will be needed for future interop.What is nice to have, and could potentially help (In order of decreasing importance):
The text was updated successfully, but these errors were encountered: