[pypy-commit] pypy default: Make GraphAnalyzer return the bottom result when encountering a null function pointer.

2016-01-11 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r81679:58ef780a3875
Date: 2016-01-11 23:11 +0100
http://bitbucket.org/pypy/pypy/changeset/58ef780a3875/

Log:Make GraphAnalyzer return the bottom result when encountering a null
function pointer.

diff --git a/rpython/translator/backendopt/graphanalyze.py 
b/rpython/translator/backendopt/graphanalyze.py
--- a/rpython/translator/backendopt/graphanalyze.py
+++ b/rpython/translator/backendopt/graphanalyze.py
@@ -80,12 +80,17 @@
 funcobj = op.args[0].value._obj
 except DelayedPointer:
 return self.top_result()
+if funcobj is None:
+# We encountered a null pointer.  Calling it will crash.
+# However, the call could be on a dead path, so we return the
+# bottom result here.
+return self.bottom_result()
 if getattr(funcobj, 'external', None) is not None:
 x = self.analyze_external_call(funcobj, seen)
 if self.verbose and x:
 self.dump_info('analyze_external_call %s: %r' % (op, x))
 return x
-graph = get_graph(op.args[0], self.translator)
+graph = funcobj.graph
 assert graph is not None
 x = self.analyze_direct_call(graph, seen)
 if self.verbose and x:
diff --git a/rpython/translator/backendopt/test/test_graphanalyze.py 
b/rpython/translator/backendopt/test/test_graphanalyze.py
--- a/rpython/translator/backendopt/test/test_graphanalyze.py
+++ b/rpython/translator/backendopt/test/test_graphanalyze.py
@@ -65,3 +65,14 @@
 op = SpaceOperation('direct_call', [c_f], None)
 analyzer = BoolGraphAnalyzer(t)
 assert analyzer.analyze(op)
+
+
+def test_null_fnptr():
+from rpython.flowspace.model import SpaceOperation, Constant
+from rpython.rtyper.lltypesystem.lltype import Void, FuncType, nullptr
+from rpython.translator.translator import TranslationContext
+t = TranslationContext()
+fnptr = nullptr(FuncType([], Void))
+op = SpaceOperation('direct_call', [Constant(fnptr)], None)
+analyzer = BoolGraphAnalyzer(t)
+assert not analyzer.analyze(op)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy llvm-translation-backend: Fix this test by using the new entrypoint API.

2016-01-11 Thread mjacob
Author: Manuel Jacob 
Branch: llvm-translation-backend
Changeset: r81678:03e0a99cf23b
Date: 2016-01-11 22:58 +0100
http://bitbucket.org/pypy/pypy/changeset/03e0a99cf23b/

Log:Fix this test by using the new entrypoint API.

diff --git a/rpython/translator/llvm/test/test_genllvm.py 
b/rpython/translator/llvm/test/test_genllvm.py
--- a/rpython/translator/llvm/test/test_genllvm.py
+++ b/rpython/translator/llvm/test/test_genllvm.py
@@ -534,14 +534,14 @@
 assert fc(1) == 0
 
 def test_entrypoints(self):
-from rpython.rlib.entrypoint import entrypoint
+from rpython.rlib.entrypoint import entrypoint_highlevel
 from rpython.translator.interactive import Translation
 
 def f(args):
 return 3
 
 key = 'test_entrypoints42'
-@entrypoint(key, [int], 'foobar')
+@entrypoint_highlevel(key, [int], 'foobar')
 def g(x):
 return x + 42
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy.org extradoc: update the values

2016-01-11 Thread arigo
Author: Armin Rigo 
Branch: extradoc
Changeset: r692:2af2311f676c
Date: 2016-01-12 00:17 +0100
http://bitbucket.org/pypy/pypy.org/changeset/2af2311f676c/

Log:update the values

diff --git a/don1.html b/don1.html
--- a/don1.html
+++ b/don1.html
@@ -15,7 +15,7 @@
 
 

-   $62669 of $105000 (59.7%)
+   $62717 of $105000 (59.7%)


 
@@ -23,7 +23,7 @@
   
   This donation goes towards supporting Python 3 in 
PyPy.
   Current status:
-we have $7853 left
+we have $7897 left
   in the account. Read proposal
   
   
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy s390x-backend: adapted values unpacked from the gcmap for the s390x case

2016-01-11 Thread plan_rich
Author: Richard Plangger 
Branch: s390x-backend
Changeset: r81665:c7594062a728
Date: 2016-01-11 10:39 +0100
http://bitbucket.org/pypy/pypy/changeset/c7594062a728/

Log:adapted values unpacked from the gcmap for the s390x case

diff --git a/rpython/jit/backend/llsupport/test/test_gc_integration.py 
b/rpython/jit/backend/llsupport/test/test_gc_integration.py
--- a/rpython/jit/backend/llsupport/test/test_gc_integration.py
+++ b/rpython/jit/backend/llsupport/test/test_gc_integration.py
@@ -92,7 +92,7 @@
 elif self.cpu.backend_name.startswith('ppc64'):
 assert nos == [0, 1, 33]
 elif self.cpu.backend_name.startswith('zarch'):
-assert nos == [0, 1, 35]
+assert nos == [2, 3, 35]
 else:
 raise Exception("write the data here")
 assert frame.jf_frame[nos[0]]
@@ -647,11 +647,12 @@
 gcmap = unpack_gcmap(frame)
 if self.cpu.backend_name.startswith('ppc64'):
 assert gcmap == [30, 31, 32]
+elif self.cpu.backend_name.startswith('zarch'):
+assert gcmap == [32, 33, 34]
 elif self.cpu.IS_64_BIT:
 assert gcmap == [28, 29, 30]
 elif self.cpu.backend_name.startswith('arm'):
 assert gcmap == [44, 45, 46]
-pass
 else:
 assert gcmap == [22, 23, 24]
 for item, s in zip(gcmap, new_items):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy s390x-backend: translation changes to the instruction builder, this was up to now quite dynamic

2016-01-11 Thread plan_rich
Author: Richard Plangger 
Branch: s390x-backend
Changeset: r81668:dab47ded5b1d
Date: 2016-01-11 11:29 +0100
http://bitbucket.org/pypy/pypy/changeset/dab47ded5b1d/

Log:translation changes to the instruction builder, this was up to now
quite dynamic

diff --git a/rpython/jit/backend/zarch/assembler.py 
b/rpython/jit/backend/zarch/assembler.py
--- a/rpython/jit/backend/zarch/assembler.py
+++ b/rpython/jit/backend/zarch/assembler.py
@@ -512,7 +512,6 @@
 # registers).
 mc = InstrBuilder()
 #
-mc.trap()
 # mc.STG(r.r14, l.addr(14*WORD, r.SP))
 # Do the call
 mc.push_std_frame()
@@ -526,7 +525,7 @@
 mc.LG(r.SCRATCH, l.addr(0, r.SCRATCH))
 # if this comparison is true, then everything is ok,
 # else we have an exception
-mc.cmp_op(r.SCRATCH, 0, imm=True)
+mc.cmp_op(r.SCRATCH, l.imm(0), imm=True)
 #
 # So we return to our caller, conditionally if "EQ"
 # mc.LG(r.r14, l.addr(14*WORD, r.SP))
diff --git a/rpython/jit/backend/zarch/instruction_builder.py 
b/rpython/jit/backend/zarch/instruction_builder.py
--- a/rpython/jit/backend/zarch/instruction_builder.py
+++ b/rpython/jit/backend/zarch/instruction_builder.py
@@ -436,18 +436,55 @@
 return encode_rie_c
 
 def build_unpack_func(mnemonic, func):
-def function(self, *args):
-newargs = [None] * len(func._arguments_)
-for i,arg in enumerate(unrolling_iterable(func._arguments_)):
-if arg == '-':
-newargs[i] = 0
-elif arg == 'r' or arg == 'r/m' or arg == 'f' or arg == 'eo':
-newargs[i] = args[i].value
-elif arg.startswith('i') or arg.startswith('u') or 
arg.startswith('h'):
-newargs[i] = args[i].value
-else:
-newargs[i] = args[i]
-return func(self, *newargs)
+@always_inline
+def unpack_arg(arg, argtype):
+if argtype == '-':
+return 0
+elif argtype == 'r' or argtype == 'r/m' or \
+ argtype == 'f' or argtype == 'eo':
+return arg.value
+elif argtype.startswith('i') or argtype.startswith('u') or 
argtype.startswith('h'):
+return arg.value
+else:
+return arg
+unpack_arg._annspecialcase_ = 'specialize:arg(1)'
+argtypes = func._arguments_
+at = argtypes[0] if len(argtypes) >= 1 else '-'
+bt = argtypes[1] if len(argtypes) >= 2 else '-'
+ct = argtypes[2] if len(argtypes) >= 3 else '-'
+dt = argtypes[3] if len(argtypes) >= 4 else '-'
+def function0(self):
+return func(self)
+def function1(self, a):
+e = unpack_arg(a, at)
+return func(self, e)
+def function2(self, a, b):
+e = unpack_arg(a, at)
+f = unpack_arg(b, bt)
+return func(self, e, f)
+def function3(self, a, b, c):
+e = unpack_arg(a, at)
+f = unpack_arg(b, bt)
+g = unpack_arg(c, ct)
+return func(self, e, f, g)
+def function4(self, a, b):
+e = unpack_arg(a, at)
+f = unpack_arg(b, bt)
+g = unpack_arg(c, ct)
+h = unpack_arg(d, dt)
+return func(self, e, f, g, h)
+if len(argtypes) == 0:
+function = function0
+elif len(argtypes) == 1:
+function = function1
+elif len(argtypes) == 2:
+function = function2
+elif len(argtypes) == 3:
+function = function3
+elif len(argtypes) == 4:
+function = function4
+else:
+assert 0, "implement function for argtypes %s" % (argtypes,)
 function.__name__ = mnemonic
 return function
 
diff --git a/rpython/jit/backend/zarch/runner.py 
b/rpython/jit/backend/zarch/runner.py
--- a/rpython/jit/backend/zarch/runner.py
+++ b/rpython/jit/backend/zarch/runner.py
@@ -73,3 +73,8 @@
 cast_ptr_to_int._annspecialcase_ = 'specialize:arglltype(0)'
 cast_ptr_to_int = staticmethod(cast_ptr_to_int)
 
+def build_regalloc(self):
+''' NOT_RPYTHON: for tests '''
+from rpython.jit.backend.zarch.regalloc import Regalloc
+assert self.assembler is not None
+return Regalloc(self.assembler)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: ups a better way

2016-01-11 Thread fijal
Author: fijal
Branch: vmprof-newstack
Changeset: r81664:94707b484f65
Date: 2016-01-11 11:24 +0200
http://bitbucket.org/pypy/pypy/changeset/94707b484f65/

Log:ups a better way

diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h 
b/rpython/rlib/rvmprof/src/vmprof_main.h
--- a/rpython/rlib/rvmprof/src/vmprof_main.h
+++ b/rpython/rlib/rvmprof/src/vmprof_main.h
@@ -159,7 +159,7 @@
 }
 #ifdef PYPY_JIT_CODEMAP
 if (stack->kind == VMPROF_JITTED_TAG) {
-pc = stack->value;
+pc = (intptr_t*)(stack->value - sizeof(intptr_t))[0];
 n = vmprof_write_header_for_jit_addr(result, n, pc, max_depth);
 stack = stack->next;
 }
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: I'll never get it right

2016-01-11 Thread fijal
Author: fijal
Branch: vmprof-newstack
Changeset: r81666:9ca1bce08a8b
Date: 2016-01-11 11:44 +0200
http://bitbucket.org/pypy/pypy/changeset/9ca1bce08a8b/

Log:I'll never get it right

diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h 
b/rpython/rlib/rvmprof/src/vmprof_main.h
--- a/rpython/rlib/rvmprof/src/vmprof_main.h
+++ b/rpython/rlib/rvmprof/src/vmprof_main.h
@@ -159,7 +159,7 @@
 }
 #ifdef PYPY_JIT_CODEMAP
 if (stack->kind == VMPROF_JITTED_TAG) {
-pc = (intptr_t*)(stack->value - sizeof(intptr_t))[0];
+pc = ((intptr_t*)(stack->value - sizeof(intptr_t)))[0];
 n = vmprof_write_header_for_jit_addr(result, n, pc, max_depth);
 stack = stack->next;
 }
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy.org extradoc: update the values

2016-01-11 Thread arigo
Author: Armin Rigo 
Branch: extradoc
Changeset: r691:5c4b20a06a45
Date: 2016-01-11 11:52 +0100
http://bitbucket.org/pypy/pypy.org/changeset/5c4b20a06a45/

Log:update the values

diff --git a/don3.html b/don3.html
--- a/don3.html
+++ b/don3.html
@@ -9,13 +9,13 @@
 
   $(function() {
 $("#progressbar").progressbar({
-  value: 88.0
+  value: 88.6
});
   });
 
 

-   $52771 of $6 (88.0%)
+   $53142 of $6 (88.6%)


 
@@ -23,7 +23,7 @@
   
   This donation goes towards supporting NumPy in PyPy.
   Current status:
-we have $7593 left
+we have $7933 left
   in the account. Read proposal
   
   
diff --git a/don4.html b/don4.html
--- a/don4.html
+++ b/don4.html
@@ -17,7 +17,7 @@
2nd call:

-   $30322 of $8 (37.9%)
+   $30344 of $8 (37.9%)


 
@@ -25,7 +25,7 @@
   
   This donation goes towards supporting the 
Transactional Memory in PyPy.
   Current status:
-we have $23057 left
+we have $23076 left
   in the account. Read proposal (2nd 
call)
   
   
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: ups

2016-01-11 Thread fijal
Author: fijal
Branch: vmprof-newstack
Changeset: r81667:65638eea1b89
Date: 2016-01-11 12:05 +0200
http://bitbucket.org/pypy/pypy/changeset/65638eea1b89/

Log:ups

diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h 
b/rpython/rlib/rvmprof/src/vmprof_main.h
--- a/rpython/rlib/rvmprof/src/vmprof_main.h
+++ b/rpython/rlib/rvmprof/src/vmprof_main.h
@@ -158,7 +158,7 @@
 n += 2;
 }
 #ifdef PYPY_JIT_CODEMAP
-if (stack->kind == VMPROF_JITTED_TAG) {
+else if (stack->kind == VMPROF_JITTED_TAG) {
 pc = ((intptr_t*)(stack->value - sizeof(intptr_t)))[0];
 n = vmprof_write_header_for_jit_addr(result, n, pc, max_depth);
 stack = stack->next;
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: missing fixes for pypy

2016-01-11 Thread fijal
Author: fijal
Branch: vmprof-newstack
Changeset: r81663:6d7759d0694a
Date: 2016-01-11 11:12 +0200
http://bitbucket.org/pypy/pypy/changeset/6d7759d0694a/

Log:missing fixes for pypy

diff --git a/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h 
b/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h
--- a/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h
+++ b/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h
@@ -24,9 +24,8 @@
 
 // modify the last entry to point to start address and not the random one
 // in the middle
-result[n] = VMPROF_ASSEMBLER_TAG;
-result[n + 1] = start_addr;
-n += 2;
+result[n++] = VMPROF_ASSEMBLER_TAG;
+result[n++] = start_addr;
 start = n;
 while (n < max_depth) {
 id = pypy_yield_codemap_at_addr(codemap, addr, _pos);
diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h 
b/rpython/rlib/rvmprof/src/vmprof_main.h
--- a/rpython/rlib/rvmprof/src/vmprof_main.h
+++ b/rpython/rlib/rvmprof/src/vmprof_main.h
@@ -151,10 +151,19 @@
 }
 #endif
 while (n < max_depth - 1 && stack) {
-result[n] = stack->kind;
-result[n + 1] = stack->value;
-stack = stack->next;
-n += 2;
+if (stack->kind == VMPROF_CODE_TAG) {
+result[n] = stack->kind;
+result[n + 1] = stack->value;
+stack = stack->next;
+n += 2;
+}
+#ifdef PYPY_JIT_CODEMAP
+if (stack->kind == VMPROF_JITTED_TAG) {
+pc = stack->value;
+n = vmprof_write_header_for_jit_addr(result, n, pc, max_depth);
+stack = stack->next;
+}
+#endif
 }
 return n;
 }
___
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

2016-01-11 Thread mjacob
Author: Manuel Jacob 
Branch: llvm-translation-backend
Changeset: r81680:2aff8b331a70
Date: 2016-01-12 02:44 +0100
http://bitbucket.org/pypy/pypy/changeset/2aff8b331a70/

Log:hg merge default

diff --git a/rpython/translator/backendopt/graphanalyze.py 
b/rpython/translator/backendopt/graphanalyze.py
--- a/rpython/translator/backendopt/graphanalyze.py
+++ b/rpython/translator/backendopt/graphanalyze.py
@@ -80,12 +80,17 @@
 funcobj = op.args[0].value._obj
 except DelayedPointer:
 return self.top_result()
+if funcobj is None:
+# We encountered a null pointer.  Calling it will crash.
+# However, the call could be on a dead path, so we return the
+# bottom result here.
+return self.bottom_result()
 if getattr(funcobj, 'external', None) is not None:
 x = self.analyze_external_call(funcobj, seen)
 if self.verbose and x:
 self.dump_info('analyze_external_call %s: %r' % (op, x))
 return x
-graph = get_graph(op.args[0], self.translator)
+graph = funcobj.graph
 assert graph is not None
 x = self.analyze_direct_call(graph, seen)
 if self.verbose and x:
diff --git a/rpython/translator/backendopt/test/test_graphanalyze.py 
b/rpython/translator/backendopt/test/test_graphanalyze.py
--- a/rpython/translator/backendopt/test/test_graphanalyze.py
+++ b/rpython/translator/backendopt/test/test_graphanalyze.py
@@ -65,3 +65,14 @@
 op = SpaceOperation('direct_call', [c_f], None)
 analyzer = BoolGraphAnalyzer(t)
 assert analyzer.analyze(op)
+
+
+def test_null_fnptr():
+from rpython.flowspace.model import SpaceOperation, Constant
+from rpython.rtyper.lltypesystem.lltype import Void, FuncType, nullptr
+from rpython.translator.translator import TranslationContext
+t = TranslationContext()
+fnptr = nullptr(FuncType([], Void))
+op = SpaceOperation('direct_call', [Constant(fnptr)], None)
+analyzer = BoolGraphAnalyzer(t)
+assert not analyzer.analyze(op)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy repeatlist_strategy: Create a new branch to test the repeatlist strategy

2016-01-11 Thread Vincent Legoll
Author: Vincent Legoll 
Branch: repeatlist_strategy
Changeset: r81676:6dff0c69e127
Date: 2016-01-11 21:51 +0100
http://bitbucket.org/pypy/pypy/changeset/6dff0c69e127/

Log:Create a new branch to test the repeatlist strategy

___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy repeatlist_strategy: Initial commit

2016-01-11 Thread Vincent Legoll
Author: Vincent Legoll 
Branch: repeatlist_strategy
Changeset: r81677:856e309b020f
Date: 2016-01-11 21:55 +0100
http://bitbucket.org/pypy/pypy/changeset/856e309b020f/

Log:Initial commit
- some tests still fail because mul() is not allowed to call clone()

diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -35,11 +35,17 @@
 from pypy.objspace.std.unicodeobject import W_UnicodeObject
 from pypy.objspace.std.util import get_positive_index, negate
 
-__all__ = ['W_ListObject', 'make_range_list', 'make_empty_list_with_size']
+__all__ = ['W_ListObject', "make_repeat_list",  'make_range_list', 
'make_empty_list_with_size']
 
 
 UNROLL_CUTOFF = 5
 
+def make_repeat_list(space, w_item, length):
+if length <= 0:
+return make_empty_list(space)
+strategy = space.fromcache(RepeatListStrategy)
+storage = strategy.erase((w_item, length))
+return W_ListObject.from_storage_and_strategy(space, storage, strategy)
 
 def make_range_list(space, start, step, length):
 if length <= 0:
@@ -961,7 +967,7 @@
 
 def setslice(self, w_list, start, step, slicelength, w_other):
 strategy = w_other.strategy
-storage = strategy.getstorage_copy(w_other)
+storage = strategy.getstorage_copy(w_other) # XXX Why not 
strategy.copy_into(w_other, w_list) ?
 w_list.strategy = strategy
 w_list.lstorage = storage
 
@@ -1031,6 +1037,224 @@
 self.sizehint = hint
 
 
+class RepeatListStrategy(ListStrategy):
+"""RepeatListStrategy is used when a list is created using the 
multiplication
+   operator on iterables. The storage is a two elements tuple, with the
+   repeated item, and a positive integer storing the length."""
+
+erase, unerase = rerased.new_erasing_pair("repeat")
+erase = staticmethod(erase)
+unerase = staticmethod(unerase)
+
+def unwrap(self, w_obj):
+return w_obj
+
+def wrap(self, item):
+return item
+
+def clone(self, w_list):
+storage = w_list.lstorage  # lstorage is tuple, no need to clone
+w_clone = W_ListObject.from_storage_and_strategy(self.space, storage,
+ self)
+return w_clone
+
+def copy_into(self, w_list, w_other):
+w_other.strategy = self
+w_other.lstorage = w_list.lstorage
+
+def _resize_hint(self, w_list, hint):
+raise NotImplementedError
+
+def find(self, w_list, w_item, start, stop):
+w_l_item, length = self.unerase(w_list.lstorage)
+if length > 0 and start < length and self.space.eq_w(w_l_item, w_item):
+return 0
+raise ValueError
+
+def switch_to_item_strategy(self, w_list, w_item=None):
+w_l_item, length = self.unerase(w_list.lstorage)
+w_item_type = type(w_l_item)
+if w_item is not None and type(w_item) is w_item_type:
+if w_item_type is W_IntObject:
+strategy = self.space.fromcache(IntegerListStrategy)
+item_w = strategy.unwrap(w_l_item)
+lstorage = [item_w] * length
+w_list.lstorage = strategy.erase(lstorage)
+w_list.strategy = strategy
+return
+elif w_item_type is W_BytesObject:
+strategy = self.space.fromcache(BytesListStrategy)
+item_w = strategy.unwrap(w_l_item)
+lstorage = [item_w] * length
+w_list.lstorage = strategy.erase(lstorage)
+w_list.strategy = strategy
+return
+elif w_item_type is W_UnicodeObject:
+strategy = self.space.fromcache(UnicodeListStrategy)
+item_w = strategy.unwrap(w_l_item)
+lstorage = [item_w] * length
+w_list.lstorage = strategy.erase(lstorage)
+w_list.strategy = strategy
+return
+elif w_item_type is W_FloatObject:
+strategy = self.space.fromcache(FloatListStrategy)
+item_w = strategy.unwrap(w_l_item)
+lstorage = [item_w] * length
+w_list.lstorage = strategy.erase(lstorage) # XXX: use 
init_from_list_w too ? or define init_from_list_unw() ?
+w_list.strategy = strategy
+return
+# Fall back to ObjectListStrategy
+strategy = self.space.fromcache(ObjectListStrategy)
+w_list.strategy = strategy
+items = [w_l_item] * length
+strategy.init_from_list_w(w_list, items)
+
+def append(self, w_list, w_item):
+w_l_item, length = self.unerase(w_list.lstorage)
+if type(w_item) is type(w_l_item):
+if self.space.eq_w(w_item, w_l_item):
+w_list.lstorage = self.erase((w_l_item, length + 1))
+return
+

[pypy-commit] pypy llvm-translation-backend: hg merge default

2016-01-11 Thread mjacob
Author: Manuel Jacob 
Branch: llvm-translation-backend
Changeset: r81675:768918ab952a
Date: 2016-01-11 20:25 +0100
http://bitbucket.org/pypy/pypy/changeset/768918ab952a/

Log:hg merge default

diff too long, truncating to 2000 out of 29542 lines

diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -29,4 +29,4 @@
 release/
 !pypy/tool/release/
 rpython/_cache/
-__pycache__/
+.cache/
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -28,7 +28,7 @@
 DEALINGS IN THE SOFTWARE.
 
 
-PyPy Copyright holders 2003-2015
+PyPy Copyright holders 2003-2016
 --- 
 
 Except when otherwise stated (look for LICENSE files or information at
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 
-all: pypy-c
+all: pypy-c cffi_imports
 
 PYPY_EXECUTABLE := $(shell which pypy)
 URAM := $(shell python -c "import sys; print 4.5 if sys.maxint>1<<32 else 2.5")
@@ -10,6 +10,8 @@
 RUNINTERP = $(PYPY_EXECUTABLE)
 endif
 
+.PHONY: cffi_imports
+
 pypy-c:
@echo
@echo 
""
@@ -36,3 +38,6 @@
 # replaced with an opaque --jobserver option by the time this Makefile
 # runs.  We cannot get their original value either:
 # http://lists.gnu.org/archive/html/help-make/2010-08/msg00106.html
+
+cffi_imports: pypy-c
+   PYTHONPATH=. ./pypy-c pypy/tool/build_cffi_imports.py
diff --git a/lib-python/2.7/collections.py b/lib-python/2.7/collections.py
--- a/lib-python/2.7/collections.py
+++ b/lib-python/2.7/collections.py
@@ -18,9 +18,9 @@
 assert '__pypy__' not in _sys.builtin_module_names
 newdict = lambda _ : {}
 try:
-from __pypy__ import reversed_dict
+from __pypy__ import reversed_dict as _reversed_dict
 except ImportError:
-reversed_dict = lambda d: reversed(d.keys())
+_reversed_dict = None # don't have ordered dicts
 
 try:
 from thread import get_ident as _get_ident
@@ -46,7 +46,7 @@
 '''
 
 def __reversed__(self):
-return reversed_dict(self)
+return _reversed_dict(self)
 
 def popitem(self, last=True):
 '''od.popitem() -> (k, v), return and remove a (key, value) pair.
@@ -116,6 +116,178 @@
 return ItemsView(self)
 
 
+def _compat_with_unordered_dicts():
+# This returns the methods needed in OrderedDict in case the base
+# 'dict' class is not actually ordered, like on top of CPython or
+# old PyPy or PyPy-STM.
+
+# = Original comments and code follows  =
+# = The unmodified methods are not repeated =
+
+# An inherited dict maps keys to values.
+# The inherited dict provides __getitem__, __len__, __contains__, and get.
+# The remaining methods are order-aware.
+# Big-O running times for all methods are the same as regular dictionaries.
+
+# The internal self.__map dict maps keys to links in a doubly linked list.
+# The circular doubly linked list starts and ends with a sentinel element.
+# The sentinel element never gets deleted (this simplifies the algorithm).
+# Each link is stored as a list of length three:  [PREV, NEXT, KEY].
+
+def __init__(self, *args, **kwds):
+'''Initialize an ordered dictionary.  The signature is the same as
+regular dictionaries, but keyword arguments are not recommended because
+their insertion order is arbitrary.
+
+'''
+if len(args) > 1:
+raise TypeError('expected at most 1 arguments, got %d' % len(args))
+try:
+self.__root
+except AttributeError:
+self.__root = root = [] # sentinel node
+root[:] = [root, root, None]
+self.__map = {}
+self.__update(*args, **kwds)
+
+def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
+'od.__setitem__(i, y) <==> od[i]=y'
+# Setting a new item creates a new link at the end of the linked list,
+# and the inherited dictionary is updated with the new key/value pair.
+if key not in self:
+root = self.__root
+last = root[0]
+last[1] = root[0] = self.__map[key] = [last, root, key]
+return dict_setitem(self, key, value)
+
+def __delitem__(self, key, dict_delitem=dict.__delitem__):
+'od.__delitem__(y) <==> del od[y]'
+# Deleting an existing item uses self.__map to find the link which gets
+# removed by updating the links in the predecessor and successor nodes.
+dict_delitem(self, key)
+link_prev, link_next, _ = self.__map.pop(key)
+link_prev[1] = link_next# update 
link_prev[NEXT]
+link_next[0] = link_prev# update 
link_next[PREV]
+
+def __iter__(self):
+'od.__iter__() <==> iter(od)'
+# Traverse the linked list in order.
+root = self.__root
+curr = root[1]   

[pypy-commit] pypy s390x-backend: guard_subclass, guard_is_object ported to s390x

2016-01-11 Thread plan_rich
Author: Richard Plangger 
Branch: s390x-backend
Changeset: r81672:39f75f1f6c6b
Date: 2016-01-11 14:27 +0100
http://bitbucket.org/pypy/pypy/changeset/39f75f1f6c6b/

Log:guard_subclass, guard_is_object ported to s390x simplified the code
in int_shift_left (use some old code of the regalloc) impl of stack
check slowpath and stack check

diff --git a/rpython/jit/backend/zarch/assembler.py 
b/rpython/jit/backend/zarch/assembler.py
--- a/rpython/jit/backend/zarch/assembler.py
+++ b/rpython/jit/backend/zarch/assembler.py
@@ -529,12 +529,11 @@
 #
 mc._pop_core_regs_from_jitframe([r.r14]) # restore the link on the jit 
frame
 # So we return to our caller, conditionally if "EQ"
-# mc.LG(r.r14, l.addr(14*WORD, r.SP))
 mc.BCR(c.EQ, r.r14)
 #
 # Else, jump to propagate_exception_path
 assert self.propagate_exception_path
-mc.b_abs(self.propagate_exception_path)
+mc.branch_absolute(self.propagate_exception_path)
 #
 rawstart = mc.materialize(self.cpu, [])
 self.stack_check_slowpath = rawstart
diff --git a/rpython/jit/backend/zarch/helper/regalloc.py 
b/rpython/jit/backend/zarch/helper/regalloc.py
--- a/rpython/jit/backend/zarch/helper/regalloc.py
+++ b/rpython/jit/backend/zarch/helper/regalloc.py
@@ -112,15 +112,10 @@
 # in the addr part of the instruction
 l1 = addr(a1.getint())
 else:
-self.rm.ensure_in_reg(a1, r.SCRATCH)
-l1 = addr(0, r.SCRATCH)
-l0 = self.ensure_reg(a0)
-if l0.is_in_pool():
-loc = self.force_allocate_reg(op)
-self.assembler.mc.LG(loc, l0)
-l0 = loc
-else:
-self.force_result_in_reg(op, a0)
+tmp = self.rm.ensure_reg(a1, force_in_reg=True)
+l1 = addr(0, tmp)
+l0 = self.ensure_reg(a0, force_in_reg=True)
+self.force_result_in_reg(op, a0)
 self.free_op_vars()
 return [l0, l1]
 
diff --git a/rpython/jit/backend/zarch/opassembler.py 
b/rpython/jit/backend/zarch/opassembler.py
--- a/rpython/jit/backend/zarch/opassembler.py
+++ b/rpython/jit/backend/zarch/opassembler.py
@@ -634,10 +634,7 @@
 # Note that the typeid half-word is at offset 0 on a little-endian
 # machine; it is at offset 2 or 4 on a big-endian machine.
 assert self.cpu.supports_guard_gc_type
-if IS_PPC_32:
-self.mc.lhz(targetreg.value, loc_ptr.value, 2 * IS_BIG_ENDIAN)
-else:
-self.mc.lwz(targetreg.value, loc_ptr.value, 4 * IS_BIG_ENDIAN)
+self.mc.LGF(targetreg, l.addr(4, loc_ptr))
 
 def _cmp_guard_gc_type(self, loc_ptr, expected_typeid):
 self._read_typeid(r.SCRATCH2, loc_ptr)
@@ -666,9 +663,11 @@
 
 self._read_typeid(r.SCRATCH2, loc_object)
 self.mc.load_imm(r.SCRATCH, base_type_info + infobits_offset)
-assert shift_by == 0 # on PPC64; fixme for PPC32
-self.mc.lbzx(r.SCRATCH2.value, r.SCRATCH2.value, r.SCRATCH.value)
-self.mc.andix(r.SCRATCH2.value, r.SCRATCH2.value, IS_OBJECT_FLAG & 
0xff)
+assert shift_by == 0
+self.mc.AGR(r.SCRATCH, r.SCRATCH2)
+self.mc.LLGC(r.SCRATCH2, l.addr(0, r.SCRATCH))
+self.mc.LGHI(r.SCRATCH, l.imm(IS_OBJECT_FLAG & 0xff))
+self.mc.NGR(r.SCRATCH2, r.SCRATCH)
 self.guard_success_cc = c.NE
 self._emit_guard(op, arglocs[1:])
 
@@ -683,7 +682,7 @@
 self.mc.LG(r.SCRATCH2, l.addr(offset, loc_object))
 # read the vtable's subclassrange_min field
 assert check_imm(offset2)
-self.mc.LG(r.SCRATCH2.value, r.SCRATCH2.value, offset2)
+self.mc.load(r.SCRATCH2, r.SCRATCH2, offset2)
 else:
 # read the typeid
 self._read_typeid(r.SCRATCH, loc_object)
@@ -692,8 +691,11 @@
 base_type_info, shift_by, sizeof_ti = (
 self.cpu.gc_ll_descr.get_translated_info_for_typeinfo())
 self.mc.load_imm(r.SCRATCH2, base_type_info + sizeof_ti + offset2)
-assert shift_by == 0 # on PPC64; fixme for PPC32
-self.mc.ldx(r.SCRATCH2.value, r.SCRATCH2.value, r.SCRATCH.value)
+assert shift_by == 0
+# add index manually
+# we cannot use r0 in l.addr(...)
+self.mc.AGR(r.SCRATCH, r.SCRATCH2)
+self.mc.load(r.SCRATCH2, r.SCRATCH, 0)
 # get the two bounds to check against
 vtable_ptr = loc_check_against_class.getint()
 vtable_ptr = rffi.cast(rclass.CLASSTYPE, vtable_ptr)
@@ -706,8 +708,8 @@
 assert 0 <= check_min <= 0x7fff
 assert 0 <= check_diff <= 0x
 # check by doing the unsigned comparison (tmp - min) < (max - min)
-self.mc.subi(r.SCRATCH2.value, r.SCRATCH2.value, check_min)
-self.mc.cmp_op(0, r.SCRATCH2.value, check_diff, imm=True, signed=False)
+self.mc.AGHI(r.SCRATCH2, l.imm(-check_min))
+self.mc.cmp_op(r.SCRATCH2, 

[pypy-commit] pypy s390x-backend: push pop from jitframe optimization (using store/load multiple instruction on s390x) + test

2016-01-11 Thread plan_rich
Author: Richard Plangger 
Branch: s390x-backend
Changeset: r81670:6c8cea4f1f86
Date: 2016-01-11 13:52 +0100
http://bitbucket.org/pypy/pypy/changeset/6c8cea4f1f86/

Log:push pop from jitframe optimization (using store/load multiple
instruction on s390x) + test

diff --git a/rpython/jit/backend/zarch/assembler.py 
b/rpython/jit/backend/zarch/assembler.py
--- a/rpython/jit/backend/zarch/assembler.py
+++ b/rpython/jit/backend/zarch/assembler.py
@@ -512,7 +512,7 @@
 # registers).
 mc = InstrBuilder()
 #
-# mc.STG(r.r14, l.addr(14*WORD, r.SP))
+mc._push_core_regs_to_jitframe([r.r14]) # store the link on the jit 
frame
 # Do the call
 mc.push_std_frame()
 mc.LGR(r.r2, r.SP)
@@ -527,6 +527,7 @@
 # else we have an exception
 mc.cmp_op(r.SCRATCH, l.imm(0), imm=True)
 #
+mc._pop_core_regs_from_jitframe([r.r14]) # restore the link on the jit 
frame
 # So we return to our caller, conditionally if "EQ"
 # mc.LG(r.r14, l.addr(14*WORD, r.SP))
 mc.BCR(c.EQ, r.r14)
@@ -551,16 +552,14 @@
 endaddr, lengthaddr, _ = self.cpu.insert_stack_check()
 diff = lengthaddr - endaddr
 assert check_imm_value(diff)
-xxx
 
 mc = self.mc
-mc.load_imm(r.SCRATCH, self.stack_check_slowpath)
-mc.load_imm(r.SCRATCH2, endaddr) # li r2, endaddr
-mc.mtctr(r.SCRATCH.value)
-mc.load(r.SCRATCH.value, r.SCRATCH2.value, 0)# ld r0, [end]
-mc.load(r.SCRATCH2.value, r.SCRATCH2.value, diff)# ld r2, [length]
-mc.subf(r.SCRATCH.value, r.SP.value, r.SCRATCH.value)  # sub r0, SP
-mc.cmp_op(0, r.SCRATCH.value, r.SCRATCH2.value, signed=False)
+mc.load_imm(r.SCRATCH2, endaddr) # li r0, endaddr
+mc.branch_absolute(self.stack_check_slowpath)
+mc.load(r.SCRATCH, r.SCRATCH2, 0)# lg r1, [end]
+mc.load(r.SCRATCH2, r.SCRATCH2, diff)# lg r0, [length]
+mc.SGR(r.SCRATCH, r.SP)  # sub r1, SP
+mc.cmp_op(r.SCRATCH, r.SCRATCH2, signed=False)
 mc.bgtctrl()
 
 def _check_frame_depth(self, mc, gcmap):
@@ -1057,21 +1056,71 @@
 mc.MOVSD_bx((ofs + i * coeff) * WORD + base_ofs, i)
 
 def _push_core_regs_to_jitframe(self, mc, includes=r.registers):
+self._multiple_to_or_from_jitframe(mc, includes, store=True)
+
+@specialize.arg(3)
+def _multiple_to_or_from_jitframe(self, mc, includes, store):
 if len(includes) == 0:
 return
 base_ofs = self.cpu.get_baseofs_of_frame_field()
-base = includes[0].value
+if len(includes) == 1:
+iv = includes[0]
+addr = l.addr(base_ofs + iv.value * WORD, r.SPP)
+if store:
+mc.STG(iv, addr)
+else:
+mc.LG(iv, addr)
+return
+
 val = includes[0].value
-for register in includes:
-if register.value != val:
-break
-val += 1
+# includes[i => j]
+# for each continous sequence in the registers are stored
+# with STMG instead of STG, in the best case this only leads
+# to 1 instruction to store r.ri -> r.rj (if it is continuous)
+i = 0
+j = 1
+for register in includes[1:]:
+if i >= j:
+j += 1
+continue
+regval = register.value
+if regval != (val+1):
+iv = includes[i]
+diff = (val - iv.value)
+addr = l.addr(base_ofs + iv.value * WORD, r.SPP)
+if diff > 0:
+if store:
+mc.STMG(iv, includes[i+diff], addr) 
+else:
+mc.LMG(iv, includes[i+diff], addr) 
+i = j
+else:
+if store:
+mc.STG(iv, addr)
+else:
+mc.LG(iv, addr)
+i = j
+val = regval
+j += 1
+if i >= len(includes):
+# all have been stored
+return
+diff = (val - includes[i].value)
+iv = includes[i]
+addr = l.addr(base_ofs + iv.value * WORD, r.SPP)
+if diff > 0:
+if store:
+mc.STMG(iv, includes[-1], addr) 
+else:
+mc.LMG(iv, includes[-1], addr) 
 else:
-mc.STMG(includes[0], includes[-1], l.addr(base_ofs + base * WORD, 
r.SPP))
-return
-# unordered!
-for register in includes:
-mc.STG(register, l.addr(base_ofs + register.value * WORD, r.SPP))
+if store:
+mc.STG(iv, addr)
+else:
+mc.LG(iv, addr)
+
+def 

[pypy-commit] pypy vmprof-newstack: small fixes

2016-01-11 Thread fijal
Author: fijal
Branch: vmprof-newstack
Changeset: r81669:80db53f41aa2
Date: 2016-01-11 13:35 +0200
http://bitbucket.org/pypy/pypy/changeset/80db53f41aa2/

Log:small fixes

diff --git a/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py 
b/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
--- a/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
+++ b/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
@@ -19,9 +19,14 @@
 from rpython.rlib import rvmprof
 
 class MyCode:
-pass
+def __init__(self, name):
+self.name = name
+
 def get_name(code):
-return 'py:code:52:x'
+return code.name
+
+code2 = MyCode("py:y:foo:4")
+
 try:
 rvmprof.register_code_object_class(MyCode, get_name)
 except rvmprof.VMProfPlatformUnsupported, e:
@@ -40,15 +45,15 @@
 while i < num:
 driver.jit_merge_point(code=code, i=i, s=s, num=num)
 s += (i << 1)
-if s % 32423423423 == 0 and s > 0 == 0:
-print s
+if s % 3 == 0 and code is not code2:
+main(code2, 100)
 i += 1
 return s
 
 tmpfilename = str(udir.join('test_rvmprof'))
 
 def f(num):
-code = MyCode()
+code = MyCode("py:x:foo:3")
 rvmprof.register_code(code, get_name)
 fd = os.open(tmpfilename, os.O_WRONLY | os.O_CREAT, 0666)
 period = 0.0001
@@ -67,7 +72,7 @@
 import pdb
 pdb.set_trace()
 
-self.meta_interp(f, [1])
+self.meta_interp(f, [100])
 try:
 import vmprof
 except ImportError:
diff --git a/rpython/rlib/rvmprof/rvmprof.py b/rpython/rlib/rvmprof/rvmprof.py
--- a/rpython/rlib/rvmprof/rvmprof.py
+++ b/rpython/rlib/rvmprof/rvmprof.py
@@ -33,7 +33,7 @@
 self._code_classes = set()
 self._gather_all_code_objs = lambda: None
 self._cleanup_()
-self._code_unique_id = 0
+self._code_unique_id = 4
 self.cintf = cintf.setup()
 
 def _cleanup_(self):
diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h 
b/rpython/rlib/rvmprof/src/vmprof_main.h
--- a/rpython/rlib/rvmprof/src/vmprof_main.h
+++ b/rpython/rlib/rvmprof/src/vmprof_main.h
@@ -154,16 +154,15 @@
 if (stack->kind == VMPROF_CODE_TAG) {
 result[n] = stack->kind;
 result[n + 1] = stack->value;
-stack = stack->next;
 n += 2;
 }
 #ifdef PYPY_JIT_CODEMAP
 else if (stack->kind == VMPROF_JITTED_TAG) {
 pc = ((intptr_t*)(stack->value - sizeof(intptr_t)))[0];
 n = vmprof_write_header_for_jit_addr(result, n, pc, max_depth);
-stack = stack->next;
 }
 #endif
+stack = stack->next;
 }
 return n;
 }
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy s390x-backend: added case where parameters are not ordered

2016-01-11 Thread plan_rich
Author: Richard Plangger 
Branch: s390x-backend
Changeset: r81671:4f539fd728fc
Date: 2016-01-11 13:55 +0100
http://bitbucket.org/pypy/pypy/changeset/4f539fd728fc/

Log:added case where parameters are not ordered

diff --git a/rpython/jit/backend/zarch/test/test_assembler.py 
b/rpython/jit/backend/zarch/test/test_assembler.py
--- a/rpython/jit/backend/zarch/test/test_assembler.py
+++ b/rpython/jit/backend/zarch/test/test_assembler.py
@@ -430,12 +430,19 @@
 loaded = []
 
 # just one single
-for r in [r.r14, r.r0, r.r1, r.r15]:
-self.pushpop_jitframe([r])
-assert stored == [(r,)]
+for x in [r.r14, r.r0, r.r1, r.r15]:
+self.pushpop_jitframe([x])
+assert stored == [(x,)]
 assert stored == loaded
 stored = []
 loaded = []
 
+# unordered
+self.pushpop_jitframe([r.r14, r.r8, r.r4, r.r0])
+assert stored == [(r.r14,), (r.r8,), (r.r4,), (r.r0,)]
+assert stored == loaded
+stored = []
+loaded = []
 
 
+
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] buildbot s390x-buildbot: include linux in the value of the platform dict

