[pypy-commit] pypy default: remove nonsense hints (those functions contain loops)

2011-12-26 Thread fijal
Author: Maciej Fijalkowski fij...@gmail.com
Branch: 
Changeset: r50865:45a754407e3d
Date: 2011-12-26 11:01 +0200
http://bitbucket.org/pypy/pypy/changeset/45a754407e3d/

Log:remove nonsense hints (those functions contain loops)

diff --git a/pypy/interpreter/eval.py b/pypy/interpreter/eval.py
--- a/pypy/interpreter/eval.py
+++ b/pypy/interpreter/eval.py
@@ -98,7 +98,6 @@
 Abstract. Get the expected number of locals.
 raise TypeError, abstract
 
-@jit.dont_look_inside
 def fast2locals(self):
 # Copy values from the fastlocals to self.w_locals
 if self.w_locals is None:
@@ -112,7 +111,6 @@
 w_name = self.space.wrap(name)
 self.space.setitem(self.w_locals, w_name, w_value)
 
-@jit.dont_look_inside
 def locals2fast(self):
 # Copy values from self.w_locals to the fastlocals
 assert self.w_locals is not None
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: remove some nonsense, handle_exception always raises

2011-12-26 Thread fijal
Author: Maciej Fijalkowski fij...@gmail.com
Branch: 
Changeset: r50866:94934ddf3ae9
Date: 2011-12-26 11:07 +0200
http://bitbucket.org/pypy/pypy/changeset/94934ddf3ae9/

Log:remove some nonsense, handle_exception always raises

diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -619,7 +619,7 @@
   self.descr_reqcls,
   args)
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -655,7 +655,7 @@
   self.descr_reqcls,
   args)
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -674,7 +674,7 @@
   self.descr_reqcls,
   args.prepend(w_obj))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -690,7 +690,7 @@
 raise OperationError(space.w_SystemError,
  space.wrap(unexpected DescrMismatch error))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -708,7 +708,7 @@
self.descr_reqcls,
Arguments(space, [w1]))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -726,7 +726,7 @@
self.descr_reqcls,
Arguments(space, [w1, w2]))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -744,7 +744,7 @@
self.descr_reqcls,
Arguments(space, [w1, w2, w3]))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -763,7 +763,7 @@
Arguments(space,
  [w1, w2, w3, w4]))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: test for 05c2089f5545, it curently fails

2011-12-26 Thread hakanardo
Author: Hakan Ardo ha...@debian.org
Branch: 
Changeset: r50867:fff6b491e07d
Date: 2011-12-26 11:27 +0100
http://bitbucket.org/pypy/pypy/changeset/fff6b491e07d/

Log:test for 05c2089f5545, it curently fails

diff --git a/pypy/jit/metainterp/optimizeopt/test/test_multilabel.py 
b/pypy/jit/metainterp/optimizeopt/test/test_multilabel.py
--- a/pypy/jit/metainterp/optimizeopt/test/test_multilabel.py
+++ b/pypy/jit/metainterp/optimizeopt/test/test_multilabel.py
@@ -1,10 +1,13 @@
 from __future__ import with_statement
 from pypy.jit.metainterp.optimizeopt.test.test_util import (
-LLtypeMixin, BaseTest, Storage, _sortboxes, FakeDescrWithSnapshot)
+LLtypeMixin, BaseTest, Storage, _sortboxes, FakeDescrWithSnapshot,
+FakeMetaInterpStaticData)
 from pypy.jit.metainterp.history import TreeLoop, JitCellToken, TargetToken
 from pypy.jit.metainterp.resoperation import rop, opname, ResOperation
 from pypy.jit.metainterp.optimize import InvalidLoop
 from py.test import raises
+from pypy.jit.metainterp.optimizeopt.optimizer import Optimization
+from pypy.jit.metainterp.optimizeopt.util import make_dispatcher_method
 
 class BaseTestMultiLabel(BaseTest):
 enable_opts = 
intbounds:rewrite:virtualize:string:earlyforce:pure:heap:unroll
@@ -84,6 +87,8 @@
 
 return optimized
 
+class OptimizeoptTestMultiLabel(BaseTestMultiLabel):
+
 def test_simple(self):
 ops = 
 [i1]
@@ -381,6 +386,55 @@
 
 self.optimize_loop(ops, expected)
 
-class TestLLtype(BaseTestMultiLabel, LLtypeMixin):
+
+class OptRenameStrlen(Optimization):
+def propagate_forward(self, op):
+dispatch_opt(self, op)
+
+def optimize_STRLEN(self, op):
+newop = op.clone()
+newop.result = op.result.clonebox()
+self.emit_operation(newop)
+self.make_equal_to(op.result, self.getvalue(newop.result))
+
+dispatch_opt = make_dispatcher_method(OptRenameStrlen, 'optimize_',
+  default=OptRenameStrlen.emit_operation)
+
+class BaseTestOptimizerRenamingBoxes(BaseTestMultiLabel):
+
+def _do_optimize_loop(self, loop, call_pure_results):
+from pypy.jit.metainterp.optimizeopt.unroll import optimize_unroll
+from pypy.jit.metainterp.optimizeopt.util import args_dict
+from pypy.jit.metainterp.optimizeopt.pure import OptPure
+
+self.loop = loop
+loop.call_pure_results = args_dict()
+metainterp_sd = FakeMetaInterpStaticData(self.cpu)
+optimize_unroll(metainterp_sd, loop, [OptRenameStrlen(), OptPure()], 
True)
+
+def test_optimizer_renaming_boxes(self):
+ops = 
+[p1]
+i1 = strlen(p1)
+label(p1)
+i2 = strlen(p1)
+i3 = int_add(i2, 7)
+jump(p1)
+
+expected = 
+[p1]
+i1 = strlen(p1)
+i11 = same_as(i1)
+label(p1, i11)
+i2 = int_add(i11, 7)
+jump(p1)
+
+self.optimize_loop(ops, expected)
+
+
+
+class TestLLtype(OptimizeoptTestMultiLabel, LLtypeMixin):
 pass
 
+class TestOptimizerRenamingBoxesLLtype(BaseTestOptimizerRenamingBoxes, 
LLtypeMixin):
+pass
diff --git a/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py 
b/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py
--- a/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py
+++ b/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py
@@ -7759,7 +7759,7 @@
 jump(i0, p0, i2)
 
 self.optimize_loop(ops, expected)
-
+
 class TestLLtype(OptimizeOptTest, LLtypeMixin):
 pass
 
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Since alias tracking is killed the name of the imported box among the label arguments will be the name from the previous part, so we need to place the same_as after the lab

