Just store it inside a T_POINTER?
val->type = T_POINTER;
val->_pointer.value = PC;

Or whatever big enough datatype that doesn't do anything on RELEASE.

2012/7/9 Benoît Minisini <gam...@users.sourceforge.net>

> Le 09/07/2012 00:13, Emil Lenngren a écrit :
> > I have a little optimization idea:
> >
> > Instead of allocating a new array EVERY time a gosub is called, instead
> use
> > the normal gambas stack.
> > First, let GP represent the offset 0 in &BP[fp->n_local + fp->n_ctrl].
> >
> > At a gosub, run STACK_check(1 + fp->stack_usage - fp->n_local), then the
> > return address and ctrl values are stored on the stack starting at
> > &BP[fp->n_local + fp->n_ctrl + GP], then GP and SP is added by 1 +
> > fp->n_ctrl.
> >
> > On a gosub return, if GP == 0, it is a normal return. If not, it is a
> gosub
> > return. Then first subtract 1 + fp->n_ctrl from GP and SP and restore the
> > ctrl values and PC.
> >
> > At exception handling, going to a Catch, change
> > while (SP > (BP + FP->n_local + FP->n_ctrl))
> > to
> > while (SP > (BP + FP->n_local + FP->n_ctrl + GP))
> >
> > I think there is nothing else that has to be done. Leaving a function
> pops
> > off the stack until it reaches PP, so that is fine.
> >
> > It is also possible to completely remove the function
> > STACK_free_gosub_stack.
> >
> > Can this be a good idea?
> >
> > /Emil
> >
>
> Yes! But I must think a bit about it.
>
> For example, any stack slot can be sent to RELEASE(), so something must
> be done if we have to store the value of PC in the stack. But it should
> not be too difficult...
>
> --
> Benoît Minisini
>
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to