[pypy-commit] pypy cpyext-ext: (ronan, fijal) add stubs for datetime object

2016-02-25 Thread fijal
Author: fijal
Branch: cpyext-ext
Changeset: r82524:ea86b9ae3ca6
Date: 2016-02-25 22:26 +0100
http://bitbucket.org/pypy/pypy/changeset/ea86b9ae3ca6/

Log:(ronan, fijal) add stubs for datetime object

diff --git a/pypy/module/cpyext/cdatetime.py b/pypy/module/cpyext/cdatetime.py
--- a/pypy/module/cpyext/cdatetime.py
+++ b/pypy/module/cpyext/cdatetime.py
@@ -42,9 +42,15 @@
 
 return datetimeAPI
 
-PyDateTime_Date = PyObject
-PyDateTime_Time = PyObject
-PyDateTime_DateTime = PyObject
+PyDateTime_DateStruct = lltype.ForwardReference()
+PyDateTime_TimeStruct = lltype.ForwardReference()
+PyDateTime_DateTimeStruct = lltype.ForwardReference()
+cpython_struct("PyDateTime_Date", PyObjectFields, PyDateTime_DateStruct)
+PyDateTime_Date = lltype.Ptr(PyDateTime_DateStruct)
+cpython_struct("PyDateTime_Time", PyObjectFields, PyDateTime_TimeStruct)
+PyDateTime_Time = lltype.Ptr(PyDateTime_TimeStruct)
+cpython_struct("PyDateTime_DateTime", PyObjectFields, 
PyDateTime_DateTimeStruct)
+PyDateTime_DateTime = lltype.Ptr(PyDateTime_DateTimeStruct)
 
 PyDeltaObjectStruct = lltype.ForwardReference()
 cpython_struct("PyDateTime_Delta", PyObjectFields, PyDeltaObjectStruct)
diff --git a/pypy/module/cpyext/include/datetime.h 
b/pypy/module/cpyext/include/datetime.h
--- a/pypy/module/cpyext/include/datetime.h
+++ b/pypy/module/cpyext/include/datetime.h
@@ -24,6 +24,18 @@
 PyObject_HEAD
 } PyDateTime_Delta;
 
+typedef struct {
+PyObject_HEAD
+} PyDateTime_Date;
+
+typedef struct {
+PyObject_HEAD
+} PyDateTime_Time;
+
+typedef struct {
+PyObject_HEAD
+} PyDateTime_DateTime;
+
 #ifdef __cplusplus
 }
 #endif
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (plan_rich, remi) replace is_callee_lookup with attribute on regloc

2016-02-25 Thread Raemi
Author: Remi Meier 
Branch: fix-longevity
Changeset: r82523:491569178ceb
Date: 2016-02-25 19:40 +0100
http://bitbucket.org/pypy/pypy/changeset/491569178ceb/

Log:(plan_rich,remi) replace is_callee_lookup with attribute on regloc

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -279,7 +279,6 @@
 # TODO would be good to keep free_caller_regs sorted (according to the ABI)
 free_callee_regs  = []
 free_caller_regs  = []
-is_callee_lookup  = None
 
 def get_lower_byte_free_register(self, reg):
 # try to return a volatile register first!
@@ -346,13 +345,13 @@
 self.remove_free_register(r)
 
 def remove_free_register(self, reg):
-if self.is_callee_lookup[reg.value]:
+if not reg.save_around_calls:
 self.free_callee_regs = [fr for fr in self.free_callee_regs if fr 
is not reg]
 else:
 self.free_caller_regs = [fr for fr in self.free_caller_regs if fr 
is not reg]
 
 def put_back_register(self, reg):
-if self.is_callee_lookup[reg.value]:
+if not reg.save_around_calls:
 self.free_callee_regs.append(reg)
 else:
 self.free_caller_regs.append(reg)
@@ -374,14 +373,10 @@
 self.save_in_callee_regs = [reg for reg in all_regs
 if reg not in save_around_call_regs]
 self._reinit_free_regs()
-if we_are_translated():
-self.is_callee_lookup = [True] * len(self.all_regs)
-else:
-# in tests the len of all_regs can change
-values = [r.value + 1 for r in self.all_regs]
-self.is_callee_lookup = [True] * max(values)
-for reg in self.save_around_call_regs:
-self.is_callee_lookup[reg.value] = False
+if not we_are_translated():
+# in tests we need to update regloc.save_around_calls
+for r in self.all_regs:
+r.save_around_calls = r in save_around_call_regs
 
 def __init__(self, live_ranges, frame_manager=None, assembler=None):
 self._change_regs(self.all_regs, self.save_around_call_regs)
diff --git a/rpython/jit/backend/x86/regalloc.py 
b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -39,6 +39,8 @@
 no_lower_byte_regs = [esi, edi]
 save_around_call_regs = [eax, edx, ecx]
 frame_reg = ebp
+for r in all_regs:
+r.save_around_calls = r in save_around_call_regs
 
 def call_result_location(self, v):
 return eax
@@ -61,6 +63,9 @@
 abi_param_regs = [edi, esi, ecx, r8, r9]
 save_around_call_regs = abi_param_regs + [eax, edx, r10]
 
+for r in all_regs:
+r.save_around_calls = r in save_around_call_regs
+
 def get_abi_param_register(self, i):
 if not IS_X86_32 and 0 <= i < len(self.abi_param_regs):
 return self.abi_param_regs[i]
diff --git a/rpython/jit/backend/x86/regloc.py 
b/rpython/jit/backend/x86/regloc.py
--- a/rpython/jit/backend/x86/regloc.py
+++ b/rpython/jit/backend/x86/regloc.py
@@ -130,6 +130,10 @@
 
 class RegLoc(AssemblerLocation):
 _immutable_ = True
+
+# indicates if the register is caller-save:
+save_around_calls = True
+
 def __init__(self, regnum, is_xmm):
 assert regnum >= 0
 self.value = regnum
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (remi, plan_rich) fixed translation

2016-02-25 Thread plan_rich
Author: Richard Plangger 
Branch: fix-longevity
Changeset: r82522:7cf8129ae01d
Date: 2016-02-25 18:25 +0100
http://bitbucket.org/pypy/pypy/changeset/7cf8129ae01d/

Log:(remi, plan_rich) fixed translation

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -374,8 +374,12 @@
 self.save_in_callee_regs = [reg for reg in all_regs
 if reg not in save_around_call_regs]
 self._reinit_free_regs()
-self.is_callee_lookup = [True] * max(
-[r.value + 1 for r in self.all_regs])
+if we_are_translated():
+self.is_callee_lookup = [True] * len(self.all_regs)
+else:
+# in tests the len of all_regs can change
+values = [r.value + 1 for r in self.all_regs]
+self.is_callee_lookup = [True] * max(values)
 for reg in self.save_around_call_regs:
 self.is_callee_lookup[reg.value] = False
 
diff --git a/rpython/jit/backend/x86/regalloc.py 
b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -281,8 +281,8 @@
 
 def _update_bindings(self, arglocs, inputargs):
 # XXX this should probably go to llsupport/regalloc.py
-used = set()
-used_xmm = set()
+used = {}
+used_xmm = {}
 i = 0
 # manually set the register and frame bindings for
 # all inputargs (for a bridge)
@@ -294,13 +294,13 @@
 if isinstance(loc, RegLoc):
 if arg.type == FLOAT:
 self.xrm.reg_bindings[arg] = loc
-used_xmm.add(loc)
+used_xmm[loc] = None
 else:
 if loc is ebp:
 self.rm.bindings_to_frame_reg[arg] = None
 else:
 self.rm.reg_bindings[arg] = loc
-used.add(loc)
+used[loc] = None
 else:
 self.fm.bind(arg, loc)
 #
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix whatsnew

2016-02-25 Thread fijal
Author: fijal
Branch: 
Changeset: r82520:a3552a8e8c2c
Date: 2016-02-25 17:55 +0100
http://bitbucket.org/pypy/pypy/changeset/a3552a8e8c2c/

Log:fix whatsnew

diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -170,4 +170,17 @@
 
 When creating instances and adding attributes in several different orders
 depending on some condition, the JIT would create too much code. This is now
-fixed.
\ No newline at end of file
+fixed.
+
+.. branch: cpyext-gc-support-2
+
+Improve CPython C API support, which means lxml now runs unmodified
+(after removing pypy hacks, pending pull request)
+
+.. branch: look-inside-tuple-hash
+
+Look inside tuple hash, improving mdp benchmark
+
+.. branch: vlen-resume
+
+Compress resume data, saving 10-20% of memory consumed by the JIT
\ No newline at end of file
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix the test

2016-02-25 Thread fijal
Author: fijal
Branch: 
Changeset: r82519:a53b593b3b95
Date: 2016-02-25 17:53 +0100
http://bitbucket.org/pypy/pypy/changeset/a53b593b3b95/

Log:fix the test

diff --git a/rpython/jit/metainterp/test/test_jitdriver.py 
b/rpython/jit/metainterp/test/test_jitdriver.py
--- a/rpython/jit/metainterp/test/test_jitdriver.py
+++ b/rpython/jit/metainterp/test/test_jitdriver.py
@@ -227,7 +227,7 @@
 i += 1
 
 self.meta_interp(f, [0])
-self.check_resops(enter_portal_frame=1, leave_portal_frame=1)
+self.check_simple_loop(enter_portal_frame=1, leave_portal_frame=1)
 
 class TestLLtype(MultipleJitDriversTests, LLJitMixin):
 pass
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (plan_rich, remi) possibly silghtly improve corner case

2016-02-25 Thread Raemi
Author: Remi Meier 
Branch: fix-longevity
Changeset: r82518:ff9c442e6dc8
Date: 2016-02-25 17:43 +0100
http://bitbucket.org/pypy/pypy/changeset/ff9c442e6dc8/

Log:(plan_rich,remi) possibly silghtly improve corner case

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -667,11 +667,22 @@
 # we need to find a new place for variable v and
 # store result in the same place
 
-loc = self.reg_bindings[v]
-# only spill variable is allowed to reassign a new register to a 
live range
-result_loc = self.force_allocate_reg(result_v, 
forbidden_vars=forbidden_vars)
-self.assembler.regalloc_mov(loc, result_loc)
-loc = result_loc
+if (not self.has_free_registers()
+and self._pick_variable_to_spill(None, forbidden_vars) is v):
+# if we would be chosen for spilling, we give up our register
+# for result_v (and move us away onto the frame) instead of
+# forcing a spill of some other variable.
+loc = self.reg_bindings[v]
+del self.reg_bindings[v]
+if self.frame_manager.get(v) is None:
+self._move_variable_away(v, loc)
+self.reg_bindings[result_v] = loc
+else:
+loc = self.reg_bindings[v]
+# only spill variable is allowed to reassign a new register to 
a live range
+result_loc = self.force_allocate_reg(result_v, 
forbidden_vars=forbidden_vars)
+self.assembler.regalloc_mov(loc, result_loc)
+loc = result_loc
 
 
 #del self.reg_bindings[v]
diff --git a/rpython/jit/backend/x86/regalloc.py 
b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -62,14 +62,22 @@
 save_around_call_regs = abi_param_regs + [eax, edx, r10]
 
 def get_abi_param_register(self, i):
-assert i >= 0 and i < len(self.abi_param_regs)
-return self.abi_param_regs[i]
+if not IS_X86_32 and 0 <= i < len(self.abi_param_regs):
+return self.abi_param_regs[i]
+return None
+
 
 class X86XMMRegisterManager(RegisterManager):
 box_types = [FLOAT, INT] # yes INT!
 all_regs = [xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7]
 # we never need lower byte I hope
 save_around_call_regs = all_regs
+abi_param_regs = all_regs
+
+def get_abi_param_register(self, i):
+if not IS_X86_32 and 0 <= i < len(self.abi_param_regs):
+return self.abi_param_regs[i]
+return None
 
 def convert_to_imm(self, c):
 adr = self.assembler.datablockwrapper.malloc_aligned(8, 8)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Intern keyword arguments.

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82517:34c1abf3cd35
Date: 2016-02-25 17:36 +0100
http://bitbucket.org/pypy/pypy/changeset/34c1abf3cd35/

Log:Intern keyword arguments.

diff --git a/pypy/objspace/std/kwargsdict.py b/pypy/objspace/std/kwargsdict.py
--- a/pypy/objspace/std/kwargsdict.py
+++ b/pypy/objspace/std/kwargsdict.py
@@ -11,7 +11,7 @@
 
 
 def _wrapkey(space, key):
-return space.wrap(key.decode('utf-8'))
+return space.new_interned_str(key)
 
 
 class EmptyKwargsDictStrategy(EmptyDictStrategy):
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py 
b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -1134,6 +1134,9 @@
 def wrapbytes(self, obj):
 return obj
 
+def new_interned_str(self, s):
+return s.decode('utf-8')
+
 def isinstance_w(self, obj, klass):
 return isinstance(obj, klass)
 isinstance = isinstance_w
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: hg merge py3k

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82516:868d62ac2a40
Date: 2016-02-25 17:15 +0100
http://bitbucket.org/pypy/pypy/changeset/868d62ac2a40/

Log:hg merge py3k

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -41,29 +41,29 @@
   Amaury Forgeot d'Arc
   Antonio Cuni
   Samuele Pedroni
+  Matti Picus
   Alex Gaynor
   Brian Kearns
-  Matti Picus
   Philip Jenvey
   Michael Hudson
+  Ronan Lamy
   David Schneider
+  Manuel Jacob
   Holger Krekel
   Christian Tismer
   Hakan Ardo
-  Manuel Jacob
-  Ronan Lamy
   Benjamin Peterson
+  Richard Plangger
   Anders Chrigstrom
   Eric van Riet Paap
   Wim Lavrijsen
-  Richard Plangger
   Richard Emslie
   Alexander Schremmer
   Dan Villiom Podlaski Christiansen
+  Remi Meier
   Lukas Diekmann
   Sven Hager
   Anders Lehmann
-  Remi Meier
   Aurelien Campeas
   Niklaus Haldimann
   Camillo Bruni
@@ -72,8 +72,8 @@
   Romain Guillebert
   Leonardo Santagada
   Seo Sanghyeon
+  Ronny Pfannschmidt
   Justin Peel
-  Ronny Pfannschmidt
   David Edelsohn
   Anders Hammarquist
   Jakub Gustak
@@ -95,6 +95,7 @@
   Tyler Wade
   Michael Foord
   Stephan Diehl
+  Vincent Legoll
   Stefan Schwarzer
   Valentino Volonghi
   Tomek Meka
@@ -105,9 +106,9 @@
   Jean-Paul Calderone
   Timo Paulssen
   Squeaky
+  Marius Gedminas
   Alexandre Fayolle
   Simon Burton
-  Marius Gedminas
   Martin Matusiak
   Konstantin Lopuhin
   Wenzhu Man
@@ -116,16 +117,20 @@
   Ivan Sichmann Freitas
   Greg Price
   Dario Bertini
+  Stefano Rivera
   Mark Pearse
   Simon Cross
   Andreas Sthrk
-  Stefano Rivera
+  Edd Barrett
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
+  Jeremy Thurgood
   Pawe Piotr Przeradowski
+  Spenser Bauman
   Paul deGrandis
   Ilya Osadchiy
+  marky1991
   Tobias Oberstein
   Adrian Kuhn
   Boris Feigin
@@ -134,14 +139,12 @@
   Georg Brandl
   Bert Freudenberg
   Stian Andreassen
-  Edd Barrett
+  Tobias Pape
   Wanja Saatkamp
   Gerald Klix
   Mike Blume
-  Tobias Pape
   Oscar Nierstrasz
   Stefan H. Muller
-  Jeremy Thurgood
   Rami Chowdhury
   Eugene Oden
   Henry Mason
@@ -153,6 +156,8 @@
   Lukas Renggli
   Guenter Jantzen
   Ned Batchelder
+  Tim Felgentreff
+  Anton Gulenko
   Amit Regmi
   Ben Young
   Nicolas Chauvat
@@ -162,12 +167,12 @@
   Nicholas Riley
   Jason Chu
   Igor Trindade Oliveira
-  Tim Felgentreff
+  Yichao Yu
   Rocco Moretti
   Gintautas Miliauskas
   Michael Twomey
   Lucian Branescu Mihaila
-  Yichao Yu
+  Devin Jeanpierre
   Gabriel Lavoie
   Olivier Dormond
   Jared Grubb
@@ -191,33 +196,33 @@
   Stanislaw Halik
   Mikael Schnenberg
   Berkin Ilbeyi
-  Elmo M?ntynen
+  Elmo Mntynen
+  Faye Zhao
   Jonathan David Riehl
   Anders Qvist
   Corbin Simpson
   Chirag Jadwani
   Beatrice During
   Alex Perry
-  Vincent Legoll
+  Vaibhav Sood
   Alan McIntyre
-  Spenser Bauman
+  William Leslie
   Alexander Sedov
   Attila Gobi
+  Jasper.Schulz
   Christopher Pope
-  Devin Jeanpierre
-  Vaibhav Sood
   Christian Tismer 
   Marc Abramowitz
   Dan Stromberg
   Arjun Naik
   Valentina Mukhamedzhanova
   Stefano Parmesan
+  Mark Young
   Alexis Daboville
   Jens-Uwe Mager
   Carl Meyer
   Karl Ramm
   Pieter Zieschang
-  Anton Gulenko
   Gabriel
   Lukas Vacek
   Andrew Dalke
@@ -225,6 +230,7 @@
   Jakub Stasiak
   Nathan Taylor
   Vladimir Kryachko
+  Omer Katz
   Jacek Generowicz
   Alejandro J. Cura
   Jacob Oscarson
@@ -239,6 +245,7 @@
   Lars Wassermann
   Philipp Rustemeuer
   Henrik Vendelbo
+  Richard Lancaster
   Dan Buch
   Miguel de Val Borro
   Artur Lisiecki
@@ -250,18 +257,18 @@
   Tomo Cocoa
   Kim Jin Su
   Toni Mattis
+  Amber Brown
   Lucas Stadler
   Julian Berman
   Markus Holtermann
   roberto@goyle
   Yury V. Zaytsev
   Anna Katrina Dominguez
-  William Leslie
   Bobby Impollonia
-  Faye Zhao
   t...@eistee.fritz.box
   Andrew Thompson
   Yusei Tahara
+  Aaron Tubbs
   Ben Darnell
   Roberto De Ioris
   Juan Francisco Cantero Hurtado
@@ -273,6 +280,7 @@
   Christopher Armstrong
   Michael Hudson-Doyle
   Anders Sigfridsson
+  Nikolay Zinov
   Yasir Suhail
   Jason Michalski
   rafalgalczyn...@gmail.com
@@ -282,6 +290,7 @@
   Gustavo Niemeyer
   Stephan Busemann
   Rafa Gaczyski
+  Matt Bogosian
   Christian Muirhead
   Berker Peksag
   James Lan
@@ -316,9 +325,9 @@
   Stefan Marr
   jiaaro
   Mads Kiilerich
-  Richard Lancaster
   opassembler.py
   Antony Lee
+  Jason Madden
   Yaroslav Fedevych
   Jim Hunziker
   Markus Unterwaditzer
@@ -327,6 +336,7 @@
   squeaky
   Zearin
   soareschen
+  Jonas Pfannschmidt
   Kurt Griffiths
   Mike Bayer
   Matthew Miller
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -174,9 +174,6 @@
cmdline="--translationmodules",
suggests=[("objspace.allworkingmodules", False)]),
 
-BoolOption("usepycfiles", "Write and read pyc files when importing",
-   default=True),
-
 StrOption("soabi",

[pypy-commit] pypy py3k: hg merge default

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82515:299018381016
Date: 2016-02-25 16:38 +0100
http://bitbucket.org/pypy/pypy/changeset/299018381016/

Log:hg merge default

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -41,29 +41,29 @@
   Amaury Forgeot d'Arc
   Antonio Cuni
   Samuele Pedroni
+  Matti Picus
   Alex Gaynor
   Brian Kearns
-  Matti Picus
   Philip Jenvey
   Michael Hudson
+  Ronan Lamy
   David Schneider
+  Manuel Jacob
   Holger Krekel
   Christian Tismer
   Hakan Ardo
-  Manuel Jacob
-  Ronan Lamy
   Benjamin Peterson
+  Richard Plangger
   Anders Chrigstrom
   Eric van Riet Paap
   Wim Lavrijsen
-  Richard Plangger
   Richard Emslie
   Alexander Schremmer
   Dan Villiom Podlaski Christiansen
+  Remi Meier
   Lukas Diekmann
   Sven Hager
   Anders Lehmann
-  Remi Meier
   Aurelien Campeas
   Niklaus Haldimann
   Camillo Bruni
@@ -72,8 +72,8 @@
   Romain Guillebert
   Leonardo Santagada
   Seo Sanghyeon
+  Ronny Pfannschmidt
   Justin Peel
-  Ronny Pfannschmidt
   David Edelsohn
   Anders Hammarquist
   Jakub Gustak
@@ -95,6 +95,7 @@
   Tyler Wade
   Michael Foord
   Stephan Diehl
+  Vincent Legoll
   Stefan Schwarzer
   Valentino Volonghi
   Tomek Meka
@@ -105,9 +106,9 @@
   Jean-Paul Calderone
   Timo Paulssen
   Squeaky
+  Marius Gedminas
   Alexandre Fayolle
   Simon Burton
-  Marius Gedminas
   Martin Matusiak
   Konstantin Lopuhin
   Wenzhu Man
@@ -116,16 +117,20 @@
   Ivan Sichmann Freitas
   Greg Price
   Dario Bertini
+  Stefano Rivera
   Mark Pearse
   Simon Cross
   Andreas Sthrk
-  Stefano Rivera
+  Edd Barrett
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
+  Jeremy Thurgood
   Pawe Piotr Przeradowski
+  Spenser Bauman
   Paul deGrandis
   Ilya Osadchiy
+  marky1991
   Tobias Oberstein
   Adrian Kuhn
   Boris Feigin
@@ -134,14 +139,12 @@
   Georg Brandl
   Bert Freudenberg
   Stian Andreassen
-  Edd Barrett
+  Tobias Pape
   Wanja Saatkamp
   Gerald Klix
   Mike Blume
-  Tobias Pape
   Oscar Nierstrasz
   Stefan H. Muller
-  Jeremy Thurgood
   Rami Chowdhury
   Eugene Oden
   Henry Mason
@@ -153,6 +156,8 @@
   Lukas Renggli
   Guenter Jantzen
   Ned Batchelder
+  Tim Felgentreff
+  Anton Gulenko
   Amit Regmi
   Ben Young
   Nicolas Chauvat
@@ -162,12 +167,12 @@
   Nicholas Riley
   Jason Chu
   Igor Trindade Oliveira
-  Tim Felgentreff
+  Yichao Yu
   Rocco Moretti
   Gintautas Miliauskas
   Michael Twomey
   Lucian Branescu Mihaila
-  Yichao Yu
+  Devin Jeanpierre
   Gabriel Lavoie
   Olivier Dormond
   Jared Grubb
@@ -191,33 +196,33 @@
   Stanislaw Halik
   Mikael Schnenberg
   Berkin Ilbeyi
-  Elmo M?ntynen
+  Elmo Mntynen
+  Faye Zhao
   Jonathan David Riehl
   Anders Qvist
   Corbin Simpson
   Chirag Jadwani
   Beatrice During
   Alex Perry
-  Vincent Legoll
+  Vaibhav Sood
   Alan McIntyre
-  Spenser Bauman
+  William Leslie
   Alexander Sedov
   Attila Gobi
+  Jasper.Schulz
   Christopher Pope
-  Devin Jeanpierre
-  Vaibhav Sood
   Christian Tismer 
   Marc Abramowitz
   Dan Stromberg
   Arjun Naik
   Valentina Mukhamedzhanova
   Stefano Parmesan
+  Mark Young
   Alexis Daboville
   Jens-Uwe Mager
   Carl Meyer
   Karl Ramm
   Pieter Zieschang
-  Anton Gulenko
   Gabriel
   Lukas Vacek
   Andrew Dalke
@@ -225,6 +230,7 @@
   Jakub Stasiak
   Nathan Taylor
   Vladimir Kryachko
+  Omer Katz
   Jacek Generowicz
   Alejandro J. Cura
   Jacob Oscarson
@@ -239,6 +245,7 @@
   Lars Wassermann
   Philipp Rustemeuer
   Henrik Vendelbo
+  Richard Lancaster
   Dan Buch
   Miguel de Val Borro
   Artur Lisiecki
@@ -250,18 +257,18 @@
   Tomo Cocoa
   Kim Jin Su
   Toni Mattis
+  Amber Brown
   Lucas Stadler
   Julian Berman
   Markus Holtermann
   roberto@goyle
   Yury V. Zaytsev
   Anna Katrina Dominguez
-  William Leslie
   Bobby Impollonia
-  Faye Zhao
   t...@eistee.fritz.box
   Andrew Thompson
   Yusei Tahara
+  Aaron Tubbs
   Ben Darnell
   Roberto De Ioris
   Juan Francisco Cantero Hurtado
@@ -273,6 +280,7 @@
   Christopher Armstrong
   Michael Hudson-Doyle
   Anders Sigfridsson
+  Nikolay Zinov
   Yasir Suhail
   Jason Michalski
   rafalgalczyn...@gmail.com
@@ -282,6 +290,7 @@
   Gustavo Niemeyer
   Stephan Busemann
   Rafa Gaczyski
+  Matt Bogosian
   Christian Muirhead
   Berker Peksag
   James Lan
@@ -316,9 +325,9 @@
   Stefan Marr
   jiaaro
   Mads Kiilerich
-  Richard Lancaster
   opassembler.py
   Antony Lee
+  Jason Madden
   Yaroslav Fedevych
   Jim Hunziker
   Markus Unterwaditzer
@@ -327,6 +336,7 @@
   squeaky
   Zearin
   soareschen
+  Jonas Pfannschmidt
   Kurt Griffiths
   Mike Bayer
   Matthew Miller
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -172,9 +172,6 @@
cmdline="--translationmodules",
suggests=[("objspace.allworkingmodules", False)]),
 
