Discussion:
FreeVal in motoc_array_new
David Hakim
2003-05-10 23:00:39 UTC
Permalink
Does moto_freeVal free codeval.value when in compiler mode ? I'm
worried that it might. If this is the case then codeval.value may need
to be moto_strdup'ed for that while loop to work reliably.

-Dave
Dave,
while(stack_size(frame->opstack) > stacksize){
MotoVal* indexMotoVal = opstack_pop(env);
arrayIndexExpressions[i] = indexMotoVal->codeval.value;
i--;
moto_freeVal(env,indexMotoVal);
}
the val is freed after it has been assigned to
arrayIndexExpressions[i]...
motoc(uc_operand(p, 2));
v2 = opstack_pop(env);
motoc(uc_operand(p, 0));
v1 = opstack_pop(env);
tests/class_succ and its String[] initialization works anyway...
motoc(uc_operand(p, 0));
v1 = opstack_pop(env);
motoc(uc_operand(p, 2));
v2 = opstack_pop(env);
arrayIndexExpressions[i] ends up being null, as expected... and
initialization
doesn't work...
Do you understand what happens?
Stefano
Stefano Corsi
2003-05-11 01:01:37 UTC
Permalink
Post by David Hakim
Does moto_freeVal free codeval.value when in compiler mode ? I'm
worried that it might. If this is the case then codeval.value may need
to be moto_strdup'ed for that while loop to work reliably.
What about not freeing the MotoVal's? Is it "tolera[ble|ted]" in compiler
mode?

Stefano

Loading...