2016-01-11 Thread plan_rich
Author: Richard Plangger 
Branch: s390x-buildbot
Changeset: r976:aa640461e854
Date: 2016-01-11 17:39 +0100
http://bitbucket.org/pypy/buildbot/changeset/aa640461e854/

Log:include linux in the value of the platform dict

diff --git a/bot2/pypybuildbot/pypylist.py b/bot2/pypybuildbot/pypylist.py
--- a/bot2/pypybuildbot/pypylist.py
+++ b/bot2/pypybuildbot/pypylist.py
@@ -42,7 +42,7 @@
 'osx64': 'macosx-x86-64',
 'win32': 'win-x86-32',
 'freebsd64': 'freebsd-9-x86-64',
-'s390x': 's390-64',
+'s390x': 'linux-s390-64',
 }
 
 DESCRIPTIONS = {
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] buildbot s390x-buildbot: added more config:

2016-01-11 Thread plan_rich
Author: Richard Plangger 
Branch: s390x-buildbot
Changeset: r977:97612101816f
Date: 2016-01-11 18:04 +0100
http://bitbucket.org/pypy/buildbot/changeset/97612101816f/

Log:added more config: own, app-level, jit, pylib for the s390x build
slaves. named the slave 'ibm-research'

diff --git a/bot2/pypybuildbot/master.py b/bot2/pypybuildbot/master.py
--- a/bot2/pypybuildbot/master.py
+++ b/bot2/pypybuildbot/master.py
@@ -64,6 +64,9 @@
 pypyTranslatedAppLevelTestFactory64 = pypybuilds.Translated(lib_python=True,
 app_tests=True,
 platform='linux64')