-BoolOption("usepycfiles", "Write and read pyc files when importing",
-   default=True),
-
 StrOption("soabi",
  

[pypy-commit] pypy fix-longevity: (plan_rich, remi) add additional arg to LiveRanges() in test and fix test

2016-02-25 Thread Raemi
Author: Remi Meier 
Branch: fix-longevity
Changeset: r82514:46c6887af094
Date: 2016-02-25 17:03 +0100
http://bitbucket.org/pypy/pypy/changeset/46c6887af094/

Log:(plan_rich,remi) add additional arg to LiveRanges() in test and fix
test

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -643,9 +643,10 @@
 self.assembler.regalloc_mov(prev_loc, loc)
 
 def force_result_in_reg(self, result_v, v, forbidden_vars=[]):
-""" Make sure that result is in the same register as v.
-The variable v is copied away if it's further used.  The meaning
-of 'forbidden_vars' is the same as in 'force_allocate_reg'.
+""" Allocate a register for result_v and copy the contents of v's
+register to result_v's register. v will stay in the register it
+was initially assigned to. The meaning of 'forbidden_vars' is the
+same as in 'force_allocate_reg'.
 """
 self._check_type(result_v)
 self._check_type(v)
@@ -803,6 +804,9 @@
 self.longevity[var] = (start, end)
 
 def get_call_argument_index(self, var, pos):
+if not we_are_translated():  # tests
+if self.dist_to_next_call is None:
+return -1
 dist_to_call = self.dist_to_next_call[pos]
 if dist_to_call < 0:
 return -1
diff --git a/rpython/jit/backend/llsupport/test/test_regalloc.py 
b/rpython/jit/backend/llsupport/test/test_regalloc.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc.py
@@ -78,7 +78,7 @@
 def test_freeing_vars(self):
 b0, b1, b2 = newboxes(0, 0, 0)
 longevity = {b0: (0, 1), b1: (0, 2), b2: (0, 2)}
-rm = RegisterManager(LiveRanges(longevity, None, None))
+rm = RegisterManager(LiveRanges(longevity, None, None, None))
 rm.next_instruction()
 for b in b0, b1, b2:
 rm.try_allocate_reg(b)
@@ -103,7 +103,7 @@
 
 def test_register_exhaustion(self):
 boxes, longevity = boxes_and_longevity(5)
-rm = RegisterManager(LiveRanges(longevity, None, None))
+rm = RegisterManager(LiveRanges(longevity, None, None, None))
 rm.next_instruction()
 for b in boxes[:len(regs)]:
 assert rm.try_allocate_reg(b)
@@ -117,7 +117,7 @@
 class XRegisterManager(RegisterManager):
 no_lower_byte_regs = [r2, r3]
 
-rm = XRegisterManager(LiveRanges(longevity, None, None))
+rm = XRegisterManager(LiveRanges(longevity, None, None, None))
 rm.next_instruction()
 loc0 = rm.try_allocate_reg(b0, need_lower_byte=True)
 assert loc0 not in XRegisterManager.no_lower_byte_regs
@@ -131,7 +131,7 @@
 
 def test_specific_register(self):
 boxes, longevity = boxes_and_longevity(5)
-rm = RegisterManager(LiveRanges(longevity, None, None))
+rm = RegisterManager(LiveRanges(longevity, None, None, None))
 rm.next_instruction()
 loc = rm.try_allocate_reg(boxes[0], selected_reg=r1)
 assert loc is r1
@@ -152,7 +152,7 @@
 class XRegisterManager(RegisterManager):
 no_lower_byte_regs = [r2, r3]
 
-rm = XRegisterManager(LiveRanges(longevity, None, None),
+rm = XRegisterManager(LiveRanges(longevity, None, None, None),
   frame_manager=fm,
   assembler=MockAsm())
 rm.next_instruction()
@@ -178,7 +178,7 @@
 def test_make_sure_var_in_reg(self):
 boxes, longevity = boxes_and_longevity(5)
 fm = TFrameManager()
-rm = RegisterManager(LiveRanges(longevity, None, None), 
frame_manager=fm,
+rm = RegisterManager(LiveRanges(longevity, None, None, None), 
frame_manager=fm,
  assembler=MockAsm())
 rm.next_instruction()
 # allocate a stack position
@@ -194,7 +194,7 @@
 longevity = {b0: (0, 1), b1: (1, 3)}
 fm = TFrameManager()
 asm = MockAsm()
-rm = RegisterManager(LiveRanges(longevity, None, None), 
frame_manager=fm, assembler=asm)
+rm = RegisterManager(LiveRanges(longevity, None, None, None), 
frame_manager=fm, assembler=asm)
 rm.next_instruction()
 # first path, var is already in reg and dies
 loc0 = rm.force_allocate_reg(b0)
@@ -210,14 +210,15 @@
 longevity = {b0: (0, 2), b1: (1, 3)}
 fm = TFrameManager()
 asm = MockAsm()
-rm = RegisterManager(LiveRanges(longevity, None, None), 
frame_manager=fm, assembler=asm)
+rm = RegisterManager(LiveRanges(longevity, None, None, None), 
frame_manager=fm, assembler=asm)
 rm.next_instruction()
 loc0 = rm.force_allocate_reg(b0)
 rm._check_invariants()
   

[pypy-commit] pypy cpyext-ext: Fix refcount bug in test

2016-02-25 Thread rlamy
Author: Ronan Lamy 
Branch: cpyext-ext
Changeset: r82513:4f809c093ddd
Date: 2016-02-25 17:00 +0100
http://bitbucket.org/pypy/pypy/changeset/4f809c093ddd/

Log:Fix refcount bug in test

diff --git a/pypy/module/cpyext/test/test_dictobject.py 
b/pypy/module/cpyext/test/test_dictobject.py
--- a/pypy/module/cpyext/test/test_dictobject.py
+++ b/pypy/module/cpyext/test/test_dictobject.py
@@ -169,9 +169,8 @@
w_proxy, space.wrap('sys'))
 raises(OperationError, space.call_method, w_proxy, 'clear')
 assert api.PyDictProxy_Check(w_proxy)
-
+
 class AppTestDictObject(AppTestCpythonExtensionBase):
-#@py.test.mark.xfail(reason='make_frozendict memoize only works 
translated')
 def test_dictproxytype(self):
 module = self.import_extension('foo', [
 ("dict_proxy", "METH_VARARGS",
@@ -182,12 +181,11 @@
  if (!PyArg_ParseTuple(args, "O", ))
  return NULL;
  proxydict = PyDictProxy_New(dict);
- Py_DECREF(dict);
  if (!PyDictProxy_Check(proxydict)) {
 Py_DECREF(proxydict);
 PyErr_SetNone(PyExc_ValueError);
 return NULL;
- } 
+ }
  if (!PyDictProxy_CheckExact(proxydict)) {
 Py_DECREF(proxydict);
 PyErr_SetNone(PyExc_ValueError);
@@ -195,7 +193,7 @@
  }
  i = PyObject_Size(proxydict);
  Py_DECREF(proxydict);
- return PyLong_FromLong(i); 
+ return PyLong_FromLong(i);
  """),
 ])
 assert module.dict_proxy({'a': 1, 'b': 2}) == 2
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (plan_rich, remi) fix for updating bridge argument register assignment

2016-02-25 Thread Raemi
Author: Remi Meier 
Branch: fix-longevity
Changeset: r82512:af0b03bc7ce0
Date: 2016-02-25 16:46 +0100
http://bitbucket.org/pypy/pypy/changeset/af0b03bc7ce0/

Log:(plan_rich,remi) fix for updating bridge argument register
assignment

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -803,7 +803,6 @@
 self.longevity[var] = (start, end)
 
 def get_call_argument_index(self, var, pos):
-assert self.dist_to_next_call[pos] >= 0
 dist_to_call = self.dist_to_next_call[pos]
 if dist_to_call < 0:
 return -1
diff --git a/rpython/jit/backend/x86/regalloc.py 
b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -274,6 +274,7 @@
 def _update_bindings(self, arglocs, inputargs):
 # XXX this should probably go to llsupport/regalloc.py
 used = set()
+used_xmm = set()
 i = 0
 # manually set the register and frame bindings for
 # all inputargs (for a bridge)
@@ -285,7 +286,7 @@
 if isinstance(loc, RegLoc):
 if arg.type == FLOAT:
 self.xrm.reg_bindings[arg] = loc
-used.add(loc)
+used_xmm.add(loc)
 else:
 if loc is ebp:
 self.rm.bindings_to_frame_reg[arg] = None
@@ -296,7 +297,7 @@
 self.fm.bind(arg, loc)
 #
 self.rm.update_free_registers(used)
-self.xrm.update_free_registers(used)
+self.xrm.update_free_registers(used_xmm)
 self.possibly_free_vars(list(inputargs))
 self.fm.finish_binding()
 self.rm._check_invariants()
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (remi, plan_rich) did not save two files

2016-02-25 Thread plan_rich
Author: Richard Plangger 
Branch: fix-longevity
Changeset: r82511:bcfdedbf3019
Date: 2016-02-25 16:35 +0100
http://bitbucket.org/pypy/pypy/changeset/bcfdedbf3019/

Log:(remi, plan_rich) did not save two files

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -672,13 +672,13 @@
 self.assembler.regalloc_mov(loc, result_loc)
 loc = result_loc
 
+
 #del self.reg_bindings[v]
 #if self.frame_manager.get(v) is None or self.has_free_registers():
 #self._move_variable_away(v, loc)
 
 #self.reg_bindings[result_v] = loc
 else:
-import pdb; pdb.set_trace()
 self._reallocate_from_to(v, result_v)
 loc = self.reg_bindings[result_v]
 return loc
@@ -804,7 +804,10 @@
 
 def get_call_argument_index(self, var, pos):
 assert self.dist_to_next_call[pos] >= 0
-op = self.operations[pos + self.dist_to_next_call[pos]]
+dist_to_call = self.dist_to_next_call[pos]
+if dist_to_call < 0:
+return -1
+op = self.operations[pos + dist_to_call]
 for i,arg in enumerate(op.getarglist()):
 if arg is var:
 return i-1 # first parameter is the functionh
@@ -817,7 +820,7 @@
 start, end = self.longevity[var]
 dist = self.dist_to_next_call[position]
 assert end >= position
-if dist >= 0 and position + dist < end:
+if dist >= 0 and position+dist < end:
 # the variable is used after the call instr
 return True
 return False
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (remi, plan_rich) the first version that correctly considers call args and live ranges that survive calls

2016-02-25 Thread plan_rich
Author: Richard Plangger 
Branch: fix-longevity
Changeset: r82510:9823e109f391
Date: 2016-02-25 16:30 +0100
http://bitbucket.org/pypy/pypy/changeset/9823e109f391/

Log:(remi, plan_rich) the first version that correctly considers call
args and live ranges that survive calls

diff --git a/rpython/jit/backend/llsupport/test/test_regalloc_call.py 
b/rpython/jit/backend/llsupport/test/test_regalloc_call.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc_call.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc_call.py
@@ -201,7 +201,7 @@
 """, namespace=self.namespace)
 i1 = ops.operations[0]
 i2 = ops.operations[1]
-trace_alloc = TraceAllocation(ops, [eax, edx, get_param(0)], [r8, r9, 
r12], [eax, r12], tt)
+trace_alloc = TraceAllocation(ops, [r13, edx, get_param(0)], [r8, r9, 
r12], [r13, r12], tt)
 trace_alloc.run_allocation()
 # we force the allocation to immediately take the first call parameter 
register
 # the new regalloc will not shuffle register binding around (other 
than spilling)
@@ -209,7 +209,10 @@
 assert trace_alloc.initial_register(i1) == get_param(0)
 assert trace_alloc.is_caller_saved(i1)
 assert trace_alloc.is_callee_saved(i2)
-assert trace_alloc.move_count() == 1
+# two moves to preserve the live range -> register mapping (i0,i2)
+# p0 is reloaded before the jump (because it is a gc pointer)
+# i2 is not at the right location
+assert trace_alloc.move_count() == 4
 
 def test_call_allocate_first_param_to_callee2(self):
 tt, ops = parse_loop("""
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: updates

