Dolphin: play nice with non-java languages
One of the major things I'd like to see from Dolphin is the ability to host a much wider range of languages with in the JVM, without effectively needing a VM within a VM.
To support ML-style languages efficiently, it would realy help if methods could return tuples. At the moment, methods can have a return type that is void or a java type. This works by leaving any value on the top of an empty stack in the called method, and then popping the stack-frame and setting the top-of-stack index to the return value if there is one. Tuples could be directly supported by just setting the stack-frame to include n values from the invoked method's stack.
I guess this would require some changes.
* the method signatures return value string would need changing to allow a list of types (in the same way that the method arguments list does)
* the vm would need altering to implement returning numbers of arguments other than 0 and 1.
* a return opcode would need to be added that was parameterised with an int in the bytecode for how many values to return (or how many 32 bit words to return?). It would be a validation constraint that the method return signature had as many components as this int. Presumably, using 0 or 1 would be the same as using the existing opcodes.
I'm not sugesting that tuples be added to Java (although I wouldn't object to this) but that the vm be modified to aid in supporting non-java languages.