ammarbinfaisal / sahl

a programming language with channels and coroutines/threads
MIT License
9 stars 1 forks source link

functions and call on native backend #17

Closed ammarbinfaisal closed 1 year ago

ammarbinfaisal commented 1 year ago

In the bytecode of a function we dont keep track of how many arguments it is supposed to receive. And in the vm we just add them to the locals. This is an issue when we have to convert that bytecode to assembly.

ammarbinfaisal commented 1 year ago

Save the param count in the bytecode itself. That;s the easiest fix.

ammarbinfaisal commented 1 year ago

Or in the disassemble function also extract info from CALL ops to se how many args being to which function.

ammarbinfaisal commented 1 year ago

https://github.com/abooishaaq/sahl/commit/a3eddcb3770970472a7e27bff13a40eaa9f1dcea fixes this issue