summaryrefslogtreecommitdiffstatshomepage
path: root/py/compile.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-11-27 17:09:11 +0000
committerDamien George <damien.p.george@gmail.com>2015-11-29 14:25:36 +0000
commitb8cfb0d7b2c91ea1e17f6caeabfc9cb23166cdc1 (patch)
treed8fc58ac063c837b22b15f7a3967a09f06013054 /py/compile.c
parent999cedb90ff0827cdb9dfe0e4faa6ebc1739d271 (diff)
downloadmicropython-b8cfb0d7b2c91ea1e17f6caeabfc9cb23166cdc1.tar.gz
micropython-b8cfb0d7b2c91ea1e17f6caeabfc9cb23166cdc1.zip
py: Add support for 64-bit NaN-boxing object model, on 32-bit machine.
To use, put the following in mpconfigport.h: #define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_D) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE) typedef int64_t mp_int_t; typedef uint64_t mp_uint_t; #define UINT_FMT "%llu" #define INT_FMT "%lld" Currently does not work with native emitter enabled.
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/compile.c b/py/compile.c
index 6fffd9c0bf..5c2fce6866 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -2439,7 +2439,12 @@ STATIC void compile_bytes(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
STATIC void compile_const_object(compiler_t *comp, mp_parse_node_struct_t *pns) {
+ #if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_D
+ // nodes are 32-bit pointers, but need to extract 64-bit object
+ EMIT_ARG(load_const_obj, (uint64_t)pns->nodes[0] | ((uint64_t)pns->nodes[1] << 32));
+ #else
EMIT_ARG(load_const_obj, (mp_obj_t)pns->nodes[0]);
+ #endif
}
typedef void (*compile_function_t)(compiler_t*, mp_parse_node_struct_t*);