Author: Maciej Fijalkowski <fij...@gmail.com>
Branch: 
Changeset: r44988:68f68a718996
Date: 2011-06-17 17:01 +0200
http://bitbucket.org/pypy/pypy/changeset/68f68a718996/

Log:    disallow , in debug_merge_point args, kill special casing in
        oparser.

diff --git a/pypy/jit/metainterp/logger.py b/pypy/jit/metainterp/logger.py
--- a/pypy/jit/metainterp/logger.py
+++ b/pypy/jit/metainterp/logger.py
@@ -103,6 +103,7 @@
         if op.getopnum() == rop.DEBUG_MERGE_POINT:
             jd_sd = self.metainterp_sd.jitdrivers_sd[op.getarg(0).getint()]
             s = jd_sd.warmstate.get_location_str(op.getarglist()[2:])
+            s = s.replace(',', '.') # we use comma for argument splitting
             return "debug_merge_point(%d, '%s')" % (op.getarg(1).getint(), s)
         if ops_offset is None:
             offset = -1
diff --git a/pypy/jit/tool/oparser.py b/pypy/jit/tool/oparser.py
--- a/pypy/jit/tool/oparser.py
+++ b/pypy/jit/tool/oparser.py
@@ -181,11 +181,8 @@
         args = []
         descr = None
         if argspec.strip():
-            if opname == 'debug_merge_point':
-                allargs = argspec.split(',', 1)
-            else:
-                allargs = [arg for arg in argspec.split(",")
-                           if arg != '']
+            allargs = [arg for arg in argspec.split(",")
+                       if arg != '']
 
             poss_descr = allargs[-1].strip()
             if poss_descr.startswith('descr='):
diff --git a/pypy/jit/tool/test/test_oparser.py 
b/pypy/jit/tool/test/test_oparser.py
--- a/pypy/jit/tool/test/test_oparser.py
+++ b/pypy/jit/tool/test/test_oparser.py
@@ -147,13 +147,13 @@
         []
         debug_merge_point(0, "info")
         debug_merge_point(0, 'info')
-        debug_merge_point(1, '<some ('other,')> info')
+        debug_merge_point(1, '<some ('other.')> info')
         debug_merge_point(0, '(stuff) #1')
         '''
         loop = self.parse(x)
         assert loop.operations[0].getarg(1)._get_str() == 'info'
         assert loop.operations[1].getarg(1)._get_str() == 'info'
-        assert loop.operations[2].getarg(1)._get_str() == "<some ('other,')> 
info"
+        assert loop.operations[2].getarg(1)._get_str() == "<some ('other.')> 
info"
         assert loop.operations[3].getarg(1)._get_str() == "(stuff) #1"
 
 
diff --git a/pypy/module/pypyjit/interp_jit.py 
b/pypy/module/pypyjit/interp_jit.py
--- a/pypy/module/pypyjit/interp_jit.py
+++ b/pypy/module/pypyjit/interp_jit.py
@@ -47,6 +47,11 @@
     return (bytecode.co_flags & CO_GENERATOR) != 0
 
 
+def wrap_oplist(space, logger, operations):
+    list_w = []
+    for op in operations:
+        xxx
+
 class PyPyJitDriver(JitDriver):
     reds = ['frame', 'ec']
     greens = ['next_instr', 'is_being_profiled', 'pycode']
@@ -62,8 +67,7 @@
             return
         if space.is_true(cache.w_compile_hook):
             logops = logger._make_log_operations()
-            list_w = [space.wrap(logops.repr_of_resop(op))
-                      for op in operations]
+            list_w = wrap_oplist(space, logger, operations)
             pycode = cast_base_ptr_to_instance(PyCode, ll_pycode)
             cache.in_recursion = True
             try:
@@ -85,8 +89,7 @@
             return
         if space.is_true(cache.w_compile_hook):
             logops = logger._make_log_operations()
-            list_w = [space.wrap(logops.repr_of_resop(op))
-                      for op in operations]
+            list_w = wrap_oplist(space, logger, operations)
             cache.in_recursion = True
             try:
                 space.call_function(cache.w_compile_hook,
diff --git a/pypy/module/pypyjit/test/test_jit_hook.py 
b/pypy/module/pypyjit/test/test_jit_hook.py
--- a/pypy/module/pypyjit/test/test_jit_hook.py
+++ b/pypy/module/pypyjit/test/test_jit_hook.py
@@ -13,7 +13,7 @@
 from pypy.jit.metainterp.typesystem import llhelper
 
 class MockSD(object):
-    class cpu:
+    class cpu(object):
         ts = llhelper
 
 class AppTestJitHook(object):
@@ -33,8 +33,9 @@
         oplist = parse("""
         [i1, i2]
         i3 = int_add(i1, i2)
+        debug_merge_point(0, 0, 0, 0, ConstPtr(ptr0))
         guard_true(i3) []
-        """).operations
+        """, namespace={'ptr0': 3}).operations
 
         def interp_on_compile():
             pypyjitdriver.on_compile(logger, LoopToken(), oplist, 'loop',
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to