diff options
author | blmorris <bryan.morrissey@gmail.com> | 2014-07-15 12:28:49 -0400 |
---|---|---|
committer | blmorris <bryan.morrissey@gmail.com> | 2014-07-15 12:28:49 -0400 |
commit | 0429d35f37532d2a981e704f014a248da9b157d8 (patch) | |
tree | 89b46c4453ba89072ac6926b930acf1276a79b7b /py/emitbc.c | |
parent | 847a6b30b17493853322532a40f48afb1d975d2e (diff) | |
parent | dce8876dbe272d34d8d28aac21b4a4c3bdea0317 (diff) | |
download | micropython-0429d35f37532d2a981e704f014a248da9b157d8.tar.gz micropython-0429d35f37532d2a981e704f014a248da9b157d8.zip |
Merge https://github.com/micropython/micropython
Diffstat (limited to 'py/emitbc.c')
-rw-r--r-- | py/emitbc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/py/emitbc.c b/py/emitbc.c index ebc2ba5003..365ec458a2 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -50,7 +50,6 @@ struct _emit_t { pass_kind_t pass : 8; uint last_emit_was_return_value : 8; - byte dummy_data[DUMMY_DATA_SIZE]; int stack_size; @@ -67,6 +66,8 @@ struct _emit_t { uint bytecode_offset; uint bytecode_size; byte *code_base; // stores both byte code and code info + // Accessed as uint, so must be aligned as such + byte dummy_data[DUMMY_DATA_SIZE]; }; STATIC void emit_bc_rot_two(emit_t *emit); @@ -207,6 +208,8 @@ STATIC void emit_write_bytecode_byte_ptr(emit_t* emit, byte b, void *ptr) { emit_write_bytecode_byte(emit, b); emit_align_bytecode_to_machine_word(emit); mp_uint_t *c = (mp_uint_t*)emit_get_cur_to_write_bytecode(emit, sizeof(mp_uint_t)); + // Verify thar c is already uint-aligned + assert(c == MP_ALIGN(c, sizeof(mp_uint_t))); *c = (mp_uint_t)ptr; } |