forked from enlightenment/efl
parent
7cf6b74ee7
commit
d73081e84b
|
@ -478,10 +478,20 @@ embryo_program_vm_push(Embryo_Program *ep)
|
|||
{
|
||||
Embryo_Header *hdr;
|
||||
|
||||
if ((!ep) || (ep->base)) return;
|
||||
if (!ep) return;
|
||||
ep->pushes++;
|
||||
if (ep->pushes > 1)
|
||||
{
|
||||
embryo_program_vm_reset(ep);
|
||||
return;
|
||||
}
|
||||
hdr = (Embryo_Header *)ep->code;
|
||||
ep->base = malloc(hdr->stp);
|
||||
if (!ep->base) return;
|
||||
if (!ep->base)
|
||||
{
|
||||
ep->pushes = 0;
|
||||
return;
|
||||
}
|
||||
embryo_program_vm_reset(ep);
|
||||
}
|
||||
|
||||
|
@ -499,6 +509,8 @@ void
|
|||
embryo_program_vm_pop(Embryo_Program *ep)
|
||||
{
|
||||
if ((!ep) || (!ep->base)) return;
|
||||
ep->pushes--;
|
||||
if (ep->pushes >= 1) return;
|
||||
free(ep->base);
|
||||
ep->base = NULL;
|
||||
}
|
||||
|
|
|
@ -218,6 +218,7 @@ struct _Embryo_Param
|
|||
struct _Embryo_Program
|
||||
{
|
||||
unsigned char *base; /* points to the Embryo_Program header ("ephdr") plus the code, optionally also the data */
|
||||
int pushes; /* number of pushes - pops */
|
||||
/* for external functions a few registers must be accessible from the outside */
|
||||
Embryo_Cell cip; /* instruction pointer: relative to base + ephdr->cod */
|
||||
Embryo_Cell frm; /* stack frame base: relative to base + ephdr->dat */
|
||||
|
|
Loading…
Reference in New Issue