Yes. Which is why I think the implementation is just slots in the
call frame. (The function2 registers are disjoint from the four
global registers. In function2 you can't access the global
registers. Each function2 gets its own set of local registers. The
function header can assign parameters and VM state like root,
arguments, super, etc. to registers.)
On 2 Dec 2005, at 12:53, Adam Wolff wrote:
Wait so when you call a function, you don't have to emit the code to
push all the register variables on to the stack and then feed them
back in
when you return? The VM does this for you?
On Dec 1, P T Withington wrote:
The semantics of Javascript require that all variables declared in
a function
have the scope of the entire function. The compiler implements
this by
allocating a register for every variable declaration in a function
on function
entry. So, you can put your `var`s wherever you like, the
compiler has to
emit the same code.
[I don't know how the Flash VM implements its registers, but my
educated guess
is that VM registers are just slots in a stack so there is no
overhead to
saving/restoring registers other than adjusting the stack pointer.]
On 1 Dec 2005, at 20:59, Adam Wolff wrote:
If I have this:
function func1(){
var a, b;
a=1;
func2();
b=2;
return a+b;
}
Question for the compiler folks: I assume that a and b are register
variables. Is the compiler smart enough to know that I haven't
assigned a
value to b before the call to func2, so that its value does not
need to be
preserved on the stack when the call is made? If not, if I moved
the var b
declaration below the function call, would that help?
A
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev