Fix leaks in the object stack

This patch fixes some leaks in the object stack when getting various
class properties. With this fix an assert can be added to verify that
the object stack is clean when a thread is exiting.
This commit is contained in:
Cary R 2013-12-03 17:19:35 -08:00
parent 5a0f9f4604
commit 7e55babb62
6 changed files with 8 additions and 5 deletions

View File

@ -2121,6 +2121,7 @@ static struct vector_info draw_property_expr(ivl_expr_t expr, unsigned wid)
fprintf(vvp_out, " %%load/obj v%p_0;\n", sig);
fprintf(vvp_out, " %%prop/v %u, %u, %u;\n", pidx, res.base, wid);
fprintf(vvp_out, " %%pop/obj 1, 0;\n");
return res;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Stephen Williams (steve@icarus.com)
* Copyright (c) 2012-2013 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -173,6 +173,7 @@ static int eval_object_property(ivl_expr_t expr)
fprintf(vvp_out, " %%load/obj v%p_0;\n", sig);
fprintf(vvp_out, " %%prop/obj %u;\n", pidx);
fprintf(vvp_out, " %%pop/obj 1, 1;\n");
return 0;
}

View File

@ -172,6 +172,7 @@ static void draw_property_real(ivl_expr_t expr)
fprintf(vvp_out, " %%load/obj v%p_0;\n", sig);
fprintf(vvp_out, " %%prop/r %u;\n", pidx);
fprintf(vvp_out, " %%pop/obj 1, 0;\n");
}
static void draw_realnum_real(ivl_expr_t expr)

View File

@ -67,6 +67,7 @@ static void string_ex_property(ivl_expr_t expr)
fprintf(vvp_out, " %%load/obj v%p_0;\n", sig);
fprintf(vvp_out, " %%prop/str %u;\n", pidx);
fprintf(vvp_out, " %%pop/obj 1, 0;\n");
}
static void string_ex_signal(ivl_expr_t expr)

View File

@ -897,11 +897,9 @@ the result.
* %prop/str <pid>
Read a vector (/v) or real value (/r) or string (/str) or object from
the property number <pid> of the class object on the stop of the
the property number <pid> of the class object on the top of the
object stack. Push the resulting value to the appropriate stack. The
object that is the source is NOT popped from from object stack.
The class object stack is NOT popped.
class object that is the source is NOT popped from the object stack.
* %pushi/real <mant>, <exp>

View File

@ -236,6 +236,7 @@ struct vthread_s {
bits4 = vvp_vector4_t();
assert(stack_real_.empty());
assert(stack_str_.empty());
assert(stack_obj_size_ == 0);
}
};