[pypy-commit] lang-smalltalk storage: Merged.

anton_gulenko noreply at buildbot.pypy.org
Fri Jul 18 14:09:02 CEST 2014


Author: Anton Gulenko <anton.gulenko at googlemail.com>
Branch: storage
Changeset: r919:8c1727512fd2
Date: 2014-07-18 13:50 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/8c1727512fd2/

Log:	Merged. Removed configurable trace depth (unnecessary).

diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -35,7 +35,7 @@
     )
 
     def __init__(self, space, image=None, image_name="",
-                trace_depth=-1, evented=True, interrupts=True):
+                trace=False, evented=True, interrupts=True):
         # === Initialize immutable variables
         self.space = space
         self.image = image
@@ -54,7 +54,7 @@
         # === Initialize mutable variables
         self.interrupt_check_counter = self.interrupt_counter_size
         self.next_wakeup_tick = 0
-        self.trace_depth = trace_depth
+        self.trace = trace
         self.trace_proxy = objspace.ConstantFlag()
         self.stack_depth = 0
 
@@ -230,21 +230,13 @@
         return s_frame
         
     # ============== Methods for tracing, printing and debugging ==============
-
-    def activate_trace(self, trace_depth=0):
-        self.trace_depth = trace_depth
-        
-    def deactivate_trace(self):
-        self.trace_depth = -1
-        
+    
     def is_tracing(self):
-        return jit.promote(self.trace_depth) >= 0
-        
+        return jit.promote(self.trace)
+    
     def print_padded(self, str):
-        depth = jit.promote(self.trace_depth)
-        assert depth >= 0
-        if self.stack_depth <= depth:
-            print (' ' * self.stack_depth) + str
+        assert self.is_tracing()
+        print (' ' * self.stack_depth) + str
     
     def activate_debug_bytecode(self):
         "NOT_RPYTHON"
diff --git a/spyvm/plugins/vmdebugging.py b/spyvm/plugins/vmdebugging.py
--- a/spyvm/plugins/vmdebugging.py
+++ b/spyvm/plugins/vmdebugging.py
@@ -10,12 +10,12 @@
 
 @DebuggingPlugin.expose_primitive(unwrap_spec=[object])
 def trace(interp, s_frame, w_rcvr):
-    interp.activate_trace()
+    interp.trace = True
     return w_rcvr
 
 @DebuggingPlugin.expose_primitive(unwrap_spec=[object])
 def untrace(interp, s_frame, w_rcvr):
-    interp.deactivate_trace()
+    interp.trace = False
     return w_rcvr
 
 @DebuggingPlugin.expose_primitive(unwrap_spec=[object])
diff --git a/spyvm/test/test_largeinteger.py b/spyvm/test/test_largeinteger.py
--- a/spyvm/test/test_largeinteger.py
+++ b/spyvm/test/test_largeinteger.py
@@ -8,7 +8,7 @@
     space, interp, _, _ = read_image('bootstrapped.image')
     w = space.w
     copy_to_module(locals(), __name__)
-    interp.deactivate_trace()
+    interp.trace = False
     space.initialize_class(space.w_String, interp)
 
 def teardown_module():
@@ -38,10 +38,7 @@
     except Exception:
         w_selector = find_symbol_in_methoddict_of(selector, w(intmask(candidates[0])).getclass(space).shadow)
     
-    if trace:
-        interp.activate_trace()
-    else:
-        interp.deactivate_trace()
+    interp.trace = trace
     for i, v in enumerate(candidates):
         x = w_l(v)
         if j is None:
@@ -53,7 +50,7 @@
                 y = w_l(j)
         z = perform_primitive(x, w_selector, y)
         assert r_uint(z.value) == r_uint(operation(v, y.value))
-    interp.deactivate_trace()
+    interp.trace = False
 
 def test_bitAnd():
     do_primitive("bitAnd:", operator.and_)
diff --git a/targetimageloadingsmalltalk.py b/targetimageloadingsmalltalk.py
--- a/targetimageloadingsmalltalk.py
+++ b/targetimageloadingsmalltalk.py
@@ -12,7 +12,7 @@
 
 def _usage(argv):
     print """
-    Usage: %s <path> [-r|-m|-h] [-naPu] [-jpiS] [-tTlLE]
+    Usage: %s <path> [-r|-m|-h] [-naPu] [-jpiS] [-tlLE]
             <path> - image path (default: Squeak.image)
 
           Execution mode:
@@ -39,7 +39,6 @@
             
           Logging parameters:
             -t|--trace                 - Output a trace of each message, primitive, return value and process switch.
-            -T <depth>                 - Like -t, but limit the stack depth for the trace to <depth>.
             -l|--storage-log           - Output a log of storage operations.
             -L|--storage-log-aggregate - Output an aggregated storage log at the end of execution.
             -E|--storage-log-elements  - Include classnames of elements into the storage log.
@@ -89,7 +88,7 @@
     # == Other parameters
     poll = False
     interrupts = True
-    trace_depth = -1
+    trace = False
     
     space = prebuilt_space
     idx = 1
@@ -109,11 +108,7 @@
             elif arg in ["-m", "--method"]:
                 selector, idx = get_parameter(argv, idx, arg)
             elif arg in ["-t", "--trace"]:
-                trace_depth = sys.maxint
-            elif arg in ["-T"]:
-                trace_depth, idx = get_int_parameter(argv, idx, arg)
-                if trace_depth < 0:
-                    raise error.Exit("Need argument >= 0 for -T.")
+                trace = True
             elif arg in ["-p", "--poll"]:
                 poll = True
             elif arg in ["-a", "--arg"]:
@@ -164,7 +159,7 @@
     image_reader = squeakimage.reader_for_image(space, squeakimage.Stream(data=imagedata))
     image = create_image(space, image_reader)
     interp = interpreter.Interpreter(space, image, image_name=path,
-                trace_depth=trace_depth, evented=not poll,
+                trace=trace, evented=not poll,
                 interrupts=interrupts)
     space.runtime_setup(argv[0])
     print_error("") # Line break after image-loading characters


More information about the pypy-commit mailing list