~lbnz/xr0

6a17ff635e9dda18d84138b77938233208c98934 — Leibniz Founders 6 months ago d503145 chore/remove-submod-decls-from-state
checkpoint
4 files changed, 22 insertions(+), 19 deletions(-)

M include/state.h
M src/state/heap.c
M src/state/state.c
M src/verify/verify.c
M include/state.h => include/state.h +18 -15
@@ 10,7 10,7 @@ struct ast_type;
struct ast_variable;
struct ast_expr;

/* externals */
/* ext */
struct externals;

/* object */


@@ 48,15 48,15 @@ state_declare(struct state *, struct ast_variable *var, bool isparam);
void
state_undeclarevars(struct state *s);

struct ast_type *
state_gettype(struct state *, char *id);

struct object *
state_getresult(struct state *);

struct object *
state_getobject(struct state *, char *id);

struct ast_type *
state_getobjecttype(struct state *, char *id);

struct object *
state_deref(struct state *, struct value *ptr, struct ast_expr *index);



@@ 81,6 81,9 @@ bool
state_range_aredeallocands(struct state *, struct object *,
		struct ast_expr *lw, struct ast_expr *up);

struct value *
state_vconst(struct state *);

bool
state_hasgarbage(struct state *);



@@ 100,19 103,10 @@ struct block *
state_getblock(struct state *state, struct location *loc);

bool
state_isdeallocand(struct state *s, struct location *loc);

bool
state_stack_references(struct state *s, struct location *loc);

struct value *
state_vconst(struct state *state);

bool
state_eval(struct state *, struct ast_expr *);
state_references(struct state *s, struct location *loc);


/* VALUE */
/* USED BY VALUE */

struct location *
location_copy(struct location *);


@@ 126,4 120,13 @@ location_str(struct location *);
bool
location_references(struct location *l1, struct location *l2, struct state *);


/* USED BY OBJECT */

bool
state_isdeallocand(struct state *s, struct location *loc);

bool
state_eval(struct state *, struct ast_expr *);

#endif

M src/state/heap.c => src/state/heap.c +1 -1
@@ 151,7 151,7 @@ block_referenced(struct state *s, int addr)
	struct location *loc = location_create(
		LOCATION_DYNAMIC, addr, ast_expr_constant_create(0)
	);
	bool referenced = state_stack_references(s, loc); 
	bool referenced = state_references(s, loc); 
	location_destroy(loc);
	return referenced;
}

M src/state/state.c => src/state/state.c +2 -2
@@ 169,7 169,7 @@ state_getresulttype(struct state *state)
}

struct ast_type *
state_gettype(struct state *state, char *id)
state_getobjecttype(struct state *state, char *id)
{
	if (strcmp(id, KEYWORD_RESULT) == 0) {
		return state_getresulttype(state);


@@ 318,7 318,7 @@ state_location_destroy(struct location *loc)
}

bool
state_stack_references(struct state *s, struct location *loc)
state_references(struct state *s, struct location *loc)
{
	return stack_references(s->stack, loc, s);
}

M src/verify/verify.c => src/verify/verify.c +1 -1
@@ 784,7 784,7 @@ expr_identifier_lvalue(struct ast_expr *expr, struct state *state)
{
	char *id = ast_expr_as_identifier(expr);
	return lvalue_create(
		state_gettype(state, id),
		state_getobjecttype(state, id),
		state_getobject(state, id)
	);
}