summaryrefslogtreecommitdiffstatshomepage
path: root/py/emitbc.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-06-03 10:46:36 +0100
committerDamien George <damien.p.george@gmail.com>2014-06-03 10:46:36 +0100
commit07995e947967b7159cf88c48c2f09463015c1d45 (patch)
tree7affa52a8ac05faa07ec777a319015731a5abc73 /py/emitbc.c
parent509c7a7854f24c202832d8fb1369130bf8908261 (diff)
parent411732e93bcbeb529bc5f9722015b61c63eef3c5 (diff)
downloadmicropython-07995e947967b7159cf88c48c2f09463015c1d45.tar.gz
micropython-07995e947967b7159cf88c48c2f09463015c1d45.zip
Merge pull request #649 from pfalcon/multi-opt
Support multiple bytecode optimisation levels
Diffstat (limited to 'py/emitbc.c')
-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;