Skip to content

Commit

Permalink
sprinkle __purefunc/__constfunc
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt committed Jan 21, 2023
1 parent e7a15c1 commit 2f005bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include "toywasm_config.h"

#include "platform.h"

enum valtype;
struct localtype;
struct resulttype;
Expand All @@ -20,7 +22,7 @@ struct cell {
#endif
};

uint32_t valtype_cellsize(enum valtype t);
uint32_t valtype_cellsize(enum valtype t) __constfunc;

uint32_t resulttype_cellidx(const struct resulttype *rt, uint32_t idx,
uint32_t *cszp);
Expand Down
3 changes: 2 additions & 1 deletion lib/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "toywasm_config.h"

#include "cell.h"
#include "platform.h"
#include "report.h"
#include "vec.h"

Expand Down Expand Up @@ -248,7 +249,7 @@ int frame_enter(struct exec_context *ctx, struct instance *inst,
void frame_clear(struct funcframe *frame);
void frame_exit(struct exec_context *ctx);
struct cell *frame_locals(struct exec_context *ctx,
const struct funcframe *frame);
const struct funcframe *frame) __purefunc;
void exec_context_init(struct exec_context *ctx, struct instance *inst);
void exec_context_clear(struct exec_context *ctx);
void exec_context_print_stats(struct exec_context *ctx);
Expand Down
9 changes: 5 additions & 4 deletions lib/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "bitmap.h"
#include "cell.h"
#include "lock.h"
#include "platform.h"
#include "vec.h"

#define WASM_MAGIC 0x6d736100
Expand Down Expand Up @@ -462,10 +463,10 @@ struct import_object {
struct import_object *next;
};

bool is_numtype(enum valtype vt);
bool is_vectype(enum valtype vt);
bool is_reftype(enum valtype vt);
bool is_valtype(enum valtype vt);
bool is_numtype(enum valtype vt) __constfunc;
bool is_vectype(enum valtype vt) __constfunc;
bool is_reftype(enum valtype vt) __constfunc;
bool is_valtype(enum valtype vt) __constfunc;
int compare_resulttype(const struct resulttype *a, const struct resulttype *b);
int compare_functype(const struct functype *a, const struct functype *b);
int compare_name(const struct name *a, const struct name *b);
Expand Down

0 comments on commit 2f005bb

Please sign in to comment.