2011-12-26 Thread hakanardo
Author: Hakan Ardo ha...@debian.org
Branch: 
Changeset: r50868:660488a0ae41
Date: 2011-12-26 11:40 +0100
http://bitbucket.org/pypy/pypy/changeset/660488a0ae41/

Log:Since alias tracking is killed the name of the imported box among
the label arguments will be the name from the previous part, so we
need to place the same_as after the label now. This fixes the test
in fff6b491e07d.

diff --git a/pypy/jit/metainterp/optimizeopt/test/test_multilabel.py 
b/pypy/jit/metainterp/optimizeopt/test/test_multilabel.py
--- a/pypy/jit/metainterp/optimizeopt/test/test_multilabel.py
+++ b/pypy/jit/metainterp/optimizeopt/test/test_multilabel.py
@@ -424,10 +424,10 @@
 expected = 
 [p1]
 i1 = strlen(p1)
+label(p1, i1)
 i11 = same_as(i1)
-label(p1, i11)
 i2 = int_add(i11, 7)
-jump(p1)
+jump(p1, i11)
 
 self.optimize_loop(ops, expected)
 
diff --git a/pypy/jit/metainterp/optimizeopt/unroll.py 
b/pypy/jit/metainterp/optimizeopt/unroll.py
--- a/pypy/jit/metainterp/optimizeopt/unroll.py
+++ b/pypy/jit/metainterp/optimizeopt/unroll.py
@@ -269,10 +269,8 @@
 # in case it does, we would prefer to be suboptimal in asm
 # to a fatal RPython exception.
 if newresult is not op.result and not newvalue.is_constant():
-# XXX fix me?
-#self.short_boxes.alias(newresult, op.result)
 op = ResOperation(rop.SAME_AS, [op.result], newresult)
-self.optimizer._newoperations = [op] + 
self.optimizer._newoperations
+self.optimizer._newoperations.append(op)
 self.optimizer.flush()
 self.optimizer.emitting_dissabled = False
 
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: backout 94934ddf3ae9, it's nonsense, but annotator does not understand it and

2011-12-26 Thread fijal
Author: Maciej Fijalkowski fij...@gmail.com
Branch: 
Changeset: r50869:21ca3b5a40aa
Date: 2011-12-26 12:57 +0200
http://bitbucket.org/pypy/pypy/changeset/21ca3b5a40aa/

Log:backout 94934ddf3ae9, it's nonsense, but annotator does not
understand it and I'm too lazy to convince it

diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -619,7 +619,7 @@
   self.descr_reqcls,
   args)
 except Exception, e:
-self.handle_exception(space, e)
+raise self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -655,7 +655,7 @@
   self.descr_reqcls,
   args)
 except Exception, e:
-self.handle_exception(space, e)
+raise self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -674,7 +674,7 @@
   self.descr_reqcls,
   args.prepend(w_obj))
 except Exception, e:
-self.handle_exception(space, e)
+raise self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -690,7 +690,7 @@
 raise OperationError(space.w_SystemError,
  space.wrap(unexpected DescrMismatch error))
 except Exception, e:
-self.handle_exception(space, e)
+raise self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -708,7 +708,7 @@
self.descr_reqcls,
Arguments(space, [w1]))
 except Exception, e:
-self.handle_exception(space, e)
+raise self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -726,7 +726,7 @@
self.descr_reqcls,
Arguments(space, [w1, w2]))
 except Exception, e:
-self.handle_exception(space, e)
+raise self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -744,7 +744,7 @@
self.descr_reqcls,
Arguments(space, [w1, w2, w3]))
 except Exception, e:
-self.handle_exception(space, e)
+raise self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -763,7 +763,7 @@
Arguments(space,
  [w1, w2, w3, w4]))
 except Exception, e:
-self.handle_exception(space, e)
+raise self.handle_exception(space, e)
 if w_result is None:
 w_result = space.w_None
 return w_result
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy concurrent-marksweep: Document and start implementing an idea to make major collection

2011-12-26 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: concurrent-marksweep
Changeset: r50870:05769b6b553e
Date: 2011-12-26 13:46 +0100
http://bitbucket.org/pypy/pypy/changeset/05769b6b553e/

Log:Document and start implementing an idea to make major collection
parallel.

diff --git a/pypy/rpython/memory/gc/concurrentgen.py 
b/pypy/rpython/memory/gc/concurrentgen.py
--- a/pypy/rpython/memory/gc/concurrentgen.py
+++ b/pypy/rpython/memory/gc/concurrentgen.py
@@ -14,20 +14,15 @@
 from pypy.module.thread import ll_thread
 
 #
-# A 3/4th concurrent generational marksweep GC.
+# A concurrent generational marksweep GC.
 #
 # This uses a separate thread to run the minor collections in parallel.
 # See concurrentgen.txt for some details.
 #
-# Major collections are serialized for the mark phase, but the sweep
-# phase can be parallelized again.  XXX not done so far, YYY investigate
-# also completely parallelizing them too
-#
 # Based on observations of the timing of collections with minimark
 # (on translate.py): about 15% of the time in minor collections
-# (including 2% in walk_roots), and about 7% in major collections (with
-# probably 3-4% in the marking phase).  So out of a total of 22% this
-# should parallelize 16-17%, i.e. 3/4th.
+# (including 2% in walk_roots), and about 7% in major collections.
+# So out of a total of 22% this should parallelize 20%.
 #
 # This is an entirely non-moving collector, with a generational write
 # barrier adapted to the concurrent marking done by the collector thread.
@@ -44,10 +39,8 @@
 # let us know if the 'tid' is valid or is just a word-aligned address):
 MARK_BYTE_1   = 0x6D# 'm', 109
 MARK_BYTE_2   = 0x4B# 'K', 75
-MARK_BYTE_OLD_1   = 0x23# '#', 35
-MARK_BYTE_OLD_2   = 0x2F# '/', 47
-MARK_BYTE_STATIC  = 0x35# '5', 53
-mark_byte_is_old  = lambda n: n = MARK_BYTE_OLD_2
+MARK_BYTE_3   = 0x23# '#', 35
+MARK_BYTE_STATIC  = 0x53# 'S', 83
 # Next lower byte: a combination of flags.
 FL_WITHHASH   = 0x0100
 FL_EXTRA  = 0x0200
@@ -144,8 +137,10 @@
 #
 # See concurrentgen.txt for more information about these fields.
 self.current_young_marker = MARK_BYTE_1
