Skip to content

Commit

Permalink
Reduce size of bproto (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored Jul 10, 2023
1 parent de9c4c3 commit 279544b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/be_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ typedef struct bproto {
bbyte nupvals; /* upvalue count */
bbyte argc; /* argument count */
bbyte varg; /* variable argument position + 1 */
int16_t codesize; /* code size */
int16_t nconst; /* constants count */
int16_t nproto; /* proto count */
bgcobject *gray; /* for gc gray list */
bupvaldesc *upvals;
bvalue *ktab; /* constants table */
struct bproto **ptab; /* proto table */
binstruction *code; /* instructions sequence */
bstring *name; /* function name */
int codesize; /* code size */
int nconst; /* constants count */
int nproto; /* proto count */
#if BE_DEBUG_SOURCE_FILE
bstring *source; /* source file name */
#endif
Expand Down
12 changes: 6 additions & 6 deletions src/berry.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,15 +532,15 @@ typedef bclass_ptr bclass_array[];
BE_IIF(_is_upval)(sizeof(_name##_upvals)/sizeof(bupvaldesc),0), /**< nupvals */ \
(_argc), /**< argc */ \
0, /**< varg */ \
sizeof(_name##_code)/sizeof(uint32_t), /**< codesize */ \
BE_IIF(_is_const)(sizeof(_name##_ktab)/sizeof(bvalue),0), /**< nconst */ \
BE_IIF(_is_subproto)(sizeof(_name##_subproto)/sizeof(bproto*),0), /**< proto */ \
NULL, /**< bgcobject *gray */ \
BE_IIF(_is_upval)((bupvaldesc*)&_name##_upvals,NULL), /**< bupvaldesc *upvals */ \
BE_IIF(_is_const)((bvalue*)&_name##_ktab,NULL), /**< ktab */ \
BE_IIF(_is_subproto)((struct bproto**)&_name##_subproto,NULL), /**< bproto **ptab */ \
(binstruction*) &_name##_code, /**< code */ \
be_local_const_str(_name##_str_name), /**< name */ \
sizeof(_name##_code)/sizeof(uint32_t), /**< codesize */ \
BE_IIF(_is_const)(sizeof(_name##_ktab)/sizeof(bvalue),0), /**< nconst */ \
BE_IIF(_is_subproto)(sizeof(_name##_subproto)/sizeof(bproto*),0), /**< proto */ \
PROTO_SOURCE_FILE_STR(_name) /**< source */ \
PROTO_RUNTIME_BLOCK /**< */ \
PROTO_VAR_INFO_BLOCK /**< */ \
Expand All @@ -560,15 +560,15 @@ typedef bclass_ptr bclass_array[];
BE_IIF(_has_upval)(sizeof(*_upvals)/sizeof(bupvaldesc),0), /**< nupvals */ \
(_argc), /**< argc */ \
(_varg), /**< varg */ \
sizeof(*_code)/sizeof(binstruction), /**< codesize */ \
BE_IIF(_has_const)(sizeof(*_ktab)/sizeof(bvalue),0), /**< nconst */ \
BE_IIF(_has_subproto)(sizeof(*_protos)/sizeof(bproto*),0), /**< proto */ \
NULL, /**< bgcobject *gray */ \
(bupvaldesc*) _upvals, /**< bupvaldesc *upvals */ \
(bvalue*) _ktab, /**< ktab */ \
(struct bproto**) _protos, /**< bproto **ptab */ \
(binstruction*) _code, /**< code */ \
((bstring*) _fname), /**< name */ \
sizeof(*_code)/sizeof(binstruction), /**< codesize */ \
BE_IIF(_has_const)(sizeof(*_ktab)/sizeof(bvalue),0), /**< nconst */ \
BE_IIF(_has_subproto)(sizeof(*_protos)/sizeof(bproto*),0), /**< proto */ \
PROTO_SOURCE_FILE(_source) /**< source */ \
PROTO_RUNTIME_BLOCK /**< */ \
PROTO_VAR_INFO_BLOCK /**< */ \
Expand Down

0 comments on commit 279544b

Please sign in to comment.