-- Leo's gemini proxy
-- Connecting to iceworks.cc:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
Created: 2023-10-02T23:42:32-05:00
Stack VMs such as Java's have "local variables" which are identical to registers anyway, despite posessing an instruction stack to compute on.
Spilling: moving data out of registers to memory when you have run out of registers and a more important one needs to be used
Assign a register number to positions of the evaluation stack.
Walk through the byte stream and simulate running the opcodes. When an instruction would pop two numbers and push one, look at the register number assigned to the stack positions and replace it with the number. So an 'a b -> a' stack diagram becomes 'add 0 1 0'.
Sometimes the Java machine says nonsense like "STORE 6, LOAD 6," which is intended to copy a value from the stack to local variable #6 while retaining it on the stack. You may need an optimization pass to go over and fix those.
-- Response ended
-- Page fetched on Fri Jun 7 07:11:24 2024