-self.collector.current_aging_marker = MARK_BYTE_2
+self.current_aging_marker = MARK_BYTE_2
+self.current_old_marker   = MARK_BYTE_3
 #
+self.num_major_collects = 0
 #self.ready_to_start_lock = ...built in setup()
 #self.finished_lock = ...built in setup()
 #self.mutex_lock = ...built in setup()
@@ -321,10 +316,11 @@
 #
 def force_scan(obj):
 cym = self.current_young_marker
+com = self.current_old_marker
 mark = self.get_mark(obj)
 #debug_print(deletion_barrier:, mark, obj)
 #
-if mark_byte_is_old(mark): # most common case, make it fast
+if mark == com: # most common case, make it fast
 #
 self.set_mark(obj, cym)
 #
@@ -344,7 +340,7 @@
 mark = self.get_mark(obj)
 self.set_mark(obj, cym)
 #
-if mark == self.collector.current_aging_marker:
+if mark == self.current_aging_marker:
 #
 # it is only possible to reach this point if there is
 # a collection running in collector_mark(), before it
@@ -363,10 +359,10 @@
   write barrier: oups!?)
 #
 else:
-# MARK_BYTE_OLD_* is possible here: the collector thread
+# a 'com' mark is possible here: the collector thread
 # sets it in parallel to objects.  In that case it has
 # been handled already.
-ll_assert(mark_byte_is_old(mark),
+ll_assert(mark == self.current_old_marker,
   write barrier: bogus object mark)
 #
 self.release(self.mutex_lock)
@@ -438,9 +434,10 @@
 self.finalizer_lock_count -= 1
 
 
-def collect(self, gen=3):
+def collect(self, gen=4):
 
-gen=0: Trigger a minor collection if none is running.  Never blocks.
+gen=0: Trigger a minor collection if none is running.  Never blocks,
+except if it happens to start a major collection.
 
 gen=1: The same, but if a minor collection is running, wait for
 it to finish before triggering the next one.  Guarantees that
@@ -451,18 +448,17 @@
 finish.  Guarantees that young objects not reachable when
 collect() is called will be freed by the time collect() returns.
 
-gen=3: Major collection.
+gen=3: Trigger a major collection, waiting for it to start.
+Guarantees that any object not reachable when collect() is called
+will soon be freed.
 
-XXX 

[pypy-commit] pypy concurrent-marksweep: hg merge default

2011-12-26 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: concurrent-marksweep
Changeset: r50872:130f4c04e5c4
Date: 2011-12-26 13:50 +0100
http://bitbucket.org/pypy/pypy/changeset/130f4c04e5c4/

Log:hg merge default

diff --git a/pypy/interpreter/eval.py b/pypy/interpreter/eval.py
--- a/pypy/interpreter/eval.py
+++ b/pypy/interpreter/eval.py
@@ -98,7 +98,6 @@
 Abstract. Get the expected number of locals.
 raise TypeError, abstract
 
-@jit.dont_look_inside
 def fast2locals(self):
 # Copy values from the fastlocals to self.w_locals
 if self.w_locals is None:
@@ -112,7 +111,6 @@
 w_name = self.space.wrap(name)
 self.space.setitem(self.w_locals, w_name, w_value)
 
-@jit.dont_look_inside
 def locals2fast(self):
 # Copy values from self.w_locals to the fastlocals
 assert self.w_locals is not None
diff --git a/pypy/jit/metainterp/optimizeopt/test/test_multilabel.py 
b/pypy/jit/metainterp/optimizeopt/test/test_multilabel.py
--- a/pypy/jit/metainterp/optimizeopt/test/test_multilabel.py
+++ b/pypy/jit/metainterp/optimizeopt/test/test_multilabel.py
@@ -1,10 +1,13 @@
 from __future__ import with_statement
 from pypy.jit.metainterp.optimizeopt.test.test_util import (
-LLtypeMixin, BaseTest, Storage, _sortboxes, FakeDescrWithSnapshot)
+LLtypeMixin, BaseTest, Storage, _sortboxes, FakeDescrWithSnapshot,
+FakeMetaInterpStaticData)
 from pypy.jit.metainterp.history import TreeLoop, JitCellToken, TargetToken
 from pypy.jit.metainterp.resoperation import rop, opname, ResOperation
 from pypy.jit.metainterp.optimize import InvalidLoop
 from py.test import raises
+from pypy.jit.metainterp.optimizeopt.optimizer import Optimization
+from pypy.jit.metainterp.optimizeopt.util import make_dispatcher_method
 
 class BaseTestMultiLabel(BaseTest):
 enable_opts = 
intbounds:rewrite:virtualize:string:earlyforce:pure:heap:unroll
@@ -84,6 +87,8 @@
 
 return optimized
 
+class OptimizeoptTestMultiLabel(BaseTestMultiLabel):
+
 def test_simple(self):
 ops = 
 [i1]
@@ -381,6 +386,55 @@
 
 self.optimize_loop(ops, expected)
 
-class TestLLtype(BaseTestMultiLabel, LLtypeMixin):
+
+class OptRenameStrlen(Optimization):
+def propagate_forward(self, op):
+dispatch_opt(self, op)
+
+def optimize_STRLEN(self, op):
+newop = op.clone()
+newop.result = op.result.clonebox()
+self.emit_operation(newop)
+self.make_equal_to(op.result, self.getvalue(newop.result))
+
+dispatch_opt = make_dispatcher_method(OptRenameStrlen, 'optimize_',
+  default=OptRenameStrlen.emit_operation)
+
+class BaseTestOptimizerRenamingBoxes(BaseTestMultiLabel):
+
+def _do_optimize_loop(self, loop, call_pure_results):
+from pypy.jit.metainterp.optimizeopt.unroll import optimize_unroll
+from pypy.jit.metainterp.optimizeopt.util import args_dict
+from pypy.jit.metainterp.optimizeopt.pure import OptPure
+
+self.loop = loop
+loop.call_pure_results = args_dict()
+metainterp_sd = FakeMetaInterpStaticData(self.cpu)
+optimize_unroll(metainterp_sd, loop, [OptRenameStrlen(), OptPure()], 
True)
+
+def test_optimizer_renaming_boxes(self):
+ops = 
+[p1]
+i1 = strlen(p1)
+label(p1)
+i2 = strlen(p1)
+i3 = int_add(i2, 7)
+jump(p1)
+
+expected = 
+[p1]
+i1 = strlen(p1)
+label(p1, i1)
+i11 = same_as(i1)
+i2 = int_add(i11, 7)
+jump(p1, i11)
+
+self.optimize_loop(ops, expected)
+
+
+
+class TestLLtype(OptimizeoptTestMultiLabel, LLtypeMixin):
 pass
 
