I'm writing a bytecode compiler and a VM. I'm able to use constants by placing any non-integer values in a constant pool and pushing the 4-byte integer address on to the stack. That part is fine.
But now I'm adding global variables which get stored in a virtual memory area which I call "Ram". The values I store there will, of course, also be indexed by address just like the constants. So let's say I push two addresses on to operand stack and then run my FADD (Floating Add) - when the instruction pops the two addresses off the stack to perform the addition, how does it know if those addresses come from the global memory as opposed to the constant pool? What is the standard approach?