[pypy-commit] buildbot default: set maxbuilds for raspberry-pi buildslaves

2013-05-08 Thread bivab
Author: David Schneider 
Branch: 
Changeset: r816:0255e0434ee6
Date: 2013-05-08 10:03 +0200
http://bitbucket.org/pypy/buildbot/changeset/0255e0434ee6/

Log:set maxbuilds for raspberry-pi buildslaves

diff --git a/bot2/pypybuildbot/master.py b/bot2/pypybuildbot/master.py
--- a/bot2/pypybuildbot/master.py
+++ b/bot2/pypybuildbot/master.py
@@ -184,9 +184,12 @@
 CPYTHON_64 = "cpython-2-benchmark-x86-64"
 
 
-extra_opts= {'xerxes': {'keepalive_interval': 15},
+extra_opts = {'xerxes': {'keepalive_interval': 15},
  'aurora': {'max_builds': 1},
  'salsa': {'max_builds': 1},
+ 'hhu-raspberry-pi': {'max_builds': 1},
+ 'hhu-pypy-pi': {'max_builds': 1},
+ 'hhu-pypy-pi2': {'max_builds': 1},
  }
 
 BuildmasterConfig = {
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: split another function for JIT backends that don't support

2013-05-08 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r63907:5fc2df623164
Date: 2013-05-08 14:54 +0200
http://bitbucket.org/pypy/pypy/changeset/5fc2df623164/

Log:split another function for JIT backends that don't support
floats/longlongs/etc.

diff --git a/pypy/module/_cffi_backend/misc.py 
b/pypy/module/_cffi_backend/misc.py
--- a/pypy/module/_cffi_backend/misc.py
+++ b/pypy/module/_cffi_backend/misc.py
@@ -235,11 +235,17 @@
 eci = ExternalCompilationInfo(post_include_bits=["""
 #define pypy__is_nonnull_longdouble(x)  ((x) != 0.0)
 """])
-is_nonnull_longdouble = rffi.llexternal(
+_is_nonnull_longdouble = rffi.llexternal(
 "pypy__is_nonnull_longdouble", [rffi.LONGDOUBLE], lltype.Bool,
 compilation_info=eci, _nowrapper=True, elidable_function=True,
 sandboxsafe=True)
 
+# split here for JIT backends that don't support floats/longlongs/etc.
+def is_nonnull_longdouble(cdata):
+return _is_nonnull_longdouble(read_raw_longdouble_data(cdata))
+def is_nonnull_float(cdata, size):
+return read_raw_float_data(cdata, size) != 0.0
+
 def object_as_bool(space, w_ob):
 # convert and cast a Python object to a boolean.  Accept an integer
 # or a float object, up to a CData 'long double'.
@@ -254,10 +260,9 @@
 is_cdata = isinstance(w_ob, W_CData)
 if is_cdata and isinstance(w_ob.ctype, W_CTypePrimitiveFloat):
 if isinstance(w_ob.ctype, W_CTypePrimitiveLongDouble):
-result = is_nonnull_longdouble(
-read_raw_longdouble_data(w_ob._cdata))
+result = is_nonnull_longdouble(w_ob._cdata)
 else:
-result = read_raw_float_data(w_ob._cdata, w_ob.ctype.size) != 0.0
+result = is_nonnull_float(w_ob._cdata, w_ob.ctype.size)
 keepalive_until_here(w_ob)
 return result
 #
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: No-op.

2013-05-08 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r63908:31f9068a63bf
Date: 2013-05-08 17:09 +0200
http://bitbucket.org/pypy/pypy/changeset/31f9068a63bf/

Log:No-op.

diff --git a/rpython/memory/gctransform/framework.py 
b/rpython/memory/gctransform/framework.py
--- a/rpython/memory/gctransform/framework.py
+++ b/rpython/memory/gctransform/framework.py
@@ -30,14 +30,14 @@
 return False
 if getattr(func, '_gctransformer_hint_close_stack_', False):
 return True
-return graphanalyze.GraphAnalyzer.analyze_direct_call(self, graph,
-  seen)
+return graphanalyze.BoolGraphAnalyzer.analyze_direct_call(self, graph,
+  seen)
 def analyze_external_call(self, op, seen=None):
 funcobj = op.args[0].value._obj
 if getattr(funcobj, 'random_effects_on_gcobjs', False):
 return True
-return graphanalyze.GraphAnalyzer.analyze_external_call(self, op,
-seen)
+return graphanalyze.BoolGraphAnalyzer.analyze_external_call(self, op,
+seen)
 def analyze_simple_operation(self, op, graphinfo):
 if op.opname in ('malloc', 'malloc_varsize'):
 flags = op.args[1].value
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Add a test. It fails. That's a bad sign.

2013-05-08 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r63909:e65054b55bef
Date: 2013-05-08 17:09 +0200
http://bitbucket.org/pypy/pypy/changeset/e65054b55bef/

Log:Add a test. It fails. That's a bad sign.

diff --git a/rpython/translator/backendopt/test/test_graphanalyze.py 
b/rpython/translator/backendopt/test/test_graphanalyze.py
new file mode 100644
--- /dev/null
+++ b/rpython/translator/backendopt/test/test_graphanalyze.py
@@ -0,0 +1,51 @@
+import random
+from rpython.tool.algo.unionfind import UnionFind
+from rpython.translator.backendopt.graphanalyze import Dependency
+from rpython.translator.backendopt.graphanalyze import DependencyTracker
+
+
+class FakeGraphAnalyzer:
+def __init__(self):
+self._analyzed_calls = UnionFind(lambda graph: Dependency(self))
+
+@staticmethod
+def bottom_result():
+return 0
+
+@staticmethod
+def join_two_results(result1, result2):
+return result1 | result2
+
+
+def test_random_graphs():
+for _ in range(100):
+N = 10
+edges = [(random.randrange(N), random.randrange(N))
+ for i in range(N*N//3)]
+
+def expected(node1):
+prev = set()
+seen = set([node1])
+while len(seen) > len(prev):
+prev = set(seen)
+for a, b in edges:
+if a in seen:
+seen.add(b)
+return sum([1 << n for n in seen])
+
+def rectrack(n, tracker):
+if not tracker.enter(n):
+return tracker.get_cached_result(n)
+result = 1 << n
+for a, b in edges:
+if a == n:
+result |= rectrack(b, tracker)
+tracker.leave_with(result)
+return result
+
+analyzer = FakeGraphAnalyzer()
+for n in range(N):
+tracker = DependencyTracker(analyzer)
+method1 = rectrack(n, tracker)
+method2 = expected(n)
+assert method1 == method2
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy kill-gen-store-back-in: skip this test

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: kill-gen-store-back-in
Changeset: r63910:608abaa6c24f
Date: 2013-05-08 13:55 +0200
http://bitbucket.org/pypy/pypy/changeset/608abaa6c24f/

Log:skip this test

diff --git a/rpython/jit/metainterp/test/test_recursive.py 
b/rpython/jit/metainterp/test/test_recursive.py
--- a/rpython/jit/metainterp/test/test_recursive.py
+++ b/rpython/jit/metainterp/test/test_recursive.py
@@ -800,6 +800,7 @@
 assert res == main(0)
 
 def test_directly_call_assembler_virtualizable_reset_token(self):
+py.test.skip("not applicable any more, I think")
 from rpython.rtyper.lltypesystem import lltype
 from rpython.rlib.debug import llinterpcall
 
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: A crude hack to disable libffi

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63911:70a3ebe126b7
Date: 2013-05-08 17:33 +0200
http://bitbucket.org/pypy/pypy/changeset/70a3ebe126b7/

Log:A crude hack to disable libffi

diff --git a/rpython/rlib/clibffi.py b/rpython/rlib/clibffi.py
--- a/rpython/rlib/clibffi.py
+++ b/rpython/rlib/clibffi.py
@@ -64,6 +64,9 @@
 else:
 separate_module_sources = []
 
+def setup_after_config(config):
+pass
+
 if not _WIN32:
 # On some platforms, we try to link statically libffi, which is small
 # anyway and avoids endless troubles for installing.  On other platforms
@@ -72,9 +75,13 @@
 
 if _MAC_OS:
 pre_include_bits = ['#define MACOSX']
-else: 
+else:
 pre_include_bits = []
 
+def setup_after_config(config):
+if config.translation.shared:
+eci.link_files = []
+
 def find_libffi_a():
 dirlist = platform.library_dirs_for_libffi_a()
 for dir in dirlist:
@@ -357,7 +364,7 @@
  lltype.Void)
 c_ffi_prep_closure = external('ffi_prep_closure', [FFI_CLOSUREP, FFI_CIFP,
CALLBACK_TP, rffi.VOIDP],
-  rffi.INT)
+  rffi.INT)
 
 FFI_STRUCT_P = lltype.Ptr(lltype.Struct('FFI_STRUCT',
 ('ffistruct', FFI_TYPE_P.TO),
diff --git a/rpython/translator/goal/translate.py 
b/rpython/translator/goal/translate.py
--- a/rpython/translator/goal/translate.py
+++ b/rpython/translator/goal/translate.py
@@ -183,6 +183,13 @@
 # perform checks (if any) on the final config
 final_check_config(config)
 
+try:
+from rpython.rlib import clibffi
+except ImportError:
+pass # too bad
+else:
+clibffi.setup_after_config(config)
+
 return targetspec_dic, translateconfig, config, args
 
 def show_help(translateconfig, opt_parser, targetspec_dic, config):
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: merge

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63914:01814fcfecd2
Date: 2013-05-08 17:34 +0200
http://bitbucket.org/pypy/pypy/changeset/01814fcfecd2/

Log:merge

diff --git a/rpython/memory/gctransform/framework.py 
b/rpython/memory/gctransform/framework.py
--- a/rpython/memory/gctransform/framework.py
+++ b/rpython/memory/gctransform/framework.py
@@ -30,14 +30,14 @@
 return False
 if getattr(func, '_gctransformer_hint_close_stack_', False):
 return True
-return graphanalyze.GraphAnalyzer.analyze_direct_call(self, graph,
-  seen)
+return graphanalyze.BoolGraphAnalyzer.analyze_direct_call(self, graph,
+  seen)
 def analyze_external_call(self, op, seen=None):
 funcobj = op.args[0].value._obj
 if getattr(funcobj, 'random_effects_on_gcobjs', False):
 return True
-return graphanalyze.GraphAnalyzer.analyze_external_call(self, op,
-seen)
+return graphanalyze.BoolGraphAnalyzer.analyze_external_call(self, op,
+seen)
 def analyze_simple_operation(self, op, graphinfo):
 if op.opname in ('malloc', 'malloc_varsize'):
 flags = op.args[1].value
diff --git a/rpython/translator/backendopt/test/test_graphanalyze.py 
b/rpython/translator/backendopt/test/test_graphanalyze.py
new file mode 100644
--- /dev/null
+++ b/rpython/translator/backendopt/test/test_graphanalyze.py
@@ -0,0 +1,51 @@
+import random
+from rpython.tool.algo.unionfind import UnionFind
+from rpython.translator.backendopt.graphanalyze import Dependency
+from rpython.translator.backendopt.graphanalyze import DependencyTracker
+
+
+class FakeGraphAnalyzer:
+def __init__(self):
+self._analyzed_calls = UnionFind(lambda graph: Dependency(self))
+
+@staticmethod
+def bottom_result():
+return 0
+
+@staticmethod
+def join_two_results(result1, result2):
+return result1 | result2
+
+
+def test_random_graphs():
+for _ in range(100):
+N = 10
+edges = [(random.randrange(N), random.randrange(N))
+ for i in range(N*N//3)]
+
+def expected(node1):
+prev = set()
+seen = set([node1])
+while len(seen) > len(prev):
+prev = set(seen)
+for a, b in edges:
+if a in seen:
+seen.add(b)
+return sum([1 << n for n in seen])
+
+def rectrack(n, tracker):
+if not tracker.enter(n):
+return tracker.get_cached_result(n)
+result = 1 << n
+for a, b in edges:
+if a == n:
+result |= rectrack(b, tracker)
+tracker.leave_with(result)
+return result
+
+analyzer = FakeGraphAnalyzer()
+for n in range(N):
+tracker = DependencyTracker(analyzer)
+method1 = rectrack(n, tracker)
+method2 = expected(n)
+assert method1 == method2
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Finish the commit - a hack to disable libffi.a when we're shared and use

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63912:f58273adb93e
Date: 2013-05-08 17:34 +0200
http://bitbucket.org/pypy/pypy/changeset/f58273adb93e/

Log:Finish the commit - a hack to disable libffi.a when we're shared and
use the .so instead (but without a warning)

diff --git a/rpython/rlib/clibffi.py b/rpython/rlib/clibffi.py
--- a/rpython/rlib/clibffi.py
+++ b/rpython/rlib/clibffi.py
@@ -79,6 +79,8 @@
 pre_include_bits = []
 
 def setup_after_config(config):
+# a crude hack - libffi.a might be compiled without -fPIC on certain
+# platforms, just disable it when we've passed --shared
 if config.translation.shared:
 eci.link_files = []
 
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: merge

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63913:669bd7955208
Date: 2013-05-08 17:34 +0200
http://bitbucket.org/pypy/pypy/changeset/669bd7955208/

Log:merge

diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -22,6 +22,13 @@
 
 # __  Entry point  __
 
+
+# register the minimal equivalent of running a small piece of code. This
+# should be used as sparsely as possible, just to register callbacks
+
+def pypy_execute_source(source):
+pass
+
 def create_entry_point(space, w_dict):
 w_entry_point = space.getitem(w_dict, space.wrap('entry_point'))
 w_run_toplevel = space.getitem(w_dict, space.wrap('run_toplevel'))
@@ -34,8 +41,8 @@
 from rpython.jit.backend.hlinfo import highleveljitinfo
 highleveljitinfo.sys_executable = argv[0]
 
-#debug("entry point starting") 
-#for arg in argv: 
+#debug("entry point starting")
+#for arg in argv:
 #debug(" argv -> " + arg)
 if len(argv) > 2 and argv[1] == '--heapsize':
 # Undocumented option, handled at interp-level.
@@ -71,6 +78,7 @@
 debug(" operror-value: " + 
space.str_w(space.str(e.get_w_value(space
 return 1
 return exitcode
+
 return entry_point
 
 def call_finish(space):
@@ -219,7 +227,7 @@
 def jitpolicy(self, driver):
 from pypy.module.pypyjit.policy import PyPyJitPolicy, pypy_hooks
 return PyPyJitPolicy(pypy_hooks)
-
+
 def get_entry_point(self, config):
 from pypy.tool.lib_pypy import import_from_lib_pypy
 rebuild = import_from_lib_pypy('ctypes_config_cache/rebuild')
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Fixes the test, but maybe makes things slower.

2013-05-08 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r63915:3fb0e6c27959
Date: 2013-05-08 17:38 +0200
http://bitbucket.org/pypy/pypy/changeset/3fb0e6c27959/

Log:Fixes the test, but maybe makes things slower.

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
@@ -207,26 +207,29 @@
 self.graph_results = analyzer._analyzed_calls
 # the current stack of graphs being analyzed
 self.current_stack = []
-self.current_stack_set = set()
+#self.current_stack_set = set()
 
 def enter(self, graph):
 if graph not in self.graph_results:
 self.current_stack.append(graph)
-self.current_stack_set.add(graph)
+#self.current_stack_set.add(graph)
 self.graph_results.find(graph)
 return True
 else:
-if graph in self.current_stack_set:
-# found a cycle; merge all graphs in that cycle
-i = len(self.current_stack) - 1
-while self.current_stack[i] is not graph:
-self.graph_results.union(self.current_stack[i], graph)
-i -= 1
+graph = self.graph_results.find_rep(graph)
+for j in range(len(self.current_stack)):
+othergraph = self.graph_results.find_rep(self.current_stack[j])
+if graph is othergraph:
+# found a cycle; merge all graphs in that cycle
+for i in range(j, len(self.current_stack)):
+self.graph_results.union(self.current_stack[i], graph)
+# done
+break
 return False
 
 def leave_with(self, result):
 graph = self.current_stack.pop()
-self.current_stack_set.remove(graph)
+#self.current_stack_set.remove(graph)
 dep = self.graph_results[graph]
 dep.merge_with_result(result)
 
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-2.0.x: Fixes the test, but maybe makes things slower.

2013-05-08 Thread arigo
Author: Armin Rigo 
Branch: release-2.0.x
Changeset: r63916:eb5983d848f1
Date: 2013-05-08 17:38 +0200
http://bitbucket.org/pypy/pypy/changeset/eb5983d848f1/

Log:Fixes the test, but maybe makes things slower. (transplanted from
3fb0e6c27959e20cb2b71acebaea47846f24fa86)

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
@@ -207,26 +207,29 @@
 self.graph_results = analyzer._analyzed_calls
 # the current stack of graphs being analyzed
 self.current_stack = []
-self.current_stack_set = set()
+#self.current_stack_set = set()
 
 def enter(self, graph):
 if graph not in self.graph_results:
 self.current_stack.append(graph)
-self.current_stack_set.add(graph)
+#self.current_stack_set.add(graph)
 self.graph_results.find(graph)
 return True
 else:
-if graph in self.current_stack_set:
-# found a cycle; merge all graphs in that cycle
-i = len(self.current_stack) - 1
-while self.current_stack[i] is not graph:
-self.graph_results.union(self.current_stack[i], graph)
-i -= 1
+graph = self.graph_results.find_rep(graph)
+for j in range(len(self.current_stack)):
+othergraph = self.graph_results.find_rep(self.current_stack[j])
+if graph is othergraph:
+# found a cycle; merge all graphs in that cycle
+for i in range(j, len(self.current_stack)):
+self.graph_results.union(self.current_stack[i], graph)
+# done
+break
 return False
 
 def leave_with(self, result):
 graph = self.current_stack.pop()
-self.current_stack_set.remove(graph)
+#self.current_stack_set.remove(graph)
 dep = self.graph_results[graph]
 dep.merge_with_result(result)
 
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Add a very minimal embedding API. Additionally, 'main' is an always on

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63917:3bddab67a436
Date: 2013-05-08 18:01 +0200
http://bitbucket.org/pypy/pypy/changeset/3bddab67a436/

Log:Add a very minimal embedding API. Additionally, 'main' is an always
on secondary entrypoint (because why not)

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -91,7 +91,7 @@
 # itself needs the interp-level struct module
 # because 'P' is missing from the app-level one
 "_rawffi": [("objspace.usemodules.struct", True)],
-"cpyext": [("translation.secondaryentrypoints", "cpyext"),
+"cpyext": [("translation.secondaryentrypoints", "cpyext,main"),
("translation.shared", sys.platform == "win32")],
 }
 
diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -23,18 +23,13 @@
 # __  Entry point  __
 
 
-# register the minimal equivalent of running a small piece of code. This
-# should be used as sparsely as possible, just to register callbacks
-
-def pypy_execute_source(source):
-pass
-
 def create_entry_point(space, w_dict):
-w_entry_point = space.getitem(w_dict, space.wrap('entry_point'))
-w_run_toplevel = space.getitem(w_dict, space.wrap('run_toplevel'))
-w_call_finish_gateway = space.wrap(gateway.interp2app(call_finish))
-w_call_startup_gateway = space.wrap(gateway.interp2app(call_startup))
-withjit = space.config.objspace.usemodules.pypyjit
+if w_dict is not None: # for tests
+w_entry_point = space.getitem(w_dict, space.wrap('entry_point'))
+w_run_toplevel = space.getitem(w_dict, space.wrap('run_toplevel'))
+w_call_finish_gateway = space.wrap(gateway.interp2app(call_finish))
+w_call_startup_gateway = space.wrap(gateway.interp2app(call_startup))
+withjit = space.config.objspace.usemodules.pypyjit
 
 def entry_point(argv):
 if withjit:
@@ -79,7 +74,29 @@
 return 1
 return exitcode
 
-return entry_point
+# register the minimal equivalent of running a small piece of code. This
+# should be used as sparsely as possible, just to register callbacks
+
+from rpython.rlib.entrypoint import entrypoint
+from rpython.rtyper.lltypesystem import rffi
+
+@entrypoint('main', [rffi.CCHARP], c_name='pypy_execute_source')
+def pypy_execute_source(ll_source):
+source = rffi.charp2str(ll_source)
+return _pypy_execute_source(source)
+
+w_globals = space.newdict()
+
+def _pypy_execute_source(source):
+try:
+space.exec_(source, w_globals, w_globals, filename='c callback')
+except OperationError, e:
+debug("OperationError:")
+debug(" operror-type: " + e.w_type.getname(space))
+debug(" operror-value: " + 
space.str_w(space.str(e.get_w_value(space
+return 1
+
+return entry_point, _pypy_execute_source # for tests
 
 def call_finish(space):
 space.finish()
@@ -240,7 +257,7 @@
 app = gateway.applevel(open(filename).read(), 'app_main.py', 
'app_main')
 app.hidden_applevel = False
 w_dict = app.getwdict(space)
-entry_point = create_entry_point(space, w_dict)
+entry_point, _ = create_entry_point(space, w_dict)
 
 return entry_point, None, PyPyAnnotatorPolicy(single_space = space)
 
diff --git a/pypy/interpreter/test2/test_targetpypy.py 
b/pypy/interpreter/test2/test_targetpypy.py
--- a/pypy/interpreter/test2/test_targetpypy.py
+++ b/pypy/interpreter/test2/test_targetpypy.py
@@ -1,4 +1,4 @@
-from pypy.goal.targetpypystandalone import get_entry_point
+from pypy.goal.targetpypystandalone import get_entry_point, create_entry_point
 from pypy.config.pypyoption import get_pypy_config
 
 class TestTargetPyPy(object):
@@ -6,3 +6,13 @@
 config = get_pypy_config(translating=False)
 entry_point = get_entry_point(config)[0]
 entry_point(['pypy-c' , '-S', '-c', 'print 3'])
+
+def test_exeucte_source(space):
+_, execute_source = create_entry_point(space, None)
+execute_source("import sys; sys.modules['xyz'] = 3")
+x = space.int_w(space.getitem(space.getattr(space.builtin_modules['sys'],
+space.wrap('modules')),
+space.wrap('xyz')))
+assert x == 3
+execute_source("sys")
+# did not crash - the same globals
diff --git a/rpython/config/translationoption.py 
b/rpython/config/translationoption.py
--- a/rpython/config/translationoption.py
+++ b/rpython/config/translationoption.py
@@ -149,7 +149,7 @@
 StrOption("output", "Output file name", cmdline="--output"),
 StrOption("secondaryentrypoints",
 "Comma separated list of keys choosing secondary entrypoints",
-cmdline="--entrypoints", default="")

[pypy-commit] pypy default: merge

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63918:c5635f5e10d6
Date: 2013-05-08 18:02 +0200
http://bitbucket.org/pypy/pypy/changeset/c5635f5e10d6/

Log:merge

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
@@ -207,26 +207,29 @@
 self.graph_results = analyzer._analyzed_calls
 # the current stack of graphs being analyzed
 self.current_stack = []
-self.current_stack_set = set()
+#self.current_stack_set = set()
 
 def enter(self, graph):
 if graph not in self.graph_results:
 self.current_stack.append(graph)
-self.current_stack_set.add(graph)
+#self.current_stack_set.add(graph)
 self.graph_results.find(graph)
 return True
 else:
-if graph in self.current_stack_set:
-# found a cycle; merge all graphs in that cycle
-i = len(self.current_stack) - 1
-while self.current_stack[i] is not graph:
-self.graph_results.union(self.current_stack[i], graph)
-i -= 1
+graph = self.graph_results.find_rep(graph)
+for j in range(len(self.current_stack)):
+othergraph = self.graph_results.find_rep(self.current_stack[j])
+if graph is othergraph:
+# found a cycle; merge all graphs in that cycle
+for i in range(j, len(self.current_stack)):
+self.graph_results.union(self.current_stack[i], graph)
+# done
+break
 return False
 
 def leave_with(self, result):
 graph = self.current_stack.pop()
-self.current_stack_set.remove(graph)
+#self.current_stack_set.remove(graph)
 dep = self.graph_results[graph]
 dep.merge_with_result(result)
 
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Shuffle stuff around so we don't have test2 any more

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63919:bf1f12fda345
Date: 2013-05-08 18:10 +0200
http://bitbucket.org/pypy/pypy/changeset/bf1f12fda345/

Log:Shuffle stuff around so we don't have test2 any more

diff --git a/pypy/interpreter/test2/mymodule.py 
b/pypy/interpreter/test/mymodule.py
rename from pypy/interpreter/test2/mymodule.py
rename to pypy/interpreter/test/mymodule.py
diff --git a/pypy/interpreter/test2/test_app_main.py 
b/pypy/interpreter/test/test_app_main.py
rename from pypy/interpreter/test2/test_app_main.py
rename to pypy/interpreter/test/test_app_main.py
diff --git a/pypy/interpreter/test2/test_targetpypy.py 
b/pypy/interpreter/test/test_targetpypy.py
rename from pypy/interpreter/test2/test_targetpypy.py
rename to pypy/interpreter/test/test_targetpypy.py
diff --git a/pypy/interpreter/test2/__init__.py 
b/pypy/interpreter/test2/__init__.py
deleted file mode 100644
--- a/pypy/interpreter/test2/__init__.py
+++ /dev/null
@@ -1,1 +0,0 @@
-#empty
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix rpython

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63920:8b833d24ae83
Date: 2013-05-08 18:15 +0200
http://bitbucket.org/pypy/pypy/changeset/8b833d24ae83/

Log:fix rpython

diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -86,15 +86,20 @@
 return _pypy_execute_source(source)
 
 w_globals = space.newdict()
+space.setitem(w_globals, space.wrap('__builtins__'),
+  space.builtin_modules['__builtin__'])
 
 def _pypy_execute_source(source):
 try:
-space.exec_(source, w_globals, w_globals, filename='c callback')
+compiler = space.createcompiler()
+stmt = compiler.compile(source, 'c callback', 'exec', 0)
+stmt.exec_code(space, w_globals, w_globals)
 except OperationError, e:
 debug("OperationError:")
 debug(" operror-type: " + e.w_type.getname(space))
 debug(" operror-value: " + 
space.str_w(space.str(e.get_w_value(space
 return 1
+return 0
 
 return entry_point, _pypy_execute_source # for tests
 
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: oops

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63921:624a417bffcf
Date: 2013-05-08 18:23 +0200
http://bitbucket.org/pypy/pypy/changeset/624a417bffcf/

Log:oops

diff --git a/rpython/rlib/clibffi.py b/rpython/rlib/clibffi.py
--- a/rpython/rlib/clibffi.py
+++ b/rpython/rlib/clibffi.py
@@ -82,7 +82,7 @@
 # a crude hack - libffi.a might be compiled without -fPIC on certain
 # platforms, just disable it when we've passed --shared
 if config.translation.shared:
-eci.link_files = []
+eci.link_files = ()
 
 def find_libffi_a():
 dirlist = platform.library_dirs_for_libffi_a()
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: automatically export all @entrypoints, not sure exactly if it works

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63922:1e3bae0b8ace
Date: 2013-05-08 19:15 +0200
http://bitbucket.org/pypy/pypy/changeset/1e3bae0b8ace/

Log:automatically export all @entrypoints, not sure exactly if it works

diff --git a/rpython/rlib/entrypoint.py b/rpython/rlib/entrypoint.py
--- a/rpython/rlib/entrypoint.py
+++ b/rpython/rlib/entrypoint.py
@@ -7,12 +7,16 @@
 
 if key == 'main' than it's included by default
 """
+from rpython.translator.cbuild import ExternalCompilationInfo
+
 def deco(func):
 secondary_entrypoints.setdefault(key, []).append((func, argtypes))
 if c_name is not None:
 func.c_name = c_name
 if relax:
 func.relax_sig_check = True
+func._compilation_info = ExternalCompilationInfo(
+export_symbols=[c_name or func.func_name])
 return func
 return deco
 
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: export also this

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63923:6d23754a30c9
Date: 2013-05-08 19:19 +0200
http://bitbucket.org/pypy/pypy/changeset/6d23754a30c9/

Log:export also this

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
@@ -112,7 +112,7 @@
 str(exename), args))
 profdrv.probe(exename, args)
 return profdrv.after()
-
+
 class CBuilder(object):
 c_source_filename = None
 _compiled = False
@@ -149,7 +149,7 @@
   thread_enabled=self.config.translation.thread,
   sandbox=self.config.translation.sandbox)
 self.db = db
-
+
 # give the gc a chance to register interest in the start-up functions 
it
 # need (we call this for its side-effects of db.get())
 list(db.gcpolicy.gc_startup_code())
@@ -257,7 +257,8 @@
 if self.config.translation.shared:
 defines['PYPY_MAIN_FUNCTION'] = "pypy_main_startup"
 self.eci = self.eci.merge(ExternalCompilationInfo(
-export_symbols=["pypy_main_startup"]))
+export_symbols=["pypy_main_startup",
+'RPython_StartupCode']))
 self.eci, cfile, extra = gen_source(db, modulename, targetdir,
 self.eci, defines=defines,
 split=self.split)
@@ -622,7 +623,7 @@
 if self.database.gcpolicy.need_no_typeptr():
 pass# XXX gcc uses toons of memory???
 else:
-split_criteria_big = SPLIT_CRITERIA * 4 
+split_criteria_big = SPLIT_CRITERIA * 4
 
 #
 # All declarations
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: avoid the platform module at applevel

2013-05-08 Thread pjenvey
Author: Philip Jenvey 
Branch: 
Changeset: r63924:b191d9f8333c
Date: 2013-05-08 10:23 -0700
http://bitbucket.org/pypy/pypy/changeset/b191d9f8333c/

Log:avoid the platform module at applevel

diff --git a/pypy/objspace/std/test/test_listobject.py 
b/pypy/objspace/std/test/test_listobject.py
--- a/pypy/objspace/std/test/test_listobject.py
+++ b/pypy/objspace/std/test/test_listobject.py
@@ -431,10 +431,12 @@
 
 class AppTestW_ListObject(object):
 def setup_class(cls):
+import platform
 import sys
 on_cpython = (cls.runappdirect and
   not hasattr(sys, 'pypy_translation_info'))
 cls.w_on_cpython = cls.space.wrap(on_cpython)
+cls.w_on_arm = cls.space.wrap(platform.machine().startswith('arm'))
 cls.w_runappdirect = cls.space.wrap(cls.runappdirect)
 
 def test_getstrategyfromlist_w(self):
@@ -948,8 +950,7 @@
 def test_setitem_slice_performance(self):
 # because of a complexity bug, this used to take forever on a
 # translated pypy.  On CPython2.6 -A, it takes around 5 seconds.
-import platform
-if platform.machine().startswith('arm'):
+if self.on_arm:
 skip("consumes too much memory for most ARM machines")
 if self.runappdirect:
 count = 16*1024*1024
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix import

2013-05-08 Thread pjenvey
Author: Philip Jenvey 
Branch: 
Changeset: r63925:712b0d30494a
Date: 2013-05-08 10:30 -0700
http://bitbucket.org/pypy/pypy/changeset/712b0d30494a/

Log:fix import

diff --git a/rpython/rlib/entrypoint.py b/rpython/rlib/entrypoint.py
--- a/rpython/rlib/entrypoint.py
+++ b/rpython/rlib/entrypoint.py
@@ -7,7 +7,7 @@
 
 if key == 'main' than it's included by default
 """
-from rpython.translator.cbuild import ExternalCompilationInfo
+from rpython.translator.tool.cbuild import ExternalCompilationInfo
 
 def deco(func):
 secondary_entrypoints.setdefault(key, []).append((func, argtypes))
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: 2to3

2013-05-08 Thread pjenvey
Author: Philip Jenvey 
Branch: py3k
Changeset: r63926:28b4dbf82ddf
Date: 2013-05-08 11:11 -0700
http://bitbucket.org/pypy/pypy/changeset/28b4dbf82ddf/

Log:2to3

diff --git a/lib_pypy/ctypes_config_cache/dumpcache.py 
b/lib_pypy/ctypes_config_cache/dumpcache.py
--- a/lib_pypy/ctypes_config_cache/dumpcache.py
+++ b/lib_pypy/ctypes_config_cache/dumpcache.py
@@ -11,7 +11,7 @@
 g = open(filename, 'w')
 print >> g, '''\
 import sys
-_size = 32 if sys.maxint <= 2**32 else 64
+_size = 32 if sys.maxsize <= 2**32 else 64
 # XXX relative import, should be removed together with
 # XXX the relative imports done e.g. by lib_pypy/pypy_test/test_hashlib
 _mod = __import__("_%s_%%s_" %% (_size,),
diff --git a/pypy/module/_random/test/test_random.py 
b/pypy/module/_random/test/test_random.py
--- a/pypy/module/_random/test/test_random.py
+++ b/pypy/module/_random/test/test_random.py
@@ -46,7 +46,7 @@
 rnd = _random.Random()
 rnd.seed()
 different_nums = []
-mask = sys.maxint * 2 + 1
+mask = sys.maxsize * 2 + 1
 for obj in ["spam and eggs", 3.14, 1+2j, 'a', tuple('abc')]:
 nums = []
 for o in [obj, hash(obj) & mask, -(hash(obj) & mask)]:
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: dance a bit, so the RPython_StartupCode is called with correctly set stack bottom

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63927:037ff5bf2cf9
Date: 2013-05-08 20:47 +0200
http://bitbucket.org/pypy/pypy/changeset/037ff5bf2cf9/

Log:dance a bit, so the RPython_StartupCode is called with correctly set
stack bottom

diff --git a/rpython/rlib/clibffi.py b/rpython/rlib/clibffi.py
--- a/rpython/rlib/clibffi.py
+++ b/rpython/rlib/clibffi.py
@@ -83,6 +83,7 @@
 # platforms, just disable it when we've passed --shared
 if config.translation.shared:
 eci.link_files = ()
+eci.libraries = ('ffi',)
 
 def find_libffi_a():
 dirlist = platform.library_dirs_for_libffi_a()
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
@@ -2,7 +2,9 @@
 import py
 import sys, os
 from rpython.rlib import exports
+from rpython.rlib.entrypoint import entrypoint
 from rpython.rtyper.typesystem import getfunctionptr
+from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.tool import runsubprocess
 from rpython.tool.nullpath import NullPyPathLocal
 from rpython.tool.udir import udir
@@ -257,8 +259,7 @@
 if self.config.translation.shared:
 defines['PYPY_MAIN_FUNCTION'] = "pypy_main_startup"
 self.eci = self.eci.merge(ExternalCompilationInfo(
-export_symbols=["pypy_main_startup",
-'RPython_StartupCode']))
+export_symbols=["pypy_main_startup"]))
 self.eci, cfile, extra = gen_source(db, modulename, targetdir,
 self.eci, defines=defines,
 split=self.split)
@@ -726,6 +727,15 @@
 for line in preimplementationlines:
 print >> f, line
 
+# the point of dance below is so the call to rpython_startup_code actually
+# does call asm_stack_bottom
+
+RPython_StartupCode = rffi.llexternal([], lltype.Void)
+
+@entrypoint('main', [], c_name='rpython_startup_code')
+def rpython_startup_code():
+return RPython_StartupCode()
+
 def gen_startupcode(f, database):
 # generate the start-up code and put it into a function
 print >> f, 'char *RPython_StartupCode(void) {'
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: merge

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63928:6cf91c47a736
Date: 2013-05-08 20:47 +0200
http://bitbucket.org/pypy/pypy/changeset/6cf91c47a736/

Log:merge

diff --git a/pypy/objspace/std/test/test_listobject.py 
b/pypy/objspace/std/test/test_listobject.py
--- a/pypy/objspace/std/test/test_listobject.py
+++ b/pypy/objspace/std/test/test_listobject.py
@@ -431,10 +431,12 @@
 
 class AppTestW_ListObject(object):
 def setup_class(cls):
+import platform
 import sys
 on_cpython = (cls.runappdirect and
   not hasattr(sys, 'pypy_translation_info'))
 cls.w_on_cpython = cls.space.wrap(on_cpython)
+cls.w_on_arm = cls.space.wrap(platform.machine().startswith('arm'))
 cls.w_runappdirect = cls.space.wrap(cls.runappdirect)
 
 def test_getstrategyfromlist_w(self):
@@ -948,8 +950,7 @@
 def test_setitem_slice_performance(self):
 # because of a complexity bug, this used to take forever on a
 # translated pypy.  On CPython2.6 -A, it takes around 5 seconds.
-import platform
-if platform.machine().startswith('arm'):
+if self.on_arm:
 skip("consumes too much memory for most ARM machines")
 if self.runappdirect:
 count = 16*1024*1024
diff --git a/rpython/rlib/entrypoint.py b/rpython/rlib/entrypoint.py
--- a/rpython/rlib/entrypoint.py
+++ b/rpython/rlib/entrypoint.py
@@ -7,7 +7,7 @@
 
 if key == 'main' than it's included by default
 """
-from rpython.translator.cbuild import ExternalCompilationInfo
+from rpython.translator.tool.cbuild import ExternalCompilationInfo
 
 def deco(func):
 secondary_entrypoints.setdefault(key, []).append((func, argtypes))
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: oops

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63929:5bc8ded7660e
Date: 2013-05-08 21:20 +0200
http://bitbucket.org/pypy/pypy/changeset/5bc8ded7660e/

Log:oops

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
@@ -730,7 +730,7 @@
 # the point of dance below is so the call to rpython_startup_code actually
 # does call asm_stack_bottom
 
-RPython_StartupCode = rffi.llexternal([], lltype.Void)
+RPython_StartupCode = rffi.llexternal('RPython_StartupCode', [], lltype.Void)
 
 @entrypoint('main', [], c_name='rpython_startup_code')
 def rpython_startup_code():
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: shuffle stuff around

2013-05-08 Thread fijal
Author: Maciej Fijalkowski 
Branch: 
Changeset: r63930:0423d458c98d
Date: 2013-05-08 23:54 +0200
http://bitbucket.org/pypy/pypy/changeset/0423d458c98d/

Log:shuffle stuff around

diff --git a/rpython/rlib/entrypoint.py b/rpython/rlib/entrypoint.py
--- a/rpython/rlib/entrypoint.py
+++ b/rpython/rlib/entrypoint.py
@@ -8,7 +8,7 @@
 if key == 'main' than it's included by default
 """
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
-
+
 def deco(func):
 secondary_entrypoints.setdefault(key, []).append((func, argtypes))
 if c_name is not None:
@@ -20,3 +20,15 @@
 return func
 return deco
 
+# the point of dance below is so the call to rpython_startup_code actually
+# does call asm_stack_bottom. It's here because there is no other good place.
+# This thing is imported by any target which has any API, so it'll get
+# registered
+
+from rpython.rtyper.lltypesystem import lltype, rffi
+
+RPython_StartupCode = rffi.llexternal('RPython_StartupCode', [], lltype.Void)
+
+@entrypoint('main', [], c_name='rpython_startup_code')
+def rpython_startup_code():
+return RPython_StartupCode()
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
@@ -727,15 +727,6 @@
 for line in preimplementationlines:
 print >> f, line
 
-# the point of dance below is so the call to rpython_startup_code actually
-# does call asm_stack_bottom
-
-RPython_StartupCode = rffi.llexternal('RPython_StartupCode', [], lltype.Void)
-
-@entrypoint('main', [], c_name='rpython_startup_code')
-def rpython_startup_code():
-return RPython_StartupCode()
-
 def gen_startupcode(f, database):
 # generate the start-up code and put it into a function
 print >> f, 'char *RPython_StartupCode(void) {'
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: Unify formatting of glossaries (use Sphinx' glossary as reference).

2013-05-08 Thread Manuel Jacob
Author: Manuel Jacob
Branch: improve-docs
Changeset: r63932:6ad53ec0bc2a
Date: 2013-05-08 14:53 +0200
http://bitbucket.org/pypy/pypy/changeset/6ad53ec0bc2a/

Log:Unify formatting of glossaries (use Sphinx' glossary as reference).

diff --git a/pypy/doc/glossary.rst b/pypy/doc/glossary.rst
--- a/pypy/doc/glossary.rst
+++ b/pypy/doc/glossary.rst
@@ -1,53 +1,52 @@
 .. _glossary:
 
-
 Glossary
-
+
 
 PyPy, like any large project, has developed a jargon of its own.  This
 document gives brief definition of some of these terms and provides
 links to more information.
 
-.. if you add new entries, keep the alphabetical sorting!
+.. if you add new entries, keep the alphabetical sorting and formatting!
 
 .. glossary::
 
-application level
-applevel_ code is normal Python code running on top of the PyPy or
-:term:`CPython` interpreter (see :term:`interpreter level`)
+   application level
+  applevel_ code is normal Python code running on top of the PyPy or
+  :term:`CPython` interpreter (see :term:`interpreter level`)
 
-CPython
-The "default" implementation of Python, written in C and
-distributed by the PSF_ on http://www.python.org.
+   CPython
+  The "default" implementation of Python, written in C and
+  distributed by the PSF_ on http://www.python.org.
 
-interpreter level
-Code running at this level is part of the implementation of the
-PyPy interpreter and cannot interact normally with :term:`application
-level` code; it typically provides implementation for an object
-space and its builtins.
+   interpreter level
+  Code running at this level is part of the implementation of the
+  PyPy interpreter and cannot interact normally with :term:`application
+  level` code; it typically provides implementation for an object
+  space and its builtins.
 
-mixed module
+   mixed module
   a module that accesses PyPy's :term:`interpreter level`.  The name comes
   from the fact that the module's implementation can be a mixture of
   :term:`application level` and :term:`interpreter level` code.
 
-object space
-   The `object space `__ (often abbreviated to
-   "objspace") creates all objects and knows how to perform operations
-   on the objects. You may think of an object space as being a library
-   offering a fixed API, a set of operations, with implementations
-   that a) correspond to the known semantics of Python objects, b)
-   extend or twist these semantics, or c) serve whole-program analysis
-   purposes.
+   object space
+  The `object space `__ (often abbreviated to
+  "objspace") creates all objects and knows how to perform operations
+  on the objects. You may think of an object space as being a library
+  offering a fixed API, a set of operations, with implementations
+  that a) correspond to the known semantics of Python objects, b)
+  extend or twist these semantics, or c) serve whole-program analysis
+  purposes.
 
-stackless
-Technology that enables various forms of non conventional control
-flow, such as coroutines, greenlets and tasklets.  Inspired by
-Christian Tismer's `Stackless Python `__.
+   stackless
+  Technology that enables various forms of non conventional control
+  flow, such as coroutines, greenlets and tasklets.  Inspired by
+  Christian Tismer's `Stackless Python `__.
 
-standard interpreter
-   It is the `subsystem implementing the Python language`_, composed
-   of the bytecode interpreter and of the standard objectspace.
+   standard interpreter
+  It is the `subsystem implementing the Python language`_, composed
+  of the bytecode interpreter and of the standard objectspace.
 
 .. _applevel: coding-guide.html#application-level
 .. _PSF: http://www.python.org/psf/
diff --git a/rpython/doc/glossary.rst b/rpython/doc/glossary.rst
--- a/rpython/doc/glossary.rst
+++ b/rpython/doc/glossary.rst
@@ -1,112 +1,114 @@
+.. _glossary:
+
 Glossary
 
 
-.. if you add new entries, keep the alphabetical sorting!
+.. if you add new entries, keep the alphabetical sorting and formatting!
 
 .. glossary::
 
-annotator
-The component of the :term:`RPython toolchain` that performs a form
-of :term:`type inference` on the flow graph. See the `annotator pass`_
-in the documentation.
+   annotator
+  The component of the :term:`RPython toolchain` that performs a form
+  of :term:`type inference` on the flow graph. See the `annotator pass`_
+  in the documentation.
 
-backend
-Code generator that converts an `RPython
-`__ program to a `target
-language`_ using the :term:`RPython toolchain`. A backend uses either 
the
-:term:`lltypesystem` or the :term:`ootypesystem`.
+   backend
+  Code generator tha

[pypy-commit] pypy improve-docs: I think the reader knows what a glossary is. ; )

2013-05-08 Thread Manuel Jacob
Author: Manuel Jacob
Branch: improve-docs
Changeset: r63933:0632a34fd3d9
Date: 2013-05-08 14:54 +0200
http://bitbucket.org/pypy/pypy/changeset/0632a34fd3d9/

Log:I think the reader knows what a glossary is. ;)

diff --git a/pypy/doc/glossary.rst b/pypy/doc/glossary.rst
--- a/pypy/doc/glossary.rst
+++ b/pypy/doc/glossary.rst
@@ -3,10 +3,6 @@
 Glossary
 
 
-PyPy, like any large project, has developed a jargon of its own.  This
-document gives brief definition of some of these terms and provides
-links to more information.
-
 .. if you add new entries, keep the alphabetical sorting and formatting!
 
 .. glossary::
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy improve-docs: Use Sphinx' cross-referencing features in glossaries (this will be expanded).

2013-05-08 Thread Manuel Jacob
Author: Manuel Jacob
Branch: improve-docs
Changeset: r63934:b9177bbb48cd
Date: 2013-05-08 15:28 +0200
http://bitbucket.org/pypy/pypy/changeset/b9177bbb48cd/

Log:Use Sphinx' cross-referencing features in glossaries (this will be
expanded).

diff --git a/pypy/doc/architecture.rst b/pypy/doc/architecture.rst
--- a/pypy/doc/architecture.rst
+++ b/pypy/doc/architecture.rst
@@ -171,8 +171,8 @@
 .. _`document about the RPython toolchain`: translation.html
 .. _`garbage collector`: garbage_collection.html
 .. _`RPython toolchain`: translation.html
-.. _`standard interpreter`:
-.. _`python interpreter`:
+
+.. _python-interpreter:
 
 PyPy Python Interpreter
 ---
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
@@ -44,8 +44,8 @@
 but let's stick with this somewhat canonical approach.
 
 
-.. _`application-level`:
-.. _`interpreter-level`:
+.. _application-level:
+.. _interpreter-level:
 
 Application-level and interpreter-level execution and objects
 -
diff --git a/pypy/doc/glossary.rst b/pypy/doc/glossary.rst
--- a/pypy/doc/glossary.rst
+++ b/pypy/doc/glossary.rst
@@ -8,7 +8,7 @@
 .. glossary::
 
application level
-  applevel_ code is normal Python code running on top of the PyPy or
+  :ref:`applevel` code is normal Python code running on 
top of the PyPy or
   :term:`CPython` interpreter (see :term:`interpreter level`)
 
CPython
@@ -27,7 +27,7 @@
   :term:`application level` and :term:`interpreter level` code.
 
object space
-  The `object space `__ (often abbreviated to
+  :doc:`objspace` (often abbreviated to
   "objspace") creates all objects and knows how to perform operations
   on the objects. You may think of an object space as being a library
   offering a fixed API, a set of operations, with implementations
@@ -41,9 +41,7 @@
   Christian Tismer's `Stackless Python `__.
 
standard interpreter
-  It is the `subsystem implementing the Python language`_, composed
+  It is the :ref:`subsystem implementing the Python language 
`, composed
   of the bytecode interpreter and of the standard objectspace.
 
-.. _applevel: coding-guide.html#application-level
 .. _PSF: http://www.python.org/psf/
-.. _`subsystem implementing the Python language`: 
architecture.html#standard-interpreter
diff --git a/pypy/doc/objspace.rst b/pypy/doc/objspace.rst
--- a/pypy/doc/objspace.rst
+++ b/pypy/doc/objspace.rst
@@ -1,6 +1,6 @@
-==
-Object Spaces
-==
+
+The Object Space
+
 
 .. contents::
 
@@ -9,7 +9,7 @@
 .. _`Object Space`:
 
 Introduction
-
+
 
 The object space creates all objects and knows how to perform operations
 on the objects. You may think of an object space as being a library
diff --git a/rpython/doc/getting-started.rst b/rpython/doc/getting-started.rst
--- a/rpython/doc/getting-started.rst
+++ b/rpython/doc/getting-started.rst
@@ -49,7 +49,7 @@
 
 .. _`part 2`: 
http://morepypy.blogspot.com/2011/04/tutorial-part-2-adding-jit.html
 
-.. _`try out the translator`:
+.. _try-out-the-translator:
 
 Trying out the translator
 -
diff --git a/rpython/doc/glossary.rst b/rpython/doc/glossary.rst
--- a/rpython/doc/glossary.rst
+++ b/rpython/doc/glossary.rst
@@ -9,13 +9,12 @@
 
annotator
   The component of the :term:`RPython toolchain` that performs a form
-  of :term:`type inference` on the flow graph. See the `annotator pass`_
+  of :term:`type inference` on the flow graph. See :ref:`annotator`
   in the documentation.
 
backend
-  Code generator that converts an `RPython
-  `__ program to a `target
-  language`_ using the :term:`RPython toolchain`. A backend uses either the
+  Code generator that converts an :doc:`rpython` program to a :ref:`target
+  language ` using the :term:`RPython toolchain`. 
A backend uses either the
   :term:`lltypesystem` or the :term:`ootypesystem`.
 
compile-time
@@ -28,11 +27,11 @@
   implementation will be provided by the backend.
 
garbage collection framework
-  Code that makes it possible to write `PyPy's garbage collectors`_
+  Code that makes it possible to write :doc:`RPython's garbage collectors 
`
   in Python itself.
 
-   jit
-  `just in time compiler`_.
+   JIT
+  :doc:`just in time compiler `.
 
llinterpreter
   Piece of code that is able to interpret flow graphs.  This is very
@@ -63,20 +62,19 @@
promotion
   :term:`JIT` terminology.  *promotion* is a way of "using" a 
:term:`run-time`
   value at :term:`compile-time`, essentially by deferring compilation
-  until the run-time value is known. See if `the jit docs`_ help.
+  until the run-time value is known. See if :doc:`the jit docs 
` help.

[pypy-commit] pypy improve-docs: Split glossary.

2013-05-08 Thread Manuel Jacob
Author: Manuel Jacob
Branch: improve-docs
Changeset: r63931:049641859344
Date: 2013-05-08 14:42 +0200
http://bitbucket.org/pypy/pypy/changeset/049641859344/

Log:Split glossary.

diff --git a/pypy/doc/glossary.rst b/pypy/doc/glossary.rst
--- a/pypy/doc/glossary.rst
+++ b/pypy/doc/glossary.rst
@@ -12,62 +12,20 @@
 
 .. glossary::
 
-annotator
-The component of the :term:`RPython toolchain` that performs a form
-of :term:`type inference` on the flow graph. See the `annotator pass`_
-in the documentation.
-
 application level
 applevel_ code is normal Python code running on top of the PyPy or
 :term:`CPython` interpreter (see :term:`interpreter level`)
 
-backend
-Code generator that converts an `RPython
-`__ program to a `target
-language`_ using the :term:`RPython toolchain`. A backend uses either 
the
-:term:`lltypesystem` or the :term:`ootypesystem`.
-
-compile-time
-In the context of the :term:`JIT`, compile time is when the JIT is
-generating machine code "just in time".
-
 CPython
 The "default" implementation of Python, written in C and
 distributed by the PSF_ on http://www.python.org.
 
-external function
-Functions that we don't want to implement in Python for various
-reasons (e.g. they need to make calls into the OS) and whose
-implementation will be provided by the backend.
-
-garbage collection framework
-Code that makes it possible to write `PyPy's garbage collectors`_
-in Python itself.
-
 interpreter level
 Code running at this level is part of the implementation of the
 PyPy interpreter and cannot interact normally with :term:`application
 level` code; it typically provides implementation for an object
 space and its builtins.
 
-jit
-  `just in time compiler`_.
-
-llinterpreter
-   Piece of code that is able to interpret flow graphs.  This is very
-   useful for testing purposes, especially if you work on the 
:term:`RPython`
-   Typer.
-
-lltypesystem
-   A `C-like type model `__ that contains
-   structs and pointers.  A :term:`backend` that uses this type system is 
also
-   called a low-level backend.  The C backend uses this
-   typesystem.
-
-low-level helper
-A function that the :term:`RTyper` can use a call to as part of 
implementing
-some operation in terms of the target :term:`type system`.
-
 mixed module
   a module that accesses PyPy's :term:`interpreter level`.  The name comes
   from the fact that the module's implementation can be a mixture of
@@ -82,47 +40,6 @@
extend or twist these semantics, or c) serve whole-program analysis
purposes.
 
-ootypesystem
-   An `object oriented type model `__
-   containing classes and instances.  A :term:`backend` that uses this 
type system
-   is also called a high-level backend.  The JVM and CLI backends
-   all use this typesystem.
-
-prebuilt constant
-   In :term:`RPython` module globals are considered constants.  Moreover,
-   global (i.e. prebuilt) lists and dictionaries are supposed to be
-   immutable ("prebuilt constant" is sometimes abbreviated to "pbc").
-
-promotion
-   :term:`JIT` terminology.  *promotion* is a way of "using" a 
:term:`run-time`
-   value at :term:`compile-time`, essentially by deferring compilation
-   until the run-time value is known. See if `the jit docs`_ help.
-
-RPython
-   `Restricted Python`_, a limited subset of the Python_ language.
-   The limitations make :term:`type inference` possible.
-   It is also the language that the PyPy interpreter itself is written
-   in.
-
-RPython toolchain
-   The `annotator pass`_, `The RPython Typer`_, and various
-   :term:`backend`\ s.
-
-rtyper
-   Based on the type annotations, the `RPython Typer`_ turns the flow
-   graph into one that fits the model of the target 
platform/:term:`backend`
-   using either the :term:`lltypesystem` or the :term:`ootypesystem`.
-
-run-time
-   In the context of the :term:`JIT`, run time is when the code the JIT has
-   generated is executing.
-
-specialization
-   A way of controlling how a specific function is handled by the
-   :term:`annotator`.  One specialization is to treat calls to a function
-   with different argument types as if they were calls to different
-   functions with identical source.
-
 stackless
 Technology that enables various forms of non conventional control
 flow, such as coroutines, greenlets and tasklets.  Inspired by
@@ -132,38 +49,6 @@
It is the `subsystem implementing the Python language`_, composed
of the bytecode interpreter and of the standard objectspace.
 
-transformation
-   Code that modifies flowgraphs to weave in tra

[pypy-commit] pypy improve-docs: Fix two refs.

2013-05-08 Thread Manuel Jacob
Author: Manuel Jacob
Branch: improve-docs
Changeset: r63935:65bf645150fe
Date: 2013-05-08 16:06 +0200
http://bitbucket.org/pypy/pypy/changeset/65bf645150fe/

Log:Fix two refs.

diff --git a/rpython/doc/glossary.rst b/rpython/doc/glossary.rst
--- a/rpython/doc/glossary.rst
+++ b/rpython/doc/glossary.rst
@@ -65,7 +65,7 @@
   until the run-time value is known. See if :doc:`the jit docs 
` help.
 
RPython
-  :ref:`rpython`, a limited subset of the Python_ language.
+  :doc:`rpython`, a limited subset of the Python_ language.
   The limitations make :term:`type inference` possible.
   It is also the language that the PyPy interpreter itself is written
   in.
diff --git a/rpython/doc/translation.rst b/rpython/doc/translation.rst
--- a/rpython/doc/translation.rst
+++ b/rpython/doc/translation.rst
@@ -85,7 +85,7 @@
 (although these steps are not quite as distinct as you might think from
 this presentation).
 
-There is an :ref:`interactive interface ` called 
:source:`rpython/bin/translatorshell.py` to the
+There is an :ref:`interactive interface ` called 
:source:`rpython/bin/translatorshell.py` to the
 translation process which allows you to interactively work through these
 stages.
 
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: small cleanups

2013-05-08 Thread alex_gaynor
Author: Alex Gaynor 
Branch: 
Changeset: r63936:cb9096cdcb75
Date: 2013-05-08 22:29 -0700
http://bitbucket.org/pypy/pypy/changeset/cb9096cdcb75/

Log:small cleanups

diff --git a/rpython/bin/translatorshell.py b/rpython/bin/translatorshell.py
--- a/rpython/bin/translatorshell.py
+++ b/rpython/bin/translatorshell.py
@@ -1,7 +1,7 @@
-#!/usr/bin/env python 
+#!/usr/bin/env python
 
 
-"""PyPy Translator Frontend
+"""RPython Translator Frontend
 
 Glue script putting together the various pieces of the translator.
 Can be used for interactive testing of the translator.
@@ -14,7 +14,7 @@
 t.annotate()
 t.view()   # graph + annotations under the mouse
 
-t.rtype()  # use low level operations 
+t.rtype()  # use low level operations
 lib = t.compile_c()# C compilation as a library
 f = get_c_function(lib, func)  # get the function out of the library
 assert f(arg) == func(arg) # sanity check (for C)
@@ -51,7 +51,7 @@
 import os
 histfile = os.path.join(os.environ["HOME"], ".pypytrhist")
 try:
-getattr(readline, "clear_history", lambda : None)()
+getattr(readline, "clear_history", lambda: None)()
 readline.read_history_file(histfile)
 except IOError:
 pass
@@ -74,5 +74,3 @@
 
 import os
 os.putenv("PYTHONINSPECT", "1")
-
-
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit