Support methods with multiple return values
In some languages functions can return multiple values (e.g. Go). Specification of debug format can be easily extended to support methods which leave multiple values on stack.
This can also be solved by packing values in Array in compiler. However supporting this directly in specification is right way to go IMO.
In c# it's also possible, we can create a UT for it, I will check it
RETURN can define how many items do you want to return, so the ARRAY it's not required.
https://github.com/neo-project/neo-vm/blob/7d868f69d52441535f5a3f7c8ea314bc0d7a032a/src/neo-vm/ExecutionEngine.cs#L297
This issue was about extending debugger specification, not about supporting this in C# compiler.
The only way for debugger to gain info about byte-code is .debug.json file. And in specification return-type is a single string value.
https://github.com/ngdseattle/design-notes/blob/master/NDX-DN11%20-%20NEO%20Debug%20Info%20Specification.md#v10-format
I'm not sure how this repo relates to ngdseattle/design-notes (should this bug be submitted there or not), but maybe we should ask @devhawk?
The debug info format is specified in ngdseattle/design-notes. any changes to the format should have bugs opened up over there.
This bug can stay open to track implementing this change in neo-debugger
I am 100% on board with supporting multiple, strongly typed return values in the debug format. However, I want to make sure we have a consistent way of implementing that in the byte code across C# and Go as well as across Neo 2 and Neo 3.
First off, @fyrchik / @roman-khimov : it sounds like the way neo-go has implemented multiple return values is with an array. Can neo-go be updated to use the multiple return value approach @shargon pointed out?
Second, @shargon / @lightszero : I see that we've updated the master branch of NEON. What about the master-2.x branch? Also, have we updated the manifest or abi.json file to capture information about multiple return values? I don't see any code in the PR for that.
Can neo-go be updated to use the multiple return value approach @shargon pointed out?
I'm not sure this approach would work for NEO 2. We can rework something in master branch, of course.
I'm not sure this approach would work for NEO 2. We can rework something in master branch, of course.
I looked at the master-2.x branch neovm code, it appears to support multiple return values as well.
I'd like to avoid having two different mechanisms for multiple return values - a single array of values vs. neovm's multi return value support. If nothing else, we'd need two different syntaxes in debug info format and abi.json file to differentiate.
I looked at the master-2.x branch neovm code, it appears to support multiple return values as well.
But it only properly works for CALLI instruction, not for regular CALL IIRC.
Update: or maybe it's just the restrictive part of it, nothing actually prevents returning anything from regular CALL, it just won't be checked in any way, so yeah, maybe it's not an issue and we can do the same for 2.0.
I'd like to avoid having two different mechanisms for multiple return values
Sure.