+pypyTranslatedAppLevelTestFactoryS390X = pypybuilds.Translated(lib_python=True,
+   app_tests=True,
+   
platform='s390x')
 
 # these are like the two above: the only difference is that they only run
 # lib-python tests,not -A tests
@@ -146,6 +149,15 @@
 app_tests=True,
 )
 
+pypyJITTranslatedTestFactoryS390X = pypybuilds.Translated(
+platform='s390x',
+translationArgs=jit_translation_args,
+targetArgs=[],
+lib_python=True,
+pypyjit=True,
+app_tests=True,
+)
+
 pypyJITBenchmarkFactory_tannit = pypybuilds.JITBenchmark(host='tannit')
 pypyJITBenchmarkFactory64_tannit = pypybuilds.JITBenchmark(platform='linux64',
host='tannit',
@@ -162,18 +174,22 @@
 
 LINUX32 = "own-linux-x86-32"
 LINUX64 = "own-linux-x86-64"
+LINUX_S390X = "own-linux-s390x"
 
 MACOSX32 = "own-macosx-x86-32"
 WIN32 = "own-win-x86-32"
 APPLVLLINUX32 = "pypy-c-app-level-linux-x86-32"
 APPLVLLINUX64 = "pypy-c-app-level-linux-x86-64"
+APPLVLLINUX_S390X = "pypy-c-app-level-linux-s390x"
 APPLVLWIN32 = "pypy-c-app-level-win-x86-32"
 
 LIBPYTHON_LINUX32 = "pypy-c-lib-python-linux-x86-32"
 LIBPYTHON_LINUX64 = "pypy-c-lib-python-linux-x86-64"
+LIBPYTHON_LINUX_S390X = "pypy-c-lib-python-linux-s390x"
 
 JITLINUX32 = "pypy-c-jit-linux-x86-32"
 JITLINUX64 = "pypy-c-jit-linux-x86-64"
+JITLINUX_S390X = 'pypy-c-jit-linux-s390x'
 JITMACOSX64 = "pypy-c-jit-macosx-x86-64"
 #JITMACOSX64_2 = "pypy-c-jit-macosx-x86-64-2"
 JITWIN32 = "pypy-c-jit-win-x86-32"
@@ -184,6 +200,7 @@
 CPYTHON_64 = "cpython-2-benchmark-x86-64"
 NUMPY_64 = "numpy-compatibility-linux-x86-64"
 NUMPY_WIN = "numpy-compatibility-win-x86-32"
+
 # buildbot builder
 PYPYBUILDBOT = 'pypy-buildbot'
 JITFREEBSD964 = 'pypy-c-jit-freebsd-9-x86-64'
@@ -255,10 +272,13 @@
 # linux tests
 LINUX32,   # on tannit32, uses all cores
 LINUX64,   # on speed-old, uses all cores
+LINUX_S390X,   # vm (ibm-research)
 JITLINUX32,# on tannit32, uses 1 core
 JITLINUX64,# on speed-old, uses 1 core
+JITLINUX_S390X,# vm (ibm-research)
 #APPLVLLINUX32,# on tannit32, uses 1 core
 APPLVLLINUX64, # on speed-old, uses 1 core
+APPLVLLINUX_S390X, # vm (ibm-research)
 # other platforms
 #MACOSX32, # on minime
 JITWIN32,  # on allegro_win32, SalsaSalsa
@@ -302,18 +322,22 @@
 PYPYBUILDBOT,
 LINUX32,
 LINUX64,
+LINUX_S390X,
 
 MACOSX32,
 WIN32,
 APPLVLLINUX32,
 APPLVLLINUX64,
+APPLVLLINUX_S390X,
 APPLVLWIN32,
 
 LIBPYTHON_LINUX32,
 LIBPYTHON_LINUX64,
+LIBPYTHON_LINUX_S390X,
 
 JITLINUX32,
 JITLINUX64,
+JITLINUX_S390X,
 JITMACOSX64,
 JITWIN32,
 JITFREEBSD964,
@@ -355,6 +379,13 @@
"category": 'linux64',
#"locks": [TannitCPU.access('counting')],
   },
