Closed f52985 closed 3 months ago
It's all one type. The only reason SpecTec allows defining it in fragments is so that we can splice fragments instead of one huge definition. But semantically, they just form one big type.
So there (intentionally) is no way to distinguish the fragments in the IL. If we wanted to distinguish admin instructions, then we'd need to make them a separate type. That's how it was before, but the problem is that it did not scale to some of the newer proposals, and already complicated the subtype relation.
Would that even be the right distinction for your problem? There are some admin instructions, like all the addrrefs, that are simply values, and I'd assume you'd need to treat them no different from t.const, for example? The threads proposal has other examples like wait'/notify' which may not fit your intentions. Can you give a few more details on what exactly you'd like to use the distinction for?
Can you give a few more details on what exactly you'd like to use the distinction for?
To be more specific, what I want to achieve is to tell whether a given wasm instruction is a "context" or not, in more robust way.
Currently, what I have to do is, to look at the mixop
of the CaseE
, and if that is one of FRAME_
, LABEL_
or HANDLER_
, then consider that as a case,
..which might not work if a new hypothetical context is introduced.
That makes sense. How about we introduce a hint on the respective constructors for that?
Oh that makes much more sense. I'll try that, thanks!
Here's what I want to do (for more robust handling of exception handling proposal):
When I have an IL case expression like
LABEL_ (n, instr*, instr*)
, I want to know that the type of this expression isinstr/admin
, and when I have an IL case expression likeNOP
, I want to know that the type of this expression is notinstr/admin
(specifically, it isinstr/parametric
)But it seems that I cannot tell whether it is a admin instruction or not.
If I access
e.note
, it just returnsinstr
, without further information about if the instruction is frominstr/admin
orinstr/parametric
.Would this be possible currently? If not, would it be possible to implement it?