+class TestOptimizerRenamingBoxesLLtype(BaseTestOptimizerRenamingBoxes, 
LLtypeMixin):
+pass
diff --git a/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py 
b/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py
--- a/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py
+++ b/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py
@@ -7759,7 +7759,7 @@
 jump(i0, p0, i2)
 
 self.optimize_loop(ops, expected)
-
+
 class TestLLtype(OptimizeOptTest, LLtypeMixin):
 pass
 
diff --git a/pypy/jit/metainterp/optimizeopt/unroll.py 
b/pypy/jit/metainterp/optimizeopt/unroll.py
--- a/pypy/jit/metainterp/optimizeopt/unroll.py
+++ b/pypy/jit/metainterp/optimizeopt/unroll.py
@@ -269,10 +269,8 @@
 # in case it does, we would prefer to be suboptimal in asm
 # to a fatal RPython exception.
 if newresult is not op.result and not newvalue.is_constant():
-# XXX fix me?
-#self.short_boxes.alias(newresult, op.result)
 op = ResOperation(rop.SAME_AS, [op.result], newresult)
-self.optimizer._newoperations = [op] + 
self.optimizer._newoperations
+

[pypy-commit] pypy default: Simplify the graph before turning it into a generator, to get rid

2011-12-26 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: 
Changeset: r50873:d373deb39b4d
Date: 2011-12-26 15:22 +0100
http://bitbucket.org/pypy/pypy/changeset/d373deb39b4d/

Log:Simplify the graph before turning it into a generator, to get rid of
the extra variables passed around.

diff --git a/pypy/translator/generator.py b/pypy/translator/generator.py
--- a/pypy/translator/generator.py
+++ b/pypy/translator/generator.py
@@ -2,7 +2,7 @@
 from pypy.objspace.flow.model import Variable, Constant, FunctionGraph
 from pypy.translator.unsimplify import insert_empty_startblock
 from pypy.translator.unsimplify import split_block
-from pypy.translator.simplify import eliminate_empty_blocks
+from pypy.translator.simplify import eliminate_empty_blocks, simplify_graph
 from pypy.tool.sourcetools import func_with_new_name
 from pypy.interpreter.argument import Signature
 
@@ -64,6 +64,7 @@
 def next(self):
 entry = self.current
 self.current = None
+assert entry is not None  # else, recursive generator invocation
 (next_entry, return_value) = func(entry)
 self.current = next_entry
 return return_value
@@ -91,6 +92,10 @@
 block.inputargs = [v_entry1]
 
 def tweak_generator_body_graph(Entry, graph):
+# First, always run simplify_graph in order to reduce the number of
+# variables passed around
+simplify_graph(graph)
+#
 assert graph.startblock.operations[0].opname == 'generator_mark'
 graph.startblock.operations.pop(0)
 #
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Fix the test.

2011-12-26 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: 
Changeset: r50875:cce139c7a9c6
Date: 2011-12-26 15:31 +0100
http://bitbucket.org/pypy/pypy/changeset/cce139c7a9c6/

Log:Fix the test.

diff --git a/pypy/translator/generator.py b/pypy/translator/generator.py
--- a/pypy/translator/generator.py
+++ b/pypy/translator/generator.py
@@ -105,12 +105,20 @@
 #
 mappings = [Entry]
 #
+stopblock = Block([])
+v0 = Variable(); v1 = Variable()
+stopblock.operations = [
+SpaceOperation('simple_call', [Constant(StopIteration)], v0),
+SpaceOperation('type', [v0], v1),
+]
+stopblock.closeblock(Link([v1, v0], graph.exceptblock))
+#
 for block in list(graph.iterblocks()):
 for exit in block.exits:
 if exit.target is graph.returnblock:
-exit.args = [Constant(StopIteration),
- Constant(StopIteration())]
-exit.target = graph.exceptblock
+exit.args = []
+exit.target = stopblock
+assert block is not stopblock
 for index in range(len(block.operations)-1, -1, -1):
 op = block.operations[index]
 if op.opname == 'yield':
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: Add Leysin draft announcement

2011-12-26 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: extradoc
Changeset: r3991:9091b9fd97f8
Date: 2011-12-26 16:34 +0100
http://bitbucket.org/pypy/extradoc/changeset/9091b9fd97f8/

Log:Add Leysin draft announcement

diff --git a/sprintinfo/leysin-winter-2011/announcement.txt 
b/sprintinfo/leysin-winter-2012/announcement.txt
copy from sprintinfo/leysin-winter-2011/announcement.txt
copy to sprintinfo/leysin-winter-2012/announcement.txt
--- a/sprintinfo/leysin-winter-2011/announcement.txt
+++ b/sprintinfo/leysin-winter-2012/announcement.txt
@@ -1,30 +1,16 @@
 =
- PyPy Leysin Winter Sprint (16-22nd January 2011)
+ PyPy Leysin Winter Sprint (15-22nd January 2012)
 =
 
 The next PyPy sprint will be in Leysin, Switzerland, for the
-seventh time.  This is a fully public sprint: newcomers and topics
+eighth time.  This is a fully public sprint: newcomers and topics
 other than those proposed below are welcome.
 
 --
 Goals and topics of the sprint
 --
 
-* Now that we have released 1.4, and plan to release 1.4.1 soon
-  (possibly before the sprint), the sprint itself is going to be
-  mainly working on fixing issues reported by various users. Of
-  course this does not prevent people from showing up with a more
-  precise interest in mind.  If there are newcomers, we will gladly
-  give introduction talks.
-
-* We will also work on polishing and merging the long-standing
-  branches that are around, which could eventually lead to the
-  next PyPy release.  These branches are notably:
-
-  - fast-forward (Python 2.7 support, by Benjamin, Amaury, and others)
-  - jit-unroll-loops (improve JITting of smaller loops, by Hakan)
-  - arm-backend (a JIT backend for ARM, by David)
-  - jitypes2 (fast ctypes calls with the JIT, by Antonio).
+* xxx
 
 * And as usual, the main side goal is to have fun in winter sports :-)
   We can take a day off for ski.
@@ -33,8 +19,9 @@
 Exact times
 ---
 
-The work days should be 16-22 January 2011.  People may arrive on
-the 15th already and/or leave on the 23rd.
+The work days should be 15-21 January 2011 (Sunday-Saturday).  The
+official plans are for people to arrive on the 14th or the 15th, and to
+leave on the 22nd.
 
 ---
 Location  Accomodation
