On Mon, 15 Oct 2001 22:12:58 -0400 (EDT), Dan Sugalski wrote: >>doing: >> save S0 >> restore S1 >> >>(since there's no set S1,S0) >> >>binds the registers together, so a change to one is a change to >>both...which doesn't happen on int registers.
>Right. Save on a string register pushes the pointer to the string >structure in the register onto the stack. The same thing happens with >PMCs, or will when they're implemented. > >The assumption is that, when you push a register onto the stack, you'll >then stomp on the contents of the register. (Rather than what the register >points to...) Otherwise a push would need to create a copy of the string >structure and a copy of the string contents. Aren't you the guy who kept shouting "Copy on Write! Copy on Write!" all the time? ;-) Of course, there's a level at which this also must be implemented, and likely the level has become just too low to do something still as magical at this time. Perhaps it is time just to implement this copy on write scheme, right here. Perhaps push on a string register could be the ticket: if you do push on a string register, you're going to modify its contents, and you still want to hang on to the register. So it might be the perfect time to copy the string. Or you need a "string clone" op, and leave the "push" op alone. -- Bart.