Author: Richard Plangger <[email protected]>
Branch: new-jit-log
Changeset: r85372:30fc3a7cf4d3
Date: 2016-06-24 16:28 +0200
http://bitbucket.org/pypy/pypy/changeset/30fc3a7cf4d3/
Log: mutable module global lists are not allowed in rpython
diff --git a/rpython/jit/backend/llsupport/assembler.py
b/rpython/jit/backend/llsupport/assembler.py
--- a/rpython/jit/backend/llsupport/assembler.py
+++ b/rpython/jit/backend/llsupport/assembler.py
@@ -13,7 +13,7 @@
from rpython.rtyper.annlowlevel import cast_instance_to_gcref, llhelper
from rpython.rtyper.lltypesystem import rffi, lltype
-from rpython.jit.metainterp.debug import (DEBUG_COUNTER, LOOP_RUN_COUNTERS,
+from rpython.jit.metainterp.debug import (DEBUG_COUNTER, debug_sd,
flush_debug_counters)
class GuardToken(object):
@@ -333,7 +333,7 @@
self._call_assembler_patch_jmp(jmp_location)
def get_loop_run_counters(self, index):
- return LOOP_RUN_COUNTERS[index]
+ return debug_sd.loop_run_counters[index]
@specialize.argtype(1)
def _inject_debugging_code(self, looptoken, operations, tp, number):
@@ -366,15 +366,16 @@
else:
assert token
struct.number = compute_unique_id(token)
- LOOP_RUN_COUNTERS.append(struct)
+ debug_sd.loop_run_counters.append(struct)
return struct
def finish_once(self):
if self._debug:
# TODO remove the old logging system when jitlog is complete
debug_start('jit-backend-counts')
- for i in range(len(LOOP_RUN_COUNTERS)):
- struct = LOOP_RUN_COUNTERS[i]
+ length = len(debug_sd.loop_run_counters)
+ for i in range(length):
+ struct = debug_sd.loop_run_counters[i]
if struct.type == 'l':
prefix = 'TargetToken(%d)' % struct.number
else:
diff --git a/rpython/jit/backend/x86/runner.py
b/rpython/jit/backend/x86/runner.py
--- a/rpython/jit/backend/x86/runner.py
+++ b/rpython/jit/backend/x86/runner.py
@@ -2,7 +2,7 @@
from rpython.rtyper.lltypesystem import lltype, llmemory, rffi
from rpython.rlib.jit_hooks import LOOP_RUN_CONTAINER
from rpython.rlib import rgc
-from rpython.jit.metainterp.debug import LOOP_RUN_COUNTERS
+from rpython.jit.metainterp.debug import debug_sd
from rpython.jit.backend.x86.assembler import Assembler386
from rpython.jit.backend.x86.regalloc import gpr_reg_mgr_cls, xmm_reg_mgr_cls
from rpython.jit.backend.x86.profagent import ProfileAgent
@@ -116,8 +116,8 @@
def get_all_loop_runs(self):
l = lltype.malloc(LOOP_RUN_CONTAINER,
- len(LOOP_RUN_COUNTERS))
- for i, ll_s in enumerate(LOOP_RUN_COUNTERS):
+ len(debug_sd.loop_run_counters))
+ for i, ll_s in enumerate(debug_sd.loop_run_counters):
l[i].type = ll_s.type
l[i].number = ll_s.number
l[i].counter = ll_s.i
diff --git a/rpython/jit/metainterp/debug.py b/rpython/jit/metainterp/debug.py
--- a/rpython/jit/metainterp/debug.py
+++ b/rpython/jit/metainterp/debug.py
@@ -5,7 +5,11 @@
# forever, just because we want to report them at the end
# of the process
-LOOP_RUN_COUNTERS = []
+class DebugStaticData(object):
+ def __init__(self):
+ self.loop_run_counters = []
+
+debug_sd = DebugStaticData()
DEBUG_COUNTER = lltype.Struct('DEBUG_COUNTER',
# 'b'ridge, 'l'abel or # 'e'ntry point
@@ -16,8 +20,9 @@
def flush_debug_counters():
# this is always called, the jitlog knows if it is enabled
- for i in range(len(LOOP_RUN_COUNTERS)):
- struct = LOOP_RUN_COUNTERS[i]
+ length = len(debug_sd.loop_run_counters)
+ for i in range(length):
+ struct = debug_sd.loop_run_counters[i]
_log_jit_counter(struct)
# reset the counter, flush in a later point in time will
# add up the counters!
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit