Skip to content

Commit e9012a2

Browse files
committed
py/emitnative: Change type of const_table from uintptr_t to mp_uint_t.
This matches how bytecode does it, and matches the signature of mp_emit_glue_assign_native. Since the native emitter doesn't support nan-boxing uintptr_t and mp_uint_t are anyway the same bit-width.
1 parent bbccb0f commit e9012a2

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

py/emitnative.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ struct _emit_t {
209209
uint16_t const_table_cur_obj;
210210
uint16_t const_table_num_obj;
211211
uint16_t const_table_cur_raw_code;
212-
uintptr_t *const_table;
212+
mp_uint_t *const_table;
213213

214214
bool last_emit_was_return_value;
215215

@@ -529,7 +529,7 @@ STATIC void emit_native_end_pass(emit_t *emit) {
529529
// Add room for qstr names of arguments
530530
const_table_alloc += emit->scope->num_pos_args + emit->scope->num_kwonly_args;
531531
}
532-
emit->const_table = m_new(uintptr_t, const_table_alloc);
532+
emit->const_table = m_new(mp_uint_t, const_table_alloc);
533533
}
534534

535535
if (emit->pass == MP_PASS_EMIT) {
@@ -918,7 +918,7 @@ STATIC exc_stack_entry_t *emit_native_pop_exc_stack(emit_t *emit) {
918918
return e;
919919
}
920920

921-
STATIC void emit_load_reg_with_ptr(emit_t *emit, int reg, uintptr_t ptr, size_t table_off) {
921+
STATIC void emit_load_reg_with_ptr(emit_t *emit, int reg, mp_uint_t ptr, size_t table_off) {
922922
if (!emit->do_viper_types) {
923923
// Skip qstr names of arguments
924924
table_off += emit->scope->num_pos_args + emit->scope->num_kwonly_args;
@@ -933,12 +933,12 @@ STATIC void emit_load_reg_with_ptr(emit_t *emit, int reg, uintptr_t ptr, size_t
933933

934934
STATIC void emit_load_reg_with_object(emit_t *emit, int reg, mp_obj_t obj) {
935935
size_t table_off = emit->const_table_cur_obj++;
936-
emit_load_reg_with_ptr(emit, reg, (uintptr_t)obj, table_off);
936+
emit_load_reg_with_ptr(emit, reg, (mp_uint_t)obj, table_off);
937937
}
938938

939939
STATIC void emit_load_reg_with_raw_code(emit_t *emit, int reg, mp_raw_code_t *rc) {
940940
size_t table_off = emit->const_table_num_obj + emit->const_table_cur_raw_code++;
941-
emit_load_reg_with_ptr(emit, reg, (uintptr_t)rc, table_off);
941+
emit_load_reg_with_ptr(emit, reg, (mp_uint_t)rc, table_off);
942942
}
943943

944944
STATIC void emit_native_label_assign(emit_t *emit, mp_uint_t l) {

0 commit comments

Comments
 (0)