py: Take out bitfield entries from their own structure.

Don't need to wrap bitfields in their own struct.  Compiler does the
correct thing without it.
pull/329/head
Damien George 2014-02-26 17:40:52 +00:00
rodzic 98fb8935bc
commit 510477557d
7 zmienionych plików z 22 dodań i 38 usunięć

Wyświetl plik

@ -4,11 +4,9 @@ typedef struct _mp_map_elem_t {
} mp_map_elem_t;
typedef struct _mp_map_t {
struct {
machine_uint_t all_keys_are_qstrs : 1;
machine_uint_t table_is_fixed_array : 1;
machine_uint_t used : (8 * sizeof(machine_uint_t) - 2);
};
machine_uint_t all_keys_are_qstrs : 1;
machine_uint_t table_is_fixed_array : 1;
machine_uint_t used : (8 * sizeof(machine_uint_t) - 2);
machine_uint_t alloc;
mp_map_elem_t *table;
} mp_map_t;

Wyświetl plik

@ -66,10 +66,8 @@ typedef struct _vstr_t {
int alloc;
int len;
char *buf;
struct {
bool had_error : 1;
bool fixed_buf : 1;
};
bool had_error : 1;
bool fixed_buf : 1;
} vstr_t;
// convenience macro to declare a vstr with a fixed size buffer on the stack

Wyświetl plik

@ -3,10 +3,8 @@ typedef uint32_t mpz_dbl_dig_t;
typedef int32_t mpz_dbl_dig_signed_t;
typedef struct _mpz_t {
struct {
machine_uint_t neg : 1;
machine_uint_t alloc : 31;
};
machine_uint_t neg : 1;
machine_uint_t alloc : 31;
machine_uint_t len;
mpz_dig_t *dig;
} mpz_t;

Wyświetl plik

@ -54,7 +54,7 @@ typedef struct _mp_obj_base_t mp_obj_base_t;
#define MP_DECLARE_CONST_FUN_OBJ(obj_name) extern const mp_obj_fun_native_t obj_name
#define MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, is_kw, n_args_min, n_args_max, fun_name) const mp_obj_fun_native_t obj_name = {{&fun_native_type}, {is_kw, n_args_min}, n_args_max, (void *)fun_name}
#define MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, is_kw, n_args_min, n_args_max, fun_name) const mp_obj_fun_native_t obj_name = {{&fun_native_type}, is_kw, n_args_min, n_args_max, (void *)fun_name}
#define MP_DEFINE_CONST_FUN_OBJ_0(obj_name, fun_name) MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, false, 0, 0, (mp_fun_0_t)fun_name)
#define MP_DEFINE_CONST_FUN_OBJ_1(obj_name, fun_name) MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, false, 1, 1, (mp_fun_1_t)fun_name)
#define MP_DEFINE_CONST_FUN_OBJ_2(obj_name, fun_name) MP_DEFINE_CONST_FUN_OBJ_VOID_PTR(obj_name, false, 2, 2, (mp_fun_2_t)fun_name)
@ -374,10 +374,8 @@ mp_obj_t mp_obj_new_bytearray_by_ref(uint n, void *items);
// functions
typedef struct _mp_obj_fun_native_t { // need this so we can define const objects (to go in ROM)
mp_obj_base_t base;
struct {
bool is_kw : 1;
machine_uint_t n_args_min : (8 * sizeof(machine_uint_t) - 1); // inclusive
};
bool is_kw : 1;
machine_uint_t n_args_min : (8 * sizeof(machine_uint_t) - 1); // inclusive
machine_uint_t n_args_max; // inclusive
void *fun;
// TODO add mp_map_t *globals

Wyświetl plik

@ -16,12 +16,10 @@
typedef struct _mp_obj_array_t {
mp_obj_base_t base;
struct {
machine_uint_t typecode : 8;
// free is number of unused elements after len used elements
// alloc size = len + free
machine_uint_t free : (8 * sizeof(machine_uint_t) - 8);
};
machine_uint_t typecode : 8;
// free is number of unused elements after len used elements
// alloc size = len + free
machine_uint_t free : (8 * sizeof(machine_uint_t) - 8);
machine_uint_t len; // in elements
void *items;
} mp_obj_array_t;

Wyświetl plik

@ -143,12 +143,10 @@ mp_obj_t rt_make_function_var_between(int n_args_min, int n_args_max, mp_fun_var
typedef struct _mp_obj_fun_bc_t {
mp_obj_base_t base;
mp_map_t *globals; // the context within which this function was defined
struct {
machine_uint_t n_args : 15; // number of arguments this function takes
machine_uint_t n_def_args : 15; // number of default arguments
machine_uint_t takes_var_args : 1; // set if this function takes variable args
machine_uint_t takes_kw_args : 1; // set if this function takes keyword args
};
machine_uint_t n_args : 15; // number of arguments this function takes
machine_uint_t n_def_args : 15; // number of default arguments
machine_uint_t takes_var_args : 1; // set if this function takes variable args
machine_uint_t takes_kw_args : 1; // set if this function takes keyword args
uint n_state; // total state size for the executing function (incl args, locals, stack)
const byte *bytecode; // bytecode for the function
qstr *args; // argument names (needed to resolve positional args passed as keywords)

Wyświetl plik

@ -45,14 +45,10 @@ typedef enum {
} mp_code_kind_t;
typedef struct _mp_code_t {
struct {
mp_code_kind_t kind : 8;
uint scope_flags : 8;
};
struct {
uint n_args : 16;
uint n_state : 16;
};
mp_code_kind_t kind : 8;
uint scope_flags : 8;
uint n_args : 16;
uint n_state : 16;
union {
struct {
byte *code;