[pypy-commit] pypy default: fix for 32 bit

2014-10-22 Thread cfbolz
Author: Carl Friedrich Bolz 
Branch: 
Changeset: r74063:0304bb9ea407
Date: 2014-10-22 10:30 +0200
http://bitbucket.org/pypy/pypy/changeset/0304bb9ea407/

Log:fix for 32 bit

diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py 
b/pypy/module/pypyjit/test_pypy_c/test_string.py
--- a/pypy/module/pypyjit/test_pypy_c/test_string.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_string.py
@@ -82,7 +82,7 @@
 strsetitem(p25, 0, i23)
 p93 = call(ConstClass(fromstr), p25, 16, descr=)
 guard_no_exception(descr=...)
-i95 = getfield_gc_pure(p93, descr=)
+i95 = getfield_gc_pure(p93, descr=)
 i96 = int_gt(i95, .*)
 guard_false(i96, descr=...)
 i94 = call(ConstClass(rbigint._toint_helper), p93, descr=)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Merged in halgari/pypy/unicode-fix (pull request #287)

2014-10-22 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r74065:45fb4f7e5325
Date: 2014-10-22 10:54 +0200
http://bitbucket.org/pypy/pypy/changeset/45fb4f7e5325/

Log:Merged in halgari/pypy/unicode-fix (pull request #287)

fix for isinstance and unicode

diff --git a/rpython/rtyper/rbuiltin.py b/rpython/rtyper/rbuiltin.py
--- a/rpython/rtyper/rbuiltin.py
+++ b/rpython/rtyper/rbuiltin.py
@@ -688,10 +688,10 @@
 if hop.s_result.is_constant():
 return hop.inputconst(lltype.Bool, hop.s_result.const)
 
-if hop.args_s[1].is_constant() and hop.args_s[1].const in (str, list):
-if hop.args_s[0].knowntype not in (str, list):
-raise TyperError("isinstance(x, str/list) expects x to be known"
- " statically to be a str/list or None")
+if hop.args_s[1].is_constant() and hop.args_s[1].const in (str, list, 
unicode):
+if hop.args_s[0].knowntype not in (str, list, unicode):
+raise TyperError("isinstance(x, str/list/unicode) expects x to be 
known"
+ " statically to be a str/list/unicode or None")
 rstrlist = hop.args_r[0]
 vstrlist = hop.inputarg(rstrlist, arg=0)
 cnone = hop.inputconst(rstrlist, None)
diff --git a/rpython/rtyper/test/test_rbuiltin.py 
b/rpython/rtyper/test/test_rbuiltin.py
--- a/rpython/rtyper/test/test_rbuiltin.py
+++ b/rpython/rtyper/test/test_rbuiltin.py
@@ -393,6 +393,21 @@
 res = self.interpret(f, [1])
 assert res is False
 
+def test_isinstance_unicode(self):
+def g():
+pass
+def f(i):
+if i == 0:
+l = u"foobar"
+else:
+l = None
+g()
+return isinstance(l, unicode)
+res = self.interpret(f, [0])
+assert res is True
+res = self.interpret(f, [1])
+assert res is False
+
 def test_instantiate(self):
 class A:
 pass
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy unicode-fix: fix for isinstance and unicode

2014-10-22 Thread halgari
Author: halgari
Branch: unicode-fix
Changeset: r74064:e5d9ee0be134
Date: 2014-10-21 11:16 -0600
http://bitbucket.org/pypy/pypy/changeset/e5d9ee0be134/

Log:fix for isinstance and unicode

diff --git a/rpython/rtyper/rbuiltin.py b/rpython/rtyper/rbuiltin.py
--- a/rpython/rtyper/rbuiltin.py
+++ b/rpython/rtyper/rbuiltin.py
@@ -688,10 +688,10 @@
 if hop.s_result.is_constant():
 return hop.inputconst(lltype.Bool, hop.s_result.const)
 
-if hop.args_s[1].is_constant() and hop.args_s[1].const in (str, list):
-if hop.args_s[0].knowntype not in (str, list):
-raise TyperError("isinstance(x, str/list) expects x to be known"
- " statically to be a str/list or None")
+if hop.args_s[1].is_constant() and hop.args_s[1].const in (str, list, 
unicode):
+if hop.args_s[0].knowntype not in (str, list, unicode):
+raise TyperError("isinstance(x, str/list/unicode) expects x to be 
known"
+ " statically to be a str/list/unicode or None")
 rstrlist = hop.args_r[0]
 vstrlist = hop.inputarg(rstrlist, arg=0)
 cnone = hop.inputconst(rstrlist, None)
diff --git a/rpython/rtyper/test/test_rbuiltin.py 
b/rpython/rtyper/test/test_rbuiltin.py
--- a/rpython/rtyper/test/test_rbuiltin.py
+++ b/rpython/rtyper/test/test_rbuiltin.py
@@ -393,6 +393,21 @@
 res = self.interpret(f, [1])
 assert res is False
 
+def test_isinstance_unicode(self):
+def g():
+pass
+def f(i):
+if i == 0:
+l = u"foobar"
+else:
+l = None
+g()
+return isinstance(l, unicode)
+res = self.interpret(f, [0])
+assert res is True
+res = self.interpret(f, [1])
+assert res is False
+
 def test_instantiate(self):
 class A:
 pass
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: Planning for today

2014-10-22 Thread rguillebert
Author: Romain Guillebert 
Branch: extradoc
Changeset: r5446:57fa4f6b67b9
Date: 2014-10-22 11:10 +0200
http://bitbucket.org/pypy/extradoc/changeset/57fa4f6b67b9/

Log:Planning for today

diff --git a/sprintinfo/warsaw-2014/planning.txt 
b/sprintinfo/warsaw-2014/planning.txt
--- a/sprintinfo/warsaw-2014/planning.txt
+++ b/sprintinfo/warsaw-2014/planning.txt
@@ -1,36 +1,38 @@
 Topics
-==
+=
 
-* cffi.verify dlopen flag (Romain)
+* cffi.verify dlopen flag - TO BE MERGED
 
-* PyPy/CPython Bridge (Romain)
+* PyPy/CPython Bridge (Romain, kostia) - IN PROGRESS
 
-* Pandas on PyPy (Romain, Kostia)
+* Profiler (Antonio, Maciej?) - IN PROGRESS
 
-* Profiler (Antonio, Maciej?)
+* Merge improve-docs (Manuel, Ronan)
 
-* Merge improve-docs (Manuel)
-
-* Merge kill-multimethod remove-remaining-smm  (Manuel)
+* Merge kill-multimethod remove-remaining-smm  (Manuel, Antonio)
 
 * STM presentation (Everybody)
 
 * Refactor annotator/rtyper (Ronan)
 
-* Python 3.3 (Valentina, Manuel)
+* Python 3.3 - IN PROGRESS
 
 * Jitviewer redesign discussion
 
 * Everything (Armin)
 
+* getting stuff run on pypy (antonin, fijal)
+
+* look into merging gc pinning (fijal, arigo)
+
 People
-==
+=
 
 Antonio
 Armin
 Kostia
 Ronan
-Valentina
 Romain
 Manuel
-Maciej (not here yet)
+Maciej
+Antonin
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy gc-incminimark-pinning: (arigo, fijal) Cannot pin objects with finalizers or light finalizers

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: gc-incminimark-pinning
Changeset: r74066:db5a5627d048
Date: 2014-10-22 11:23 +0200
http://bitbucket.org/pypy/pypy/changeset/db5a5627d048/

Log:(arigo, fijal) Cannot pin objects with finalizers or light
finalizers

diff --git a/rpython/memory/gc/base.py b/rpython/memory/gc/base.py
--- a/rpython/memory/gc/base.py
+++ b/rpython/memory/gc/base.py
@@ -73,7 +73,8 @@
 has_custom_trace,
 get_custom_trace,
 fast_path_tracing,
-has_gcptr):
+has_gcptr,
+cannot_pin):
 self.getfinalizer = getfinalizer
 self.getlightfinalizer = getlightfinalizer
 self.is_varsize = is_varsize
@@ -92,6 +93,7 @@
 self.get_custom_trace = get_custom_trace
 self.fast_path_tracing = fast_path_tracing
 self.has_gcptr = has_gcptr
+self.cannot_pin = cannot_pin
 
 def get_member_index(self, type_id):
 return self.member_index(type_id)
diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -915,14 +915,13 @@
 return False
 #
 obj_type_id = self.get_type_id(obj)
-if self.has_gcptr(obj_type_id):
+if self.cannot_pin(obj_type_id):
 # objects containing GC pointers can't be pinned. If we would add
 # it, we would have to track all pinned objects and trace them
 # every minor collection to make sure the referenced object are
 # kept alive. Right now this is not a use case that's needed.
-return False
-if self.weakpointer_offset(obj_type_id) >= 0:
-# for now we don't support pinning objects with weak pointers.
+# The check above also tests for being a less common kind of
+# object: a weakref, or one with any kind of finalizer.
 return False
 #
 self.header(obj).tid |= GCFLAG_PINNED
diff --git a/rpython/memory/gctypelayout.py b/rpython/memory/gctypelayout.py
--- a/rpython/memory/gctypelayout.py
+++ b/rpython/memory/gctypelayout.py
@@ -83,6 +83,14 @@
 infobits = self.get(typeid).infobits
 return (infobits & T_IS_GCARRAY_OF_GCPTR) != 0
 
+def q_cannot_pin(self, typeid):
+infobits = self.get(typeid).infobits
+ANY = (T_HAS_GCPTR |
+   T_IS_WEAKREF |
+   T_HAS_FINALIZER |
+   T_HAS_LIGHTWEIGHT_FINALIZER)
+return (infobits & ANY) != 0
+
 def q_finalizer(self, typeid):
 typeinfo = self.get(typeid)
 if typeinfo.infobits & T_HAS_FINALIZER:
@@ -167,7 +175,8 @@
 self.q_has_custom_trace,
 self.q_get_custom_trace,
 self.q_fast_path_tracing,
-self.q_has_gcptr)
+self.q_has_gcptr,
+self.q_cannot_pin)
 
 
 # the lowest 16bits are used to store group member index
diff --git a/rpython/memory/test/test_incminimark_gc.py 
b/rpython/memory/test/test_incminimark_gc.py
--- a/rpython/memory/test/test_incminimark_gc.py
+++ b/rpython/memory/test/test_incminimark_gc.py
@@ -48,6 +48,24 @@
 assert not rgc.pin(ref)
 self.interpret(f, [])
 
