Author: Richard Plangger <[email protected]>
Branch: new-jit-log
Changeset: r84396:29b41cf549e1
Date: 2016-05-12 08:59 +0200
http://bitbucket.org/pypy/pypy/changeset/29b41cf549e1/
Log: trying to fix translation issue
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
@@ -392,8 +392,7 @@
debug_print(prefix + ':' + str(struct.i))
debug_stop('jit-backend-counts')
- if jitlog:
- flush_debug_counters(jitlog.cintf)
+ flush_debug_counters()
@staticmethod
@rgc.no_collect
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
@@ -14,11 +14,11 @@
('number', lltype.Signed)
)
-def flush_debug_counters(cintf):
+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]
- _log_jit_counter(cintf, struct)
+ _log_jit_counter(struct)
# reset the counter, flush in a later point in time will
# add up the counters!
struct.i = 0
diff --git a/rpython/rlib/jitlog.py b/rpython/rlib/jitlog.py
--- a/rpython/rlib/jitlog.py
+++ b/rpython/rlib/jitlog.py
@@ -3,7 +3,7 @@
import struct
import os
-from rpython.rlib.rvmprof import cintf
+from rpython.rlib.rvmprof.rvmprof import CINTF
from rpython.jit.metainterp import resoperation as resoperations
from rpython.jit.metainterp.resoperation import rop
from rpython.jit.metainterp.history import ConstInt, ConstFloat
@@ -224,37 +224,36 @@
return ''.join(content)
-def _log_jit_counter(cintf, struct):
- if not cintf.jitlog_enabled():
+def _log_jit_counter(struct):
+ if not CINTF.jitlog_enabled():
return
le_addr = encode_le_addr(struct.number)
# not an address (but a number) but it is a machine word
le_count = encode_le_addr(struct.i)
out = le_addr + le_count
- cintf.jitlog_write_marked(MARK_JITLOG_COUNTER, out, len(out))
+ CINTF.jitlog_write_marked(MARK_JITLOG_COUNTER, out, len(out))
class VMProfJitLogger(object):
def __init__(self, cpu=None):
self.cpu = cpu
- self.cintf = cintf.setup()
self.memo = {}
self.trace_id = -1
self.metainterp_sd = None
def setup_once(self):
- if self.cintf.jitlog_enabled():
+ if CINTF.jitlog_enabled():
return
- self.cintf.jitlog_try_init_using_env()
- if not self.cintf.jitlog_enabled():
+ CINTF.jitlog_try_init_using_env()
+ if not CINTF.jitlog_enabled():
return
blob = assemble_header()
- self.cintf.jitlog_write_marked(MARK_JITLOG_HEADER, blob, len(blob))
+ CINTF.jitlog_write_marked(MARK_JITLOG_HEADER, blob, len(blob))
def finish(self):
- self.cintf.jitlog_teardown()
+ CINTF.jitlog_teardown()
def start_new_trace(self, metainterp_sd, faildescr=None,
entry_bridge=False):
- if not self.cintf.jitlog_enabled():
+ if not CINTF.jitlog_enabled():
return
self.metainterp_sd = metainterp_sd
self.trace_id += 1
@@ -273,14 +272,14 @@
def _write_marked(self, mark, line):
if not we_are_translated():
- assert self.cintf.jitlog_enabled()
- self.cintf.jitlog_write_marked(mark, line, len(line))
+ assert CINTF.jitlog_enabled()
+ CINTF.jitlog_write_marked(mark, line, len(line))
def log_jit_counter(self, struct):
- _log_jit_counter(self.cintf, struct)
+ _log_jit_counter(CINTF, struct)
def log_trace(self, tag, metainterp_sd, mc, memo=None):
- if not self.cintf.jitlog_enabled():
+ if not CINTF.jitlog_enabled():
return EMPTY_TRACE_LOG
assert self.metainterp_sd is not None
assert isinstance(tag, int)
@@ -289,7 +288,7 @@
return LogTrace(tag, memo, self.metainterp_sd, mc, self)
def log_patch_guard(self, descr_number, addr):
- if not self.cintf.jitlog_enabled():
+ if not CINTF.jitlog_enabled():
return
le_descr_number = encode_le_addr(descr_number)
le_addr = encode_le_addr(addr)
diff --git a/rpython/rlib/rvmprof/rvmprof.py b/rpython/rlib/rvmprof/rvmprof.py
--- a/rpython/rlib/rvmprof/rvmprof.py
+++ b/rpython/rlib/rvmprof/rvmprof.py
@@ -25,6 +25,8 @@
def __str__(self):
return self.msg
+CINTF = cintf.setup()
+
class VMProf(object):
_immutable_fields_ = ['is_enabled?']
@@ -35,7 +37,6 @@
self._gather_all_code_objs = lambda: None
self._cleanup_()
self._code_unique_id = 4
- self.cintf = cintf.setup()
def _cleanup_(self):
self.is_enabled = False
@@ -112,12 +113,12 @@
if self.is_enabled:
raise VMProfError("vmprof is already enabled")
- p_error = self.cintf.vmprof_init(fileno, interval, "pypy")
+ p_error = CINTF.vmprof_init(fileno, interval, "pypy")
if p_error:
raise VMProfError(rffi.charp2str(p_error))
self._gather_all_code_objs()
- res = self.cintf.vmprof_enable()
+ res = CINTF.vmprof_enable()
if res < 0:
raise VMProfError(os.strerror(rposix.get_saved_errno()))
self.is_enabled = True
@@ -125,16 +126,16 @@
def enable_jitlog(self, fileno):
# initialize the jit log
from rpython.rlib import jitlog as jl
- p_error = self.cintf.jitlog_init(fileno)
+ p_error = CINTF.jitlog_init(fileno)
if p_error:
raise VMProfError(rffi.charp2str(p_error))
blob = jl.assemble_header()
- self.cintf.jitlog_write_marked(jl.MARK_JITLOG_HEADER, blob, len(blob))
+ CINTF.jitlog_write_marked(jl.MARK_JITLOG_HEADER, blob, len(blob))
def disable_jitlog(self):
from rpython.jit.metainterp.debug import flush_debug_counters
- flush_debug_counters(self.cintf)
- self.cintf.jitlog_teardown()
+ flush_debug_counters()
+ CINTF.jitlog_teardown()
def disable(self):
"""Disable vmprof.
@@ -143,7 +144,7 @@
if not self.is_enabled:
raise VMProfError("vmprof is not enabled")
self.is_enabled = False
- res = self.cintf.vmprof_disable()
+ res = CINTF.vmprof_disable()
if res < 0:
raise VMProfError(os.strerror(rposix.get_saved_errno()))
@@ -151,7 +152,7 @@
assert name.count(':') == 3 and len(name) <= MAX_FUNC_NAME, (
"the name must be 'class:func_name:func_line:filename' "
"and at most %d characters; got '%s'" % (MAX_FUNC_NAME, name))
- if self.cintf.vmprof_register_virtual_function(name, uid, 500000) < 0:
+ if CINTF.vmprof_register_virtual_function(name, uid, 500000) < 0:
raise VMProfError("vmprof buffers full! disk full or too slow")
def vmprof_execute_code(name, get_code_fn, result_class=None):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit