You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
ref.i31 is both an administrative instruction and an instruction #470
Since the renaming of i31.new to ref.i31, ref.i31 appears twice in the set of instructions (when including administrative instructions) with each having a different syntax (one made of an integer in the case of the administrative one).
Then, the reduction rule for ref.i31 is quite confusing:
(i32.const n) ref.i31 -> ref.i31 (n mod 2^31)
On the left side you have the ref.i31 syntax and on the other side the ref.i31 int syntax.
Is there any plan to change one of them again to try to clarifies things ?
Yeah, this is analogous to ref.func, where we go from ref.func $x to ref.func 𝑎𝑑𝑑𝑟, essentially overloading the mnemonic. We should probably have a better naming scheme for administrative instructions that are reducts of regular ones.
We should probably have a better naming scheme for administrative instructions that are reducts of regular ones.
Indeed, that would help in some cases. I'm writing a proof and I either have to explain that there are two instruction with the same name (which I'd like to avoid because it's disturbing the reader) or use another name (likely i31.new) otherwise it will be too much confusing for potential reviewers that are not familiar with the Wasm semantics.
The only convention I could think of so far is to add a prime to the administrative versions, which we e.g. used in the OOPSLA'19 memory model paper. How about going with that for your paper as well?
Well, we should find a convention that works uniformly for more than just references. For example, we have invoke which is just call', threads have wait', and possibly others. And of course I dropped i31.new for a reason: to distinguish allocations from just referencing.
It's currently called invoke (on main repo), but relates to call in exactly the same way as ref.func relates to ref.func with addr. Ideally, they should use the same convention.
Ideally yes, but I'm not sure we can find a convention that is not confusing. To me, adding a prime is confusing because these are not variables but instruction literals. I believe it would make everything simpler if we were to find a proper name for each of them - of course, that may not always be easy.
If we want to distinguish allocating instructions, we could have i31.of_i32 instead of i31.new. For func.new, I don't have a good name right now, I'll try to think about it.
I knew the invoke one (I thought you were saying it was reducing to call' and I was getting worried that I missed something in my formalization). I believe this one is a perfectly fine name.
For wait', I don't know. I'm not familiar yet with the threads proposal semantics.
See my reply on the other issue. Also, ref.null is already standardised as part of Wasm 2.0 (as is ref.func, btw), so we cannot change it anymore.
OK, so we probably won't be able to fix the issue in the way I propose by having proper name for each instructions. Still, I believe we could fix those that are not yet fully part of a released standard such as i31.ref being renamed to i31.of_i32 or whatever.
Activity
rossberg commentedon Nov 6, 2023
Yeah, this is analogous to
ref.func, where we go fromref.func $xtoref.func 𝑎𝑑𝑑𝑟, essentially overloading the mnemonic. We should probably have a better naming scheme for administrative instructions that are reducts of regular ones.redianthus commentedon Nov 8, 2023
Indeed, that would help in some cases. I'm writing a proof and I either have to explain that there are two instruction with the same name (which I'd like to avoid because it's disturbing the reader) or use another name (likely
i31.new) otherwise it will be too much confusing for potential reviewers that are not familiar with the Wasm semantics.rossberg commentedon Nov 8, 2023
The only convention I could think of so far is to add a prime to the administrative versions, which we e.g. used in the OOPSLA'19 memory model paper. How about going with that for your paper as well?
redianthus commentedon Nov 8, 2023
That could be a solution. I'm going to think about it and see if I can think of something else.
I believe it would be good to also harmonize the script format. For instance, here:
The
ref.i31should probably match what we have as the administrative instruction, what do you think ?rossberg commentedon Nov 8, 2023
Hm, yeah, but then all ref patterns should still follow a consistent naming scheme as well.
redianthus commentedon Nov 8, 2023
Here are a few possibilities:
ref.i31ref.i31 u31ref.i31struct.newref.struct structaddrref.structref.funcref.func funcaddrref.funci31.newref.i31 u31ref.i31struct.newref.struct structaddrref.structref.funcref.func funcaddrref.funcref.i31ref.i31' u31ref.i31'struct.newref.struct' structaddrref.struct'ref.funcref.func' funcaddrref.func'ref.i31ptr.i31 u31ptr.i31struct.newptr.struct structaddrptr.structref.funcptr.func funcaddrptr.funci31.newref.i31 u31ref.i31struct.newref.struct structaddrref.structfunc.newref.func funcaddrref.funcref.i31i31.const u31i31.const u31?struct.newptr.struct structaddrptr.structref.funcptr.func funcaddrptr.funci31.newi31.const u31i31.const u31?struct.newref.struct structaddrref.structfunc.newref.func funcaddrref.funcThe one I like the most is probably the
Newone.rossberg commentedon Nov 10, 2023
Well, we should find a convention that works uniformly for more than just references. For example, we have
invokewhich is justcall', threads havewait', and possibly others. And of course I dropped i31.new for a reason: to distinguish allocations from just referencing.redianthus commentedon Nov 10, 2023
I can't find the
call'you're referring to, where is it defined ?rossberg commentedon Nov 10, 2023
It's currently called
invoke(on main repo), but relates tocallin exactly the same way asref.funcrelates toref.funcwith addr. Ideally, they should use the same convention.redianthus commentedon Nov 10, 2023
Ideally yes, but I'm not sure we can find a convention that is not confusing. To me, adding a prime is confusing because these are not variables but instruction literals. I believe it would make everything simpler if we were to find a proper name for each of them - of course, that may not always be easy.
If we want to distinguish allocating instructions, we could have
i31.of_i32instead ofi31.new. Forfunc.new, I don't have a good name right now, I'll try to think about it.I knew the
invokeone (I thought you were saying it was reducing tocall'and I was getting worried that I missed something in my formalization). I believe this one is a perfectly fine name.For
wait', I don't know. I'm not familiar yet with the threads proposal semantics.EDIT:
Quoting your answer in #478:
OK, so we probably won't be able to fix the issue in the way I propose by having proper name for each instructions. Still, I believe we could fix those that are not yet fully part of a released standard such as
i31.refbeing renamed toi31.of_i32or whatever.