Repository navigation
INTERPRETER #104
Replies: 23 comments 58 replies
|
I have opened this section so as not to mix such specific topics in other discussions |
|
I have created a spreadsheet to be able to describe and discuss opcodes and how they work. |
|
I have added a stupid print OP in compiler. I don't know some functionalities then print value and possible opcode |
|
Starting the disassembler. There are still things that I don't quite understand. |
|
@hiperiondev
Finally, function bytecode is recursive - that is to say, a function has it's own literal cache, function section and runnable code section. In addition, I think the first two bytes of the runnable code section are ACTUALLY specifying the literal within the function's cache containing the parameter list, and the next two bytes specify the literal in the cache which is the returns array. (sticking those indexes within the runnable section was another ugly hack - sorry!) I should note that the final parameter might actually signal a rest parameter with |
Good. In any case, a disassembler only takes into account the bytecode, not the execution time. In the case of FN_CALL there is no argument in the code, therefore it is an opcode without arguments.
Could you give me a concrete example of how that would be interpreted? I guess that's why the first test (fib-memo) works but the second fails (function-within-function-bugfix), clearly I can't apply toy_read_interpreter_sections directly to the function body. If it is exactly the same as the rest of the code, the two bytes that you say are consumed here: Is there a recursion limit for functions?
|
|
I have solved the recursion problem in the function code and now it seems to work correctly. And every FN_RETURN continue with: That's right? |
|
Just making a note here: while the args & rets literal indexes are technically stored within the program section, they are extracted BEFORE the function proceeds to (I fixed how these are read in the disassembler, btw - check the pull requests) |
|
Good!!! |
|
After: Is that a bug or does it have some functionality? |
That looks much nicer without the extra SCOPE operations. |
|
I was thinking that maybe FN_RETURN is not the proper name for the OPCODE, since it doesn't really perform a RETURN but rather a data manipulation for the return. Perhaps FN_DATA_RETURN would be more appropriate. |
|
I'm going to start separating the code from the functions. |
|
In generator.toy, function 0 (generateTilemapData) I understand that this would indicate the number of values returned, but currently it cannot be more than 1. |
|
At the beginning of the file are the calls to import: Why is there a NULL in the middle? |
|
In generator.tb Why does it nest two SCOPEs? |
|
here's a thought - arrays generally don't shrink their capacities... but the interpreter's stack could do that to free up memory, perhaps? |
|
Concerning #107 - I've made a few tweaks (will push and close in a moment) to remove an excess scope creation when using a.toy a.tb b.toy b.tb |
|
I just pushed a change to the disassembler. Now you can choose a linear presentation according to a conventional assembler. |
|
Question about JUMPs:
|
|
In LITERAL_ARRAY and LITERAL_DICTIONARY what is SUBTYPE? |
|
Now, with the last commit, disassembler show all the program relative to labels. |
|
I'm back! Although, for now a little slow because I am moving to a new house, when I am completely settled I will resume the project with more vigor. I've been working on a new interpreter, based on the JVM handles frames for local variables. You can see the first implementation is: https://github.com/hiperiondev/stack_vm |
Uh oh!
There was an error while loading. Please reload this page.
Here we will only discuss issues related to the internal functioning of the interpreter/VM (opcodes, data types, address types, memory management, etc).
All reactions