@@ -56,13 +43,14 @@
 expensive) and maybe the possibility to get a single room if you really want
 to.
 
-Please register by svn:
+Please register by Mercurial::
 
-  
http://codespeak.net/svn/pypy/extradoc/sprintinfo/leysin-winter-2011/people.txt
+  https://bitbucket.org/pypy/extradoc/
+  
https://bitbucket.org/pypy/extradoc/raw/extradoc/sprintinfo/leysin-winter-2012
 
-or on the pypy-sprint mailing list if you do not yet have check-in rights:
+or on the pypy-dev mailing list if you do not yet have check-in rights:
 
-  http://codespeak.net/mailman/listinfo/pypy-sprint
+  http://mail.python.org/mailman/listinfo/pypy-dev
 
 You need a Swiss-to-(insert country here) power adapter.  There will be
 some Swiss-to-EU adapters around -- bring a EU-format power strip if you
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: Add the standard people.txt

2011-12-26 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: extradoc
Changeset: r3992:fc335a8ec80e
Date: 2011-12-26 16:38 +0100
http://bitbucket.org/pypy/extradoc/changeset/fc335a8ec80e/

Log:Add the standard people.txt

diff --git a/sprintinfo/leysin-winter-2012/people.txt 
b/sprintinfo/leysin-winter-2012/people.txt
new file mode 100644
--- /dev/null
+++ b/sprintinfo/leysin-winter-2012/people.txt
@@ -0,0 +1,57 @@
+
+People coming to the Leysin sprint Winter 2011
+==
+
+People who have a ``?`` in their arrive/depart or accomodation
+column are known to be coming but there are no details 
+available yet from them.
+
+
+ == ===
+Name  Arrive/Depart Accomodation 
+ == ===
+Armin Rigo  private
+ == ===
+
+
+People on the following list were present at previous sprints: 
+
+ == =
+   Name  Arrive/Depart  Accomodation 
+ == =
+Antonio Cuni ?  ?
+Michael Foord?  ?
+Maciej Fijalkowski   ?  ?
+David Schneider  ?  ?
+Jacob Hallen ?  ?
+Laura Creighton  ?  ?
+Hakan Ardo   ?  ?
+Carl Friedrich Bolz  ?  ?
+Samuele Pedroni  ?  ?
+Anders Hammarquist   ?  ?
+Christian Tismer ?  ?
+Niko Matsakis?  ?
+Toby Watson  ?  ?
+Paul deGrandis   ?  ?
+Michael Hudson   ?  ?
+Anders Lehmann   ?  ?
+Niklaus Haldimann?  ?
+Lene Wagner  ?  ?
+Amaury Forgeot d'Arc ?  ?
+Valentino Volonghi   ?  ?
+Boris Feigin?  ?
+Andrew Thompson  ?  ?
+Bert Freudenberg ?  ?
+Beatrice Duering ?  ?
+Richard Emslie   ?  ?
+Johan Hahn   ?  ?
+Stephan Diehl?  ?
+Alexander Schremmer  ?  ?
+Anders Chrigstroem   ?  ?
+Eric van Riet Paap   ?  ?
+Holger Krekel?  ?
+Guido Wesdorp?  ?
+Leonardo Santagada   ?  ?
+Alexandre Fayolle?  ?
+Sylvain Th#65533;nault ?  ?
+ == =
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy jit-improve-nested-loops: fix test

2011-12-26 Thread hakanardo
Author: Hakan Ardo ha...@debian.org
Branch: jit-improve-nested-loops
Changeset: r50877:be85523c5872
Date: 2011-12-26 14:11 +0100
http://bitbucket.org/pypy/pypy/changeset/be85523c5872/

Log:fix test

diff --git a/pypy/jit/metainterp/test/test_loop.py 
b/pypy/jit/metainterp/test/test_loop.py
--- a/pypy/jit/metainterp/test/test_loop.py
+++ b/pypy/jit/metainterp/test/test_loop.py
@@ -756,7 +756,7 @@
 res = self.meta_interp(interpret, [1])
 assert res == interpret(1)
 # XXX it's unsure how many loops should be there
-self.check_trace_count(3)
+self.check_trace_count(2)
 
 def test_path_with_operations_not_from_start(self):
 jitdriver = JitDriver(greens = ['k'], reds = ['n', 'z'])
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy jit-improve-nested-loops: more generally ensure that TargetTokens of labels has the correct original_jitcell_token

2011-12-26 Thread hakanardo
Author: Hakan Ardo ha...@debian.org
Branch: jit-improve-nested-loops
Changeset: r50878:5706bc85eb3b
Date: 2011-12-26 16:57 +0100
http://bitbucket.org/pypy/pypy/changeset/5706bc85eb3b/

Log:more generally ensure that TargetTokens of labels has the correct
original_jitcell_token

diff --git a/pypy/jit/metainterp/compile.py b/pypy/jit/metainterp/compile.py
--- a/pypy/jit/metainterp/compile.py
+++ b/pypy/jit/metainterp/compile.py
@@ -176,10 +176,10 @@
 loop.original_jitcell_token = jitcell_token
 for label in all_target_tokens:
 assert isinstance(label, TargetToken)
-label.original_jitcell_token = jitcell_token
 if label.virtual_state and label.short_preamble:
 metainterp_sd.logger_ops.log_short_preamble([], 
label.short_preamble)
 jitcell_token.target_tokens = all_target_tokens
+propagate_original_jitcell_token(loop)
 send_loop_to_backend(greenkey, jitdriver_sd, metainterp_sd, loop, loop)
 record_loop_or_bridge(metainterp_sd, loop)
 return all_target_tokens[0]
@@ -247,11 +247,11 @@
 for box in loop.inputargs:
 assert isinstance(box, Box)
 
-target_token = loop.operations[-1].getdescr()
+target_token = loop.operations[-1].getdescr()
 resumekey.compile_and_attach(metainterp, loop)
+
 target_token = label.getdescr()
 assert isinstance(target_token, TargetToken)
-target_token.original_jitcell_token = loop.original_jitcell_token
 record_loop_or_bridge(metainterp_sd, loop)
 return target_token
 
@@ -288,6 +288,15 @@
 assert i == len(inputargs)
 loop.operations = extra_ops + loop.operations
 
+def propagate_original_jitcell_token(trace):
+for op in trace.operations:
+if op.getopnum() == rop.LABEL:
+token = op.getdescr()
+assert isinstance(token, TargetToken)
+assert token.original_jitcell_token is None
+token.original_jitcell_token = trace.original_jitcell_token
+
+
 def send_loop_to_backend(greenkey, jitdriver_sd, metainterp_sd, loop, type):
 vinfo = jitdriver_sd.virtualizable_info
 if vinfo is not None:
@@ -558,6 +567,7 @@
 inputargs = metainterp.history.inputargs
 if not we_are_translated():
 self._debug_suboperations = new_loop.operations
+propagate_original_jitcell_token(new_loop)
 send_bridge_to_backend(metainterp.jitdriver_sd, metainterp.staticdata,
self, inputargs, new_loop.operations,
new_loop.original_jitcell_token)
@@ -744,6 +754,7 @@
 jitdriver_sd = metainterp.jitdriver_sd
 redargs = new_loop.inputargs
 new_loop.original_jitcell_token = jitcell_token = 
make_jitcell_token(jitdriver_sd)
+propagate_original_jitcell_token(new_loop)
 send_loop_to_backend(self.original_greenkey, metainterp.jitdriver_sd,
  metainterp_sd, new_loop, entry bridge)
 # send the new_loop to warmspot.py, to be called directly the next time
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Fix comment, and simplify the final logic.

2011-12-26 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: 
Changeset: r50879:f9932c00e2d2
Date: 2011-12-26 17:07 +0100
http://bitbucket.org/pypy/pypy/changeset/f9932c00e2d2/

Log:Fix comment, and simplify the final logic.

diff --git a/pypy/objspace/std/stringobject.py 
b/pypy/objspace/std/stringobject.py
--- a/pypy/objspace/std/stringobject.py
+++ b/pypy/objspace/std/stringobject.py
@@ -537,7 +537,7 @@
 builder.append(by)
 builder.append_slice(input, upper, len(input))
 else:
-# An ok guess for the result size
+# First compute the exact result size
 count = input.count(sub)
 if count  maxsplit and maxsplit  0:
 count = maxsplit
@@ -553,21 +553,16 @@
 builder = StringBuilder(result_size)
 start = 0
 sublen = len(sub)
-first = True
 
 while maxsplit != 0:
 next = input.find(sub, start)
 if next  0:
 break
-if not first:
-builder.append(by)
-first = False
 builder.append_slice(input, start, next)
+builder.append(by)
 start = next + sublen
 maxsplit -= 1   # NB. if it's already  0, it stays  0
 
-if not first:
-builder.append(by)
 builder.append_slice(input, start, len(input))
 
 return space.wrap(builder.build())
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: another attempt to remove a very confusing raise

2011-12-26 Thread fijal
Author: Maciej Fijalkowski fij...@gmail.com
Branch: 
Changeset: r50880:a6b6b5a373a1
Date: 2011-12-26 21:18 +0200
http://bitbucket.org/pypy/pypy/changeset/a6b6b5a373a1/

Log:another attempt to remove a very confusing raise

diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -619,7 +619,8 @@
   self.descr_reqcls,
   args)
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -655,7 +656,8 @@
   self.descr_reqcls,
   args)
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -674,7 +676,8 @@
   self.descr_reqcls,
   args.prepend(w_obj))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -690,7 +693,8 @@
 raise OperationError(space.w_SystemError,
  space.wrap(unexpected DescrMismatch error))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -708,7 +712,8 @@
self.descr_reqcls,
Arguments(space, [w1]))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -726,7 +731,8 @@
self.descr_reqcls,
Arguments(space, [w1, w2]))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -744,7 +750,8 @@
self.descr_reqcls,
Arguments(space, [w1, w2, w3]))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -763,7 +770,8 @@
Arguments(space,
  [w1, w2, w3, w4]))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: remove some unnecessary copies (they used to be necessary, not any more)

2011-12-26 Thread fijal
Author: Maciej Fijalkowski fij...@gmail.com
Branch: 
Changeset: r50881:c3142d5c9c35
Date: 2011-12-26 22:23 +0200
http://bitbucket.org/pypy/pypy/changeset/c3142d5c9c35/

Log:remove some unnecessary copies (they used to be necessary, not any
more)

diff --git a/pypy/module/micronumpy/interp_numarray.py 
b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -578,8 +578,8 @@
 strides.append(concrete.strides[i])
 backstrides.append(concrete.backstrides[i])
 shape.append(concrete.shape[i])
-return space.wrap(W_NDimSlice(concrete.start, strides[:],
-  backstrides[:], shape[:], concrete))
+return space.wrap(W_NDimSlice(concrete.start, strides,
+  backstrides, shape, concrete))
 
 def descr_get_flatiter(self, space):
 return space.wrap(W_FlatIterator(self))
@@ -820,8 +820,8 @@
 if self.order == 'C':
 strides.reverse()
 backstrides.reverse()
-self.strides = strides[:]
-self.backstrides = backstrides[:]
+self.strides = strides
+self.backstrides = backstrides
 
 def array_sig(self, res_shape):
 if res_shape is not None and self.shape != res_shape:
@@ -1025,9 +1025,9 @@
 strides.reverse()
 backstrides.reverse()
 new_shape.reverse()
-self.strides = strides[:]
-self.backstrides = backstrides[:]
-self.shape = new_shape[:]
+self.strides = strides
+self.backstrides = backstrides
+self.shape = new_shape
 return
 new_strides = calc_new_strides(new_shape, self.shape, self.strides)
 if new_strides is None:
@@ -1037,7 +1037,7 @@
 for nd in range(len(new_shape)):
 new_backstrides[nd] = (new_shape[nd] - 1) * new_strides[nd]
 self.strides = new_strides[:]
-self.backstrides = new_backstrides[:]
+self.backstrides = new_backstrides
 self.shape = new_shape[:]
 
 class W_NDimArray(ConcreteArray):
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: it's fine to inline this.

2011-12-26 Thread alex_gaynor
Author: Alex Gaynor alex.gay...@gmail.com
Branch: 
Changeset: r50882:21bb1c0bd208
Date: 2011-12-26 15:05 -0600
http://bitbucket.org/pypy/pypy/changeset/21bb1c0bd208/

Log:it's fine to inline this.

diff --git a/pypy/jit/codewriter/support.py b/pypy/jit/codewriter/support.py
--- a/pypy/jit/codewriter/support.py
+++ b/pypy/jit/codewriter/support.py
@@ -162,7 +162,6 @@
 _ll_4_list_setslice = rlist.ll_listsetslice
 _ll_2_list_delslice_startonly = rlist.ll_listdelslice_startonly
 _ll_3_list_delslice_startstop = rlist.ll_listdelslice_startstop
-_ll_1_list_list2fixed = lltypesystem_rlist.ll_list2fixed
 _ll_2_list_inplace_mul = rlist.ll_inplace_mul
 
 _ll_2_list_getitem_foldable = _ll_2_list_getitem
diff --git a/pypy/rpython/lltypesystem/rlist.py 
b/pypy/rpython/lltypesystem/rlist.py
--- a/pypy/rpython/lltypesystem/rlist.py
+++ b/pypy/rpython/lltypesystem/rlist.py
@@ -375,7 +375,6 @@
 newitems = malloc(LIST.items.TO, n)
 rgc.ll_arraycopy(olditems, newitems, 0, 0, n)
 return newitems
-ll_list2fixed.oopspec = 'list.list2fixed(l)'
 
 def ll_list2fixed_exact(l):
 ll_assert(l.length == len(l.items), ll_list2fixed_exact: bad length)
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: merged upstream

2011-12-26 Thread alex_gaynor
Author: Alex Gaynor alex.gay...@gmail.com
Branch: 
Changeset: r50883:a0b6f54563e6
Date: 2011-12-26 15:06 -0600
http://bitbucket.org/pypy/pypy/changeset/a0b6f54563e6/

Log:merged upstream

diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -619,7 +619,8 @@
   self.descr_reqcls,
   args)
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -655,7 +656,8 @@
   self.descr_reqcls,
   args)
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -674,7 +676,8 @@
   self.descr_reqcls,
   args.prepend(w_obj))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -690,7 +693,8 @@
 raise OperationError(space.w_SystemError,
  space.wrap(unexpected DescrMismatch error))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -708,7 +712,8 @@
self.descr_reqcls,
Arguments(space, [w1]))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -726,7 +731,8 @@
self.descr_reqcls,
Arguments(space, [w1, w2]))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -744,7 +750,8 @@
self.descr_reqcls,
Arguments(space, [w1, w2, w3]))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
@@ -763,7 +770,8 @@
Arguments(space,
  [w1, w2, w3, w4]))
 except Exception, e:
-raise self.handle_exception(space, e)
+self.handle_exception(space, e)
+w_result = None
 if w_result is None:
 w_result = space.w_None
 return w_result
diff --git a/pypy/module/micronumpy/interp_numarray.py 
b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -578,8 +578,8 @@
 strides.append(concrete.strides[i])
 backstrides.append(concrete.backstrides[i])
 shape.append(concrete.shape[i])
-return space.wrap(W_NDimSlice(concrete.start, strides[:],
-  backstrides[:], shape[:], concrete))
+return space.wrap(W_NDimSlice(concrete.start, strides,
+  backstrides, shape, concrete))
 
 def descr_get_flatiter(self, space):
 return space.wrap(W_FlatIterator(self))
@@ -820,8 +820,8 @@
 if self.order == 'C':
 strides.reverse()
 backstrides.reverse()
-self.strides = strides[:]
-self.backstrides = backstrides[:]
+self.strides = strides
+self.backstrides = backstrides
 
 def array_sig(self, res_shape):
 if res_shape is not None and self.shape != res_shape:
@@ -1025,9 +1025,9 @@
 strides.reverse()
 backstrides.reverse()
 new_shape.reverse()
-self.strides = strides[:]
-self.backstrides = backstrides[:]
-self.shape = new_shape[:]
+self.strides = strides
+self.backstrides = backstrides
+

[pypy-commit] jitviewer default: move stuff around - helps with setup.py develop

2011-12-26 Thread fijal
Author: Maciej Fijalkowski fij...@gmail.com
Branch: 
Changeset: r178:1d7244f7b370
Date: 2011-12-26 23:11 +0200
http://bitbucket.org/pypy/jitviewer/changeset/1d7244f7b370/

Log:move stuff around - helps with setup.py develop

diff --git a/_jitviewer/static/DroidSansMono.ttf b/static/DroidSansMono.ttf
rename from _jitviewer/static/DroidSansMono.ttf
rename to static/DroidSansMono.ttf
diff --git a/_jitviewer/static/jquery-1.2.6.min.js b/static/jquery-1.2.6.min.js
rename from _jitviewer/static/jquery-1.2.6.min.js
rename to static/jquery-1.2.6.min.js
diff --git a/_jitviewer/static/jquery.min.js b/static/jquery.min.js
rename from _jitviewer/static/jquery.min.js
rename to static/jquery.min.js
diff --git a/_jitviewer/static/jquery.scrollTo-1.4.1.js 
b/static/jquery.scrollTo-1.4.1.js
rename from _jitviewer/static/jquery.scrollTo-1.4.1.js
rename to static/jquery.scrollTo-1.4.1.js
diff --git a/_jitviewer/static/jquery.scrollTo-1.4.2-min.js 
b/static/jquery.scrollTo-1.4.2-min.js
rename from _jitviewer/static/jquery.scrollTo-1.4.2-min.js
rename to static/jquery.scrollTo-1.4.2-min.js
diff --git a/_jitviewer/static/loop.js b/static/loop.js
rename from _jitviewer/static/loop.js
rename to static/loop.js
diff --git a/_jitviewer/static/pygments.css b/static/pygments.css
rename from _jitviewer/static/pygments.css
rename to static/pygments.css
diff --git a/_jitviewer/static/qt_workaround.css b/static/qt_workaround.css
rename from _jitviewer/static/qt_workaround.css
rename to static/qt_workaround.css
diff --git a/_jitviewer/static/script.js b/static/script.js
rename from _jitviewer/static/script.js
rename to static/script.js
diff --git a/_jitviewer/static/style.css b/static/style.css
rename from _jitviewer/static/style.css
rename to static/style.css
diff --git a/_jitviewer/templates/index.html b/templates/index.html
rename from _jitviewer/templates/index.html
rename to templates/index.html
diff --git a/_jitviewer/templates/loop.html b/templates/loop.html
rename from _jitviewer/templates/loop.html
rename to templates/loop.html
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: some tests and fixes

2011-12-26 Thread fijal
Author: Maciej Fijalkowski fij...@gmail.com
Branch: 
Changeset: r50884:40a95aa4967f
Date: 2011-12-26 23:36 +0200
http://bitbucket.org/pypy/pypy/changeset/40a95aa4967f/

Log:some tests and fixes