+def test_pin_finalizer_not_implemented(self):
+import weakref
+class A:
+def __del__(self):
+pass
+class B:
+def __del__(self):
+foo.bar += 1
+class Foo:
+bar = 0
+foo = Foo()
+def f():
+a = A()
+b = B()
+assert not rgc.pin(a)
+assert not rgc.pin(b)
+self.interpret(f, [])
+
 def test_weakref_to_pinned(self):
 import weakref
 from rpython.rlib import rgc
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy gc-incminimark-pinning: "Fix" the issue of weakrefs to pinned objects by writing why we really

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: gc-incminimark-pinning
Changeset: r74067:ea490b011329
Date: 2014-10-22 11:34 +0200
http://bitbucket.org/pypy/pypy/changeset/ea490b011329/

Log:"Fix" the issue of weakrefs to pinned objects by writing why we
really shouldn't get any weakref to pinned objects.

diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -2517,6 +2517,11 @@
 (obj + offset).address[0] = self.get_forwarding_address(
 pointing_to)
 else:
+# If the target is pinned, then we reach this point too.
+# It means that a hypothetical RPython interpreter that
+# would let you take a weakref to a pinned object (strange
+# thing not possible at all in PyPy) might see these
+# weakrefs marked as dead too early.
 (obj + offset).address[0] = llmemory.NULL
 continue# no need to remember this weakref any longer
 #
diff --git a/rpython/memory/test/test_incminimark_gc.py 
b/rpython/memory/test/test_incminimark_gc.py
--- a/rpython/memory/test/test_incminimark_gc.py
+++ b/rpython/memory/test/test_incminimark_gc.py
@@ -1,3 +1,4 @@
+import py
 from rpython.rtyper.lltypesystem import lltype
 from rpython.rtyper.lltypesystem.lloperation import llop
 from rpython.rlib import rgc
@@ -67,6 +68,7 @@
 self.interpret(f, [])
 
 def test_weakref_to_pinned(self):
+py.test.skip("weakref to pinned object: not supported")
 import weakref
 from rpython.rlib import rgc
 class A(object):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy gc-incminimark-pinning: Estimate 'max_number_of_pinned_objects' conservatively, instead of hard-coding 100.

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: gc-incminimark-pinning
Changeset: r74068:ab0bdd3d41a8
Date: 2014-10-22 11:46 +0200
http://bitbucket.org/pypy/pypy/changeset/ab0bdd3d41a8/

Log:Estimate 'max_number_of_pinned_objects' conservatively, instead of
hard-coding 100.

diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -256,11 +256,6 @@
 # minimal allocated size of the nursery is 2x the following
 # number (by default, at least 132KB on 32-bit and 264KB on 64-bit).
 "large_object": (16384+512)*WORD,
-
-# Number of objects that are allowed to be pinned in the nursery
-# at the same time.  Must be lesser than or equal to the chunk size
-# of an AddressStack.
-"max_number_of_pinned_objects": 100,
 }
 
 def __init__(self, config,
@@ -273,7 +268,6 @@
  major_collection_threshold=2.5,
  growth_rate_max=2.5,   # for tests
  card_page_indices=0,
- max_number_of_pinned_objects=100,
  large_object=8*WORD,
  ArenaCollectionClass=None,
  **kwds):
@@ -290,7 +284,7 @@
 self.max_heap_size = 0.0
 self.max_heap_size_already_raised = False
 self.max_delta = float(r_uint(-1))
-self.max_number_of_pinned_objects = max_number_of_pinned_objects
+self.max_number_of_pinned_objects = 0  # computed later
 #
 self.card_page_indices = card_page_indices
 if self.card_page_indices > 0:
@@ -459,6 +453,10 @@
 llarena.arena_free(self.nursery)
 self.nursery_size = newsize
 self.allocate_nursery()
+#
+# Estimate this number conservatively
+bigobj = self.nonlarge_max + 1
+self.max_number_of_pinned_objects = self.nursery_size / (bigobj * 2)
 
 def _nursery_memory_size(self):
 extra = self.nonlarge_max + 1
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: update the paragraph on object spaces

2014-10-22 Thread rlamy
Author: Ronan Lamy 
Branch: improve-docs
Changeset: r74069:e69f81e2747e
Date: 2014-10-22 12:32 +0200
http://bitbucket.org/pypy/pypy/changeset/e69f81e2747e/

Log:update the paragraph on object spaces

diff --git a/pypy/doc/architecture.rst b/pypy/doc/architecture.rst
--- a/pypy/doc/architecture.rst
+++ b/pypy/doc/architecture.rst
@@ -70,11 +70,6 @@
 lists, as well as the operations between them, like addition or
 truth-value-testing.
 
-.. TODO edit the sentence about the flow object space
-
-This division between bytecode evaluator and object space is very
-important, as it gives a lot of flexibility.  One can plug in
-different :doc:`object spaces ` to get different or enriched 
behaviours
-of the Python objects.  Additionally, a special more abstract object
-space, the :ref:`flow object space `, allows us to reuse 
the bytecode
-evaluator for our translation framework.
+This division between bytecode evaluator and object space gives a lot of
+flexibility.  One can plug in different :doc:`object spaces ` to get
+different or enriched behaviours of the Python objects.
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy gc-incminimark-pinning: Change alloc_buffer() to once again use prebuilt GC strings,

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: gc-incminimark-pinning
Changeset: r74070:8e1098ac3210
Date: 2014-10-22 12:42 +0200
http://bitbucket.org/pypy/pypy/changeset/8e1098ac3210/

Log:Change alloc_buffer() to once again use prebuilt GC strings, pinned.

diff --git a/rpython/rtyper/lltypesystem/rffi.py 
b/rpython/rtyper/lltypesystem/rffi.py
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -793,6 +793,7 @@
 return cast(TYPEP, data_start), pinned, False
 # ^^^ already nonmovable. Therefore it's not raw allocated nor
 # pinned.
+get_nonmovingbuffer._always_inline_ = 'try' # get rid of the returned tuple
 get_nonmovingbuffer._annenforceargs_ = [strtype]
 
 # (str, char*, bool, bool) -> None
@@ -812,52 +813,67 @@
 keepalive_until_here(data)
 free_nonmovingbuffer._annenforceargs_ = [strtype, None, bool, bool]
 
-# int -> (char*, str)
+# int -> (char*, str, int)
 def alloc_buffer(count):
 """
-Returns a (raw_buffer, gc_buffer) pair, allocated with count bytes.
+Returns a (raw_buffer, gc_buffer, case_num) triple,
+allocated with count bytes.
 The raw_buffer can be safely passed to a native function which expects
 it to not move. Call str_from_buffer with the returned values to get a
 safe high-level string. When the garbage collector cooperates, this
 allows for the process to be performed without an extra copy.
 Make sure to call keep_buffer_alive_until_here on the returned values.
 """
-raw_buf = lltype.malloc(TYPEP.TO, count, flavor='raw')
-return raw_buf, lltype.nullptr(STRTYPE)
+new_buf = lltype.malloc(STRTYPE, count)
+pinned = 0
+if rgc.can_move(new_buf):
+if rgc.pin(new_buf):
+pinned = 1
+else:
+raw_buf = lltype.malloc(TYPEP.TO, count, flavor='raw')
+return raw_buf, new_buf, 2
+#
+# following code is executed if:
+# - rgc.can_move(data) and rgc.pin(data) both returned true
+# - rgc.can_move(data) returned false
+data_start = cast_ptr_to_adr(new_buf) + \
+offsetof(STRTYPE, 'chars') + itemoffsetof(STRTYPE.chars, 0)
+return cast(TYPEP, data_start), new_buf, pinned
 alloc_buffer._always_inline_ = 'try' # to get rid of the returned tuple
 alloc_buffer._annenforceargs_ = [int]
 
 # (char*, str, int, int) -> None
 @jit.dont_look_inside
-@enforceargs(None, None, int, int)
-def str_from_buffer(raw_buf, gc_buf, allocated_size, needed_size):
+@enforceargs(None, None, int, int, int)
+def str_from_buffer(raw_buf, gc_buf, case_num, allocated_size, 
needed_size):
 """
 Converts from a pair returned by alloc_buffer to a high-level string.
 The returned string will be truncated to needed_size.
 """
 assert allocated_size >= needed_size
+if allocated_size != needed_size:
+from rpython.rtyper.lltypesystem.lloperation import llop
+if llop.shrink_array(lltype.Bool, gc_buf, needed_size):
+pass # now 'gc_buf' is smaller
+else:
+gc_buf = lltype.malloc(STRTYPE, needed_size)
+case_num = 2
+if case_num == 2:
+copy_raw_to_string(raw_buf, gc_buf, 0, needed_size)
+return hlstrtype(gc_buf)
 
-if gc_buf and (allocated_size == needed_size):
-return hlstrtype(gc_buf)
-
-new_buf = lltype.malloc(STRTYPE, needed_size)
-if gc_buf:
-copy_string_contents(gc_buf, new_buf, 0, 0, needed_size)
-else:
-copy_raw_to_string(raw_buf, new_buf, 0, needed_size)
-return hlstrtype(new_buf)
-
-# (char*, str) -> None
+# (char*, str, int) -> None
 @jit.dont_look_inside
-def keep_buffer_alive_until_here(raw_buf, gc_buf):
+def keep_buffer_alive_until_here(raw_buf, gc_buf, case_num):
 """
 Keeps buffers alive or frees temporary buffers created by alloc_buffer.
 This must be called after a call to alloc_buffer, usually in a
 try/finally block.
 """
-if gc_buf:
-keepalive_until_here(gc_buf)
-elif raw_buf:
+keepalive_until_here(gc_buf)
+if case_num == 1:
+rgc.unpin(gc_buf)
+if case_num == 2:
 lltype.free(raw_buf, flavor='raw')
 
 # char* -> str, with an upper bound on the length in case there is no \x00
@@ -1144,23 +1160,25 @@
 def __init__(self, size):
 self.size = size
 def __enter__(self):
-self.raw, self.gc_buf = alloc_buffer(self.size)
+self.raw, self.gc_buf, self.case_num = alloc_buffer(self.size)
 return self
 def __exit__(self, *args):
-keep_buffer_alive_until_here(self.raw, self.gc_buf)
+keep_buffer_alive_until_here(self.raw, self.gc_buf, self.case_num)
 def s

[pypy-commit] pypy gc-incminimark-pinning: Kill outdated test

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: gc-incminimark-pinning
Changeset: r74071:a4c674b9e803
Date: 2014-10-22 14:35 +0200
http://bitbucket.org/pypy/pypy/changeset/a4c674b9e803/

Log:Kill outdated test

diff --git a/pypy/module/cpyext/test/test_unicodeobject.py 
b/pypy/module/cpyext/test/test_unicodeobject.py
--- a/pypy/module/cpyext/test/test_unicodeobject.py
+++ b/pypy/module/cpyext/test/test_unicodeobject.py
@@ -326,13 +326,6 @@
 self.raises(space, api, TypeError, api.PyUnicode_FromEncodedObject, 
space.wrap(u_text), null_charp, None)
 rffi.free_charp(b_text)
 
-def test_leak(self):
-size = 50
-raw_buf, gc_buf = rffi.alloc_buffer(size)
-for i in range(size): raw_buf[i] = 'a'
-str = rffi.str_from_buffer(raw_buf, gc_buf, size, size)
-rffi.keep_buffer_alive_until_here(raw_buf, gc_buf)
-
 def test_mbcs(self, space, api):
 if sys.platform != 'win32':
 py.test.skip("mcbs encoding only exists on Windows")
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy gc-incminimark-pinning: Fix fix fix

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: gc-incminimark-pinning
Changeset: r74072:627e4d900c45
Date: 2014-10-22 14:41 +0200
http://bitbucket.org/pypy/pypy/changeset/627e4d900c45/

Log:Fix fix fix

diff --git a/pypy/module/bz2/interp_bz2.py b/pypy/module/bz2/interp_bz2.py
--- a/pypy/module/bz2/interp_bz2.py
+++ b/pypy/module/bz2/interp_bz2.py
@@ -195,7 +195,7 @@
 self._allocate_chunk(initial_size)
 
 def _allocate_chunk(self, size):
-self.raw_buf, self.gc_buf = rffi.alloc_buffer(size)
+self.raw_buf, self.gc_buf, self.case_num = rffi.alloc_buffer(size)
 self.current_size = size
 self.bzs.c_next_out = self.raw_buf
 rffi.setintfield(self.bzs, 'c_avail_out', size)
@@ -204,8 +204,10 @@
 assert 0 <= chunksize <= self.current_size
 raw_buf = self.raw_buf
 gc_buf = self.gc_buf
-s = rffi.str_from_buffer(raw_buf, gc_buf, self.current_size, chunksize)
-rffi.keep_buffer_alive_until_here(raw_buf, gc_buf)
+case_num = self.case_num
+s = rffi.str_from_buffer(raw_buf, gc_buf, case_num,
+ self.current_size, chunksize)
+rffi.keep_buffer_alive_until_here(raw_buf, gc_buf, case_num)
 self.current_size = 0
 return s
 
@@ -225,7 +227,8 @@
 
 def free(self):
 if self.current_size > 0:
-rffi.keep_buffer_alive_until_here(self.raw_buf, self.gc_buf)
+rffi.keep_buffer_alive_until_here(self.raw_buf, self.gc_buf,
+  self.case_num)
 
 def __enter__(self):
 return self
diff --git a/rpython/rtyper/lltypesystem/ll2ctypes.py 
b/rpython/rtyper/lltypesystem/ll2ctypes.py
--- a/rpython/rtyper/lltypesystem/ll2ctypes.py
+++ b/rpython/rtyper/lltypesystem/ll2ctypes.py
@@ -565,6 +565,8 @@
 if addr in ALLOCATED:
 raise Exception("internal ll2ctypes error - "
 "double conversion from lltype to ctypes?")
+if self._TYPE._gckind == 'gc':
+return
 # XXX don't store here immortal structures
 ALLOCATED[addr] = self
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy gc-incminimark-pinning: Fix the tests

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: gc-incminimark-pinning
Changeset: r74073:34820ba4adac
Date: 2014-10-22 14:59 +0200
http://bitbucket.org/pypy/pypy/changeset/34820ba4adac/

Log:Fix the tests

diff --git a/rpython/memory/gc/test/test_object_pinning.py 
b/rpython/memory/gc/test/test_object_pinning.py
--- a/rpython/memory/gc/test/test_object_pinning.py
+++ b/rpython/memory/gc/test/test_object_pinning.py
@@ -15,6 +15,11 @@
 
 class PinningGCTest(BaseDirectGCTest):
 
+def setup_method(self, meth):
+BaseDirectGCTest.setup_method(self, meth)
+max = getattr(meth, 'max_number_of_pinned_objects', 20)
+self.gc.max_number_of_pinned_objects = max
+
 def test_pin_can_move(self):
 # even a pinned object is considered to be movable. Only the caller
 # of pin() knows if it is currently movable or not.
@@ -877,19 +882,20 @@
 self.gc.collect()
 
 def test_pinning_limit(self):
+assert self.gc.max_number_of_pinned_objects == 5
 for instance_nr in xrange(self.gc.max_number_of_pinned_objects):
 ptr = self.malloc(T)
 adr = llmemory.cast_ptr_to_adr(ptr)
 ptr.someInt = 100 + instance_nr
 self.stackroots.append(ptr)
-self.gc.pin(adr)
+assert self.gc.pin(adr)
 #
 # now we reached the maximum amount of pinned objects
 ptr = self.malloc(T)
 adr = llmemory.cast_ptr_to_adr(ptr)
 self.stackroots.append(ptr)
 assert not self.gc.pin(adr)
-test_pinning_limit.GC_PARAMS = {'max_number_of_pinned_objects': 5}
+test_pinning_limit.max_number_of_pinned_objects = 5
 
 def test_full_pinned_nursery_pin_fail(self):
 typeid = self.get_type_id(T)
@@ -909,6 +915,5 @@
 # nursery should be full now, at least no space for another `T`.
 # Next malloc should fail.
 py.test.raises(Exception, self.malloc, T)
-test_full_pinned_nursery_pin_fail.GC_PARAMS = \
-{'max_number_of_pinned_objects': 50}
+test_full_pinned_nursery_pin_fail.max_number_of_pinned_objects = 50
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy gc-incminimark-pinning: A random test trying to pin objects.

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: gc-incminimark-pinning
Changeset: r74074:e34a36193f6a
Date: 2014-10-22 15:20 +0200
http://bitbucket.org/pypy/pypy/changeset/e34a36193f6a/

Log:A random test trying to pin objects.

diff --git a/rpython/translator/c/test/test_newgc.py 
b/rpython/translator/c/test/test_newgc.py
--- a/rpython/translator/c/test/test_newgc.py
+++ b/rpython/translator/c/test/test_newgc.py
@@ -1504,6 +1504,54 @@
 class TestIncrementalMiniMarkGC(TestMiniMarkGC):
 gcpolicy = "incminimark"
 
+def define_random_pin(self):
+class A:
+foo = None
+bar = '..'
+def f():
+alist = [A()]
+slist = ['..']
+i = 0
+j = 0
+k = 0
+while i < 300:
+k = (k * 1291 + i) % 4603
+a = A()
+if k < 1000:
+alist.append(a)
+elif k < 2000:
+j = (i * k)
+alist[j % len(alist)].foo = alist[(j+i) % len(alist)]
+elif k < 3000:
+alist[i % len(alist)].bar = slist[(j+i) % len(slist)]
+elif k < 4000:
+slist.append(chr(i & 255) + chr(k & 255))
+elif k < 4100 and len(alist) > 1:
+drop = alist.pop()
+alist[i % len(alist)] = drop
+elif k < 4200 and len(slist) > 1:
+drop = slist.pop()
+slist[i % len(slist)] = drop
+elif k < 4300:
+rgc.pin(slist[i % len(slist)])  # <-- pin!
+keepalive_until_here(a)
+i += 1
+n = 0
+m = 0
+for i in range(len(alist)):
+a = alist[i]
+if a.foo is None:
+n -= 1
+else:
+n += ord(a.foo.bar[0])
+m += ord(a.foo.bar[1])
+return m - n
+return f
+
+def test_random_pin(self):
+res = self.run("random_pin")
+assert res == 279882
+
 
 # 
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: Remove includes of removed file _ref.txt.

2014-10-22 Thread mjacob
Author: Manuel Jacob 
Branch: improve-docs
Changeset: r74077:6b291674a63b
Date: 2014-10-22 15:30 +0200
http://bitbucket.org/pypy/pypy/changeset/6b291674a63b/

Log:Remove includes of removed file _ref.txt.

diff --git a/pypy/doc/cppyy_backend.rst b/pypy/doc/cppyy_backend.rst
--- a/pypy/doc/cppyy_backend.rst
+++ b/pypy/doc/cppyy_backend.rst
@@ -43,6 +43,3 @@
 to ``PATH``).
 In case of the former, include files are expected under ``$ROOTSYS/include``
 and libraries under ``$ROOTSYS/lib``.
-
-
-.. include:: _ref.txt
diff --git a/pypy/doc/stm.rst b/pypy/doc/stm.rst
--- a/pypy/doc/stm.rst
+++ b/pypy/doc/stm.rst
@@ -158,7 +158,6 @@
 
 User Guide
 ==
-  
 
 Drop-in replacement
 ---
@@ -343,7 +342,7 @@
 only requires that the end programmer identifies where this parallelism
 is likely to be found, and communicates it to the system, using for
 example the ``transaction.add()`` scheme.
-
+
 .. _`transaction.py`: 
https://bitbucket.org/pypy/pypy/raw/stmgc-c7/lib_pypy/transaction.py
 .. _OpenMP: http://en.wikipedia.org/wiki/OpenMP
 
@@ -377,7 +376,7 @@
 The ``__pypy__.thread`` submodule is a built-in module of PyPy that
 contains a few internal built-in functions used by the
 ``transactional_memory`` module, plus the following:
-
+
 * ``__pypy__.thread.atomic``: a context manager to run a block in
   fully atomic mode, without "releasing the GIL".  (May be eventually
   removed?)
@@ -544,6 +543,3 @@
 See also
 https://bitbucket.org/pypy/pypy/raw/default/pypy/doc/project-ideas.rst
 (section about STM).
-
-
-.. include:: _ref.txt
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: (ronan, mjacob) Complete index of release notes, add index of whatsnew.

2014-10-22 Thread mjacob
Author: Manuel Jacob 
Branch: improve-docs
Changeset: r74078:7f91eb4c773f
Date: 2014-10-22 15:44 +0200
http://bitbucket.org/pypy/pypy/changeset/7f91eb4c773f/

Log:(ronan, mjacob) Complete index of release notes, add index of
whatsnew.

diff --git a/pypy/doc/index-of-release-notes.rst 
b/pypy/doc/index-of-release-notes.rst
--- a/pypy/doc/index-of-release-notes.rst
+++ b/pypy/doc/index-of-release-notes.rst
@@ -1,8 +1,8 @@
 Historical release notes
 
 
-Cpython 2.7 compatible versions
-===
+CPython 2.7 compatible versions
+---
 
 .. toctree::
 
@@ -38,7 +38,12 @@
release-0.7.0.rst
release-0.6
 
-Cpython 3.2 compatible versions
-===
+
+CPython 3.2 compatible versions
+---
+
 .. toctree::