+  {"name": LINUX_S390X,
+   "slavenames": ["ibm-research"],
+   "builddir": LINUX_S390X,
+   "factory": pypyOwnTestFactory,
+   "category": 's390x',
+   #"locks": [TannitCPU.access('counting')],
+  },
   {"name": APPLVLLINUX32,
#"slavenames": ["allegro32"],
"slavenames": ["tannit32"],
@@ -370,6 +401,13 @@
"category": "linux64",
#"locks": [TannitCPU.access('counting')],
   },
+  {"name": APPLVLLINUX_S390X,
+   "slavenames": 

[pypy-commit] buildbot s390x-buildbot: added s390x to config

2016-01-11 Thread plan_rich
Author: Richard Plangger 
Branch: s390x-buildbot
Changeset: r975:df8ff01c8d56
Date: 2016-01-11 17:36 +0100
http://bitbucket.org/pypy/buildbot/changeset/df8ff01c8d56/

Log:added s390x to config

diff --git a/bot2/pypybuildbot/pypylist.py b/bot2/pypybuildbot/pypylist.py
--- a/bot2/pypybuildbot/pypylist.py
+++ b/bot2/pypybuildbot/pypylist.py
@@ -28,6 +28,7 @@
 'linux':100,
 'linux64':   50,
 'osx':   30,
+'s390x': 20,
 'win32': 10,
 'linux_armhf_raspbian': 7,
 'linux_armhf_raring': 6,
@@ -41,6 +42,7 @@
 'osx64': 'macosx-x86-64',
 'win32': 'win-x86-32',
 'freebsd64': 'freebsd-9-x86-64',
+'s390x': 's390-64',
 }
 
 DESCRIPTIONS = {
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy s390x-backend: some more translation issues solved

2016-01-11 Thread plan_rich
Author: Richard Plangger 
Branch: s390x-backend
Changeset: r81673:c296d7fff786
Date: 2016-01-11 16:25 +0100
http://bitbucket.org/pypy/pypy/changeset/c296d7fff786/

Log:some more translation issues solved

diff --git a/rpython/jit/backend/zarch/assembler.py 
b/rpython/jit/backend/zarch/assembler.py
--- a/rpython/jit/backend/zarch/assembler.py
+++ b/rpython/jit/backend/zarch/assembler.py
@@ -32,6 +32,9 @@
 from rpython.rtyper.annlowlevel import llhelper, cast_instance_to_gcref
 from rpython.rlib.jit import AsmInfo
 
+class JitFrameTooDeep(Exception):
+pass
+
 class AssemblerZARCH(BaseAssembler, OpAssembler):
 
 def __init__(self, cpu, translate_support_code=False):
@@ -835,10 +838,9 @@
 return
 # move immediate value to memory
 elif loc.is_stack():
-with scratch_reg(self.mc):
-offset = loc.value
-self.mc.load_imm(r.SCRATCH, prev_loc)
-self.mc.STG(r.SCRATCH, l.addr(offset, r.SPP))
+offset = loc.value
+self.mc.load_imm(r.SCRATCH, prev_loc.value)
+self.mc.STG(r.SCRATCH, l.addr(offset, r.SPP))
 return
 assert 0, "not supported location"
 elif prev_loc.is_in_pool():
@@ -858,9 +860,8 @@
 # move in memory
 elif loc.is_stack():
 target_offset = loc.value
-with scratch_reg(self.mc):
-self.mc.load(r.SCRATCH.value, r.SPP, offset)
-self.mc.store(r.SCRATCH.value, r.SPP, target_offset)
+self.mc.load(r.SCRATCH, r.SPP, offset)
+self.mc.store(r.SCRATCH, r.SPP, target_offset)
 return
 # move from memory to fp register
 elif loc.is_fp_reg():
@@ -879,23 +880,16 @@
 self.mc.STG(prev_loc, l.addr(offset, r.SPP))
 return
 assert 0, "not supported location"
-elif prev_loc.is_imm_float():
-value = prev_loc.getint()
+elif prev_loc.is_in_pool():
 # move immediate value to fp register
 if loc.is_fp_reg():
-xxx
-with scratch_reg(self.mc):
-self.mc.load_imm(r.SCRATCH, value)
-self.mc.lfdx(loc.value, 0, r.SCRATCH.value)
+self.LD(loc, prev_loc)
 return
 # move immediate value to memory
 elif loc.is_stack():
-xxx
-with scratch_reg(self.mc):
-offset = loc.value
-self.mc.load_imm(r.SCRATCH, value)
-self.mc.lfdx(r.FP_SCRATCH.value, 0, r.SCRATCH.value)
-self.mc.stfd(r.FP_SCRATCH.value, r.SPP.value, offset)
+offset = loc.value
+self.mc.LD(r.FP_SCRATCH, prev_loc)
+self.mc.STDY(r.FP_SCRATCH, l.addr(offset, r.SPP))
 return
 assert 0, "not supported location"
 elif prev_loc.is_fp_reg():
diff --git a/rpython/jit/backend/zarch/instruction_builder.py 
b/rpython/jit/backend/zarch/instruction_builder.py
--- a/rpython/jit/backend/zarch/instruction_builder.py
+++ b/rpython/jit/backend/zarch/instruction_builder.py
@@ -448,7 +448,9 @@
 else:
 return arg
 unpack_arg._annspecialcase_ = 'specialize:arg(1)'
-argtypes = func._arguments_
+argtypes = func._arguments_[:]
+#while len(argtypes) > 0 and argtypes[-1] == '-':
+#argtypes.pop()
 at = argtypes[0] if len(argtypes) >= 1 else '-'
 bt = argtypes[1] if len(argtypes) >= 2 else '-'
 ct = argtypes[2] if len(argtypes) >= 3 else '-'
@@ -467,7 +469,7 @@
 f = unpack_arg(b, bt)
 g = unpack_arg(c, ct)
 return func(self, e, f, g)
-def function4(self, a, b):
+def function4(self, a, b, c, d):
 e = unpack_arg(a, at)
 f = unpack_arg(b, bt)
 g = unpack_arg(c, ct)
diff --git a/rpython/jit/backend/zarch/locations.py 
b/rpython/jit/backend/zarch/locations.py
--- a/rpython/jit/backend/zarch/locations.py
+++ b/rpython/jit/backend/zarch/locations.py
@@ -97,31 +97,6 @@
 def is_imm(self):
 return True
 
-class ConstFloatLoc(AssemblerLocation):
-"""This class represents an imm float value which is stored in memory at
-the address stored in the field value"""
-_immutable_ = True
-width = WORD
-type = FLOAT
-
-def __init__(self, value):
-self.value = value
-
-def getint(self):
-return self.value
-
-def __repr__(self):
-return "imm_float(stored at %d)" % (self.value)
-
-def is_imm_float(self):
-return True
-
-def as_key(self):  # a real address + 1
-return self.value | 1
-
-def is_float(self):
-return True
-
 class StackLocation(AssemblerLocation):
 _immutable_ = True
 
diff --git 

[pypy-commit] buildbot default: renamed ibm-research to dje, added seperate nightly to test not default on s390x, but s390x-backend

2016-01-11 Thread plan_rich
Author: Richard Plangger 
Branch: 
Changeset: r980:158bfd82f5f8
Date: 2016-01-11 19:02 +0100
http://bitbucket.org/pypy/buildbot/changeset/158bfd82f5f8/

Log:renamed ibm-research to dje, added seperate nightly to test not
default on s390x, but s390x-backend

diff --git a/bot2/pypybuildbot/master.py b/bot2/pypybuildbot/master.py
--- a/bot2/pypybuildbot/master.py
+++ b/bot2/pypybuildbot/master.py
@@ -272,13 +272,10 @@
 # linux tests
 LINUX32,   # on tannit32, uses all cores
 LINUX64,   # on speed-old, uses all cores
-LINUX_S390X,   # vm (ibm-research)
 JITLINUX32,# on tannit32, uses 1 core
 JITLINUX64,# on speed-old, uses 1 core
-JITLINUX_S390X,# vm (ibm-research)
 #APPLVLLINUX32,# on tannit32, uses 1 core
 APPLVLLINUX64, # on speed-old, uses 1 core
-APPLVLLINUX_S390X, # vm (ibm-research)
 # other platforms
 #MACOSX32, # on minime
 JITWIN32,  # on allegro_win32, SalsaSalsa
@@ -291,6 +288,12 @@
 PYPYBUILDBOT   # on cobra
 ], branch='default', hour=0, minute=0),
 
