summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-06-02 19:39:15 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-06-03 12:32:59 +0300
commitb8f117dd32aae6d2d8108ba101961d00df123e4f (patch)
tree2c95c5359e92463763d2c6b2d8a3dc18f6c71300
parentd3439d0c6065bc60a9c4c915f4a1a3ffa796cf33 (diff)
downloadmicropython-b8f117dd32aae6d2d8108ba101961d00df123e4f.tar.gz
micropython-b8f117dd32aae6d2d8108ba101961d00df123e4f.zip
py: For optimization level -O3 and higher, remove lineno info from bytecode.
-rw-r--r--py/emitbc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/emitbc.c b/py/emitbc.c
index cfaea7c88a..841dd4aabb 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -352,6 +352,10 @@ STATIC void emit_bc_adjust_stack_size(emit_t *emit, int delta) {
STATIC void emit_bc_set_source_line(emit_t *emit, int source_line) {
//printf("source: line %d -> %d offset %d -> %d\n", emit->last_source_line, source_line, emit->last_source_line_offset, emit->bytecode_offset);
#if MICROPY_ENABLE_SOURCE_LINE
+ if (mp_optimise_value >= 3) {
+ // If we compile with -O3, don't store line numbers.
+ return;
+ }
if (source_line > emit->last_source_line) {
uint bytes_to_skip = emit->bytecode_offset - emit->last_source_line_offset;
uint lines_to_skip = source_line - emit->last_source_line;