2016-02-25 Thread arigo
Author: Armin Rigo 
Branch: extradoc
Changeset: r5611:ff9f6252e503
Date: 2016-02-25 16:23 +0100
http://bitbucket.org/pypy/extradoc/changeset/ff9f6252e503/

Log:updates

diff --git a/blog/draft/cpyext-gcsupport.rst b/blog/draft/cpyext-gcsupport.rst
--- a/blog/draft/cpyext-gcsupport.rst
+++ b/blog/draft/cpyext-gcsupport.rst
@@ -36,15 +36,16 @@
 `lxml`_ package---which is is one of the most popular packages on PyPI.
 (Specifically, you need version 3.5.0 with
 https://github.com/lxml/lxml/pull/187 to remove old PyPy-specific hacks
-that were not really working.)  At this point, we no longer recommend
-using the `cffi lxml`_ alternative: although it may still be faster, it
-might be incomplete and old.
+that were not really working.  See details__.)  At this point, we no
+longer recommend using the cffi-lxml alternative: although it may
+still be faster, it might be incomplete and old.
 
 We are actively working on extending our C-API support, and hope to soon
 merge a branch to support more of the C-API functions (some numpy news
 coming!).  Please `try it out`_ and let us know how it works for you.
 
 _`lxml`: https://github.com/lxml/lxml
+__: https://bitbucket.org/pypy/compatibility/wiki/lxml
 _`try it out`: http://buildbot.pypy.org/nightly/trunk/
 
 Armin Rigo and the PyPy team
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (plan_rich, remi) fix and test for call survival condition

2016-02-25 Thread Raemi
Author: Remi Meier 
Branch: fix-longevity
Changeset: r82509:a1c4102f1903
Date: 2016-02-25 16:16 +0100
http://bitbucket.org/pypy/pypy/changeset/a1c4102f1903/

Log:(plan_rich,remi) fix and test for call survival condition

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -817,7 +817,7 @@
 start, end = self.longevity[var]
 dist = self.dist_to_next_call[position]
 assert end >= position
-if end-position < dist:
+if dist >= 0 and position + dist < end:
 # the variable is used after the call instr
 return True
 return False
diff --git a/rpython/jit/backend/llsupport/test/test_regalloc_integration.py 
b/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
@@ -203,6 +203,24 @@
 lrs = compute_var_live_ranges(loop.inputargs, loop.operations)
 assert lrs.dist_to_next_call == [2, 1, 0, -4, -5]
 
+def test_survives_call(self):
+ops = '''
+[p0,i0]
+i1 = int_add(i0,i0)
+i2 = int_sub(i0,i1)
+call_n(p0, i1, descr=raising_calldescr)
+i3 = int_mul(i2,i0)
+guard_true(i3) []
+i5 = int_mul(i2,i0)
+jump(p0,i2)
+'''
+loop = self.parse(ops)
+lrs = compute_var_live_ranges(loop.inputargs, loop.operations)
+assert not lrs.survives_call(loop.operations[0], 0)
+assert lrs.survives_call(loop.operations[1], 1)
+assert not lrs.survives_call(loop.operations[3], 3)
+assert not lrs.exists(loop.operations[5])
+
 
 def test_simple_loop(self):
 ops = '''
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: updates

2016-02-25 Thread arigo
Author: Armin Rigo 
Branch: extradoc
Changeset: r5610:a8a9dcfcf523
Date: 2016-02-25 16:18 +0100
http://bitbucket.org/pypy/extradoc/changeset/a8a9dcfcf523/

Log:updates

diff --git a/blog/draft/cpyext-gcsupport.rst b/blog/draft/cpyext-gcsupport.rst
--- a/blog/draft/cpyext-gcsupport.rst
+++ b/blog/draft/cpyext-gcsupport.rst
@@ -1,23 +1,50 @@
 CAPI Support update
 ===
 
-I have merged a rewrite of the interaction between c-API c-level objects and 
-interpreter level objects. Each refcounted c-level object is now reflected in
-an interpreter level object, and the garbage collector can release the object
-pair only if the refcount is 0 and the interpreter level object is not longer
-referenced.
+As you know, PyPy can emulate the CPython C API to some extent.  It is
+done by passing around ``PyObject *`` pointers.  Inside PyPy, the
+objects don't have the same ``PyObject *`` structure at all; and
+additionally their memory address can change.  PyPy handles the
+difference by maintaining two sets of objects.  More precisely, starting
+from a PyPy object, it can allocate on demand a ``PyObject`` structure
+and fill it with information that points back to the original PyPy
+objects; and conversely, starting from a C-level object, it can allocate
+a PyPy-level object and fill it with information in the opposite
+direction.
 
-The rewrite significantly simplifies our previous code, and should make using
-the c-API less slow (it is still slower than using pure python though).
-XXX citations needed ...
+I have merged a rewrite of the interaction between C-API C-level objects
+and PyPy's interpreter level objects.  This is mostly a simplification
+based on a small hack in our garbage collector.  This hack makes the
+garbage collector aware of the reference-counted ``PyObject``
+structures.  When it considers a pair consisting of a PyPy object and a
+``PyObject``, it will always free either none or both of them at the
+same time.  They both stay alive if *either* there is a regular GC
+reference to the PyPy object, *or* the reference counter in the
+``PyObject`` is bigger than zero.
 
-The good news is that now PyPy can support the upstream `lxml`_ package, which 
is
-is one of the most popular packages on PyPI (specifically version X.X.X with 
old
-PyPy specific hacks removed). We do recommend using the `cffi lxml`_ 
alternative,
-since it will be faster on PyPy.
+This gives a more stable result.  Previously, a PyPy object might grow a
+corresponding ``PyObject``, loose it (when its reference counter goes to
+zero), and later have another corresponding ``PyObject`` re-created at a
+different address.  Now, once a link is created, it remains alive until
+both objects die.
 
-We are actively working on extending our c-API support, and hope to soon merge
-a branch to support more of the c-API functions. Please try it out and let us
-know how it works for you.
+The rewrite significantly simplifies our previous code (which used to be
+based on at least 4 different dictionaries), and should make using the
+C-API less slow (it is still slower than using pure python or cffi).
+
+So, the good news is that now PyPy actually supports the upstream
+`lxml`_ package---which is is one of the most popular packages on PyPI.
+(Specifically, you need version 3.5.0 with
+https://github.com/lxml/lxml/pull/187 to remove old PyPy-specific hacks
+that were not really working.)  At this point, we no longer recommend
+using the `cffi lxml`_ alternative: although it may still be faster, it
+might be incomplete and old.
+
+We are actively working on extending our C-API support, and hope to soon
+merge a branch to support more of the C-API functions (some numpy news
+coming!).  Please `try it out`_ and let us know how it works for you.
+
+_`lxml`: https://github.com/lxml/lxml
+_`try it out`: http://buildbot.pypy.org/nightly/trunk/
 
 Armin Rigo and the PyPy team
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: merged fix-longevity

2016-02-25 Thread plan_rich
Author: Richard Plangger 
Branch: fix-longevity
Changeset: r82508:947d61d6c498
Date: 2016-02-25 15:51 +0100
http://bitbucket.org/pypy/pypy/changeset/947d61d6c498/

Log:merged fix-longevity

diff --git a/rpython/jit/backend/llsupport/test/test_regalloc_integration.py 
b/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
@@ -190,6 +190,20 @@
 assert lrs.dist_to_next_call == [3, 2, 1, 0, 1, 0, -7, -8]
 
 
+def test_compute_call_distances2(self):
+ops = '''
+[p0,i0]
+i1 = int_add(i0,i0)
+i2 = int_sub(i0,i1)
+call_n(p0, i1, descr=raising_calldescr)
+i3 = int_mul(i2,i0)
+jump(p0,i2)
+'''
+loop = self.parse(ops)
+lrs = compute_var_live_ranges(loop.inputargs, loop.operations)
+assert lrs.dist_to_next_call == [2, 1, 0, -4, -5]
+
+
 def test_simple_loop(self):
 ops = '''
 [i0]
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (remi, plan_rich) forward with argument allocation for calls

2016-02-25 Thread plan_rich
Author: Richard Plangger 
Branch: fix-longevity
Changeset: r82507:5678f7fbd0b3
Date: 2016-02-25 15:49 +0100
http://bitbucket.org/pypy/pypy/changeset/5678f7fbd0b3/

Log:(remi, plan_rich) forward with argument allocation for calls

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -276,6 +276,7 @@
 save_around_call_regs = []
 frame_reg = None
 
+# TODO would be good to keep free_caller_regs sorted (according to the ABI)
 free_callee_regs  = []
 free_caller_regs  = []
 is_callee_lookup  = None
@@ -300,6 +301,16 @@
 else:
 target_pool = self.free_caller_regs
 second_pool = self.free_callee_regs
+if target_reg is not None:
+# try to allocate this regsiter to a special register
+for i,reg in enumerate(target_pool):
+if reg is target_reg:
+del target_pool[i]
+return reg
+for i,reg in enumerate(second_pool):
+if reg is target_reg:
+del second_pool[i]
+return reg
 if target_pool:
 return target_pool.pop()
 if second_pool:
@@ -309,12 +320,25 @@
 def has_free_registers(self):
 return self.free_callee_regs or self.free_caller_regs
 
+def get_abi_param_register(self, i):
+raise NotImplementedError
+
 def allocate_new(self, var):
 if self.live_ranges.exists(var) and 
self.live_ranges.survives_call(var, self.position):
 # we want a callee save register
 return self.get_free_register(var, callee=True)
 else:
-return self.get_free_register(var, callee=False, target_reg=None)
+# if survives_call indicates that the live range ends at the call 
site
+# we would like to allocate the register directly to the parameter
+# register
+
+index = self.live_ranges.get_call_argument_index(var, 
self.position)
+target_reg = None
+if index != -1:
+target_reg = self.get_abi_param_register(index)
+
+
+return self.get_free_register(var, callee=False, 
target_reg=target_reg)
 
 def update_free_registers(self, regs_in_use):
 self._reinit_free_regs()
@@ -641,13 +665,20 @@
 if self.live_ranges.last_use(v) > self.position:
 # we need to find a new place for variable v and
 # store result in the same place
+
 loc = self.reg_bindings[v]
-del self.reg_bindings[v]
-if self.frame_manager.get(v) is None or self.has_free_registers():
-self._move_variable_away(v, loc)
+# only spill variable is allowed to reassign a new register to a 
live range
+result_loc = self.force_allocate_reg(result_v, 
forbidden_vars=forbidden_vars)
+self.assembler.regalloc_mov(loc, result_loc)
+loc = result_loc
 
-self.reg_bindings[result_v] = loc
+#del self.reg_bindings[v]
+#if self.frame_manager.get(v) is None or self.has_free_registers():
+#self._move_variable_away(v, loc)
+
+#self.reg_bindings[result_v] = loc
 else:
+import pdb; pdb.set_trace()
 self._reallocate_from_to(v, result_v)
 loc = self.reg_bindings[result_v]
 return loc
@@ -756,10 +787,11 @@
 
 
 class LiveRanges(object):
-def __init__(self, longevity, last_real_usage, dist_to_next_call):
+def __init__(self, longevity, last_real_usage, dist_to_next_call, 
operations):
 self.longevity = longevity
 self.last_real_usage = last_real_usage
 self.dist_to_next_call = dist_to_next_call
+self.operations = operations
 
 def exists(self, var):
 return var in self.longevity
@@ -770,6 +802,14 @@
 def new_live_range(self, var, start, end):
 self.longevity[var] = (start, end)
 
+def get_call_argument_index(self, var, pos):
+assert self.dist_to_next_call[pos] >= 0
+op = self.operations[pos + self.dist_to_next_call[pos]]
+for i,arg in enumerate(op.getarglist()):
+if arg is var:
+return i-1 # first parameter is the functionh
+return -1
+
 def survives_call(self, var, position):
 if not we_are_translated():
 if self.dist_to_next_call is None:
@@ -777,8 +817,8 @@
 start, end = self.longevity[var]
 dist = self.dist_to_next_call[position]
 assert end >= position
-if end-position <= dist:
-# it is 'live during a call' if it live range ends after the call
+if end-position < dist:
+# the variable is used after the call instr
 return True
 return 

[pypy-commit] pypy default: Remove objspace.usepycfiles option.

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82506:bc2f7f711496
Date: 2016-02-25 15:44 +0100
http://bitbucket.org/pypy/pypy/changeset/bc2f7f711496/

Log:Remove objspace.usepycfiles option.

This option was needed for the sandbox feature, where it might not
be allowed to write to the file system. Nowadays Python has a
sys.dont_write_bytecode flag, which can be used for that. By
default, this flags is `False`, unless when the sandbox feature is
enabled; in this case it's set to `True`.

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -170,12 +170,8 @@
cmdline="--translationmodules",
suggests=[("objspace.allworkingmodules", False)]),
 
-BoolOption("usepycfiles", "Write and read pyc files when importing",
-   default=True),
-
 BoolOption("lonepycfiles", "Import pyc files with no matching py file",
-   default=False,
-   requires=[("objspace.usepycfiles", True)]),
+   default=False),
 
 StrOption("soabi",
   "Tag to differentiate extension modules built for different 
Python interpreters",
diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -277,7 +277,6 @@
 
 if config.translation.sandbox:
 config.objspace.lonepycfiles = False
-config.objspace.usepycfiles = False
 
 config.translating = True
 
diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -85,7 +85,7 @@
 # The "imp" module does not respect this, and is allowed to find
 # lone .pyc files.
 # check the .pyc file
-if space.config.objspace.usepycfiles and 
space.config.objspace.lonepycfiles:
+if space.config.objspace.lonepycfiles:
 pycfile = filepart + ".pyc"
 if file_exists(pycfile):
 # existing .pyc file
@@ -888,17 +888,11 @@
 """
 w = space.wrap
 
-if space.config.objspace.usepycfiles:
-src_stat = os.fstat(fd)
-cpathname = pathname + 'c'
-mtime = int(src_stat[stat.ST_MTIME])
-mode = src_stat[stat.ST_MODE]
-stream = check_compiled_module(space, cpathname, mtime)
-else:
-cpathname = None
-mtime = 0
-mode = 0
-stream = None
+src_stat = os.fstat(fd)
+cpathname = pathname + 'c'
+mtime = int(src_stat[stat.ST_MTIME])
+mode = src_stat[stat.ST_MODE]
+stream = check_compiled_module(space, cpathname, mtime)
 
 if stream:
 # existing and up-to-date .pyc file
@@ -913,7 +907,7 @@
 else:
 code_w = parse_source_module(space, pathname, source)
 
-if space.config.objspace.usepycfiles and write_pyc:
+if write_pyc:
 if not space.is_true(space.sys.get('dont_write_bytecode')):
 write_compiled_module(space, code_w, cpathname, mode, mtime)
 
diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -123,7 +123,7 @@
 stream.try_to_find_file_descriptor())
 finally:
 stream.close()
-if space.config.objspace.usepycfiles:
+if not space.config.translation.sandbox:
 # also create a lone .pyc file
 p.join('lone.pyc').write(p.join('x.pyc').read(mode='rb'),
  mode='wb')
@@ -1349,8 +1349,14 @@
 
 
 class AppTestWriteBytecode(object):
+spaceconfig = {
+"translation.sandbox": False
+}
+
 def setup_class(cls):
 cls.saved_modules = _setup(cls.space)
+sandbox = cls.spaceconfig['translation.sandbox']
+cls.w_sandbox = cls.space.wrap(sandbox)
 
 def teardown_class(cls):
 _teardown(cls.space, cls.saved_modules)
@@ -1364,7 +1370,7 @@
 import os.path
 from test_bytecode import a
 assert a.__file__.endswith('a.py')
-assert os.path.exists(a.__file__ + 'c')
+assert os.path.exists(a.__file__ + 'c') == (not self.sandbox)
 
 def test_write_bytecode(self):
 import os.path
@@ -1383,15 +1389,15 @@
 assert not os.path.exists(c.__file__ + 'c')
 
 
-class AppTestNoPycFile(object):
+class AppTestWriteBytecodeSandbox(AppTestWriteBytecode):
 spaceconfig = {
-"objspace.usepycfiles": False,
-"objspace.lonepycfiles": False
+"translation.sandbox": True
 }
+
+
+class _AppTestLonePycFileBase(object):
 def setup_class(cls):
-usepycfiles = cls.spaceconfig['objspace.usepycfiles']
 lonepycfiles = cls.spaceconfig['objspace.lonepycfiles']
-cls.w_usepycfiles = cls.space.wrap(usepycfiles)
 cls.w_lonepycfiles = 

[pypy-commit] pypy fix-longevity: (plan_rich, remi) test and fix for call_dists calculation

2016-02-25 Thread Raemi
Author: Remi Meier 
Branch: fix-longevity
Changeset: r82505:4e99dd1d0654
Date: 2016-02-25 15:03 +0100
http://bitbucket.org/pypy/pypy/changeset/4e99dd1d0654/

Log:(plan_rich,remi) test and fix for call_dists calculation

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -796,6 +796,9 @@
 last_call_pos = -1
 for i in range(len(operations)-1, -1, -1):
 op = operations[i]
+if op.is_call():
+last_call_pos = i
+dist_to_next_call[i] = last_call_pos - i
 if op.type != 'v':
 if op not in last_used and op.has_no_side_effect():
 continue
@@ -816,9 +819,6 @@
 assert not isinstance(arg, Const)
 if arg not in last_used:
 last_used[arg] = i
-if op.is_call():
-last_call_pos = i
-dist_to_next_call[i] = last_call_pos - i
 #
 longevity = {}
 for i, arg in enumerate(operations):
diff --git a/rpython/jit/backend/llsupport/test/test_regalloc_call.py 
b/rpython/jit/backend/llsupport/test/test_regalloc_call.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc_call.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc_call.py
@@ -200,8 +200,9 @@
 """, namespace=self.namespace)
 i1 = ops.operations[0]
 i2 = ops.operations[1]
-trace_alloc = TraceAllocation(ops, [eax, edx], [r8, r9, r10], [eax, 
r10], tt)
-trace_alloc.run_allocation([r8,r9,edx])
+trace_alloc = TraceAllocation(ops, [eax, edx, get_param(0)],
+  [r8, r9, r10], [eax, r10], tt)
+trace_alloc.run_allocation()
 # we force the allocation to immediately take the first call parameter 
register
 # the new regalloc will not shuffle register binding around (other 
than spilling)
 # in the best case this will reduce a lot of movement
diff --git a/rpython/jit/backend/llsupport/test/test_regalloc_integration.py 
b/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
@@ -190,6 +190,20 @@
 assert lrs.dist_to_next_call == [3, 2, 1, 0, 1, 0, -7, -8]
 
 