+Nightly("nightly-0-01", [
+LINUX_S390X,   # vm (ibm-research)
+JITLINUX_S390X,# vm (ibm-research)
+APPLVLLINUX_S390X, # vm (ibm-research)
+], branch='s390x-backend', hour=2, minute=0),
+
 Nightly("nightly-1-00", [
 JITBENCH,  # on tannit32, uses 1 core (in part 
exclusively)
 JITBENCH64,# on tannit64, uses 1 core (in part 
exclusively)
@@ -380,7 +383,7 @@
#"locks": [TannitCPU.access('counting')],
   },
   {"name": LINUX_S390X,
-   "slavenames": ["ibm-research"],
+   "slavenames": ["dje"],
"builddir": LINUX_S390X,
"factory": pypyOwnTestFactory,
"category": 's390x',
@@ -402,7 +405,7 @@
#"locks": [TannitCPU.access('counting')],
   },
   {"name": APPLVLLINUX_S390X,
-   "slavenames": ["ibm-research"],
+   "slavenames": ["dje"],
"builddir": APPLVLLINUX_S390X,
"factory": pypyTranslatedAppLevelTestFactoryS390X,
"category": "s390x",
@@ -424,7 +427,7 @@
#"locks": [TannitCPU.access('counting')],
   },
   {"name": LIBPYTHON_LINUX_S390X,
-   "slavenames": ["ibm-research"],
+   "slavenames": ["dje"],
"builddir": LIBPYTHON_LINUX_S390X,
"factory": pypyTranslatedLibPythonTestFactory,
"category": "s390x",
@@ -446,7 +449,7 @@
#"locks": [TannitCPU.access('counting')],
   },
   {'name': JITLINUX_S390X,
-   'slavenames': ["ibm-research"],
+   'slavenames': ["dje"],
'builddir': JITLINUX_S390X,
'factory': pypyJITTranslatedTestFactoryS390X,
'category': 'linux-s390x',
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] buildbot s390x-buildbot: close branch

2016-01-11 Thread plan_rich
Author: Richard Plangger 
Branch: s390x-buildbot
Changeset: r979:7aadd1e862b1
Date: 2016-01-11 18:44 +0100
http://bitbucket.org/pypy/buildbot/changeset/7aadd1e862b1/

Log:close branch

___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] buildbot default: merged s390x changes

2016-01-11 Thread plan_rich
Author: Richard Plangger 
Branch: 
Changeset: r978:659fc9f38ab8
Date: 2016-01-11 18:44 +0100
http://bitbucket.org/pypy/buildbot/changeset/659fc9f38ab8/

Log:merged s390x changes

diff --git a/bot2/pypybuildbot/master.py b/bot2/pypybuildbot/master.py
--- a/bot2/pypybuildbot/master.py
+++ b/bot2/pypybuildbot/master.py
@@ -64,6 +64,9 @@
 pypyTranslatedAppLevelTestFactory64 = pypybuilds.Translated(lib_python=True,
 app_tests=True,
 platform='linux64')
+pypyTranslatedAppLevelTestFactoryS390X = pypybuilds.Translated(lib_python=True,
+   app_tests=True,
+   
platform='s390x')
 
 # these are like the two above: the only difference is that they only run
 # lib-python tests,not -A tests
@@ -146,6 +149,15 @@
 app_tests=True,
 )
 
+pypyJITTranslatedTestFactoryS390X = pypybuilds.Translated(
+platform='s390x',
+translationArgs=jit_translation_args,
+targetArgs=[],
+lib_python=True,
+pypyjit=True,
+app_tests=True,
+)
+
 pypyJITBenchmarkFactory_tannit = pypybuilds.JITBenchmark(host='tannit')
 pypyJITBenchmarkFactory64_tannit = pypybuilds.JITBenchmark(platform='linux64',
host='tannit',
@@ -162,18 +174,22 @@
 
 LINUX32 = "own-linux-x86-32"
 LINUX64 = "own-linux-x86-64"
+LINUX_S390X = "own-linux-s390x"
 
 MACOSX32 = "own-macosx-x86-32"
 WIN32 = "own-win-x86-32"
 APPLVLLINUX32 = "pypy-c-app-level-linux-x86-32"
 APPLVLLINUX64 = "pypy-c-app-level-linux-x86-64"
+APPLVLLINUX_S390X = "pypy-c-app-level-linux-s390x"
 APPLVLWIN32 = "pypy-c-app-level-win-x86-32"
 
 LIBPYTHON_LINUX32 = "pypy-c-lib-python-linux-x86-32"
 LIBPYTHON_LINUX64 = "pypy-c-lib-python-linux-x86-64"
+LIBPYTHON_LINUX_S390X = "pypy-c-lib-python-linux-s390x"
 
 JITLINUX32 = "pypy-c-jit-linux-x86-32"
 JITLINUX64 = "pypy-c-jit-linux-x86-64"
+JITLINUX_S390X = 'pypy-c-jit-linux-s390x'
 JITMACOSX64 = "pypy-c-jit-macosx-x86-64"
 #JITMACOSX64_2 = "pypy-c-jit-macosx-x86-64-2"
 JITWIN32 = "pypy-c-jit-win-x86-32"
@@ -184,6 +200,7 @@
 CPYTHON_64 = "cpython-2-benchmark-x86-64"
 NUMPY_64 = "numpy-compatibility-linux-x86-64"
 NUMPY_WIN = "numpy-compatibility-win-x86-32"
+
 # buildbot builder
 PYPYBUILDBOT = 'pypy-buildbot'
 JITFREEBSD964 = 'pypy-c-jit-freebsd-9-x86-64'
@@ -255,10 +272,13 @@
 # linux tests
 LINUX32,   # on tannit32, uses all cores
 LINUX64,   # on speed-old, uses all cores
+LINUX_S390X,   # vm (ibm-research)
 JITLINUX32,# on tannit32, uses 1 core
 JITLINUX64,# on speed-old, uses 1 core
+JITLINUX_S390X,# vm (ibm-research)
 #APPLVLLINUX32,# on tannit32, uses 1 core
 APPLVLLINUX64, # on speed-old, uses 1 core
+APPLVLLINUX_S390X, # vm (ibm-research)
 # other platforms
 #MACOSX32, # on minime
 JITWIN32,  # on allegro_win32, SalsaSalsa
@@ -302,18 +322,22 @@
 PYPYBUILDBOT,
 LINUX32,
 LINUX64,
+LINUX_S390X,
 
 MACOSX32,
 WIN32,
 APPLVLLINUX32,
 APPLVLLINUX64,
+APPLVLLINUX_S390X,
 APPLVLWIN32,
 
 LIBPYTHON_LINUX32,
 LIBPYTHON_LINUX64,
+LIBPYTHON_LINUX_S390X,
 
 JITLINUX32,
 JITLINUX64,
+JITLINUX_S390X,
 JITMACOSX64,
 JITWIN32,
 JITFREEBSD964,
@@ -355,6 +379,13 @@
"category": 'linux64',
#"locks": [TannitCPU.access('counting')],
   },
+  {"name": LINUX_S390X,
+   "slavenames": ["ibm-research"],
+   "builddir": LINUX_S390X,
+   "factory": pypyOwnTestFactory,
+   "category": 's390x',
+   #"locks": [TannitCPU.access('counting')],
+  },
   {"name": APPLVLLINUX32,
#"slavenames": ["allegro32"],
"slavenames": ["tannit32"],
@@ -370,6 +401,13 @@
"category": "linux64",
#"locks": [TannitCPU.access('counting')],
   },
+  {"name": APPLVLLINUX_S390X,
+   "slavenames": ["ibm-research"],
+   "builddir": APPLVLLINUX_S390X,
+   "factory": 

[pypy-commit] pypy vmprof-newstack: fix fix fix

2016-01-11 Thread fijal
Author: fijal
Branch: vmprof-newstack
Changeset: r81674:a1dd8454d500
Date: 2016-01-11 20:45 +0200
http://bitbucket.org/pypy/pypy/changeset/a1dd8454d500/

Log:fix fix fix

diff --git a/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py 
b/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
--- a/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
+++ b/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
@@ -19,6 +19,7 @@
 from rpython.rlib import rvmprof
 
 class MyCode:
+_vmprof_unique_id = 0
 def __init__(self, name):
 self.name = name
 
@@ -26,14 +27,18 @@
 return code.name
 
 code2 = MyCode("py:y:foo:4")
+rvmprof.register_code(code2, get_name)
 
 try:
 rvmprof.register_code_object_class(MyCode, get_name)
 except rvmprof.VMProfPlatformUnsupported, e:
 py.test.skip(str(e))
 
+def get_unique_id(code):
+return rvmprof.get_unique_id(code)
+
 driver = JitDriver(greens = ['code'], reds = ['i', 's', 'num'],
-is_recursive=True)
+is_recursive=True, get_unique_id=get_unique_id)
 
 @rvmprof.vmprof_execute_code("xcode13", lambda code, num: code)
 def main(code, num):
@@ -45,7 +50,7 @@
 while i < num:
 driver.jit_merge_point(code=code, i=i, s=s, num=num)
 s += (i << 1)
-if s % 3 == 0 and code is not code2:
+if i % 3 == 0 and code is not code2:
 main(code2, 100)
 i += 1
 return s
@@ -72,7 +77,7 @@
 import pdb
 pdb.set_trace()
 
-self.meta_interp(f, [100])
+self.meta_interp(f, [100], inline=True)
 try:
 import vmprof
 except ImportError:
diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py
--- a/rpython/rlib/jit.py
+++ b/rpython/rlib/jit.py
@@ -623,6 +623,8 @@
 raise AttributeError("no 'greens' or 'reds' supplied")
 if virtualizables is not None:
 self.virtualizables = virtualizables
+if get_unique_id is not None or is_recursive:
+assert get_unique_id is not None and is_recursive, "get_unique_id 
and is_recursive must be specified at the same time"
 for v in self.virtualizables:
 assert v in self.reds
 # if reds are automatic, they won't be passed to jit_merge_point, so
diff --git a/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h 
b/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h
--- a/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h
+++ b/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h
@@ -11,7 +11,7 @@
 #ifdef PYPY_JIT_CODEMAP
 void *codemap;
 long current_pos = 0;
-intptr_t id;
+intptr_t ident;
 long start_addr = 0;
 intptr_t addr = (intptr_t)ip;
 int start, k;
@@ -28,21 +28,22 @@
 result[n++] = start_addr;
 start = n;
 while (n < max_depth) {
-id = pypy_yield_codemap_at_addr(codemap, addr, _pos);
-if (id == -1)
+ident = pypy_yield_codemap_at_addr(codemap, addr, _pos);
+if (ident == -1)
 // finish
 break;
-if (id == 0)
+if (ident == 0)
 continue; // not main codemap
 result[n++] = VMPROF_JITTED_TAG;
-result[n++] = id;
+result[n++] = ident;
 }
-k = 0;
+k = 1;
+
 while (k < (n - start) / 2) {
 tmp = result[start + k];
-result[start + k] = result[n - k - 1];
-result[n - k - 1] = tmp;
-k++;
+result[start + k] = result[n - k];
+result[n - k] = tmp;
+k += 2;
 }
 #endif
 return n;
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit