jmeaster30 / ocean

A C-like programming language (get it like sea-like like an ocean lol)
GNU General Public License v3.0
0 stars 0 forks source link

Need an equivalent of dup_x1 java bytecode instruction #75

Closed jmeaster30 closed 9 months ago

jmeaster30 commented 9 months ago

This instruction duplicates the value at the op of the stack and inserts it 2 positions down so for example this stack

Top |    |
A   | B  |

turns into

Top |    |    |
A   | B  | A  | 

maybe the duplicate instruction can have an optional number argument for where the duplicate goes. Default 0 puts it at the top (or right below the top value), 1 puts it below next value on the stack (basically matches the number of the java bytecode instruction) and any other value puts the duplicated value further down

jmeaster30 commented 9 months ago

Done :)