+def test_compute_call_distances2(self):
+ops = '''
+[p0,i0]
+i1 = int_add(i0,i0)
+i2 = int_sub(i0,i1)
+call_n(p0, i1, descr=raising_calldescr)
+i3 = int_mul(i2,i0)
+jump(p0,i2)
+'''
+loop = self.parse(ops)
+lrs = compute_var_live_ranges(loop.inputargs, loop.operations)
+assert lrs.dist_to_next_call == [2, 1, 0, -4, -5]
+
+
 def test_simple_loop(self):
 ops = '''
 [i0]
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: start updating for bug-fix releases

2016-02-25 Thread mattip
Author: mattip 
Branch: 
Changeset: r82504:2828af388188
Date: 2016-02-25 12:58 +0100
http://bitbucket.org/pypy/pypy/changeset/2828af388188/

Log:start updating for bug-fix releases

diff --git a/pypy/doc/how-to-release.rst b/pypy/doc/how-to-release.rst
--- a/pypy/doc/how-to-release.rst
+++ b/pypy/doc/how-to-release.rst
@@ -1,5 +1,20 @@
-Making a PyPy Release
-=
+The PyPy Release Process
+
+
+Release Policy
+++
+
+We try to create a stable release a few times a year. These are released on
+a branch named like release-2.x or release-4.x, and each release is tagged,
+for instance release-4.0.1. 
+
+After release, inevitably there are bug fixes. It is the responsibility of
+the commiter who fixes a bug to make sure this fix is on the release branch,
+so that we can then create a tagged bug-fix release, which will hopefully
+happen more often than stable releases.
+
+How to Create a PyPy Release
+
 
 Overview
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy cpyext-ext: (matti, arigo, ronan around)

2016-02-25 Thread arigo
Author: Armin Rigo 
Branch: cpyext-ext
Changeset: r82503:1dfe3b071dc6
Date: 2016-02-25 14:35 +0100
http://bitbucket.org/pypy/pypy/changeset/1dfe3b071dc6/

Log:(matti, arigo, ronan around)

Test and fix: initialize ob_pypy_link correctly to 0

diff --git a/pypy/module/cpyext/object.py b/pypy/module/cpyext/object.py
--- a/pypy/module/cpyext/object.py
+++ b/pypy/module/cpyext/object.py
@@ -16,8 +16,9 @@
 
 @cpython_api([Py_ssize_t], rffi.VOIDP)
 def PyObject_Malloc(space, size):
+# returns non-zero-initialized memory, like CPython
 return lltype.malloc(rffi.VOIDP.TO, size,
- flavor='raw', zero=True)
+ flavor='raw')
 
 @cpython_api([rffi.VOIDP], lltype.Void)
 def PyObject_Free(space, ptr):
@@ -189,6 +190,7 @@
 if not obj:
 PyErr_NoMemory(space)
 obj.c_ob_type = type
+obj.c_ob_pypy_link = 0
 obj.c_ob_refcnt = 1
 return obj
 
diff --git a/pypy/module/cpyext/pyobject.py b/pypy/module/cpyext/pyobject.py
--- a/pypy/module/cpyext/pyobject.py
+++ b/pypy/module/cpyext/pyobject.py
@@ -53,6 +53,7 @@
 flavor='raw', zero=True)
 pyobj = rffi.cast(PyObject, buf)
 pyobj.c_ob_refcnt = 1
+#pyobj.c_ob_pypy_link should get assigned very quickly
 pyobj.c_ob_type = pytype
 return pyobj
 
@@ -325,6 +326,7 @@
 @cpython_api([PyObject], lltype.Void)
 def _Py_NewReference(space, obj):
 obj.c_ob_refcnt = 1
+# XXX is it always useful to create the W_Root object here?
 w_type = from_ref(space, rffi.cast(PyObject, obj.c_ob_type))
 assert isinstance(w_type, W_TypeObject)
 get_typedescr(w_type.layout.typedef).realize(space, obj)
diff --git a/pypy/module/cpyext/test/test_object.py 
b/pypy/module/cpyext/test/test_object.py
--- a/pypy/module/cpyext/test/test_object.py
+++ b/pypy/module/cpyext/test/test_object.py
@@ -217,6 +217,20 @@
 AppTestCpythonExtensionBase.setup_class.im_func(cls)
 cls.w_tmpname = cls.space.wrap(str(py.test.ensuretemp("out", dir=0)))
 
+def test_object_malloc(self):
+module = self.import_extension('foo', [
+("malloctest", "METH_NOARGS",
+ """
+ PyObject *obj = PyObject_MALLOC(sizeof(PyIntObject));
+ obj = PyObject_Init(obj, _Type);
+ if (obj != NULL)
+ ((PyIntObject *)obj)->ob_ival = -424344;
+ return obj;
+ """)])
+x = module.malloctest()
+assert type(x) is int
+assert x == -424344
+
 def test_TypeCheck(self):
 module = self.import_extension('foo', [
 ("typecheck", "METH_VARARGS",
diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -506,6 +506,7 @@
  flavor='raw', zero=True)
 pto = heaptype.c_ht_type
 pto.c_ob_refcnt = 1
+pto.c_ob_pypy_link = 0
 pto.c_ob_type = metatype
 pto.c_tp_flags |= Py_TPFLAGS_HEAPTYPE
 pto.c_tp_as_number = heaptype.c_as_number
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (plan_rich, remi) faster update_free_registers

2016-02-25 Thread Raemi
Author: Remi Meier 
Branch: fix-longevity
Changeset: r82502:3271c1578a13
Date: 2016-02-25 14:34 +0100
http://bitbucket.org/pypy/pypy/changeset/3271c1578a13/

Log:(plan_rich,remi) faster update_free_registers

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -317,7 +317,6 @@
 return self.get_free_register(var, callee=False, target_reg=None)
 
 def update_free_registers(self, regs_in_use):
-# XXX: slow?
 self._reinit_free_regs()
 for r in regs_in_use:
 self.remove_free_register(r)
@@ -342,17 +341,18 @@
reg in self.free_caller_regs
 
 def _reinit_free_regs(self):
-self.free_callee_regs = [reg for reg in self.all_regs
- if reg not in self.save_around_call_regs]
+self.free_callee_regs = self.save_in_callee_regs[:]
 self.free_caller_regs = self.save_around_call_regs[:]
 
 def _change_regs(self, all_regs, save_around_call_regs):
 self.all_regs = all_regs
 self.save_around_call_regs = save_around_call_regs
+self.save_in_callee_regs = [reg for reg in all_regs
+if reg not in save_around_call_regs]
 self._reinit_free_regs()
 self.is_callee_lookup = [True] * max(
 [r.value + 1 for r in self.all_regs])
-for reg in save_around_call_regs:
+for reg in self.save_around_call_regs:
 self.is_callee_lookup[reg.value] = False
 
 def __init__(self, live_ranges, frame_manager=None, assembler=None):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Reset sys.dont_write_bytecode because apparently the tests are not independent from each other.

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82500:b94753e4f5cc
Date: 2016-02-25 13:25 +0100
http://bitbucket.org/pypy/pypy/changeset/b94753e4f5cc/

Log:Reset sys.dont_write_bytecode because apparently the tests are not
independent from each other.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -1347,11 +1347,16 @@
 
 
 class AppTestWriteBytecode(object):
-def setup(cls):
+def setup_class(cls):
 cls.saved_modules = _setup(cls.space)
 
-def teardown(cls):
+def teardown_class(cls):
 _teardown(cls.space, cls.saved_modules)
+cls.space.appexec([], """
+():
+import sys
+sys.dont_write_bytecode = False
+""")
 
 def test_default(self):
 import os.path
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Try to make import tests more independent from each other.

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82501:34a4d2b7e371
Date: 2016-02-25 14:04 +0100
http://bitbucket.org/pypy/pypy/changeset/34a4d2b7e371/

Log:Try to make import tests more independent from each other.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -150,6 +150,8 @@
 """)
 
 def _teardown(space, w_saved_modules):
+p = udir.join('impsubdir')
+p.remove()
 space.appexec([w_saved_modules], """
 ((saved_path, saved_modules)):
 import sys
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (plan_rich, remi) support changing of register set for tests

2016-02-25 Thread Raemi
Author: Remi Meier 
Branch: fix-longevity
Changeset: r82499:851789a1560c
Date: 2016-02-25 13:56 +0100
http://bitbucket.org/pypy/pypy/changeset/851789a1560c/

Log:(plan_rich,remi) support changing of register set for tests

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -318,7 +318,7 @@
 
 def update_free_registers(self, regs_in_use):
 # XXX: slow?
-self._reset_free_regs()
+self._reinit_free_regs()
 for r in regs_in_use:
 self.remove_free_register(r)
 
@@ -341,16 +341,22 @@
 return reg in self.free_callee_regs or \
reg in self.free_caller_regs
 
-def _reset_free_regs(self):
+def _reinit_free_regs(self):
 self.free_callee_regs = [reg for reg in self.all_regs
  if reg not in self.save_around_call_regs]
 self.free_caller_regs = self.save_around_call_regs[:]
 
+def _change_regs(self, all_regs, save_around_call_regs):
+self.all_regs = all_regs
+self.save_around_call_regs = save_around_call_regs
+self._reinit_free_regs()
+self.is_callee_lookup = [True] * max(
+[r.value + 1 for r in self.all_regs])
+for reg in save_around_call_regs:
+self.is_callee_lookup[reg.value] = False
+
 def __init__(self, live_ranges, frame_manager=None, assembler=None):
-self._reset_free_regs()
-self.is_callee_lookup = [True] * len(self.all_regs)
-for reg in self.save_around_call_regs:
-self.is_callee_lookup[reg.value] = False
+self._change_regs(self.all_regs, self.save_around_call_regs)
 
 self.live_ranges = live_ranges
 self.temp_boxes = []
diff --git a/rpython/jit/backend/llsupport/test/test_regalloc_call.py 
b/rpython/jit/backend/llsupport/test/test_regalloc_call.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc_call.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc_call.py
@@ -117,15 +117,15 @@
 self.regalloc.rm.reg_bindings[var] = reg
 
 # instead of having all machine registers, we want only to provide some
-fr = self.regalloc.free_regs
+self.regalloc.rm._change_regs(self.regalloc.all_regs,
+  self.regalloc.caller_saved)
 if free_regs is None:
-self.regalloc.rm.free_regs = [reg for reg in fr
-  if reg not in 
self.initial_binding.values()]
+self.regalloc.rm.update_free_registers(
+self.initial_binding.values())
 else:
-self.regalloc.rm.free_regs = free_regs
-self.regalloc.rm.all_regs = self.regalloc.all_regs
-self.regalloc.rm.save_around_call_regs = self.regalloc.caller_saved
-
+self.regalloc.rm.update_free_registers(
+set(self.regalloc.all_regs) - set(free_regs))
+self.regalloc.rm._check_invariants()
 # invoke the allocator!
 self.regalloc.walk_operations(inputargs, operations)
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (plan_rich, remi) small fixes and allow updating the free regs lists

2016-02-25 Thread Raemi
Author: Remi Meier 
Branch: fix-longevity
Changeset: r82498:d6ea9d88da47
Date: 2016-02-25 13:42 +0100
http://bitbucket.org/pypy/pypy/changeset/d6ea9d88da47/

Log:(plan_rich,remi) small fixes and allow updating the free regs lists

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -310,12 +310,18 @@
 return self.free_callee_regs or self.free_caller_regs
 
 def allocate_new(self, var):
-if self.live_ranges.survives_call(var, self.position):
+if self.live_ranges.exists(var) and 
self.live_ranges.survives_call(var, self.position):
 # we want a callee save register
 return self.get_free_register(var, callee=True)
 else:
 return self.get_free_register(var, callee=False, target_reg=None)
 
+def update_free_registers(self, regs_in_use):
+# XXX: slow?
+self._reset_free_regs()
+for r in regs_in_use:
+self.remove_free_register(r)
+
 def remove_free_register(self, reg):
 if self.is_callee_lookup[reg.value]:
 self.free_callee_regs = [fr for fr in self.free_callee_regs if fr 
is not reg]
@@ -335,9 +341,13 @@
 return reg in self.free_callee_regs or \
reg in self.free_caller_regs
 
+def _reset_free_regs(self):
+self.free_callee_regs = [reg for reg in self.all_regs
+ if reg not in self.save_around_call_regs]
+self.free_caller_regs = self.save_around_call_regs[:]
+
 def __init__(self, live_ranges, frame_manager=None, assembler=None):
-self.free_callee_regs = [reg for reg in self.all_regs if reg not in 
self.save_around_call_regs]
-self.free_caller_regs = self.save_around_call_regs[:]
+self._reset_free_regs()
 self.is_callee_lookup = [True] * len(self.all_regs)
 for reg in self.save_around_call_regs:
 self.is_callee_lookup[reg.value] = False
diff --git a/rpython/jit/backend/llsupport/test/test_regalloc.py 
b/rpython/jit/backend/llsupport/test/test_regalloc.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc.py
@@ -23,9 +23,9 @@
 
 class FakeReg(object):
 def __init__(self, i):
-self.index = i
+self.value = i
 def __repr__(self):
-return 'r%d' % self.index
+return 'r%d' % self.value
 
 r0, r1, r2, r3 = [FakeReg(i) for i in range(4)]
 regs = [r0, r1, r2, r3]
diff --git a/rpython/jit/backend/x86/regalloc.py 
b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -266,11 +266,13 @@
 else:
 return self.xrm.make_sure_var_in_reg(var, forbidden_vars)
 
-def _update_bindings(self, locs, inputargs):
+def _update_bindings(self, arglocs, inputargs):
 # XXX this should probably go to llsupport/regalloc.py
-used = {}
+used = set()
 i = 0
-for loc in locs:
+# manually set the register and frame bindings for
+# all inputargs (for a bridge)
+for loc in arglocs:
 if loc is None: # xxx bit kludgy
 loc = ebp
 arg = inputargs[i]
@@ -278,23 +280,18 @@
 if isinstance(loc, RegLoc):
 if arg.type == FLOAT:
 self.xrm.reg_bindings[arg] = loc
-used[loc] = None
+used.add(loc)
 else:
 if loc is ebp:
 self.rm.bindings_to_frame_reg[arg] = None
 else:
 self.rm.reg_bindings[arg] = loc
-used[loc] = None
+used.add(loc)
 else:
 self.fm.bind(arg, loc)
-self.rm.free_regs = []
-for reg in self.rm.all_regs:
-if reg not in used:
-self.rm.free_regs.append(reg)
-self.xrm.free_regs = []
-for reg in self.xrm.all_regs:
-if reg not in used:
-self.xrm.free_regs.append(reg)
+#
+self.rm.update_free_registers(used)
+self.xrm.update_free_registers(used)
 self.possibly_free_vars(list(inputargs))
 self.fm.finish_binding()
 self.rm._check_invariants()
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (remi, plan_rich) renamed index property to value

2016-02-25 Thread plan_rich
Author: Richard Plangger 
Branch: fix-longevity
Changeset: r82497:ed33bb43fa34
Date: 2016-02-25 13:21 +0100
http://bitbucket.org/pypy/pypy/changeset/ed33bb43fa34/

Log:(remi, plan_rich) renamed index property to value

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -317,13 +317,13 @@
 return self.get_free_register(var, callee=False, target_reg=None)
 
 def remove_free_register(self, reg):
-if self.is_callee_lookup[reg.index]:
+if self.is_callee_lookup[reg.value]:
 self.free_callee_regs = [fr for fr in self.free_callee_regs if fr 
is not reg]
 else:
 self.free_caller_regs = [fr for fr in self.free_caller_regs if fr 
is not reg]
 
 def put_back_register(self, reg):
-if self.is_callee_lookup[reg.index]:
+if self.is_callee_lookup[reg.value]:
 self.free_callee_regs.append(reg)
 else:
 self.free_caller_regs.append(reg)
@@ -340,7 +340,7 @@
 self.free_caller_regs = self.save_around_call_regs[:]
 self.is_callee_lookup = [True] * len(self.all_regs)
 for reg in self.save_around_call_regs:
-self.is_callee_lookup[reg.index] = False
+self.is_callee_lookup[reg.value] = False
 
 self.live_ranges = live_ranges
 self.temp_boxes = []
diff --git a/rpython/jit/backend/llsupport/test/test_regalloc_call.py 
b/rpython/jit/backend/llsupport/test/test_regalloc_call.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc_call.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc_call.py
@@ -11,12 +11,6 @@
 from rpython.rtyper.annlowlevel import llhelper
 from rpython.jit.codewriter.effectinfo import EffectInfo
 
-class FakeReg(object):
-def __init__(self, i):
-self.n = i
-def __repr__(self):
-return 'r%d' % self.n
-
 eax, ecx, edx, ebx, esp, ebp, esi, edi, r8, r9, r10, r11, r12, r13, r14, r15 = 
REGLOCS
 caller_saved = []
 callee_saved = []
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (remi, plan_rich) fixed all broken tests because of our refactoring

2016-02-25 Thread plan_rich
Author: Richard Plangger 
Branch: fix-longevity
Changeset: r82496:1b6e563e6cb0
Date: 2016-02-25 13:11 +0100
http://bitbucket.org/pypy/pypy/changeset/1b6e563e6cb0/

Log:(remi, plan_rich) fixed all broken tests because of our refactoring

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -276,11 +276,9 @@
 save_around_call_regs = []
 frame_reg = None
 
-free_callee_regs = [reg for reg in all_regs if reg not in 
save_around_call_regs]
-free_caller_regs = save_around_call_regs[:]
-is_callee_lookup = [True] * len(all_regs)
-for reg in save_around_call_regs:
-is_callee_lookup[reg.index] = False
+free_callee_regs  = []
+free_caller_regs  = []
+is_callee_lookup  = None
 
 def get_lower_byte_free_register(self, reg):
 # try to return a volatile register first!
@@ -326,17 +324,24 @@
 
 def put_back_register(self, reg):
 if self.is_callee_lookup[reg.index]:
-self.free_callee_regs.push(reg)
+self.free_callee_regs.append(reg)
 else:
-self.free_caller_regs.push(reg)
+self.free_caller_regs.append(reg)
+
+def free_register_count(self):
+return len(self.free_callee_regs) + len(self.free_caller_regs)
 
 def is_free(self, reg):
 return reg in self.free_callee_regs or \
reg in self.free_caller_regs
 
 def __init__(self, live_ranges, frame_manager=None, assembler=None):
-self.free_regs = self.all_regs[:]
-self.free_regs.reverse()
+self.free_callee_regs = [reg for reg in self.all_regs if reg not in 
self.save_around_call_regs]
+self.free_caller_regs = self.save_around_call_regs[:]
+self.is_callee_lookup = [True] * len(self.all_regs)
+for reg in self.save_around_call_regs:
+self.is_callee_lookup[reg.index] = False
+
 self.live_ranges = live_ranges
 self.temp_boxes = []
 if not we_are_translated():
@@ -395,7 +400,7 @@
 self.temp_boxes = []
 
 def _check_invariants(self):
-free_count = len(self.free_callee_regs) + len(self.free_caller_regs)
+free_count = self.free_register_count()
 if not we_are_translated():
 # make sure no duplicates
 assert len(dict.fromkeys(self.reg_bindings.values())) == 
len(self.reg_bindings)
@@ -442,11 +447,15 @@
 # yes, this location is a no_lower_byte_register
 return loc
 # find a free register that is also a lower byte register
-if loc:
-self.put_back_register(loc)
+if not self.has_free_registers():
+return None
 reg = self.get_lower_byte_free_register(v)
-self.reg_bindings[v] = reg
-return reg
+if reg is not None:
+if loc:
+self.put_back_register(loc)
+self.reg_bindings[v] = reg
+return reg
+return None
 
 try:
 return self.reg_bindings[v]
@@ -737,22 +746,25 @@
 self.dist_to_next_call = dist_to_next_call
 
 def exists(self, var):
- return var in self.longevity
+return var in self.longevity
 
 def last_use(self, var):
- return self.longevity[var][1]
+return self.longevity[var][1]
 
 def new_live_range(self, var, start, end):
- self.longevity[var] = (start, end)
+self.longevity[var] = (start, end)
 
 def survives_call(self, var, position):
- start, end = self.longevity[var]
- dist = self.dist_to_next_call[position]
- assert end >= position
- if end-position <= dist:
- # it is 'live during a call' if it live range ends after the call
- return True
- return False
+if not we_are_translated():
+if self.dist_to_next_call is None:
+return False
+start, end = self.longevity[var]
+dist = self.dist_to_next_call[position]
+assert end >= position
+if end-position <= dist:
+# it is 'live during a call' if it live range ends after the call
+return True
+return False
 
 def compute_var_live_ranges(inputargs, operations):
 # compute a dictionary that maps variables to index in
diff --git a/rpython/jit/backend/llsupport/test/test_regalloc.py 
b/rpython/jit/backend/llsupport/test/test_regalloc.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc.py
@@ -23,9 +23,9 @@
 
 class FakeReg(object):
 def __init__(self, i):
-self.n = i
+self.index = i
 def __repr__(self):
-return 'r%d' % self.n
+return 'r%d' % self.index
 
 r0, r1, r2, r3 = 

[pypy-commit] pypy fix-longevity: (plan_rich, remi) fix trivial errors

2016-02-25 Thread Raemi
Author: Remi Meier 
Branch: fix-longevity
Changeset: r82495:4d5d168ea4e5
Date: 2016-02-25 12:45 +0100
http://bitbucket.org/pypy/pypy/changeset/4d5d168ea4e5/

Log:(plan_rich,remi) fix trivial errors

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -276,7 +276,7 @@
 save_around_call_regs = []
 frame_reg = None
 
-free_callee_regs = [reg for reg in all_reg if reg not in 
save_around_call_regs]
+free_callee_regs = [reg for reg in all_regs if reg not in 
save_around_call_regs]
 free_caller_regs = save_around_call_regs[:]
 is_callee_lookup = [True] * len(all_regs)
 for reg in save_around_call_regs:
@@ -319,13 +319,13 @@
 return self.get_free_register(var, callee=False, target_reg=None)
 
 def remove_free_register(self, reg):
-if is_callee_lookup[reg.index]:
-self.free_callee_regs = [fr for fr in self.free_callee_regs if fr 
is not r]
+if self.is_callee_lookup[reg.index]:
+self.free_callee_regs = [fr for fr in self.free_callee_regs if fr 
is not reg]
 else:
-self.free_caller_regs = [fr for fr in self.free_caller_regs if fr 
is not r]
+self.free_caller_regs = [fr for fr in self.free_caller_regs if fr 
is not reg]
 
 def put_back_register(self, reg):
-if is_callee_lookup[reg.index]:
+if self.is_callee_lookup[reg.index]:
 self.free_callee_regs.push(reg)
 else:
 self.free_caller_regs.push(reg)
@@ -752,7 +752,7 @@
  if end-position <= dist:
  # it is 'live during a call' if it live range ends after the call
  return True
-return False
+ return False
 
 def compute_var_live_ranges(inputargs, operations):
 # compute a dictionary that maps variables to index in
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy fix-longevity: (remi, plan_rich) missing changes that should have been commited earlier?

2016-02-25 Thread plan_rich
Author: Richard Plangger 
Branch: fix-longevity
Changeset: r82494:dad960bd604f
Date: 2016-02-25 12:42 +0100
http://bitbucket.org/pypy/pypy/changeset/dad960bd604f/

Log:(remi, plan_rich) missing changes that should have been commited
earlier?

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -276,6 +276,64 @@
 save_around_call_regs = []
 frame_reg = None
 
+free_callee_regs = [reg for reg in all_reg if reg not in 
save_around_call_regs]
+free_caller_regs = save_around_call_regs[:]
+is_callee_lookup = [True] * len(all_regs)
+for reg in save_around_call_regs:
+is_callee_lookup[reg.index] = False
+
+def get_lower_byte_free_register(self, reg):
+# try to return a volatile register first!
+for i, caller in enumerate(self.free_caller_regs):
+if caller not in self.no_lower_byte_regs:
+del self.free_caller_regs[i]
+return caller
+# in any case, we might want to try callee ones as well
+for i, callee in enumerate(self.free_callee_regs):
+if callee not in self.no_lower_byte_regs:
+del self.free_callee_regs[i]
+return callee
+return None
+
+def get_free_register(self, var, callee=False, target_reg=None):
+if callee:
+target_pool = self.free_callee_regs
+second_pool = self.free_caller_regs
+else:
+target_pool = self.free_caller_regs
+second_pool = self.free_callee_regs
+if target_pool:
+return target_pool.pop()
+if second_pool:
+return second_pool.pop()
+assert 0, "not free register, check this before calling"
+
+def has_free_registers(self):
+return self.free_callee_regs or self.free_caller_regs
+
+def allocate_new(self, var):
+if self.live_ranges.survives_call(var, self.position):
+# we want a callee save register
+return self.get_free_register(var, callee=True)
+else:
+return self.get_free_register(var, callee=False, target_reg=None)
+
+def remove_free_register(self, reg):
+if is_callee_lookup[reg.index]:
+self.free_callee_regs = [fr for fr in self.free_callee_regs if fr 
is not r]
+else:
+self.free_caller_regs = [fr for fr in self.free_caller_regs if fr 
is not r]
+
+def put_back_register(self, reg):
+if is_callee_lookup[reg.index]:
+self.free_callee_regs.push(reg)
+else:
+self.free_caller_regs.push(reg)
+
+def is_free(self, reg):
+return reg in self.free_callee_regs or \
+   reg in self.free_caller_regs
+
 def __init__(self, live_ranges, frame_manager=None, assembler=None):
 self.free_regs = self.all_regs[:]
 self.free_regs.reverse()
@@ -317,7 +375,7 @@
 return
 if not self.live_ranges.exists(v) or self.live_ranges.last_use(v) <= 
self.position:
 if v in self.reg_bindings:
-self.free_regs.append(self.reg_bindings[v])
+self.put_back_register(self.reg_bindings[v])
 del self.reg_bindings[v]
 if self.frame_manager is not None:
 self.frame_manager.mark_as_free(v)
@@ -337,17 +395,20 @@
 self.temp_boxes = []
 
 def _check_invariants(self):
+free_count = len(self.free_callee_regs) + len(self.free_caller_regs)
 if not we_are_translated():
 # make sure no duplicates
 assert len(dict.fromkeys(self.reg_bindings.values())) == 
len(self.reg_bindings)
 rev_regs = dict.fromkeys(self.reg_bindings.values())
-for reg in self.free_regs:
+for reg in self.free_caller_regs:
 assert reg not in rev_regs
-assert len(rev_regs) + len(self.free_regs) == len(self.all_regs)
+for reg in self.free_callee_regs:
+assert reg not in rev_regs
+assert len(rev_regs) + free_count == len(self.all_regs)
 else:
-assert len(self.reg_bindings) + len(self.free_regs) == 
len(self.all_regs)
+assert len(self.reg_bindings) + free_count == len(self.all_regs)
 assert len(self.temp_boxes) == 0
-if self.live_ranges:
+if self.live_ranges.longevity:
 for v in self.reg_bindings:
 assert self.live_ranges.last_use(v) > self.position
 
@@ -368,32 +429,30 @@
 return res
 else:
 del self.reg_bindings[v]
-self.free_regs.append(res)
-if selected_reg in self.free_regs:
-self.free_regs = [reg for reg in self.free_regs
-  if reg is not 

[pypy-commit] pypy default: Add app level tests for sys.dont_write_bytecode.

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82493:423372b7d89b
Date: 2016-02-25 10:23 +0100
http://bitbucket.org/pypy/pypy/changeset/423372b7d89b/

Log:Add app level tests for sys.dont_write_bytecode.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -98,6 +98,10 @@
 'a=5\nb=6\rc="""hello\r\nworld"""\r', mode='wb')
 p.join('mod.py').write(
 'a=15\nb=16\rc="""foo\r\nbar"""\r', mode='wb')
+setuppkg("test_bytecode",
+ a = '',
+ b = '',
+ c = '')
 
 # create compiled/x.py and a corresponding pyc file
 p = setuppkg("compiled", x = "x = 84")
@@ -1342,6 +1346,36 @@
 assert isinstance(importer, zipimport.zipimporter)
 
 
+class AppTestWriteBytecode(object):
+def setup(cls):
+cls.saved_modules = _setup(cls.space)
+
+def teardown(cls):
+_teardown(cls.space, cls.saved_modules)
+
+def test_default(self):
+import os.path
+from test_bytecode import a
+assert a.__file__.endswith('a.py')
+assert os.path.exists(a.__file__ + 'c')
+
+def test_write_bytecode(self):
+import os.path
+import sys
+sys.dont_write_bytecode = False
+from test_bytecode import b
+assert b.__file__.endswith('b.py')
+assert os.path.exists(b.__file__ + 'c')
+
+def test_dont_write_bytecode(self):
+import os.path
+import sys
+sys.dont_write_bytecode = True
+from test_bytecode import c
+assert c.__file__.endswith('c.py')
+assert not os.path.exists(c.__file__ + 'c')
+
+
 class AppTestNoPycFile(object):
 spaceconfig = {
 "objspace.usepycfiles": False,
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy llvm-translation-backend: hg merge default (+ fixes)

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: llvm-translation-backend
Changeset: r82492:d01ebac8cf46
Date: 2016-02-24 10:56 +0100
http://bitbucket.org/pypy/pypy/changeset/d01ebac8cf46/

Log:hg merge default (+ fixes)

diff too long, truncating to 2000 out of 11381 lines

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -22,6 +22,7 @@
 ^pypy/module/cpyext/test/.+\.obj$
 ^pypy/module/cpyext/test/.+\.manifest$
 ^pypy/module/test_lib_pypy/ctypes_tests/.+\.o$
+^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$
 ^pypy/module/cppyy/src/.+\.o$
 ^pypy/module/cppyy/bench/.+\.so$
 ^pypy/module/cppyy/bench/.+\.root$
@@ -35,7 +36,6 @@
 ^pypy/module/test_lib_pypy/cffi_tests/__pycache__.+$
 ^pypy/doc/.+\.html$
 ^pypy/doc/config/.+\.rst$
-^pypy/doc/basicblock\.asc$
 ^pypy/doc/.+\.svninfo$
 ^rpython/translator/c/src/libffi_msvc/.+\.obj$
 ^rpython/translator/c/src/libffi_msvc/.+\.dll$
@@ -45,53 +45,33 @@
 ^rpython/translator/c/src/cjkcodecs/.+\.obj$
 ^rpython/translator/c/src/stacklet/.+\.o$
 ^rpython/translator/c/src/.+\.o$
-^rpython/translator/jvm/\.project$
-^rpython/translator/jvm/\.classpath$
-^rpython/translator/jvm/eclipse-bin$
-^rpython/translator/jvm/src/pypy/.+\.class$
-^rpython/translator/benchmark/docutils$
-^rpython/translator/benchmark/templess$
-^rpython/translator/benchmark/gadfly$
-^rpython/translator/benchmark/mako$
-^rpython/translator/benchmark/bench-custom\.benchmark_result$
-^rpython/translator/benchmark/shootout_benchmarks$
+^rpython/translator/llvm/.+\.so$
 ^rpython/translator/goal/target.+-c$
 ^rpython/translator/goal/.+\.exe$
 ^rpython/translator/goal/.+\.dll$
 ^pypy/goal/pypy-translation-snapshot$
 ^pypy/goal/pypy-c
-^pypy/goal/pypy-jvm
-^pypy/goal/pypy-jvm.jar
 ^pypy/goal/.+\.exe$
 ^pypy/goal/.+\.dll$
 ^pypy/goal/.+\.lib$
 ^pypy/_cache$
-^pypy/doc/statistic/.+\.html$
-^pypy/doc/statistic/.+\.eps$
-^pypy/doc/statistic/.+\.pdf$
-^rpython/translator/cli/src/pypylib\.dll$
-^rpython/translator/cli/src/query\.exe$
-^rpython/translator/cli/src/main\.exe$
+^lib-python/2.7/lib2to3/.+\.pickle$
 ^lib_pypy/__pycache__$
 ^lib_pypy/ctypes_config_cache/_.+_cache\.py$
 ^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
 ^lib_pypy/_libmpdec/.+.o$
-^rpython/translator/cli/query-descriptions$
 ^pypy/doc/discussion/.+\.html$
 ^include/.+\.h$
 ^include/.+\.inl$
 ^pypy/doc/_build/.*$
 ^pypy/doc/config/.+\.html$
 ^pypy/doc/config/style\.css$
-^pypy/doc/jit/.+\.html$
-^pypy/doc/jit/style\.css$
 ^pypy/doc/image/lattice1\.png$
 ^pypy/doc/image/lattice2\.png$
 ^pypy/doc/image/lattice3\.png$
 ^pypy/doc/image/stackless_informal\.png$
 ^pypy/doc/image/parsing_example.+\.png$
 ^rpython/doc/_build/.*$
-^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$
 ^compiled
 ^.git/
 ^release/
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -41,29 +41,29 @@
   Amaury Forgeot d'Arc
   Antonio Cuni
   Samuele Pedroni
+  Matti Picus
   Alex Gaynor
   Brian Kearns
-  Matti Picus
   Philip Jenvey
   Michael Hudson
+  Ronan Lamy
   David Schneider
+  Manuel Jacob
   Holger Krekel
   Christian Tismer
   Hakan Ardo
-  Manuel Jacob
-  Ronan Lamy
   Benjamin Peterson
+  Richard Plangger
   Anders Chrigstrom
   Eric van Riet Paap
   Wim Lavrijsen
-  Richard Plangger
   Richard Emslie
   Alexander Schremmer
   Dan Villiom Podlaski Christiansen
+  Remi Meier
   Lukas Diekmann
   Sven Hager
   Anders Lehmann
-  Remi Meier
   Aurelien Campeas
   Niklaus Haldimann
   Camillo Bruni
@@ -72,8 +72,8 @@
   Romain Guillebert
   Leonardo Santagada
   Seo Sanghyeon
+  Ronny Pfannschmidt
   Justin Peel
-  Ronny Pfannschmidt
   David Edelsohn
   Anders Hammarquist
   Jakub Gustak
@@ -95,6 +95,7 @@
   Tyler Wade
   Michael Foord
   Stephan Diehl
+  Vincent Legoll
   Stefan Schwarzer
   Valentino Volonghi
   Tomek Meka
@@ -105,9 +106,9 @@
   Jean-Paul Calderone
   Timo Paulssen
   Squeaky
+  Marius Gedminas
   Alexandre Fayolle
   Simon Burton
-  Marius Gedminas
   Martin Matusiak
   Konstantin Lopuhin
   Wenzhu Man
@@ -116,16 +117,20 @@
   Ivan Sichmann Freitas
   Greg Price
   Dario Bertini
+  Stefano Rivera
   Mark Pearse
   Simon Cross
   Andreas Sthrk
-  Stefano Rivera
+  Edd Barrett
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
+  Jeremy Thurgood
   Pawe Piotr Przeradowski
+  Spenser Bauman
   Paul deGrandis
   Ilya Osadchiy
+  marky1991
   Tobias Oberstein
   Adrian Kuhn
   Boris Feigin
@@ -134,14 +139,12 @@
   Georg Brandl
   Bert Freudenberg
   Stian Andreassen
-  Edd Barrett
+  Tobias Pape
   Wanja Saatkamp
   Gerald Klix
   Mike Blume
-  Tobias Pape
   Oscar Nierstrasz
   Stefan H. Muller
-  Jeremy Thurgood
   Rami Chowdhury
   Eugene Oden
   Henry Mason
@@ -153,6 +156,8 @@
   Lukas Renggli
   Guenter Jantzen
   Ned Batchelder
+  Tim Felgentreff
+  Anton Gulenko
   Amit Regmi
   Ben Young
   Nicolas Chauvat
@@ -162,12 +167,12 @@
   Nicholas Riley
   Jason Chu
   Igor Trindade Oliveira
-  Tim Felgentreff
+  Yichao Yu
   Rocco Moretti
   Gintautas Miliauskas
   Michael Twomey
   Lucian 

[pypy-commit] benchmarks single-run: fix

2016-02-25 Thread fijal
Author: fijal
Branch: single-run
Changeset: r349:898cedf9e20c
Date: 2016-02-25 10:23 +0100
http://bitbucket.org/pypy/benchmarks/changeset/898cedf9e20c/

Log:fix

diff --git a/bench-data.json b/bench-data.json
--- a/bench-data.json
+++ b/bench-data.json
@@ -31,7 +31,9 @@
"warmup": 40
  },
  "bm_mdp": {
-   "description": "Some AI ..."
+   "description": "Some AI that uses a lot of fractions",
+   "total_runs": 2,
+   "warmup": 1
  },
  "pypy_interp": {
"description": "interpreting py.py",
diff --git a/benchmarks.py b/benchmarks.py
--- a/benchmarks.py
+++ b/benchmarks.py
@@ -202,7 +202,7 @@
 print err
 raise Exception("sphinx-build.py failed")
 res = float(out.splitlines()[-1])
-return RawResult([res])
+return RawResult([res], None)
 
 BM_cpython_doc.benchmark_name = 'sphinx'
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy desc-specialize: fixes

2016-02-25 Thread rlamy
Author: Ronan Lamy 
Branch: desc-specialize
Changeset: r82491:aef099eea410
Date: 2016-02-25 10:06 +0100
http://bitbucket.org/pypy/pypy/changeset/aef099eea410/

Log:fixes

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -1295,7 +1295,7 @@
 miniglobals = {'__name__':__name__, # for module name propagation
}
 exec source.compile() in miniglobals
-call_external_function = specialize.ll(miniglobals['cpy_call_external'])
+call_external_function = specialize.ll()(miniglobals['cpy_call_external'])
 call_external_function._dont_inline_ = True
 call_external_function._gctransformer_hint_close_stack_ = True
 # don't inline, as a hack to guarantee that no GC pointer is alive
diff --git a/rpython/annotator/description.py b/rpython/annotator/description.py
--- a/rpython/annotator/description.py
+++ b/rpython/annotator/description.py
@@ -6,7 +6,7 @@
 from rpython.annotator.argument import rawshape, ArgErr, simple_args
 from rpython.tool.sourcetools import valid_identifier
 from rpython.tool.pairtype import extendabletype
-from rpython.annotator.model import AnnotatorError, s_ImpossibleValue
+from rpython.annotator.model import AnnotatorError, s_ImpossibleValue, unionof
 
 class CallFamily(object):
 """A family of Desc objects that could be called from common call sites.
@@ -116,7 +116,6 @@
 self.s_value = s_ImpossibleValue# union of possible values
 
 def update(self, other):
-from rpython.annotator.model import unionof
 self.descs.update(other.descs)
 self.read_locations.update(other.read_locations)
 self.s_value = unionof(self.s_value, other.s_value)
@@ -303,7 +302,6 @@
 # Some specializations may break the invariant of returning
 # annotations that are always more general than the previous time.
 # We restore it here:
-from rpython.annotator.model import unionof
 result = unionof(result, s_previous_result)
 return result
 
@@ -399,8 +397,9 @@
 def pycall(self, whence, args, s_previous_result, op=None):
 inputcells = self.parse_arguments(args)
 s_result = self.specialize(inputcells, op)
-assert not isinstance(s_result, FunctionGraph)
-assert s_result.contains(s_previous_result)
+if isinstance(s_result, FunctionGraph):
+s_result = s_result.getreturnvar().annotation
+s_result = unionof(s_result, s_previous_result)
 return s_result
 
 
diff --git a/rpython/rtyper/lltypesystem/llmemory.py 
b/rpython/rtyper/lltypesystem/llmemory.py
--- a/rpython/rtyper/lltypesystem/llmemory.py
+++ b/rpython/rtyper/lltypesystem/llmemory.py
@@ -377,7 +377,6 @@
 def _sizeof_none(TYPE):
 assert not TYPE._is_varsize()
 return ItemOffset(TYPE)
-_sizeof_none._annspecialcase_ = 'specialize:memo'
 
 @specialize.memo()
 def _internal_array_field(TYPE):
diff --git a/rpython/rtyper/rpbc.py b/rpython/rtyper/rpbc.py
--- a/rpython/rtyper/rpbc.py
+++ b/rpython/rtyper/rpbc.py
@@ -362,9 +362,9 @@
 def get_concrete_llfn(self, s_pbc, args_s, op):
 bk = self.rtyper.annotator.bookkeeper
 funcdesc, = s_pbc.descriptions
-args = simple_args(args_s)
 with bk.at_position(None):
-graph = funcdesc.get_graph(args, op)
+argspec = simple_args(args_s)
+graph = funcdesc.get_graph(argspec, op)
 llfn = self.rtyper.getcallable(graph)
 return inputconst(typeOf(llfn), llfn)
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy desc-specialize: Create special FunctionDesc subclass for @specialize.memo() functions

2016-02-25 Thread rlamy
Author: Ronan Lamy 
Branch: desc-specialize
Changeset: r82490:67633b1da4fa
Date: 2016-02-24 19:00 +0100
http://bitbucket.org/pypy/pypy/changeset/67633b1da4fa/

Log:Create special FunctionDesc subclass for @specialize.memo()
functions

diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
--- a/rpython/annotator/bookkeeper.py
+++ b/rpython/annotator/bookkeeper.py
@@ -22,6 +22,7 @@
 from rpython.annotator import description
 from rpython.annotator.signature import annotationoftype
 from rpython.annotator.argument import simple_args
+from rpython.annotator.specialize import memo
 from rpython.rlib.objectmodel import r_dict, r_ordereddict, Symbolic
 from rpython.tool.algo.unionfind import UnionFind
 from rpython.rtyper import extregistry
@@ -417,6 +418,8 @@
 # (if any), according to the current policy
 tag = getattr(pyfunc, '_annspecialcase_', None)
 specializer = self.annotator.policy.get_specializer(tag)
+if specializer is memo:
+return description.MemoDesc(self, pyfunc, name, signature, 
defaults, specializer)
 return description.FunctionDesc(self, pyfunc, name, signature, 
defaults, specializer)
 
 def getfrozen(self, pyobj):
diff --git a/rpython/annotator/description.py b/rpython/annotator/description.py
--- a/rpython/annotator/description.py
+++ b/rpython/annotator/description.py
@@ -395,6 +395,15 @@
 
 return s_sigs
 
+class MemoDesc(FunctionDesc):
+def pycall(self, whence, args, s_previous_result, op=None):
+inputcells = self.parse_arguments(args)
+s_result = self.specialize(inputcells, op)
+assert not isinstance(s_result, FunctionGraph)
+assert s_result.contains(s_previous_result)
+return s_result
+
+
 class MethodDesc(Desc):
 knowntype = types.MethodType
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy stmgc-c8: disable cpyext on stm

2016-02-25 Thread Raemi
Author: Remi Meier 
Branch: stmgc-c8
Changeset: r82489:19cfa846e509
Date: 2016-02-25 10:01 +0100
http://bitbucket.org/pypy/pypy/changeset/19cfa846e509/

Log:disable cpyext on stm

We don't support the rawrefcount functionality in our GC, and I
think there is no fallback available.

diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -231,6 +231,9 @@
 # for now, disable _vmprof: the JIT's stm parts are not adapted
 # to track the stack depth
 config.objspace.usemodules._vmprof = False
+# we don't support rlib.rawrefcount for our GC, so we need
+# to disable cpyext...
+config.objspace.usemodules.cpyext = False
 
 if config.objspace.allworkingmodules:
 from pypy.config.pypyoption import enable_allworkingmodules
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit