I consider all issue are solved by this PR with minor tech dept.
What is not solved:
opcodes BOOLEAN.FROMFLOAT and BOOL.DEFINE are not implemented as required FLOAT and NAME stacks (which are currently not implemented)
opcodes BOOLEAN.SHOVE and BOOLEAN.YANK are not implemented as required additional clarification and decision, if we are interested in those.
unit test coverage for edge cases and various stack configuration (seems like separate issue out of basic scope)
Breaking changes:
Changed code token format into combination/concatenation of ordered CodeTag and OpCode enums.
CodeTag is extended with BOOL_LITERAL. It moves SUBLIST (last CodeTag) and gives it new key: 0x04.
OpCode has empty key space for compatibility with CodeTag. It moves int opcodes and assigns new keys.
OpCode is extended with bool opcodes.
Added OPCODE offset constants to simplify ordering and execution flow.
Added INSTRUCTION recognition in parseSublist and implemented the simplest approach.
Required actions:
Review breaking changes, provide feedback. If approved, adjust backend code accordingly, if required.
Decide on INSTRUCTION in SUBLIST.
Review code comments related to BOOLEAN.SHOVE and BOOLEAN.YANK and provide additional clarification and feedback.
Concerns:
Unit tests are fragile on updating OpCode enum, would be cool to automate code generation to avoid it.
The goal of this PR is to implement bool stack and cover with unit tests to solve:
- http://gitea.loseyourip.com:4000/giteadmin/SoLUSH-3/issues/11
- http://gitea.loseyourip.com:4000/giteadmin/SoLUSH-3/issues/12
- http://gitea.loseyourip.com:4000/giteadmin/SoLUSH-3/issues/13
I consider all issue are solved by this PR with minor tech dept.
What is not solved:
- opcodes BOOLEAN.FROMFLOAT and BOOL.DEFINE are not implemented as required FLOAT and NAME stacks (which are currently not implemented)
- opcodes BOOLEAN.SHOVE and BOOLEAN.YANK are not implemented as required additional clarification and decision, if we are interested in those.
- unit test coverage for edge cases and various stack configuration (seems like separate issue out of basic scope)
Breaking changes:
- Changed code token format into combination/concatenation of ordered CodeTag and OpCode enums.
- CodeTag is extended with BOOL_LITERAL. It moves SUBLIST (last CodeTag) and gives it new key: 0x04.
- OpCode has empty key space for compatibility with CodeTag. It moves int opcodes and assigns new keys.
- OpCode is extended with bool opcodes.
- Added OPCODE offset constants to simplify ordering and execution flow.
- Added INSTRUCTION recognition in parseSublist and implemented the simplest approach.
Required actions:
- Review breaking changes, provide feedback. If approved, adjust backend code accordingly, if required.
- Decide on INSTRUCTION in SUBLIST.
- Review code comments related to BOOLEAN.SHOVE and BOOLEAN.YANK and provide additional clarification and feedback.
Concerns:
- Unit tests are fragile on updating OpCode enum, would be cool to automate code generation to avoid it.
Awesome work! The only issue I see, is that in tests we are preparing the stacks using the bytecode. I would prefer we prepare the stacks in the test outside the execution, and only really test the opcode at hand via bytecode. Makes for more isolated and easier to understand tests. Since navelbuffle is busy at work this could be done by someone else (like me hehe).
Awesome work! The only issue I see, is that in tests we are preparing the stacks using the bytecode. I would prefer we prepare the stacks in the test outside the execution, and only really test the opcode at hand via bytecode. Makes for more isolated and easier to understand tests. Since navelbuffle is busy at work this could be done by someone else (like me hehe).
I think in such situations we should pick something that resembles the original instruction, but is easy on the gas. Like you suggested, we could just do a "deep swap". Swap the top element with the one at index.
I think in such situations we should pick something that resembles the original instruction, but is easy on the gas. Like you suggested, we could just do a "deep swap". Swap the top element with the one at index.
Here I would prefer to see a boolean stack with 2 elements loaded into the machine. Then we only do the swap op-code. Makes for a cleaner, more isolated test.
Here I would prefer to see a boolean stack with 2 elements loaded into the machine. Then we only do the swap op-code. Makes for a cleaner, more isolated test.
You are not authorized to merge this pull request.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The goal of this PR is to implement bool stack and cover with unit tests to solve:
I consider all issue are solved by this PR with minor tech dept.
What is not solved:
Breaking changes:
Required actions:
Concerns:
Awesome work! The only issue I see, is that in tests we are preparing the stacks using the bytecode. I would prefer we prepare the stacks in the test outside the execution, and only really test the opcode at hand via bytecode. Makes for more isolated and easier to understand tests. Since navelbuffle is busy at work this could be done by someone else (like me hehe).
@@ -318,0 +463,4 @@(boolStack[boolTop - 1], boolStack[boolTop - 2], boolStack[boolTop - 3]) = (boolStack[boolTop - 3], boolStack[boolTop - 1], boolStack[boolTop - 2]);}}else if (op == OpCode.BOOL_SHOVE) {I think in such situations we should pick something that resembles the original instruction, but is easy on the gas. Like you suggested, we could just do a "deep swap". Swap the top element with the one at index.
@@ -376,0 +413,4 @@// We'll produce 8 total bytes, same structure// Format: [0x04, 0x0005, 0x03(01), 0x03(00), 0x0C => bool_swap]bytes memory code = hex"040005030103000C";Here I would prefer to see a boolean stack with 2 elements loaded into the machine. Then we only do the swap op-code. Makes for a cleaner, more isolated test.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.