py: Put all global state together in state structures.

This patch consolidates all global variables in py/ core into one place,
in a global structure.  Root pointers are all located together to make
GC tracing easier and more efficient.
diff --git a/py/emitbc.c b/py/emitbc.c
index 3914a9d..a93c03e 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -30,6 +30,7 @@
 #include <string.h>
 #include <assert.h>
 
+#include "py/mpstate.h"
 #include "py/emit.h"
 #include "py/bc0.h"
 
@@ -383,7 +384,7 @@
 STATIC void emit_bc_set_source_line(emit_t *emit, mp_uint_t 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 (MP_STATE_VM(mp_optimise_value) >= 3) {
         // If we compile with -O3, don't store line numbers.
         return;
     }