From c90c0f68a2f1ee8563497a5380a16e71d18d702a Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 4 Jan 2014 01:57:00 +0200 Subject: Move INT_FMT, etc. declaration into global mpconfig.h . This in particular makes it available for stm port. --- unix/mpconfigport.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'unix') diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index 3d0dc8a56..36cf138c1 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -11,15 +11,11 @@ #ifdef __LP64__ typedef long machine_int_t; // must be pointer size typedef unsigned long machine_uint_t; // must be pointer size -#define UINT_FMT "%lu" -#define INT_FMT "%ld" #else // These are definitions for machines where sizeof(int) == sizeof(void*), // regardless for actual size. typedef int machine_int_t; // must be pointer size typedef unsigned int machine_uint_t; // must be pointer size -#define UINT_FMT "%u" -#define INT_FMT "%d" #endif #define BYTES_PER_WORD sizeof(machine_int_t) -- cgit v1.2.3 From 1c6de11f772afae9b4155f8a654cadd05125a2de Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 3 Jan 2014 02:41:17 +0200 Subject: Add basic implementation of slice object. So far, only start and stop integer indexes are supported. Step is not supported, as well as objects of arbitrary types. --- unix/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'unix') diff --git a/unix/Makefile b/unix/Makefile index fd5b6b43e..38d6ba8e1 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -50,6 +50,7 @@ PY_O = \ objnone.o \ objrange.o \ objset.o \ + objslice.o \ objstr.o \ objtuple.o \ objtype.o \ -- cgit v1.2.3 From e67ed5d285bb2ae7b83eb8be3ee488ab08fa4db1 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 4 Jan 2014 13:55:24 +0000 Subject: Improve configurability for native x64/thumb emitter. With MICROPY_EMIT_X64 and MICROPY_EMIT_THUMB disabled, the respective emitters and assemblers will not be included in the code. This can significantly reduce binary size for unix version. --- unix/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'unix') diff --git a/unix/Makefile b/unix/Makefile index 38d6ba8e1..a5c6ddcc0 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -83,10 +83,10 @@ $(BUILD)/%.o: $(PYSRC)/%.S $(BUILD)/%.o: $(PYSRC)/%.c mpconfigport.h $(CC) $(CFLAGS) -c -o $@ $< -$(BUILD)/emitnx64.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h +$(BUILD)/emitnx64.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h mpconfigport.h $(CC) $(CFLAGS) -DN_X64 -c -o $@ $< -$(BUILD)/emitnthumb.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h +$(BUILD)/emitnthumb.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h mpconfigport.h $(CC) $(CFLAGS) -DN_THUMB -c -o $@ $< # optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster) -- cgit v1.2.3 From eb7bfcb28697f6fb2d4d933bc39233aa15423a20 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 4 Jan 2014 15:57:35 +0000 Subject: Split qstr into pools, and put initial pool in ROM. Qstr's are now split into a linked-list of qstr pools. This has 2 benefits: the first pool can be in ROM (huge benefit, since we no longer use RAM for the core qstrs), and subsequent pools use m_new for the next pool instead of m_renew (thus avoiding a huge single table for all the qstrs). Still would be better to use a hash table, but this scheme takes us part of the way (eventually convert the pools to hash tables). Also fixed bug with import. Also improved the way the module code is referenced (not magic number 1 anymore). --- unix/main.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'unix') diff --git a/unix/main.c b/unix/main.c index 1aa333120..e73f69ee2 100644 --- a/unix/main.c +++ b/unix/main.c @@ -217,6 +217,13 @@ int main(int argc, char **argv) { rt_store_name(qstr_from_str_static("test"), test_obj_new(42)); + /* + printf("bytes:\n"); + printf(" total %d\n", m_get_total_bytes_allocated()); + printf(" cur %d\n", m_get_current_bytes_allocated()); + printf(" peak %d\n", m_get_peak_bytes_allocated()); + */ + if (argc == 1) { do_repl(); } else if (argc == 2) { -- cgit v1.2.3 From d674bd59890b8f63e6f67415a2107900562a645b Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 4 Jan 2014 19:38:19 +0200 Subject: Convert USE_READLINE config option to be consistent with others. --- unix/Makefile | 2 +- unix/main.c | 4 ++-- unix/mpconfigport.h | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'unix') diff --git a/unix/Makefile b/unix/Makefile index a5c6ddcc0..c7be62e99 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -2,7 +2,7 @@ PYSRC=../py BUILD=build CC = gcc -CFLAGS = -I. -I$(PYSRC) -Wall -Werror -ansi -std=gnu99 -Os -DUSE_READLINE #-DNDEBUG +CFLAGS = -I. -I$(PYSRC) -Wall -Werror -ansi -std=gnu99 -Os #-DNDEBUG LDFLAGS = -lm SRC_C = \ diff --git a/unix/main.c b/unix/main.c index e73f69ee2..ecb2fa338 100644 --- a/unix/main.c +++ b/unix/main.c @@ -15,7 +15,7 @@ #include "runtime.h" #include "repl.h" -#ifdef USE_READLINE +#if MICROPY_USE_READLINE #include #include #endif @@ -35,7 +35,7 @@ static char *str_join(const char *s1, int sep_char, const char *s2) { } static char *prompt(char *p) { -#ifdef USE_READLINE +#if MICROPY_USE_READLINE char *line = readline(p); if (line) { add_history(line); diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index 36cf138c1..7a4622b8b 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -1,5 +1,10 @@ // options to control how Micro Python is built +// Linking with GNU readline causes binary to be licensed under GPL +#ifndef MICROPY_USE_READLINE +#define MICROPY_USE_READLINE (1) +#endif + #define MICROPY_ENABLE_FLOAT (1) #define MICROPY_EMIT_CPYTHON (0) #define MICROPY_EMIT_X64 (1) -- cgit v1.2.3 From 71c5181a8dfa69ba9f5ca322a3aba0660be2e166 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 4 Jan 2014 20:21:15 +0000 Subject: Convert Python types to proper Python type hierarchy. Now much more inline with how CPython does types. --- unix/Makefile | 1 + unix/main.c | 1 + 2 files changed, 2 insertions(+) (limited to 'unix') diff --git a/unix/Makefile b/unix/Makefile index c7be62e99..984f1c3bf 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -45,6 +45,7 @@ PY_O = \ objfun.o \ objgenerator.o \ objinstance.o \ + objint.o \ objlist.o \ objmodule.o \ objnone.o \ diff --git a/unix/main.c b/unix/main.c index ecb2fa338..16fcf6ef8 100644 --- a/unix/main.c +++ b/unix/main.c @@ -192,6 +192,7 @@ static const mp_obj_type_t test_type = { { &mp_const_type }, "Test", test_print, // print + NULL, // make_new NULL, // call_n NULL, // unary_op NULL, // binary_op -- cgit v1.2.3