+
+   release-pypy3-2.4.0.rst
+   release-pypy3-2.3.1.rst
release-pypy3-2.1.0-beta1.rst
diff --git a/pypy/doc/index-of-whatsnew.rst b/pypy/doc/index-of-whatsnew.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/index-of-whatsnew.rst
@@ -0,0 +1,27 @@
+Changelogs
+==
+
+CPython 2.7 compatible versions
+---
+
+.. toctree::
+
+   whatsnew-head.rst
+   whatsnew-2.4.0.rst
+   whatsnew-2.3.1.rst
+   whatsnew-2.3.0.rst
+   whatsnew-2.2.rst
+   whatsnew-2.1.rst
+   whatsnew-2.0.rst
+   whatsnew-2.0.0-beta1.rst
+   whatsnew-1.9.rst
+
+
+
+CPython 3.2 compatible versions
+---
+
+.. toctree::
+
+   whatsnew-pypy3-2.4.0.rst
+   whatsnew-pypy3-2.3.1.rst
diff --git a/pypy/doc/index.rst b/pypy/doc/index.rst
--- a/pypy/doc/index.rst
+++ b/pypy/doc/index.rst
@@ -85,6 +85,7 @@
   eventhistory
   discussions
   index-of-release-notes
+  index-of-whatsnew
   contributor
 
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: Remove hidden TOC tree from index page, move most links under the appropriate section.

2014-10-22 Thread mjacob
Author: Manuel Jacob 
Branch: improve-docs
Changeset: r74076:375187dffcd4
Date: 2014-10-22 15:21 +0200
http://bitbucket.org/pypy/pypy/changeset/375187dffcd4/

Log:Remove hidden TOC tree from index page, move most links under the
appropriate section.

diff --git a/pypy/doc/ctypes-implementation.rst 
b/pypy/doc/discussion/ctypes-implementation.rst
rename from pypy/doc/ctypes-implementation.rst
rename to pypy/doc/discussion/ctypes-implementation.rst
diff --git a/pypy/doc/index.rst b/pypy/doc/index.rst
--- a/pypy/doc/index.rst
+++ b/pypy/doc/index.rst
@@ -43,10 +43,11 @@
   :maxdepth: 1
 
   cpython_differences
+  extending
   gc_info
   jit-hooks
   stackless
-  cppyy
+  __pypy__-module
   objspace-proxies
   sandbox
 
@@ -61,9 +62,12 @@
 
   getting-started-dev
   how-to-contribute
+  you-want-to-help
   architecture
+  configuration
   project-ideas
   project-documentation
+  how-to-release
 
 .. TODO: audit ^^
 
@@ -71,14 +75,17 @@
 .. TODO: Fill this in
 
 
-Academical stuff
-
+Further resources
+-
 
 .. toctree::
   :maxdepth: 1
 
   extradoc
-.. TODO: Remove this? Or fill it with links to papers?
+  eventhistory
+  discussions
+  index-of-release-notes
+  contributor
 
 
 .. _contact:
@@ -119,34 +126,3 @@
 * :ref:`genindex`
 * :ref:`modindex`
 * :ref:`search`
-
-
-.. TODO figure out what to do with these!
-
-.. toctree::
-  :hidden:
-
-  configuration
-  contributor
-  cppyy_backend
-  cppyy_example
-  ctypes-implementation
-  discussion/jit-profiler
-  discussions
-  eventhistory
-  extending
-  getting-started-dev
-  how-to-release
-  release-2.0.1
-  release-2.0.2
-  release-2.1.0
-  release-2.1.0-beta1
-  release-2.1.0-beta2
-  releases/index
-  whatsnew-1.9
-  whatsnew-2.0
-  whatsnew-2.0.0-beta1
-  whatsnew-2.1
-  whatsnew-head
-  you-want-to-help
-  __pypy__-module
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: Remove 'Development' heading from FAQ.

2014-10-22 Thread mjacob
Author: Manuel Jacob 
Branch: improve-docs
Changeset: r74075:a78c2953dbdd
Date: 2014-10-22 14:39 +0200
http://bitbucket.org/pypy/pypy/changeset/a78c2953dbdd/

Log:Remove 'Development' heading from FAQ.

diff --git a/pypy/doc/faq.rst b/pypy/doc/faq.rst
--- a/pypy/doc/faq.rst
+++ b/pypy/doc/faq.rst
@@ -218,9 +218,6 @@
 .. _PyPy bitbucket page: https://bitbucket.org/pypy/
 
 
-Development
-===
-
 How do I get into PyPy development?  Can I come to sprints?
 ---
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: (ronan, mjacob) Fix headings in embedding.rst.

2014-10-22 Thread mjacob
Author: Manuel Jacob 
Branch: improve-docs
Changeset: r74082:0a49c73b3dcd
Date: 2014-10-22 16:06 +0200
http://bitbucket.org/pypy/pypy/changeset/0a49c73b3dcd/

Log:(ronan, mjacob) Fix headings in embedding.rst.

diff --git a/pypy/doc/embedding.rst b/pypy/doc/embedding.rst
--- a/pypy/doc/embedding.rst
+++ b/pypy/doc/embedding.rst
@@ -1,6 +1,5 @@
-
 Embedding PyPy
---
+==
 
 PyPy has a very minimal and a very strange embedding interface, based on
 the usage of `cffi`_ and the philosophy that Python is a better language than
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: Link embedding and stm from index page.

2014-10-22 Thread mjacob
Author: Manuel Jacob 
Branch: improve-docs
Changeset: r74080:d4490f220814
Date: 2014-10-22 15:58 +0200
http://bitbucket.org/pypy/pypy/changeset/d4490f220814/

Log:Link embedding and stm from index page.

diff --git a/pypy/doc/index.rst b/pypy/doc/index.rst
--- a/pypy/doc/index.rst
+++ b/pypy/doc/index.rst
@@ -44,12 +44,14 @@
 
   cpython_differences
   extending
+  embedding
   gc_info
   jit-hooks
   stackless
   __pypy__-module
   objspace-proxies
   sandbox
+  stm
 
 
 .. _developing-pypy:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: Remove 'Where to go from here' section from build.rst.

2014-10-22 Thread mjacob
Author: Manuel Jacob 
Branch: improve-docs
Changeset: r74079:1511aa8095b4
Date: 2014-10-22 15:55 +0200
http://bitbucket.org/pypy/pypy/changeset/1511aa8095b4/

Log:Remove 'Where to go from here' section from build.rst.

diff --git a/pypy/doc/build.rst b/pypy/doc/build.rst
--- a/pypy/doc/build.rst
+++ b/pypy/doc/build.rst
@@ -165,28 +165,3 @@
 
 
 .. TODO windows
-
-
-Where to go from here
--
-
-Congratulations! Now that you've successfully built your own PyPy, you might
-want to `start writing a fast JITed interpreter with PyPy`_, or look at some
-:doc:`projects we need help with `, or just dive deeper into
-the docs:
-
-.. toctree::
-  :maxdepth: 1
-
-  getting-started-dev
-  cpython_differences
-  embedding
-  gc_info
-  jit-hooks
-  stackless
-  cppyy
-  objspace-proxies
-  sandbox
-
-
-.. _start writing a fast JITed interpreter with PyPy: 
http://morepypy.blogspot.com/2011/04/tutorial-writing-interpreter-with-pypy.html
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: (ronan, mjacob) Complete some TOC trees.

2014-10-22 Thread mjacob
Author: Manuel Jacob 
Branch: improve-docs
Changeset: r74081:744a8a154a58
Date: 2014-10-22 16:04 +0200
http://bitbucket.org/pypy/pypy/changeset/744a8a154a58/

Log:(ronan, mjacob) Complete some TOC trees.

diff --git a/pypy/doc/cppyy.rst b/pypy/doc/cppyy.rst
--- a/pypy/doc/cppyy.rst
+++ b/pypy/doc/cppyy.rst
@@ -863,3 +863,10 @@
 information is completely independent of Python.
 
 .. _Py3k: https://bitbucket.org/pypy/pypy/src/py3k
+
+
+.. toctree::
+   :hidden:
+
+   cppyy_backend
+   cppyy_example
diff --git a/pypy/doc/discussion/win64_todo.txt 
b/pypy/doc/discussion/win64_todo.txt
deleted file mode 100644
--- a/pypy/doc/discussion/win64_todo.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-2011-11-04
-ll_os.py has a problem with the file rwin32.py.
-Temporarily disabled for the win64_gborg branch. This needs to be
-investigated and re-enabled.
-Resolved, enabled.
-
-2011-11-05
-test_typed.py needs explicit tests to ensure that we
-handle word sizes right.
\ No newline at end of file
diff --git a/pypy/doc/discussions.rst b/pypy/doc/discussions.rst
--- a/pypy/doc/discussions.rst
+++ b/pypy/doc/discussions.rst
@@ -8,6 +8,8 @@
 
 .. toctree::
 
-   discussion/finalizer-order.rst
-   discussion/howtoimplementpickling.rst
-   discussion/improve-rpython.rst
+   discussion/finalizer-order
+   discussion/howtoimplementpickling
+   discussion/improve-rpython
+   discussion/ctypes-implementation
+   discussion/jit-profiler
diff --git a/pypy/doc/extending.rst b/pypy/doc/extending.rst
--- a/pypy/doc/extending.rst
+++ b/pypy/doc/extending.rst
@@ -92,3 +92,9 @@
 This is reserved for special cases: it gives direct access to e.g. the
 details of the JIT, allowing us to tweak its interaction with user code.
 This is how the numpy module is being developed.
+
+
+.. toctree::
+   :hidden:
+
+   cppyy
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: Give cppyy_example.rst a title.

2014-10-22 Thread mjacob
Author: Manuel Jacob 
Branch: improve-docs
Changeset: r74083:c49f908b8636
Date: 2014-10-22 16:10 +0200
http://bitbucket.org/pypy/pypy/changeset/c49f908b8636/

Log:Give cppyy_example.rst a title.

diff --git a/pypy/doc/cppyy_example.rst b/pypy/doc/cppyy_example.rst
--- a/pypy/doc/cppyy_example.rst
+++ b/pypy/doc/cppyy_example.rst
@@ -1,4 +1,7 @@
-// File: example.h::
+File example.h
+==
+
+::
 
 #include 
 #include 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy gc-incminimark-pinning: Add an obscure hack to make the test_newgc test pass.

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: gc-incminimark-pinning
Changeset: r74085:72a2cf960e9f
Date: 2014-10-22 16:34 +0200
http://bitbucket.org/pypy/pypy/changeset/72a2cf960e9f/

Log:Add an obscure hack to make the test_newgc test pass.

diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -379,6 +379,7 @@
 # must be traced every minor collection. Without tracing them the
 # referenced pinned object wouldn't be visited and therefore collected.
 self.old_objects_pointing_to_pinned = self.AddressStack()
+self.updated_old_objects_pointing_to_pinned = False
 #
 # Allocate a nursery.  In case of auto_nursery_size, start by
 # allocating a very small nursery, enough to do things like look
@@ -1368,6 +1369,17 @@
 one of the following flags a bit too eagerly, which means we'll have
 a bit more objects to track, but being on the safe side.
 """
+# obscre.  The flag 'updated_old_objects_pointing_to_pinned'
+# is set to True when 'old_objects_pointing_to_pinned' is modified.
+# Here, when it was modified, then we do a write_barrier() on
+# all items in that list (there should only be a small number,
+# so we don't care).  The goal is that the logic that follows below
+# works as expected...
+if self.updated_old_objects_pointing_to_pinned:
+self.old_objects_pointing_to_pinned.foreach(
+self._wb_old_object_pointing_to_pinned, None)
+self.updated_old_objects_pointing_to_pinned = False
+#
 source_hdr = self.header(source_addr)
 dest_hdr = self.header(dest_addr)
 if dest_hdr.tid & GCFLAG_TRACK_YOUNG_PTRS == 0:
@@ -1428,6 +1440,9 @@
 self.old_objects_with_cards_set.append(dest_addr)
 dest_hdr.tid |= GCFLAG_CARDS_SET
 
+def _wb_old_object_pointing_to_pinned(self, obj, ignore):
+self.write_barrier(obj)
+
 def record_pinned_object_with_shadow(self, obj, new_shadow_object_dict):
 # checks if the pinned object has a shadow and if so add it to the
 # dict of shadows.
@@ -1807,6 +1822,7 @@
 #
 debug_print("old_objects_pointing_to_pinned:", parent)
 self.old_objects_pointing_to_pinned.append(parent)
+self.updated_old_objects_pointing_to_pinned = True
 self.header(parent).tid |= GCFLAG_PINNED
 #
 if hdr.tid & GCFLAG_VISITED:
@@ -2054,6 +2070,7 @@
 self.old_objects_pointing_to_pinned.delete()
 self.old_objects_pointing_to_pinned = \
 new_old_objects_pointing_to_pinned
+self.updated_old_objects_pointing_to_pinned = True
 self.gc_state = STATE_SWEEPING
 #END MARKING
 elif self.gc_state == STATE_SWEEPING:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy gc-incminimark-pinning: Add a lot of debug prints

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: gc-incminimark-pinning
Changeset: r74084:031d55f5a105
Date: 2014-10-22 15:39 +0200
http://bitbucket.org/pypy/pypy/changeset/031d55f5a105/

Log:Add a lot of debug prints

diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -1098,6 +1098,8 @@
   "object in nursery after collection")
 ll_assert(self.header(obj).tid & GCFLAG_VISITED_RMY == 0,
   "GCFLAG_VISITED_RMY after collection")
+ll_assert(self.header(obj).tid & GCFLAG_PINNED == 0,
+  "GCFLAG_PINNED outside the nursery after collection")
 else:
 ll_assert(self.is_in_nursery(obj),
   "pinned object not in nursery")
@@ -1494,9 +1496,11 @@
 if self.old_objects_pointing_to_pinned.non_empty():
 current_old_objects_pointing_to_pinned = \
 self.old_objects_pointing_to_pinned
+debug_print("clear old_objects_pointing_to_pinned")
 self.old_objects_pointing_to_pinned = self.AddressStack()
 current_old_objects_pointing_to_pinned.foreach(
 self._visit_old_objects_pointing_to_pinned, None)
+debug_print("done repopulating old_objects_pointing_to_pinned")
 current_old_objects_pointing_to_pinned.delete()
 #
 while True:
@@ -1801,6 +1805,7 @@
 if parent != llmemory.NULL and \
 not self.header(parent).tid & 
GCFLAG_PINNED_OBJECT_PARENT_KNOWN:
 #
+debug_print("old_objects_pointing_to_pinned:", parent)
 self.old_objects_pointing_to_pinned.append(parent)
 self.header(parent).tid |= GCFLAG_PINNED
 #
@@ -2041,6 +2046,7 @@
 # get rid of objects pointing to pinned objects that were not
 # visited
 if self.old_objects_pointing_to_pinned.non_empty():
+debug_print("_sweep_old_objects_pointing_to_pinned")
 new_old_objects_pointing_to_pinned = self.AddressStack()
 self.old_objects_pointing_to_pinned.foreach(
 self._sweep_old_objects_pointing_to_pinned,
@@ -2128,7 +2134,10 @@
 
 def _sweep_old_objects_pointing_to_pinned(self, obj, new_list):
 if self.header(obj).tid & GCFLAG_VISITED:
+debug_print(obj, "-> visited")
 new_list.append(obj)
+else:
+debug_print(obj, "-> drop")
 
 def _free_if_unvisited(self, hdr):
 size_gc_header = self.gcheaderbuilder.size_gc_header
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy gc-incminimark-pinning: Remove the debug_prints

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: gc-incminimark-pinning
Changeset: r74086:89baa53de5f2
Date: 2014-10-22 16:36 +0200
http://bitbucket.org/pypy/pypy/changeset/89baa53de5f2/

Log:Remove the debug_prints

diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -1511,11 +1511,9 @@
 if self.old_objects_pointing_to_pinned.non_empty():
 current_old_objects_pointing_to_pinned = \
 self.old_objects_pointing_to_pinned
-debug_print("clear old_objects_pointing_to_pinned")
 self.old_objects_pointing_to_pinned = self.AddressStack()
 current_old_objects_pointing_to_pinned.foreach(
 self._visit_old_objects_pointing_to_pinned, None)
-debug_print("done repopulating old_objects_pointing_to_pinned")
 current_old_objects_pointing_to_pinned.delete()
 #
 while True:
@@ -1820,7 +1818,6 @@
 if parent != llmemory.NULL and \
 not self.header(parent).tid & 
GCFLAG_PINNED_OBJECT_PARENT_KNOWN:
 #
-debug_print("old_objects_pointing_to_pinned:", parent)
 self.old_objects_pointing_to_pinned.append(parent)
 self.updated_old_objects_pointing_to_pinned = True
 self.header(parent).tid |= GCFLAG_PINNED
@@ -2062,7 +2059,6 @@
 # get rid of objects pointing to pinned objects that were not
 # visited
 if self.old_objects_pointing_to_pinned.non_empty():
-debug_print("_sweep_old_objects_pointing_to_pinned")
 new_old_objects_pointing_to_pinned = self.AddressStack()
 self.old_objects_pointing_to_pinned.foreach(
 self._sweep_old_objects_pointing_to_pinned,
@@ -2151,10 +2147,7 @@
 
 def _sweep_old_objects_pointing_to_pinned(self, obj, new_list):
 if self.header(obj).tid & GCFLAG_VISITED:
-debug_print(obj, "-> visited")
 new_list.append(obj)
-else:
-debug_print(obj, "-> drop")
 
 def _free_if_unvisited(self, hdr):
 size_gc_header = self.gcheaderbuilder.size_gc_header
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy kill-exported-symbols-list: (fijal, arigo)

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: kill-exported-symbols-list
Changeset: r74087:4975a519e773
Date: 2014-10-22 16:55 +0200
http://bitbucket.org/pypy/pypy/changeset/4975a519e773/

Log:(fijal, arigo)

Kill -Wl,--export-dynamic,--version-script=...

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


[pypy-commit] pypy improve-docs: (ronan, mjacob) Update documentation TODO.

2014-10-22 Thread mjacob
Author: Manuel Jacob 
Branch: improve-docs
Changeset: r74088:e38f409137bc
Date: 2014-10-22 16:53 +0200
http://bitbucket.org/pypy/pypy/changeset/e38f409137bc/

Log:(ronan, mjacob) Update documentation TODO.

diff --git a/pypy/doc/TODO b/pypy/doc/TODO
--- a/pypy/doc/TODO
+++ b/pypy/doc/TODO
@@ -4,12 +4,9 @@
 General
 ---
 
-* structure documentation and add appropriate toctrees (mostly done)
-* architecture documents don't really show the separation between PyPy and 
RPython
+* architecture documents don't really show the separation between PyPy and
+  RPython
   * architecture.rst is duplicate (both pypy and rpython)
-* where should the documentation about coding style etc. be put?
-  * we don't really document coding style
-  * w_* convention?
 
 
 Cleanup
@@ -27,6 +24,14 @@
 * work on configuration/options documentation generation
 
 
+PyPy
+
+
+* Update coding guide
+* Move links from project-documentation.rst to index.rst and consider killing
+  it.
+
+
 RPython
 ---
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: (ronan, mjacob) Fix reST syntax in whatsnew documents.

2014-10-22 Thread mjacob
Author: Manuel Jacob 
Branch: improve-docs
Changeset: r74089:81357bbe547c
Date: 2014-10-22 17:13 +0200
http://bitbucket.org/pypy/pypy/changeset/81357bbe547c/

Log:(ronan, mjacob) Fix reST syntax in whatsnew documents.

diff --git a/pypy/doc/whatsnew-2.0.0-beta1.rst 
b/pypy/doc/whatsnew-2.0.0-beta1.rst
--- a/pypy/doc/whatsnew-2.0.0-beta1.rst
+++ b/pypy/doc/whatsnew-2.0.0-beta1.rst
@@ -22,7 +22,7 @@
 
 Check that axis arg is valid in _numpypy
 
-.. branch:less-gettestobjspace
+.. branch: less-gettestobjspace
 
 .. branch: move-apptest-support
 
diff --git a/pypy/doc/whatsnew-2.1.rst b/pypy/doc/whatsnew-2.1.rst
--- a/pypy/doc/whatsnew-2.1.rst
+++ b/pypy/doc/whatsnew-2.1.rst
@@ -6,78 +6,100 @@
 .. startrev: a13c07067613
 
 .. branch: ndarray-ptp
+
 put and array.put
 
 .. branch: numpy-pickle
+
 Pickling of numpy arrays and dtypes (including record dtypes)
 
 .. branch: remove-array-smm
+
 Remove multimethods in the arraymodule
 
 .. branch: callback-stacklet
+
 Fixed bug when switching stacklets from a C callback
 
 .. branch: remove-set-smm
+
 Remove multi-methods on sets
 
 .. branch: numpy-subarrays
+
 Implement subarrays for numpy
 
 .. branch: remove-dict-smm
+
 Remove multi-methods on dict
 
 .. branch: remove-list-smm-2
+
 Remove remaining multi-methods on list
 
 .. branch: arm-stacklet
+
 Stacklet support for ARM, enables _continuation support
 
 .. branch: remove-tuple-smm
+
 Remove multi-methods on tuple
 
 .. branch: remove-iter-smm
+
 Remove multi-methods on iterators
 
 .. branch: emit-call-x86
 .. branch: emit-call-arm
 
 .. branch: on-abort-resops
+
 Added list of resops to the pypyjit on_abort hook.
 
 .. branch: logging-perf
+
 Speeds up the stdlib logging module
 
 .. branch: operrfmt-NT
+
 Adds a couple convenient format specifiers to operationerrfmt
 
 .. branch: win32-fixes3
+
 Skip and fix some non-translated (own) tests for win32 builds
 
 .. branch: ctypes-byref
+
 Add the '_obj' attribute on ctypes pointer() and byref() objects
 
 .. branch: argsort-segfault
+
 Fix a segfault in argsort when sorting by chunks on multidim numpypy arrays 
(mikefc)
 
 .. branch: dtype-isnative
 .. branch: ndarray-round
 
 .. branch: faster-str-of-bigint
+
 Improve performance of str(long).
 
 .. branch: ndarray-view
+
 Add view to ndarray and zeroD arrays, not on dtype scalars yet
 
 .. branch: numpypy-segfault
+
 fix segfault caused by iterating over empty ndarrays
 
 .. branch: identity-set
+
 Faster sets for objects
 
 .. branch: inline-identityhash
+
 Inline the fast path of id() and hash()
 
 .. branch: package-tk
+
 Adapt package.py script to compile CFFI tk extension. Add a --without-tk switch
 to optionally skip it.
-
diff --git a/pypy/doc/whatsnew-2.2.rst b/pypy/doc/whatsnew-2.2.rst
--- a/pypy/doc/whatsnew-2.2.rst
+++ b/pypy/doc/whatsnew-2.2.rst
@@ -6,31 +6,38 @@
 .. startrev: 4eb52818e7c0
 
 .. branch: sanitise_bytecode_dispatch
+
 Make PyPy's bytecode dispatcher easy to read, and less reliant on RPython
 magic. There is no functional change, though the removal of dead code leads
 to many fewer tests to execute.
 
 .. branch: fastjson
+
 Fast json decoder written in RPython, about 3-4x faster than the pure Python
 decoder which comes with the stdlib
 
 .. branch: improve-str2charp
+
 Improve the performance of I/O writing up to 15% by using memcpy instead of
 copying char-by-char in str2charp and get_nonmovingbuffer
 
 .. branch: flowoperators
+
 Simplify rpython/flowspace/ code by using more metaprogramming.  Create
 SpaceOperator class to gather static information about flow graph operations.
 
 .. branch: package-tk
+
 Adapt package.py script to compile CFFI tk extension. Add a --without-tk switch
 to optionally skip it.
 
 .. branch: distutils-cppldflags
+
 Copy CPython's implementation of customize_compiler, dont call split on
 environment variables, honour CFLAGS, CPPFLAGS, LDSHARED and LDFLAGS on Unices.
 
 .. branch: precise-instantiate
+
 When an RPython class is instantiated via an indirect call (that is, which
 class is being instantiated isn't known precisely) allow the optimizer to have
 more precise information about which functions can be called. Needed for Topaz.
@@ -38,48 +45,59 @@
 .. branch: ssl_moving_write_buffer
 
 .. branch: pythoninspect-fix
+
 Make PyPy respect PYTHONINSPECT variable set via os.putenv in the same process
 to start interactive prompt when the script execution finishes. This adds
 new __pypy__.os.real_getenv call that bypasses Python cache and looksup env
 in the underlying OS. Translatorshell now works on PyPy.
 
 .. branch: add-statvfs
+
 Added os.statvfs and os.fstatvfs
 
 .. branch: statvfs_tests
+
 Added some addition tests for statvfs.
 
 .. branch: ndarray-subtype
+
 Allow subclassing ndarray, i.e. matrix
 
 .. branch: ndarray-sort
+
 Implement ndarray in-place sorting (for numeric types, no non-native byte 
order)
 
 .. branch: pypy-pyarray
+
 Implement much of numpy's c api in cpyext, allows (slow) access to ndarray
 from c
 
 .. branch: kil

[pypy-commit] stmgc c8-new-page-handling: try adding back some synchronization

2014-10-22 Thread Raemi
Author: Remi Meier 
Branch: c8-new-page-handling
Changeset: r1484:df56f7c667fa
Date: 2014-10-22 17:20 +0200
http://bitbucket.org/pypy/stmgc/changeset/df56f7c667fa/

Log:try adding back some synchronization

diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -18,6 +18,9 @@
 char *src_segment_base = (from_segnum >= 0 ? get_segment_base(from_segnum)
: NULL);
 
+assert(IMPLY(from_segnum >= 0, 
get_priv_segment(from_segnum)->modification_lock));
+assert(STM_PSEGMENT->modification_lock);
+
 for (; undo < end; undo++) {
 object_t *obj = undo->object;
 stm_char *oslice = ((stm_char *)obj) + SLICE_OFFSET(undo->slice);
@@ -70,8 +73,8 @@
 {
 /* looks at all bk copies of objects overlapping page 'pagenum' and
copies the part in 'pagenum' back to the current segment */
-dprintf(("copy_bk_objs_in_page_from(%d, %lu, %d)\n",
- from_segnum, pagenum, only_if_not_modified));
+dprintf(("copy_bk_objs_in_page_from(%d, %ld, %d)\n",
+ from_segnum, (long)pagenum, only_if_not_modified));
 
 struct list_s *list = get_priv_segment(from_segnum)->modified_old_objects;
 struct stm_undo_s *undo = (struct stm_undo_s *)list->items;
@@ -85,6 +88,7 @@
struct stm_commit_log_entry_s *from,
struct stm_commit_log_entry_s *to)
 {
+assert(STM_PSEGMENT->modification_lock);
 assert(from->rev_num >= to->rev_num);
 /* walk BACKWARDS the commit log and update the page 'pagenum',
initially at revision 'from', until we reach the revision 'to'. */
@@ -150,10 +154,11 @@
 assert(shared_ref_count == 1);
 
 /* make our page private */
-page_privatize_in(STM_SEGMENT->segment_num, pagenum);
+page_privatize_in(my_segnum, pagenum);
 assert(get_page_status_in(my_segnum, pagenum) == PAGE_PRIVATE);
 
-acquire_modified_objs_lock(copy_from_segnum);
+uint64_t to_lock = (1UL << copy_from_segnum)| (1UL << my_segnum);
+acquire_modification_lock_set(to_lock);
 pagecopy((char*)(get_virt_page_of(my_segnum, pagenum) * 4096UL),
  (char*)(get_virt_page_of(copy_from_segnum, pagenum) * 4096UL));
 
@@ -167,8 +172,6 @@
 OPT_ASSERT(src_version->rev_num == most_recent_rev);
 target_version = STM_PSEGMENT->last_commit_log_entry;
 
-release_modified_objs_lock(copy_from_segnum);
-release_all_privatization_locks();
 
 dprintf(("handle_segfault_in_page: rev %lu to rev %lu\n",
  src_version->rev_num, target_version->rev_num));
@@ -178,6 +181,9 @@
  */
 if (src_version->rev_num > target_version->rev_num)
 go_to_the_past(pagenum, src_version, target_version);
+
+release_modification_lock_set(to_lock);
+release_all_privatization_locks();
 }
 
 static void _signal_handler(int sig, siginfo_t *siginfo, void *context)
@@ -245,102 +251,97 @@
 
 static void _stm_validate(void *free_if_abort)
 {
+dprintf(("_stm_validate(%p)\n", free_if_abort));
 /* go from last known entry in commit log to the
most current one and apply all changes done
by other transactions. Abort if we read one of
the committed objs. */
-struct stm_commit_log_entry_s *cl = STM_PSEGMENT->last_commit_log_entry;
-struct stm_commit_log_entry_s *next_cl;
+struct stm_commit_log_entry_s *first_cl = 
STM_PSEGMENT->last_commit_log_entry;
+struct stm_commit_log_entry_s *next_cl, *last_cl, *cl;
 int my_segnum = STM_SEGMENT->segment_num;
 /* Don't check this 'cl'. This entry is already checked */
 
 if (STM_PSEGMENT->transaction_state == TS_INEVITABLE) {
-assert(cl->next == (void*)-1);
+assert(first_cl->next == (void*)-1);
 return;
 }
 
-/* We need this lock to prevent a segfault handler in a different thread
-   from seeing inconsistent data.  It could also be done by carefully
-   ordering things, but later. */
-acquire_modified_objs_lock(my_segnum);
-
-/* XX: we shouldn't be able to update pages while someone else 
copies
-   from our pages (signal handler / import objs) */
-
-bool needs_abort = false;
-uint64_t segment_copied_from = 0;
+/* Find the set of segments we need to copy from and lock them: */
+uint64_t segments_to_lock = 1UL << my_segnum;
+cl = first_cl;
 while ((next_cl = cl->next) != NULL) {
 if (next_cl == (void *)-1) {
-/* there is an inevitable transaction running */
-release_modified_objs_lock(my_segnum);
 #if STM_TESTS
-needs_abort = true;
-goto complete_work_and_possibly_abort;
+if (free_if_abort != (void *)-1)
+free(free_if_abort);
+stm_abort_transaction();
 #endif
-abort();  /* XXX non-busy wait here
- or: XXX do we always need to wait?  we should just
- break out of this loop and

[pypy-commit] pypy kill-exported-symbols-list: whack whack wahck

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: kill-exported-symbols-list
Changeset: r74090:b782b42ddc67
Date: 2014-10-22 17:26 +0200
http://bitbucket.org/pypy/pypy/changeset/b782b42ddc67/

Log:whack whack wahck

diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py
--- a/rpython/translator/c/genc.py
+++ b/rpython/translator/c/genc.py
@@ -199,6 +199,8 @@
 except (AttributeError, KeyError):
 pass
 self.merge_eci(*all)
+#
+db.exported_symbols = set(self.eci.export_symbols)
 
 def get_gcpolicyclass(self):
 if self.gcpolicy is None:
diff --git a/rpython/translator/c/node.py b/rpython/translator/c/node.py
--- a/rpython/translator/c/node.py
+++ b/rpython/translator/c/node.py
@@ -829,9 +829,12 @@
 
 def forward_declaration(self):
 for funcgen in self.funcgens:
+name = funcgen.name(self.name)
+is_exported = name in self.db.exported_symbols
 yield '%s;' % (
 forward_cdecl(self.implementationtypename,
-funcgen.name(self.name), self.db.standalone))
+name, self.db.standalone,
+is_exported=is_exported))
 
 def implementation(self):
 for funcgen in self.funcgens:
diff --git a/rpython/translator/c/src/entrypoint.h 
b/rpython/translator/c/src/entrypoint.h
--- a/rpython/translator/c/src/entrypoint.h
+++ b/rpython/translator/c/src/entrypoint.h
@@ -9,5 +9,5 @@
 #endif
 
 char *RPython_StartupCode(void);
-int PYPY_MAIN_FUNCTION(int argc, char *argv[]);
+RPY_EXPORTED int PYPY_MAIN_FUNCTION(int argc, char *argv[]);
 #endif  /* PYPY_STANDALONE */
diff --git a/rpython/translator/c/src/g_prerequisite.h 
b/rpython/translator/c/src/g_prerequisite.h
--- a/rpython/translator/c/src/g_prerequisite.h
+++ b/rpython/translator/c/src/g_prerequisite.h
@@ -25,4 +25,11 @@
 #endif
 
 
+#ifdef __GNUC__
+#  define RPY_EXPORTED __attribute__((visibility("default")))
+#else
+#  define RPY_EXPORTED __declspec(dllexport)
+#endif
+
+
 #include "src/threadlocal.h"
diff --git a/rpython/translator/c/support.py b/rpython/translator/c/support.py
--- a/rpython/translator/c/support.py
+++ b/rpython/translator/c/support.py
@@ -30,12 +30,16 @@
 __thread = "__thread "
 return __thread + ctype.replace('(@)', '@').replace('@', cname).strip()
 
-def forward_cdecl(ctype, cname, standalone, is_thread_local=False):
-__thread = ""
+def forward_cdecl(ctype, cname, standalone, is_thread_local=False,
+  is_exported=False):
+prefix = ""
 if is_thread_local:
-__thread = "__thread "
+prefix = "__thread "
+if is_exported:
+assert not is_thread_local
+prefix = "RPY_EXPORTED "
 
-cdecl_str = __thread + cdecl(ctype, cname)
+cdecl_str = prefix + cdecl(ctype, cname)
 if standalone:
 return 'extern ' + cdecl_str
 else:
diff --git a/rpython/translator/platform/__init__.py 
b/rpython/translator/platform/__init__.py
--- a/rpython/translator/platform/__init__.py
+++ b/rpython/translator/platform/__init__.py
@@ -153,18 +153,6 @@
 for line in stderr.splitlines():
 log.WARNING(line)
 
-def _make_response_file(self, prefix):
-"""Creates a temporary file with the specified prefix,
-and returns its name"""
-# Build unique filename
-num = 0
-while 1:
-response_file = udir.join('%s%i' % (prefix, num))
-num += 1
-if not response_file.check():
-break
-return response_file
-
 def _make_o_file(self, cfile, ext):
 """Create an object file name under the udir for a .c file"""
 ofile = cfile.new(ext=ext)
@@ -192,7 +180,7 @@
 if standalone:
 extra = self.standalone_only
 else:
-extra = self.shared_only
+extra = self.get_shared_only_compile_flags()
 cflags = list(self.cflags) + list(extra)
 return (cflags + list(eci.compile_extra) + args)
 
@@ -210,16 +198,10 @@
 library_dirs = self._libdirs(library_dirs)
 libraries = self._libs(eci.libraries)
 link_files = self._linkfiles(eci.link_files)
-export_flags = self._exportsymbols_link_flags(eci)
-return (library_dirs + list(self.link_flags) + export_flags +
+return (library_dirs + list(self.link_flags) +
 link_files + list(eci.link_extra) + libraries +
 list(self.extra_libs))
 
-def _exportsymbols_link_flags(self, eci, relto=None):
-if eci.export_symbols:
-raise ValueError("This platform does not support export symbols")
-return []
-
 def _finish_linking(self, ofiles, eci, outputfilename, standalone):
 if outputfilename is None:
 outputfilename = ofiles[0].purebasename
diff --git a/rpython/translator/platform/darwin.py 
b/rpython/translator/platform/darwin.py
--- a/rpython/translator/platform/darwin.py
+++ b/r

[pypy-commit] pypy improve-docs: fix reST syntax and remove duplicates in eventhistory.rst

2014-10-22 Thread rlamy
Author: Ronan Lamy 
Branch: improve-docs
Changeset: r74091:ca936bcb170a
Date: 2014-10-22 17:41 +0200
http://bitbucket.org/pypy/pypy/changeset/ca936bcb170a/

Log:fix reST syntax and remove duplicates in eventhistory.rst

diff --git a/pypy/doc/coding-guide.rst b/pypy/doc/coding-guide.rst
--- a/pypy/doc/coding-guide.rst
+++ b/pypy/doc/coding-guide.rst
@@ -169,6 +169,7 @@
 enables the code generator to emit efficient machine level replacements
 for pure integer objects, for instance.
 
+.. _wrapped:
 
 Wrapping rules
 --
diff --git a/pypy/doc/eventhistory.rst b/pypy/doc/eventhistory.rst
--- a/pypy/doc/eventhistory.rst
+++ b/pypy/doc/eventhistory.rst
@@ -40,10 +40,10 @@
 Main focus of the sprint will be on the goals of the upcoming June 0.9
 release.
 
-Read more in `the sprint announcement`_, see who is  planning to attend
+Read more in `the sprint announcement`__, see who is  planning to attend
 on the `people page`_.
 
-.. _the sprint announcement: 
https://bitbucket.org/pypy/extradoc/raw/tip/sprintinfo/ddorf2006/announce.html
+__ 
https://bitbucket.org/pypy/extradoc/raw/tip/sprintinfo/ddorf2006/announce.html
 .. _people page: 
https://bitbucket.org/pypy/extradoc/raw/tip/sprintinfo/ddorf2006/people.txt
 
 
@@ -172,7 +172,7 @@
 experimental "Thunk" object space (supporting lazy computed objects)
 with its features preserved.
 
-See the :doc:`release 0.8 announcement ` for further details 
about the release and
+See the :doc:`release 0.8 announcement ` for further details 
about the release and
 the :doc:`getting started ` document for instructions 
about downloading it and
 trying it out.  There is also a short :doc:`FAQ `.  *(11/03/2005)*
 
@@ -206,7 +206,7 @@
 The first implementation of Python in Python is now also the second
 implementation of Python in C :-)
 
-See the :doc:`release announcement ` for further details about 
the release and
+See the :doc:`release announcement ` for further details about 
the release and
 the :doc:`getting started ` document for instructions about 
downloading it and
 trying it out.  We also have the beginning of a :doc:`FAQ `.  
*(08/28/2005)*
 
@@ -221,7 +221,7 @@
 The goal of the sprint is to release a first self-contained
 PyPy-0.7 version.  Carl has written a report about `day 1 - 3`_
 and a `heidelberg summary report`_ detailing some of the works
-that led to the successful release of :doc:`pypy-0.7.0 `! 
+that led to the successful release of :doc:`pypy-0.7.0 `! 
 
 .. _heidelberg summary report: 
https://bitbucket.org/pypy/extradoc/raw/tip/sprintinfo/Heidelberg-report.txt
 .. _PyPy sprint: 
https://bitbucket.org/pypy/extradoc/raw/tip/sprintinfo/Heidelberg-sprint.txt
@@ -270,44 +270,3 @@
 .. _EuroPython: http://europython.org
 .. _sprint announcement: 
https://bitbucket.org/pypy/extradoc/raw/tip/sprintinfo/EP2005-announcement.html
 .. _list of people coming: 
https://bitbucket.org/pypy/extradoc/raw/tip/sprintinfo/EP2005-people.html
-
-
-Duesseldorf PyPy sprint 2-9 June 2006
--
-
-The next PyPy sprint will be held in the Computer Science department of
-Heinrich-Heine Universitaet Duesseldorf from the *2nd to the 9th of June*.
-Main focus of the sprint will be on the goals of the upcoming June 0.9
-release.
-
-Read more in `the sprint announcement`_, see who is  planning to attend
-on the `people page`_.
-
-.. _the sprint announcement: 
https://bitbucket.org/pypy/extradoc/raw/tip/sprintinfo/ddorf2006/announce.txt
-.. _people page: 
https://bitbucket.org/pypy/extradoc/raw/tip/sprintinfo/ddorf2006/people.txt
-
-
-PyPy at XP 2006 and Agile 2006
---
-
-PyPy will present experience reports at the two main agile conferences
-this year, `XP 2006`_ and `Agile 2006`_.
-Both experience reports focus on aspects of the sprint-driven
-development method that is being used in PyPy.
-
-.. _XP 2006: http://virtual.vtt.fi/virtual/xp2006/
-.. _Agile 2006: http://www.agile2006.org/
-
-
-EuroPython PyPy sprint 6-9 July 2006
-
-
-Once again a PyPy sprint will take place right after the EuroPython
-Conference. This year it will be from the *6th to the 9th of July*.
-
-Read more in `EuroPython sprint announcement`_, see who is  planning to attend
-on `the people page`_. There is also a page_ in the python wiki.
-
-.. _EuroPython sprint announcement: 
https://bitbucket.org/pypy/extradoc/src/tip/sprintinfo/post-ep2006/announce.txt
-.. _the people page: 
https://bitbucket.org/pypy/extradoc/src/tip/sprintinfo/post-ep2006/people.txt
-.. _page: http://wiki.python.org/moin/EuroPython2006
diff --git a/pypy/doc/release-2.3.0.rst b/pypy/doc/release-2.3.0.rst
--- a/pypy/doc/release-2.3.0.rst
+++ b/pypy/doc/release-2.3.0.rst
@@ -113,11 +113,14 @@
 NumPy
 -
 NumPy support has been split into a builtin ``_numpy`` module and a
-fork of the NumPy code base adapted to PyPy at 
-  ``https://bitbucket.org/pypy/numpy``.
+fork of the NumPy code base adapted to PyPy at
+``https://bitbucket.org/

[pypy-commit] pypy improve-docs: (ronan) Add missing label.

2014-10-22 Thread mjacob
Author: Manuel Jacob 
Branch: improve-docs
Changeset: r74092:ac046ef81af3
Date: 2014-10-22 17:58 +0200
http://bitbucket.org/pypy/pypy/changeset/ac046ef81af3/

Log:(ronan) Add missing label.

diff --git a/pypy/doc/install.rst b/pypy/doc/install.rst
--- a/pypy/doc/install.rst
+++ b/pypy/doc/install.rst
@@ -1,6 +1,8 @@
 Downloading and Installing PyPy
 ===
 
+.. _prebuilt-pypy:
+
 Download a pre-built PyPy
 ~
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: fix reST syntax in extradoc.rst

2014-10-22 Thread rlamy
Author: Ronan Lamy 
Branch: improve-docs
Changeset: r74093:27c632b803d8
Date: 2014-10-22 18:06 +0200
http://bitbucket.org/pypy/pypy/changeset/27c632b803d8/

Log:fix reST syntax in extradoc.rst

diff --git a/pypy/doc/extradoc.rst b/pypy/doc/extradoc.rst
--- a/pypy/doc/extradoc.rst
+++ b/pypy/doc/extradoc.rst
@@ -78,13 +78,13 @@
 .. _Towards a Jitting VM for Prolog Execution: 
http://www.stups.uni-duesseldorf.de/mediawiki/images/a/a7/Pub-BoLeSch2010.pdf
 .. _High performance implementation of Python for CLI/.NET with JIT compiler 
generation for dynamic languages: 
http://buildbot.pypy.org/misc/antocuni-thesis.pdf
 .. _How to *not* write Virtual Machines for Dynamic Languages: 
https://bitbucket.org/pypy/extradoc/raw/tip/talk/dyla2007/dyla.pdf
-.. _Tracing the Meta-Level: PyPy's Tracing JIT Compiler: 
https://bitbucket.org/pypy/extradoc/raw/tip/talk/icooolps2009/bolz-tracing-jit.pdf
-.. _Faster than C#: Efficient Implementation of Dynamic Languages on .NET: 
https://bitbucket.org/pypy/extradoc/raw/tip/talk/icooolps2009-dotnet/cli-jit.pdf
+.. _`Tracing the Meta-Level: PyPy's Tracing JIT Compiler`: 
https://bitbucket.org/pypy/extradoc/raw/tip/talk/icooolps2009/bolz-tracing-jit.pdf
+.. _`Faster than C#: Efficient Implementation of Dynamic Languages on .NET`: 
https://bitbucket.org/pypy/extradoc/raw/tip/talk/icooolps2009-dotnet/cli-jit.pdf
 .. _Automatic JIT Compiler Generation with Runtime Partial Evaluation: 
http://wwwold.cobra.cs.uni-duesseldorf.de/thesis/final-master.pdf
-.. _RPython: A Step towards Reconciling Dynamically and Statically Typed OO 
Languages: 
http://www.disi.unige.it/person/AnconaD/papers/DynamicLanguages_abstracts.html#AACM-DLS07
+.. _`RPython: A Step towards Reconciling Dynamically and Statically Typed OO 
Languages`: 
http://www.disi.unige.it/person/AnconaD/papers/DynamicLanguages_abstracts.html#AACM-DLS07
 .. _EU Reports: index-report.html
 .. _Hardware Transactional Memory Support for Lightweight Dynamic Language 
Evolution: http://sabi.net/nriley/pubs/dls6-riley.pdf
-.. _PyGirl: Generating Whole-System VMs from High-Level Prototypes using PyPy: 
http://scg.unibe.ch/archive/papers/Brun09cPyGirl.pdf
+.. _`PyGirl: Generating Whole-System VMs from High-Level Prototypes using 
PyPy`: http://scg.unibe.ch/archive/papers/Brun09cPyGirl.pdf
 .. _Representation-Based Just-in-Time Specialization and the Psyco Prototype 
for Python: http://psyco.sourceforge.net/psyco-pepm-a.ps.gz
 .. _Back to the Future in One Week -- Implementing a Smalltalk VM in PyPy: 
http://dx.doi.org/10.1007/978-3-540-89275-5_7
 .. _Automatic generation of JIT compilers for dynamic languages in .NET: 
https://bitbucket.org/pypy/extradoc/raw/tip/talk/ecoop2009/main.pdf
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy kill-exported-symbols-list: blind Windows fix

2014-10-22 Thread arigo
Author: Armin Rigo 
Branch: kill-exported-symbols-list
Changeset: r74094:cd54f3746fde
Date: 2014-10-22 18:19 +0200
http://bitbucket.org/pypy/pypy/changeset/cd54f3746fde/

Log:blind Windows fix

diff --git a/rpython/translator/platform/__init__.py 
b/rpython/translator/platform/__init__.py
--- a/rpython/translator/platform/__init__.py
+++ b/rpython/translator/platform/__init__.py
@@ -184,6 +184,9 @@
 cflags = list(self.cflags) + list(extra)
 return (cflags + list(eci.compile_extra) + args)
 
+def get_shared_only_compile_flags(self):
+return tuple(self.shared_only)
+
 def preprocess_library_dirs(self, library_dirs):
 if 'PYPY_LOCALBASE' in os.environ:
 dirs = list(self._preprocess_library_dirs(library_dirs))
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: a passing sanity test for unroll and new_array_clear

2014-10-22 Thread cfbolz
Author: Carl Friedrich Bolz 
Branch: 
Changeset: r74095:10d78d459c2d
Date: 2014-10-22 18:19 +0200
http://bitbucket.org/pypy/pypy/changeset/10d78d459c2d/

Log:a passing sanity test for unroll and new_array_clear

diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py 
b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
@@ -1558,6 +1558,26 @@
 """
 self.optimize_loop(ops, expected)
 
+def test_varray_clear_unroll_bug(self):
+ops = """
+[p0]
+i0 = getarrayitem_gc(p0, 0, descr=arraydescr)
+i1 = getarrayitem_gc(p0, 1, descr=arraydescr)
+i2 = getarrayitem_gc(p0, 2, descr=arraydescr)
+i3 = int_add(i0, i1)
+i4 = int_add(i3, i2)
+p1 = new_array_clear(3, descr=arraydescr)
+setarrayitem_gc(p1, 1, i4, descr=arraydescr)
+setarrayitem_gc(p1, 0, 25, descr=arraydescr)
+jump(p1)
+"""
+expected = """
+[i1]
+i2 = int_add(i1, 25)
+jump(i2)
+"""
+self.optimize_loop(ops, expected)
+
 def test_varray_alloc_and_set(self):
 ops = """
 [i1]
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix a crash related to new_array_clear in unroll.py

2014-10-22 Thread cfbolz
Author: Carl Friedrich Bolz 
Branch: 
Changeset: r74096:fcfff2e158f1
Date: 2014-10-22 18:20 +0200
http://bitbucket.org/pypy/pypy/changeset/fcfff2e158f1/

Log:fix a crash related to new_array_clear in unroll.py

test is not quite satisfactory, very unit-testy. I did not manage to
understand the real code that produced this.

diff --git a/rpython/jit/metainterp/optimizeopt/test/test_virtualstate.py 
b/rpython/jit/metainterp/optimizeopt/test/test_virtualstate.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_virtualstate.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_virtualstate.py
@@ -761,6 +761,24 @@
 assert not vstate1.generalization_of(vstate2)
 
 
+def test_crash_varay_clear(self):
+innervalue1 = OptValue(self.nodebox)
+constclassbox = self.cpu.ts.cls_of_box(self.nodebox)
+innervalue1.make_constant_class(constclassbox, -1)
+innerinfo1 = NotVirtualStateInfo(innervalue1)
+innerinfo1.position = 1
+innerinfo1.position_in_notvirtuals = 0
+
+descr = object()
+
+info1 = VArrayStateInfo(descr)
+info1.fieldstate = [innerinfo1]
+
+constvalue = self.cpu.ts.CVAL_NULLREF
+value1 = VArrayValue(descr, constvalue, 1, self.nodebox, clear=True)
+value1._items[0] = constvalue
+info1.enum_forced_boxes([None], value1, None)
+
 class BaseTestBridges(BaseTest):
 enable_opts = "intbounds:rewrite:virtualize:string:pure:heap:unroll"
 
diff --git a/rpython/jit/metainterp/optimizeopt/virtualstate.py 
b/rpython/jit/metainterp/optimizeopt/virtualstate.py
--- a/rpython/jit/metainterp/optimizeopt/virtualstate.py
+++ b/rpython/jit/metainterp/optimizeopt/virtualstate.py
@@ -205,6 +205,8 @@
 raise BadVirtualState
 for i in range(len(self.fieldstate)):
 v = value.get_item_value(i)
+if v is None:
+v = value.get_missing_null_value()
 s = self.fieldstate[i]
 if s.position > self.position:
 s.enum_forced_boxes(boxes, v, optimizer)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: issue1800: mimic cpython in the special case that stdin is a directory

2014-10-22 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r74097:67572b825fbd
Date: 2014-10-22 17:13 -0700
http://bitbucket.org/pypy/pypy/changeset/67572b825fbd/

Log:issue1800: mimic cpython in the special case that stdin is a
directory

diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -278,12 +278,21 @@
 else:
 errors = None
 
-sys.stdin = sys.__stdin__ = create_stdio(
-0, False, "", encoding, errors, unbuffered)
+sys.stderr = sys.__stderr__ = create_stdio(
+2, True, "", encoding, 'backslashreplace', unbuffered)
 sys.stdout = sys.__stdout__ = create_stdio(
 1, True, "", encoding, errors, unbuffered)
-sys.stderr = sys.__stderr__ = create_stdio(
-2, True, "", encoding, 'backslashreplace', unbuffered)
+
+try:
+sys.stdin = sys.__stdin__ = create_stdio(
+0, False, "", encoding, errors, unbuffered)
+except OSError as e:
+if e.errno != errno.EISDIR:
+raise
+import os
+print("Python error:  is a directory, cannot continue",
+  file=sys.stderr)
+os._exit(1)
 finally:
 if encerr:
 display_exception(encerr)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: utilize IsADirectoryError

2014-10-22 Thread pjenvey
Author: Philip Jenvey 
Branch: py3.3
Changeset: r74099:cc09e8a517b4
Date: 2014-10-22 17:15 -0700
http://bitbucket.org/pypy/pypy/changeset/cc09e8a517b4/

Log:utilize IsADirectoryError

diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -286,9 +286,7 @@
 try:
 sys.stdin = sys.__stdin__ = create_stdio(
 0, False, "", encoding, errors, unbuffered)
-except OSError as e:
-if e.errno != errno.EISDIR:
-raise
+except IsADirectoryError:
 import os
 print("Python error:  is a directory, cannot continue",
   file=sys.stderr)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


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

2014-10-22 Thread pjenvey
Author: Philip Jenvey 
Branch: py3.3
Changeset: r74098:e134e7d8f49f
Date: 2014-10-22 17:13 -0700
http://bitbucket.org/pypy/pypy/changeset/e134e7d8f49f/

Log:merge py3k

diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -278,12 +278,21 @@
 else:
 errors = None
 
-sys.stdin = sys.__stdin__ = create_stdio(
-0, False, "", encoding, errors, unbuffered)
+sys.stderr = sys.__stderr__ = create_stdio(
+2, True, "", encoding, 'backslashreplace', unbuffered)
 sys.stdout = sys.__stdout__ = create_stdio(
 1, True, "", encoding, errors, unbuffered)
-sys.stderr = sys.__stderr__ = create_stdio(
-2, True, "", encoding, 'backslashreplace', unbuffered)
+
+try:
+sys.stdin = sys.__stdin__ = create_stdio(
+0, False, "", encoding, errors, unbuffered)
+except OSError as e:
+if e.errno != errno.EISDIR:
+raise
+import os
+print("Python error:  is a directory, cannot continue",
+  file=sys.stderr)
+os._exit(1)
 finally:
 if encerr:
 display_exception(encerr)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit