[pypy-commit] pypy jit-applevel-info: add debug_offset operation (doesn't do much so far)

fijal noreply at buildbot.pypy.org
Tue May 17 19:25:31 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: jit-applevel-info
Changeset: r44259:89fb267cfc53
Date: 2011-05-17 19:11 +0200
http://bitbucket.org/pypy/pypy/changeset/89fb267cfc53/

Log:	add debug_offset operation (doesn't do much so far)

diff --git a/pypy/rlib/debug.py b/pypy/rlib/debug.py
--- a/pypy/rlib/debug.py
+++ b/pypy/rlib/debug.py
@@ -140,6 +140,23 @@
             return hop.inputconst(lltype.Bool, False)
 
 
+def debug_offset():
+    """ Return an offset in log file
+    """
+    return -1
+
+class Entry(ExtRegistryEntry):
+    _about_ = debug_offset
+
+    def compute_result_annotation(self):
+        from pypy.annotation import model as annmodel
+        return annmodel.SomeInteger()
+
+    def specialize_call(self, hop):
+        from pypy.rpython.lltypesystem import lltype
+        hop.exception_cannot_occur()
+        return hop.genop('debug_offset', [], resulttype=lltype.Signed)
+
 def llinterpcall(RESTYPE, pythonfunction, *args):
     """When running on the llinterp, this causes the llinterp to call to
     the provided Python function with the run-time value of the given args.
diff --git a/pypy/rlib/test/test_debug.py b/pypy/rlib/test/test_debug.py
--- a/pypy/rlib/test/test_debug.py
+++ b/pypy/rlib/test/test_debug.py
@@ -2,7 +2,7 @@
 import py
 from pypy.rlib.debug import check_annotation, make_sure_not_resized
 from pypy.rlib.debug import debug_print, debug_start, debug_stop
-from pypy.rlib.debug import have_debug_prints
+from pypy.rlib.debug import have_debug_prints, debug_offset
 from pypy.rlib.debug import check_nonneg, IntegerCanBeNegative
 from pypy.rlib import debug
 from pypy.rpython.test.test_llinterp import interpret
@@ -60,6 +60,7 @@
             debug_start("mycat")
             debug_print("foo", 2, "bar", x)
             debug_stop("mycat")
+            debug_offset() # should not explode at least
             return have_debug_prints()
 
         try:
diff --git a/pypy/rpython/lltypesystem/lloperation.py b/pypy/rpython/lltypesystem/lloperation.py
--- a/pypy/rpython/lltypesystem/lloperation.py
+++ b/pypy/rpython/lltypesystem/lloperation.py
@@ -553,6 +553,7 @@
     'debug_start':          LLOp(canrun=True),
     'debug_stop':           LLOp(canrun=True),
     'have_debug_prints':    LLOp(canrun=True),
+    'debug_offset':         LLOp(canrun=True),
     'debug_pdb':            LLOp(),
     'debug_assert':         LLOp(tryfold=True),
     'debug_fatalerror':     LLOp(),
diff --git a/pypy/rpython/lltypesystem/opimpl.py b/pypy/rpython/lltypesystem/opimpl.py
--- a/pypy/rpython/lltypesystem/opimpl.py
+++ b/pypy/rpython/lltypesystem/opimpl.py
@@ -513,6 +513,9 @@
 def op_debug_stop(category):
     debug.debug_stop(_normalize(category))
 
+def op_debug_offset():
+    return debug.debug_offset()
+
 def op_have_debug_prints():
     return debug.have_debug_prints()
 


More information about the pypy-commit mailing list