diff --git a/pypy/tool/jitlogparser/parser.py b/pypy/tool/jitlogparser/parser.py
--- a/pypy/tool/jitlogparser/parser.py
+++ b/pypy/tool/jitlogparser/parser.py
@@ -389,14 +389,22 @@
 return log, loops
 
 def split_trace(trace):
-labels = [i for i, op in enumerate(trace.operations)
-  if op.name == 'label']
-labels = [0] + labels + [len(trace.operations) - 1]
+labels = [0]
+if trace.comment and 'Guard' in trace.comment:
+descrs = ['bridge ' + re.search('Guard (\d+)', trace.comment).group(1)]
+else:
+descrs = ['']
+for i, op in enumerate(trace.operations):
+if op.name == 'label':
+labels.append(i)
+descrs.append(op.descr)
+labels.append(len(trace.operations) - 1)
 parts = []
 for i in range(len(labels) - 1):
 start, stop = labels[i], labels[i+1]
 part = copy(trace)
 part.operations = trace.operations[start : stop + 1]
+part.descr = descrs[i]
 parts.append(part)
 
 return parts
@@ -407,11 +415,7 @@
 lines = input[-1].splitlines()
 mapping = {}
 for loop in loops:
-com = loop.comment
-if 'Loop' in com:
-mapping['loop ' + re.search('Loop (\d+)', com).group(1)] = loop
-else:
-mapping['bridge ' + re.search('Guard (\d+)', com).group(1)] = loop
+mapping[loop.descr] = loop
 for line in lines:
 if line:
 num, count = line.split(':', 2)
diff --git a/pypy/tool/jitlogparser/test/test_parser.py 
b/pypy/tool/jitlogparser/test/test_parser.py
--- a/pypy/tool/jitlogparser/test/test_parser.py
+++ b/pypy/tool/jitlogparser/test/test_parser.py
@@ -1,6 +1,7 @@
 from pypy.tool.jitlogparser.parser import (SimpleParser, TraceForOpcode,
Function, adjust_bridges,
-   import_log, split_trace, Op)
+   import_log, split_trace, Op,
+   parse_log_counts)
 from pypy.tool.jitlogparser.storage import LoopStorage
 import py, sys
 
@@ -236,10 +237,10 @@
 loop = parse('''
 [i7]
 i9 = int_lt(i7, 1003)
-label(i9)
+label(i9, descr=grrr)
 guard_true(i9, descr=Guard2) []
 i13 = getfield_raw(151937600, descr=SignedFieldDescr 
pypysig_long_struct.c_value 0)
-label(i13)
+label(i13, descr=asb)
 i19 = int_lt(i13, 1003)
 guard_true(i19, descr=Guard2) []
 i113 = getfield_raw(151937600, descr=SignedFieldDescr 
pypysig_long_struct.c_value 0)
@@ -249,3 +250,32 @@
 assert len(parts[0].operations) == 2
 assert len(parts[1].operations) == 4
 assert len(parts[2].operations) == 4
+assert parts[1].descr == 'grrr'
+assert parts[2].descr == 'asb'
+
+def test_parse_log_counts():
+loop = parse('''
+[i7]
+i9 = int_lt(i7, 1003)
+label(i9, descr=grrr)
+guard_true(i9, descr=Guard2) []
+i13 = getfield_raw(151937600, descr=SignedFieldDescr 
pypysig_long_struct.c_value 0)
+label(i13, descr=asb)
+i19 = int_lt(i13, 1003)
+guard_true(i19, descr=Guard3) []
+i113 = getfield_raw(151937600, descr=SignedFieldDescr 
pypysig_long_struct.c_value 0)
+''')
+bridge = parse('''
+# bridge out of Guard 2 with 1 ops
+[]
+i0 = int_lt(1, 2)
+finish(i0)
+''')
+bridge.comment = 'bridge out of Guard 2 with 1 ops'
+loop.comment = ''
+loops = split_trace(loop) + split_trace(bridge)
+input = ['grrr:123\nasb:12\nbridge 2:1234']
+parse_log_counts(input, loops)
+assert loops[-1].count == 1234
+assert loops[1].count == 123
+assert loops[2].count == 12
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: merge

2011-12-26 Thread fijal
Author: Maciej Fijalkowski fij...@gmail.com
Branch: 
Changeset: r50885:cc6d58803952
Date: 2011-12-26 23:38 +0200
http://bitbucket.org/pypy/pypy/changeset/cc6d58803952/

Log:merge

diff --git a/pypy/jit/codewriter/support.py b/pypy/jit/codewriter/support.py
--- a/pypy/jit/codewriter/support.py
+++ b/pypy/jit/codewriter/support.py
@@ -162,7 +162,6 @@
 _ll_4_list_setslice = rlist.ll_listsetslice
 _ll_2_list_delslice_startonly = rlist.ll_listdelslice_startonly
 _ll_3_list_delslice_startstop = rlist.ll_listdelslice_startstop
-_ll_1_list_list2fixed = lltypesystem_rlist.ll_list2fixed
 _ll_2_list_inplace_mul = rlist.ll_inplace_mul
 
 _ll_2_list_getitem_foldable = _ll_2_list_getitem
diff --git a/pypy/rpython/lltypesystem/rlist.py 
b/pypy/rpython/lltypesystem/rlist.py
--- a/pypy/rpython/lltypesystem/rlist.py
+++ b/pypy/rpython/lltypesystem/rlist.py
@@ -375,7 +375,6 @@
 newitems = malloc(LIST.items.TO, n)
 rgc.ll_arraycopy(olditems, newitems, 0, 0, n)
 return newitems
-ll_list2fixed.oopspec = 'list.list2fixed(l)'
 
 def ll_list2fixed_exact(l):
 ll_assert(l.length == len(l.items), ll_list2fixed_exact: bad length)
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: split while doing import

2011-12-26 Thread fijal
Author: Maciej Fijalkowski fij...@gmail.com
Branch: 
Changeset: r50886:c8ddbb442986
Date: 2011-12-26 23:40 +0200
http://bitbucket.org/pypy/pypy/changeset/c8ddbb442986/

Log:split while doing import

diff --git a/pypy/tool/jitlogparser/parser.py b/pypy/tool/jitlogparser/parser.py
--- a/pypy/tool/jitlogparser/parser.py
+++ b/pypy/tool/jitlogparser/parser.py
@@ -385,7 +385,7 @@
   parser.postprocess(loop, backend_tp=bname,
  backend_dump=dump,
  dump_start=start_ofs))
-loops.append(loop)
+loops += split_trace(loop)
 return log, loops
 
 def split_trace(trace):
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit