Author: Armin Rigo <ar...@tunes.org>
Branch: cpyext-avoid-roundtrip
Changeset: r92720:bdbc6d0e6a01
Date: 2017-10-11 15:41 +0200
http://bitbucket.org/pypy/pypy/changeset/bdbc6d0e6a01/

Log:    merge heads

diff too long, truncating to 2000 out of 8986 lines

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -40,3 +40,7 @@
 2875f328eae2216a87f3d6f335092832eb031f56 release-pypy3.5-v5.7.1
 c925e73810367cd960a32592dd7f728f436c125c release-pypy2.7-v5.8.0
 a37ecfe5f142bc971a86d17305cc5d1d70abec64 release-pypy3.5-v5.8.0
+03d614975835870da65ff0481e1edad68ebbcb8d release-pypy2.7-v5.9.0
+d72f9800a42b46a8056951b1da2426d2c2d8d502 release-pypy3.5-v5.9.0
+03d614975835870da65ff0481e1edad68ebbcb8d release-pypy2.7-v5.9.0
+84a2f3e6a7f88f2fe698e473998755b3bd1a12e2 release-pypy2.7-v5.9.0
diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
--- a/lib_pypy/cffi.egg-info/PKG-INFO
+++ b/lib_pypy/cffi.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: cffi
-Version: 1.11.1
+Version: 1.11.2
 Summary: Foreign Function Interface for Python calling C code.
 Home-page: http://cffi.readthedocs.org
 Author: Armin Rigo, Maciej Fijalkowski
diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
--- a/lib_pypy/cffi/__init__.py
+++ b/lib_pypy/cffi/__init__.py
@@ -4,8 +4,8 @@
 from .api import FFI
 from .error import CDefError, FFIError, VerificationError, VerificationMissing
 
-__version__ = "1.11.1"
-__version_info__ = (1, 11, 1)
+__version__ = "1.11.2"
+__version_info__ = (1, 11, 2)
 
 # The verifier module file names are based on the CRC32 of a string that
 # contains the following version number.  It may be older than __version__
diff --git a/lib_pypy/cffi/_cffi_include.h b/lib_pypy/cffi/_cffi_include.h
--- a/lib_pypy/cffi/_cffi_include.h
+++ b/lib_pypy/cffi/_cffi_include.h
@@ -238,9 +238,9 @@
 _CFFI_UNUSED_FN static PyObject *_cffi_from_c_char16_t(uint16_t x)
 {
     if (sizeof(_cffi_wchar_t) == 2)
-        return _cffi_from_c_wchar_t(x);
+        return _cffi_from_c_wchar_t((_cffi_wchar_t)x);
     else
-        return _cffi_from_c_wchar3216_t(x);
+        return _cffi_from_c_wchar3216_t((int)x);
 }
 
 _CFFI_UNUSED_FN static int _cffi_to_c_char32_t(PyObject *o)
@@ -254,7 +254,7 @@
 _CFFI_UNUSED_FN static PyObject *_cffi_from_c_char32_t(int x)
 {
     if (sizeof(_cffi_wchar_t) == 4)
-        return _cffi_from_c_wchar_t(x);
+        return _cffi_from_c_wchar_t((_cffi_wchar_t)x);
     else
         return _cffi_from_c_wchar3216_t(x);
 }
diff --git a/lib_pypy/cffi/_embedding.h b/lib_pypy/cffi/_embedding.h
--- a/lib_pypy/cffi/_embedding.h
+++ b/lib_pypy/cffi/_embedding.h
@@ -247,7 +247,7 @@
 
         if (f != NULL && f != Py_None) {
             PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME
-                               "\ncompiled with cffi version: 1.11.1"
+                               "\ncompiled with cffi version: 1.11.2"
                                "\n_cffi_backend module: ", f);
             modules = PyImport_GetModuleDict();
             mod = PyDict_GetItemString(modules, "_cffi_backend");
diff --git a/pypy/doc/build.rst b/pypy/doc/build.rst
--- a/pypy/doc/build.rst
+++ b/pypy/doc/build.rst
@@ -119,7 +119,7 @@
 
 To run untranslated tests, you need the Boehm garbage collector libgc.
 
-On recent Debian and Ubuntu (like 17.04), this is the command to install
+On recent Debian and Ubuntu (16.04 onwards), this is the command to install
 all build-time dependencies::
 
     apt-get install gcc make libffi-dev pkg-config zlib1g-dev libbz2-dev \
@@ -127,7 +127,7 @@
     tk-dev libgc-dev python-cffi \
     liblzma-dev libncursesw5-dev     # these two only needed on PyPy3
 
-On older Debian and Ubuntu (12.04 to 16.04)::
+On older Debian and Ubuntu (12.04-14.04)::
 
     apt-get install gcc make libffi-dev pkg-config libz-dev libbz2-dev \
     libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev libgdbm-dev \
@@ -149,12 +149,23 @@
     xz-devel # For lzma on PyPy3.
     (XXX plus the SLES11 version of libgdbm-dev and tk-dev)
 
-On Mac OS X, most of these build-time dependencies are installed alongside
+On Mac OS X::
+
+Most of these build-time dependencies are installed alongside
 the Developer Tools. However, note that in order for the installation to
 find them you may need to run::
 
     xcode-select --install
 
+An exception is OpenSSL, which is no longer provided with the operating
+system. It can be obtained via Homebrew (with ``$ brew install openssl``),
+but it will not be available on the system path by default. The easiest
+way to enable it for building pypy is to set an environment variable::
+
+    export PKG_CONFIG_PATH=$(brew --prefix)/opt/openssl/lib/pkgconfig
+
+After setting this, translation (described next) will find the OpenSSL libs
+as expected.
 
 Run the translation
 -------------------
@@ -187,18 +198,18 @@
    entire pypy interpreter. This step is currently singe threaded, and RAM
    hungry. As part of this step,  the chain creates a large number of C code
    files and a Makefile to compile them in a
-   directory controlled by the ``PYPY_USESSION_DIR`` environment variable.  
+   directory controlled by the ``PYPY_USESSION_DIR`` environment variable.
 2. Create an executable ``pypy-c`` by running the Makefile. This step can
-   utilize all possible cores on the machine.  
-3. Copy the needed binaries to the current directory.  
-4. Generate c-extension modules for any cffi-based stdlib modules.  
+   utilize all possible cores on the machine.
+3. Copy the needed binaries to the current directory.
+4. Generate c-extension modules for any cffi-based stdlib modules.
 
 
 The resulting executable behaves mostly like a normal Python
 interpreter (see :doc:`cpython_differences`), and is ready for testing, for
 use as a base interpreter for a new virtualenv, or for packaging into a binary
 suitable for installation on another machine running the same OS as the build
-machine. 
+machine.
 
 Note that step 4 is merely done as a convenience, any of the steps may be rerun
 without rerunning the previous steps.
@@ -255,7 +266,7 @@
 
 * PyPy 2.5.1 or earlier: normal users would see permission errors.
   Installers need to run ``pypy -c "import gdbm"`` and other similar
-  commands at install time; the exact list is in 
+  commands at install time; the exact list is in
   :source:`pypy/tool/release/package.py <package.py>`.  Users
   seeing a broken installation of PyPy can fix it after-the-fact if they
   have sudo rights, by running once e.g. ``sudo pypy -c "import gdbm``.
diff --git a/pypy/doc/project-ideas.rst b/pypy/doc/project-ideas.rst
--- a/pypy/doc/project-ideas.rst
+++ b/pypy/doc/project-ideas.rst
@@ -240,9 +240,12 @@
 
 **matplotlib** https://github.com/matplotlib/matplotlib
 
-    TODO: the tkagg backend does not work, which makes tests fail on downstream
-    projects like Pandas, SciPy. It uses id(obj) as a c-pointer to obj in 
-    tkagg.py, which requires refactoring
+    Status: using the matplotlib branch of PyPy and the tkagg-cffi branch of
+    matplotlib from https://github.com/mattip/matplotlib/tree/tkagg-cffi, the
+    tkagg backend can function.
+
+    TODO: the matplotlib branch passes numpy arrays by value (copying all the
+    data), this proof-of-concept needs help to become completely compliant
 
 **wxPython** https://bitbucket.org/amauryfa/wxpython-cffi
 
diff --git a/pypy/doc/release-v5.9.0.rst b/pypy/doc/release-v5.9.0.rst
--- a/pypy/doc/release-v5.9.0.rst
+++ b/pypy/doc/release-v5.9.0.rst
@@ -10,15 +10,18 @@
 This new PyPy2.7 release includes the upstream stdlib version 2.7.13, and
 PyPy3.5 includes the upstream stdlib version 3.5.3.
 
-NumPy and Pandas now work on PyPy2.7. Issues that appeared as excessive memory
+NumPy and Pandas now work on PyPy2.7 (together with Cython 0.27.1). Issues
+that appeared as excessive memory
 use were cleared up and other incompatibilities were resolved. The C-API
 compatibility layer does slow down code which crosses the python-c interface
 often, we have ideas on how it could be improved, and still recommend
 using pure python on PyPy or interfacing via CFFI_. Many other modules
 based on C-API exentions now work on PyPy as well.
 
-Cython 0.27 (released last week) should support more projects with PyPy, both
-on PyPy2.7 and PyPy3.5 beta.
+Cython 0.27.1 (released very recently) supports more projects with PyPy, both
+on PyPy2.7 and PyPy3.5 beta. Note version **0.27.1** is now the minimum
+version that supports this version of PyPy, due to some interactions with
+updated C-API interface code.
 
 We optimized the JSON parser for recurring string keys, which should decrease
 memory use to 50% and increase parsing speed by up to 15% for large JSON files
@@ -148,8 +151,7 @@
   * Issue 2590_: fix the bounds in the GC when allocating a lot of objects 
with finalizers
   * Replace magical NOT RPYTHON comment with a decorator
   * Implement ``socket.sendmsg()``/``.recvmsg()`` for py3.5
-  * Reduce excessive ``memory_pressure`` for ``_SSLContext`` objects and add
-    ``memory_pressure`` for ``_SSLSocket`` objects
+  * Add ``memory_pressure`` for ``_SSLSocket`` objects
 
 * Degredations
 
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -3,4 +3,10 @@
 ===========================
 
 .. this is a revision shortly after release-pypy2.7-v5.9.0
-.. startrev:899e5245de1e
+.. startrev:d56dadcef996
+
+.. branch: cppyy-packaging
+Cleanup and improve cppyy packaging
+
+.. branch: docs-osx-brew-openssl
+
diff --git a/pypy/doc/whatsnew-pypy2-5.9.0.rst 
b/pypy/doc/whatsnew-pypy2-5.9.0.rst
--- a/pypy/doc/whatsnew-pypy2-5.9.0.rst
+++ b/pypy/doc/whatsnew-pypy2-5.9.0.rst
@@ -85,3 +85,12 @@
 .. branch: py_ssize_t
 
 Explicitly use Py_ssize_t as the Signed type in pypy c-api
+
+.. branch: cpyext-jit
+
+Differentiate the code to call METH_NOARGS, METH_O and METH_VARARGS in cpyext:
+this allows to write specialized code which is much faster than previous
+completely generic version. Moreover, let the JIT to look inside the cpyext
+module: the net result is that cpyext calls are up to 7x faster. However, this
+is true only for very simple situations: in all real life code, we are still
+much slower than CPython (more optimizations to come)
diff --git a/pypy/module/_cffi_backend/__init__.py 
b/pypy/module/_cffi_backend/__init__.py
--- a/pypy/module/_cffi_backend/__init__.py
+++ b/pypy/module/_cffi_backend/__init__.py
@@ -3,7 +3,7 @@
 from rpython.rlib import rdynload, clibffi
 from rpython.rtyper.lltypesystem import rffi
 
-VERSION = "1.11.1"
+VERSION = "1.11.2"
 
 FFI_DEFAULT_ABI = clibffi.FFI_DEFAULT_ABI
 try:
diff --git a/pypy/module/_cffi_backend/ctypeptr.py 
b/pypy/module/_cffi_backend/ctypeptr.py
--- a/pypy/module/_cffi_backend/ctypeptr.py
+++ b/pypy/module/_cffi_backend/ctypeptr.py
@@ -156,10 +156,11 @@
 
 class W_CTypePtrBase(W_CTypePtrOrArray):
     # base class for both pointers and pointers-to-functions
-    _attrs_ = ['is_void_ptr', 'is_voidchar_ptr']
-    _immutable_fields_ = ['is_void_ptr', 'is_voidchar_ptr']
+    _attrs_ = ['is_void_ptr', 'is_voidchar_ptr', 'is_onebyte_ptr']
+    _immutable_fields_ = ['is_void_ptr', 'is_voidchar_ptr', 'is_onebyte_ptr']
     is_void_ptr = False
     is_voidchar_ptr = False
+    is_onebyte_ptr = False
 
     def convert_to_object(self, cdata):
         ptrdata = rffi.cast(rffi.CCHARPP, cdata)[0]
@@ -179,12 +180,20 @@
             if self.is_void_ptr or other.is_void_ptr:
                 pass     # cast from or to 'void *'
             elif self.is_voidchar_ptr or other.is_voidchar_ptr:
-                space = self.space
-                msg = ("implicit cast from '%s' to '%s' "
-                    "will be forbidden in the future (check that the types "
-                    "are as you expect; use an explicit ffi.cast() if they "
-                    "are correct)" % (other.name, self.name))
-                space.warn(space.newtext(msg), space.w_UserWarning)
+                # for backward compatibility, accept "char *" as either
+                # source of target.  This is not what C does, though,
+                # so emit a warning that will eventually turn into an
+                # error.  The warning is turned off if both types are
+                # pointers to single bytes.
+                if self.is_onebyte_ptr and other.is_onebyte_ptr:
+                    pass   # no warning
+                else:
+                    space = self.space
+                    msg = ("implicit cast from '%s' to '%s' "
+                        "will be forbidden in the future (check that the types 
"
+                        "are as you expect; use an explicit ffi.cast() if they 
"
+                        "are correct)" % (other.name, self.name))
+                    space.warn(space.newtext(msg), space.w_UserWarning)
             else:
                 raise self._convert_error("compatible pointer", w_ob)
 
@@ -214,6 +223,7 @@
         self.is_void_ptr = isinstance(ctitem, ctypevoid.W_CTypeVoid)
         self.is_voidchar_ptr = (self.is_void_ptr or
                            isinstance(ctitem, ctypeprim.W_CTypePrimitiveChar))
+        self.is_onebyte_ptr = (ctitem.size == 1)
         W_CTypePtrBase.__init__(self, space, size, extra, 2, ctitem)
 
     def newp(self, w_init, allocator):
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py 
b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -1,7 +1,7 @@
 # ____________________________________________________________
 
 import sys
-assert __version__ == "1.11.1", ("This test_c.py file is for testing a version"
+assert __version__ == "1.11.2", ("This test_c.py file is for testing a version"
                                  " of cffi that differs from the one that we"
                                  " get from 'import _cffi_backend'")
 if sys.version_info < (3,):
@@ -2099,7 +2099,8 @@
     if sys.platform.startswith("linux"):
         BWChar = new_primitive_type("wchar_t")
         assert sizeof(BWChar) == 4
-        assert int(cast(BWChar, -1)) == -1        # signed, on linux
+        # wchar_t is often signed on Linux, but not always (e.g. on ARM)
+        assert int(cast(BWChar, -1)) in (-1, 4294967295)
 
 def test_char16():
     BChar16 = new_primitive_type("char16_t")
@@ -3903,9 +3904,11 @@
     BCharP = new_pointer_type(new_primitive_type("char"))
     BIntP = new_pointer_type(new_primitive_type("int"))
     BVoidP = new_pointer_type(new_void_type())
+    BUCharP = new_pointer_type(new_primitive_type("unsigned char"))
     z1 = cast(BCharP, 0)
     z2 = cast(BIntP, 0)
     z3 = cast(BVoidP, 0)
+    z4 = cast(BUCharP, 0)
     with warnings.catch_warnings(record=True) as w:
         newp(new_pointer_type(BIntP), z1)    # warn
         assert len(w) == 1
@@ -3919,6 +3922,12 @@
         assert len(w) == 2
         newp(new_pointer_type(BIntP), z3)    # fine
         assert len(w) == 2
+        newp(new_pointer_type(BCharP), z4)   # fine (ignore signedness here)
+        assert len(w) == 2
+        newp(new_pointer_type(BUCharP), z1)  # fine (ignore signedness here)
+        assert len(w) == 2
+        newp(new_pointer_type(BUCharP), z3)  # fine
+        assert len(w) == 2
     # check that the warnings are associated with lines in this file
     assert w[1].lineno == w[0].lineno + 4
 
diff --git a/pypy/module/_cppyy/__init__.py b/pypy/module/_cppyy/__init__.py
--- a/pypy/module/_cppyy/__init__.py
+++ b/pypy/module/_cppyy/__init__.py
@@ -1,12 +1,10 @@
 from pypy.interpreter.mixedmodule import MixedModule
 
 class Module(MixedModule):
-    "This module provides runtime bindings to C++ code for which reflection\n\
-    info has been generated. Current supported back-ends are Reflex and 
CINT.\n\
-    See http://doc.pypy.org/en/latest/cppyy.html for full details."
+    "This module brigdes the cppyy frontend with its backend, through PyPy.\n\
+    See http://cppyy.readthedocs.io/en/latest for full details."
 
     interpleveldefs = {
-        '_load_dictionary'       : 'interp_cppyy.load_dictionary',
         '_resolve_name'          : 'interp_cppyy.resolve_name',
         '_scope_byname'          : 'interp_cppyy.scope_byname',
         '_template_byname'       : 'interp_cppyy.template_byname',
@@ -15,14 +13,13 @@
         '_set_function_generator': 'interp_cppyy.set_function_generator',
         '_register_class'        : 'interp_cppyy.register_class',
         '_get_nullptr'           : 'interp_cppyy.get_nullptr',
-        'CPPInstanceBase'        : 'interp_cppyy.W_CPPInstance',
+        'CPPClassBase'           : 'interp_cppyy.W_CPPClass',
         'addressof'              : 'interp_cppyy.addressof',
         'bind_object'            : 'interp_cppyy.bind_object',
     }
 
     appleveldefs = {
         '_init_pythonify'        : 'pythonify._init_pythonify',
-        'load_reflection_info'   : 'pythonify.load_reflection_info',
         'add_pythonization'      : 'pythonify.add_pythonization',
         'Template'               : 'pythonify.CPPTemplate',
     }
diff --git a/pypy/module/_cppyy/backend/create_cppyy_package.py 
b/pypy/module/_cppyy/backend/create_cppyy_package.py
deleted file mode 100755
--- a/pypy/module/_cppyy/backend/create_cppyy_package.py
+++ /dev/null
@@ -1,649 +0,0 @@
-#!/usr/bin/env python
-from __future__ import print_function
-
-import os, sys
-import argparse, re, shutil, tarfile, urllib2
-
-
-DEBUG_TESTBUILD = False
-
-TARBALL_CACHE_DIR = 'releases'
-
-ROOT_KEEP = ['build', 'cmake', 'config', 'core', 'etc', 'interpreter',
-             'io', 'LICENSE', 'net', 'Makefile', 'CMakeLists.txt', 'math',
-             'main'] # main only needed in more recent root b/c of rootcling
-ROOT_CORE_KEEP = ['CMakeLists.txt', 'base', 'clib', 'clingutils', 'cont',
-                  'dictgen', 'foundation', 'lzma', 'macosx', 'meta',
-                  'metacling', 'metautils', 'rootcling_stage1', 'textinput',
-                  'thread', 'unix', 'utils', 'winnt', 'zip']
-ROOT_IO_KEEP = ['CMakeLists.txt', 'io', 'rootpcm']
-ROOT_NET_KEEP = ['CMakeLists.txt', 'net']
-ROOT_MATH_KEEP = ['CMakeLists.txt', 'mathcore']
-ROOT_ETC_KEEP = ['Makefile.arch', 'class.rules', 'cmake', 'dictpch',
-                 'gdb-backtrace.sh', 'gitinfo.txt', 'helgrind-root.supp',
-                 'hostcert.conf', 'system.plugins-ios',
-                 'valgrind-root-python.supp', 'valgrind-root.supp', 'vmc']
-
-ROOT_EXPLICIT_REMOVE = ['core/base/v7', 'math/mathcore/v7', 'io/io/v7']
-
-
-ERR_RELEASE_NOT_FOUND = 2
-
-
-#
-## CLI arguments
-#
-class ReleaseValidation(argparse.Action):
-    def __call__(self, parser, namespace, value, option_string=None):
-        if not re.match(r'6\.\d\d\.\d\d', value):
-            raise argparse.ArgumentTypeError(
-                "release number should of the form '6.dd.dd'")
-        setattr(namespace, self.dest, value)
-        return value
-
-parser = argparse.ArgumentParser(
-    description='Build PyPi package for cppyy containing the minimum of ROOT')
-parser.add_argument('-r', '--release', type=str, nargs='?',
-                    action=ReleaseValidation, help='ROOT release to use')
-
-args = parser.parse_args()
-
-
-#
-## ROOT source pull and cleansing
-#
-def clean_directory(directory, keeplist, trim_cmake=True):
-    removed_entries = []
-    for entry in os.listdir(directory):
-        if entry[0] == '.' or entry in keeplist:
-            continue
-        removed_entries.append(entry)
-        entry = os.path.join(directory, entry)
-        print('now removing', entry)
-        if os.path.isdir(entry):
-            shutil.rmtree(entry)
-        else:
-            os.remove(entry)
-
-    if not trim_cmake:
-        return
-
-    # now take the removed entries out of the CMakeLists.txt
-    if removed_entries:
-        inp = os.path.join(directory, 'CMakeLists.txt')
-        print('trimming', inp)
-        outp = inp+'.new'
-        new_cml = open(outp, 'w')
-        for line in open(inp).readlines():
-            if ('add_subdirectory' in line) or\
-               ('COMMAND' in line and 'copy' in line) or\
-               ('ROOT_ADD_TEST_SUBDIRECTORY' in line) or\
-               ('install(DIRECTORY' in line):
-                for sub in removed_entries:
-                    if sub in line:
-                        line = '#'+line
-                        break
-            new_cml.write(line)
-        new_cml.close()
-        os.rename(outp, inp)
-    else:
-        print('reusing existing %s/CMakeLists.txt' % (directory,))
- 
-
-class ReleaseValidation(argparse.Action):
-    def __call__(self, parser, namespace, value, option_string=None):
-        if not re.match(r'6\.\d\d\.\d\d', value):
-            raise argparse.ArgumentTypeError(
-                "release number should of the form '6.dd.dd'")
-        setattr(namespace, self.dest, value)
-        return value
-
-parser = argparse.ArgumentParser(
-    description='Build PyPi package for cppyy containing the minimum of ROOT')
-parser.add_argument('-r', '--release', type=str, nargs='?',
-                    action=ReleaseValidation, help='ROOT release to use')
-
-args = parser.parse_args()
-
-if not os.path.exists(TARBALL_CACHE_DIR):
-    os.mkdir(TARBALL_CACHE_DIR)
-
-if args.release:
-  # use provided release
-    fn = 'root_v%s.source.tar.gz' % args.release
-    addr = 'https://root.cern.ch/download/'+fn
-    if not os.path.exists(os.path.join(TARBALL_CACHE_DIR, fn)):
-        try:
-            print('retrieving', fn)
-            resp = urllib2.urlopen(addr, fn)
-            out = open(os.path.join(TARBALL_CACHE_DIR, fn), 'wb')
-            out.write(resp.read())
-            out.close()
-        except urllib2.HTTPError:
-            print('release %s not found' % args.release)
-            sys.exit(ERR_RELEASE_NOT_FOUND)
-    else:
-        print('reusing', fn, 'from local directory')
-else:
-    print('provide release ... getting latest release is not yet implemented 
...')
-    sys.exit(1)
-  # get latest and set fn, args.release, etc.
-
-# construct version for package
-args.version = ''
-testnext = False
-for c in args.release:
-    if testnext:
-        testnext = False
-        if c == '0':
-            continue
-    if c == '.':
-        testnext = True
-    args.version += c
-args.version += '.0'
-
-fn = os.path.join(TARBALL_CACHE_DIR, fn)
-pkgdir = os.path.join('root-'+args.release)
-if not os.path.exists(pkgdir):
-    print('now extracting', args.release)
-    tf = tarfile.TarFile.gzopen(fn)
-    tf.extractall()
-    tf.close()
-else:
-    print('reusing existing directory', pkgdir)
-
-# remove everything except for the listed set of libraries
-os.chdir(pkgdir)
-
-clean_directory(os.path.curdir, ROOT_KEEP)
-clean_directory('core',         ROOT_CORE_KEEP)
-clean_directory('etc',          ROOT_ETC_KEEP, trim_cmake=False)
-clean_directory('io',           ROOT_IO_KEEP)
-clean_directory('math',         ROOT_MATH_KEEP)
-clean_directory('net',          ROOT_NET_KEEP)
-
-
-# trim main (only need rootcling)
-print('trimming main')
-for entry in os.listdir('main/src'):
-    if entry != 'rootcling.cxx':
-        os.remove('main/src/'+entry)
-inp = 'main/CMakeLists.txt'
-outp = inp+'.new'
-new_cml = open(outp, 'w')
-for line in open(inp).readlines():
-    if ('ROOT_EXECUTABLE' in line or\
-        'SET_TARGET_PROPERTIES' in line) and\
-       not 'rootcling' in line:
-        line = '#'+line
-    new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-
-# remove afterimage and ftgl explicitly
-print('trimming externals')
-for cmf in ['AfterImage', 'FTGL']:
-    os.remove('cmake/modules/Find%s.cmake' % (cmf,))
-inp = 'cmake/modules/SearchInstalledSoftware.cmake'
-outp = inp+'.new'
-now_stripping = False
-new_cml = open(outp, 'w')
-for line in open(inp).readlines():
-    if '#---Check for ftgl if needed' == line[0:28] or\
-       '#---Check for AfterImage' == line[0:24]:
-        now_stripping = True
-    elif '#---Check' == line[0:9]:
-        now_stripping = False
-    if now_stripping:
-        line = '#'+line
-    new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-inp = 'cmake/modules/RootBuildOptions.cmake'
-outp = inp+'.new'
-new_cml = open(outp, 'w')
-for line in open(inp).readlines():
-    if 'ROOT_BUILD_OPTION(builtin_ftgl' in line or\
-       'ROOT_BUILD_OPTION(builtin_afterimage' in line:
-        line = '#'+line
-    new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-
-# remove testing and examples
-print('trimming testing')
-inp = 'CMakeLists.txt'
-outp = inp+'.new'
-now_stripping = False
-new_cml = open(outp, 'w')
-for line in open(inp).readlines():
-    if '#---Configure Testing using CTest' == line[0:33] or\
-       '#---hsimple.root' == line[0:16]:
-        now_stripping = True
-    elif '#---Packaging' == line[0:13] or\
-         '#---version' == line[0:11]:
-        now_stripping = False
-    if now_stripping:
-        line = '#'+line
-    new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-print('trimming RootCPack')
-inp = 'cmake/modules/RootCPack.cmake'
-outp = inp+'.new'
-new_cml = open(outp, 'w')
-for line in open(inp):
-    if 'README.txt' in line:
-        line = '#'+line
-    new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-# some more explicit removes:
-for dir_to_remove in ROOT_EXPLICIT_REMOVE:
-    try:
-        shutil.rmtree(dir_to_remove)
-    except OSError:
-        pass
-
-# special fixes
-inp = 'core/base/src/TVirtualPad.cxx'
-outp = inp+'.new'
-new_cml = open(outp, 'w')
-for line in open(inp):
-    if '#include "X3DBuffer.h"' == line[0:22]:
-        line = """//#include "X3DBuffer.h"
-typedef struct _x3d_sizeof_ {
-   int  numPoints;
-   int  numSegs;
-   int  numPolys;
-} Size3D;
-"""
-    new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-inp = 'math/mathcore/src/Fitter.cxx'
-if os.path.exists(inp):
-    outp = inp+'.new'
-    new_cml = open(outp, 'w')
-    for line in open(inp):
-        if '#include "TF1.h"' in line:
-            continue
-        new_cml.write(line)
-    new_cml.close()
-    os.rename(outp, inp)
-
-# done
-os.chdir(os.path.pardir)
-
-# debugging: run a test build
-if DEBUG_TESTBUILD:
-    print('running a debug test build')
-    tb = "test_builddir"
-    if os.path.exists(tb):
-        shutil.rmtree(tb)
-    os.mkdir(tb)
-    os.chdir(tb)
-    os.system('cmake ../%s -DCMAKE_INSTALL_PREFIX=../install -Dminimal=ON 
-Dasimage=OFF' % pkgdir)
-    os.system('make -j 32')
-
-
-#
-## package creation
-#
-countdown = 0
-pidir = 'Package-'+args.release
-print('creating package', pidir)
-if not os.path.exists(pidir):
-    os.mkdir(pidir)
-os.chdir(pidir); countdown += 1
-
-print('creating LICENSE.txt')
-with open('LICENSE.txt', 'w') as outp:
-    outp.write("""There are three main parts:
-
- LLVM: distributed under University of Illinois/NCSA Open Source License
-   https://opensource.org/licenses/UoI-NCSA.php
- ROOT: distributed under LGPL 2.1
-   https://root.cern.ch/license
- Cppyy: distributed under LBNL BSD
-   https://fedoraproject.org/wiki/Licensing/LBNLBSD
-""")
-
-print('creating MANIFEST.in')
-with open('MANIFEST.in', 'w') as outp:
-    outp.write("""# Include the license file
-include LICENSE.txt
-
-# Include the data files
-recursive-include src *
-""")
-
-print('creating README.rst')
-with open('README.rst', 'w') as outp:
-    outp.write("""PyPy cling-support
-==================
-
-----
-
-Find the documentation here:
-  http://doc.pypy.org/en/latest/cppyy.html
-""")
-
-print('creating setup.cfg')
-with open('setup.cfg', 'w') as outp:
-    outp.write("""[bdist_wheel]
-universal=0
-""")
-
-print('creating setup.py')
-with open('setup.py', 'w') as outp:
-    outp.write("""import os, sys, subprocess
-from setuptools import setup, find_packages
-from distutils import log
-from distutils.command.build import build as _build
-from setuptools.command.install import install as _install
-from distutils.sysconfig import get_python_lib
-from distutils.errors import DistutilsSetupError
-from codecs import open
-
-here = os.path.abspath(os.path.dirname(__file__))
-with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
-    long_description = f.read()
-
-builddir = None
-def get_builddir():
-    global builddir
-    if builddir is None:
-        topdir = os.getcwd()
-        builddir = os.path.join(topdir, 'builddir')
-    return builddir
-
-srcdir = None
-def get_srcdir():
-    global srcdir
-    if srcdir is None:
-        topdir = os.getcwd()
-        srcdir = os.path.join(topdir, 'src', 'backend')
-    return srcdir
-
-class my_cmake_build(_build):
-    def __init__(self, dist, *args, **kwargs):
-        _build.__init__(self, dist, *args, **kwargs)
-        # TODO: can't seem to find a better way of getting hold of
-        # the install_lib parameter during the build phase ...
-        prefix = ''
-        try:
-            prefix = dist.get_command_obj('install').install_lib
-        except AttributeError:
-            pass
-        if not prefix:
-            prefix = get_python_lib(1, 0)
-        self.prefix = os.path.join(prefix, 'cppyy_backend')
-
-    def run(self):
-        # base run
-        _build.run(self)
-
-        # custom run
-        log.info('Now building libcppyy_backend.so and dependencies')
-        builddir = get_builddir()
-        srcdir = get_srcdir()
-        if not os.path.exists(builddir):
-            log.info('Creating build directory %s ...' % builddir)
-            os.makedirs(builddir)
-
-        os.chdir(builddir)
-        log.info('Running cmake for cppyy_backend')
-        if subprocess.call([
-                'cmake', srcdir, '-Dminimal=ON -Dasimage=OFF',
-                '-DCMAKE_INSTALL_PREFIX='+self.prefix]) != 0:
-            raise DistutilsSetupError('Failed to configure cppyy_backend')
-
-        nprocs = os.getenv("MAKE_NPROCS")
-        if nprocs:
-            try:
-                ival = int(nprocs)
-                nprocs = '-j'+nprocs
-            except ValueError:
-                log.warn("Integer expected for MAKE_NPROCS, but got %s 
(ignored)", nprocs)
-                nprocs = '-j1'
-        else:
-            nprocs = '-j1'
-        log.info('Now building cppyy_backend and dependencies ...')
-        if subprocess.call(['make', nprocs]) != 0:
-            raise DistutilsSetupError('Failed to build cppyy_backend')
-
-        log.info('build finished')
-
-class my_libs_install(_install):
-    def run(self):
-        # base install
-        _install.run(self)
-
-        # custom install
-        log.info('Now installing libcppyy_backend.so and dependencies')
-        builddir = get_builddir()
-        if not os.path.exists(builddir):
-            raise DistutilsSetupError('Failed to find build dir!')
-        os.chdir(builddir)
-
-        prefix = self.install_lib
-        log.info('Now installing in %s ...', prefix)
-        if subprocess.call(['make', 'install']) != 0:
-            raise DistutilsSetupError('Failed to install cppyy_backend')
-
-        log.info('install finished')
-
-    def get_outputs(self):
-        outputs = _install.get_outputs(self)
-        outputs.append(os.path.join(self.install_lib, 'cppyy_backend'))
-        return outputs
-
-setup(
-    name='PyPy-cppyy-backend',
-""")
-    outp.write("    version='%s', # corresponds to ROOT %s, extra number is 
for packager\n"\
-         % (args.version, args.release))
-    outp.write("""    description='Cling support for PyPy',
-    long_description=long_description,
-
-    url='http://pypy.org',
-
-    # Author details
-    author='PyPy Developers',
-    author_email='pypy-...@python.org',
-
-    license='LLVM: UoI-NCSA; ROOT: LGPL 2.1; Cppyy: LBNL BSD',
-
-    classifiers=[
-        'Development Status :: 4 - Beta',
-
-        'Intended Audience :: Developers',
-
-        'Topic :: Software Development',
-        'Topic :: Software Development :: Interpreters',
-
-        #'License :: OSI Approved :: MIT License',
-
-        'Programming Language :: Python :: 2',
-        'Programming Language :: Python :: 2.7',
-        'Programming Language :: Python :: Implementation :: PyPy',
-        'Programming Language :: C',
-        'Programming Language :: C++',
-
-        'Natural Language :: English'
-    ],
-
-    keywords='interpreter development',
-
-    packages=find_packages('src', ['backend']),
-    include_package_data=True,
-
-    extras_require={
-    },
-
-    cmdclass = {
-        'build': my_cmake_build,
-        'install': my_libs_install,
-    },
-)
-""")
-
-
-print('creating src ... ROOT part')
-if not os.path.exists('src'):
-    os.mkdir('src')
-os.chdir('src'); countdown += 1
-if not os.path.exists('backend'):
-    src = os.path.join(os.path.pardir, os.path.pardir, pkgdir)
-    print('now copying', src)
-    shutil.copytree(src, 'backend')
-
-print('creating src ... cppyy part')
-os.chdir('backend'); countdown += 1
-if not os.path.exists('cppyy'):
-    os.mkdir('cppyy')
-    os.chdir('cppyy'); countdown += 1
-
-    with open('CMakeLists.txt', 'w') as outp:
-        
outp.write("""############################################################################
-# CMakeLists.txt file for building cppyy package
-############################################################################
-
-ROOT_GLOB_SOURCES(sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cxx)
-set_source_files_properties(${sources} COMPILE_FLAGS "-fomit-frame-pointer 
-fvisibility=hidden -DRPY_EXTERN=RPY_EXPORTED -DRPYTHON_LL2CTYPES")
-
-add_definitions(${CLING_CXXFLAGS})
-
-ROOT_LINKER_LIBRARY(cppyy_backend ${sources}
-                               LIBRARIES ${CMAKE_DL_LIBS}
-                               DEPENDENCIES Core Cling RIO Thread)
-
-add_dependencies(cppyy_backend CLING)
-""")
-
-    os.mkdir('src')
-    os.chdir('src'); countdown += 1
-    print('pulling cppyy/clingcwrapper.cxx from pypy')
-    base = 'https://bitbucket.org/pypy/pypy/raw/default/pypy/module/cppyy/'
-    for cppyy_file in ['src/callcontext.h', 'include/capi.h', 
'src/clingcwrapper.cxx',
-                       'include/clingcwrapper.h', 'include/cpp_cppyy.h', 
'include/cppyy.h']:
-        resp = urllib2.urlopen(base+cppyy_file)
-        with open(os.path.basename(cppyy_file), 'w') as outp:
-            outp.write(resp.read())
-
-    # fix include
-    inp = 'capi.h'
-    outp = inp+'.new'
-    new_cml = open(outp, 'w')
-    for line in open(inp).readlines():
-        if 'src/precommondefs.h' in line:
-            line = '#include "precommondefs.h"\n'
-        new_cml.write(line)
-    new_cml.close()
-    os.rename(outp, inp)
-
-    with open('precommondefs.h', 'w') as outp:
-        outp.write("""/***** Start of precommondefs.h *****/
-
-/* This is extracted from pyconfig.h from CPython.  It sets the macros
-   that affect the features we get from system include files.
-   It must not #include anything. */
-
-#ifndef __PYPY_PRECOMMONDEFS_H
-#define __PYPY_PRECOMMONDEFS_H
-
-
-/* Define on Darwin to activate all library features */
-#define _DARWIN_C_SOURCE 1
-/* This must be set to 64 on some systems to enable large file support. */
-#define _FILE_OFFSET_BITS 64
-/* Define on Linux to activate all library features */
-#define _GNU_SOURCE 1
-/* This must be defined on some systems to enable large file support. */
-#define _LARGEFILE_SOURCE 1
-/* Define on NetBSD to activate all library features */
-#define _NETBSD_SOURCE 1
-/* Define to activate features from IEEE Stds 1003.1-2001 */
-#ifndef _POSIX_C_SOURCE
-#  define _POSIX_C_SOURCE 200112L
-#endif
-/* Define on FreeBSD to activate all library features */
-#define __BSD_VISIBLE 1
-#define __XSI_VISIBLE 700
-/* Windows: winsock/winsock2 mess */
-#define WIN32_LEAN_AND_MEAN
-#ifdef _WIN64
-   typedef          __int64 Signed;
-   typedef unsigned __int64 Unsigned;
-#  define SIGNED_MIN LLONG_MIN
-#else
-   typedef          long Signed;
-   typedef unsigned long Unsigned;
-#  define SIGNED_MIN LONG_MIN
-#endif
-
-#if !defined(RPY_ASSERT) && !defined(RPY_LL_ASSERT) && !defined(NDEBUG)
-#  define NDEBUG
-#endif
-
-
-/* All functions and global variables declared anywhere should use
-   one of the following attributes:
-
-   RPY_EXPORTED:  the symbol is exported out of libpypy-c.so.
-
-   RPY_EXTERN:    the symbol is not exported out of libpypy-c.so, but
-                  otherwise works like 'extern' by being available to
-                  other C sources.
-
-   static:        as usual, this means the symbol is local to this C file.
-
-   Don't use _RPY_HIDDEN directly.  For tests involving building a custom
-   .so, translator/tool/cbuild.py overrides RPY_EXTERN so that it becomes
-   equal to RPY_EXPORTED.
-
-   Any function or global variable declared with no attribute at all is
-   a bug; please report or fix it.
-*/
-#ifdef __GNUC__
-#  define RPY_EXPORTED extern __attribute__((visibility("default")))
-#  define _RPY_HIDDEN  __attribute__((visibility("hidden")))
-#else
-#  define RPY_EXPORTED extern __declspec(dllexport)
-#  define _RPY_HIDDEN  /* nothing */
-#endif
-#ifndef RPY_EXTERN
-#  define RPY_EXTERN   extern _RPY_HIDDEN
-#endif
-
-
-#endif /* __PYPY_PRECOMMONDEFS_H */
-
-/***** End of precommondefs.h *****/
-""")
-
-# back up to pip package top
-for i in range(countdown-1):
-    os.chdir(os.path.pardir)
-
-# add cppyy module to cmake
-os.chdir('src/backend')
-inp = 'CMakeLists.txt'
-print('adding cppyy to cmake')
-outp = inp+'.new'
-new_cml = open(outp, 'w')
-for line in open(inp).readlines():
-    if 'add_subdirectory' in line and 'net' in line:
-        line += 'add_subdirectory (cppyy)\n'
-    new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-# done!
diff --git a/pypy/module/_cppyy/bench/Makefile 
b/pypy/module/_cppyy/bench/Makefile
deleted file mode 100644
--- a/pypy/module/_cppyy/bench/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-all: bench02Dict_reflex.so
-
-ROOTSYS := ${ROOTSYS}
-
-ifeq ($(ROOTSYS),)
-  genreflex=genreflex
-  cppflags=
-else
-  genreflex=$(ROOTSYS)/bin/genreflex
-  cppflags=-I$(ROOTSYS)/include -L$(ROOTSYS)/lib
-endif
-
-PLATFORM := $(shell uname -s)
-ifeq ($(PLATFORM),Darwin)
-  cppflags+=-dynamiclib -single_module -arch x86_64
-endif
-
-ifeq ($(shell $(genreflex) --help | grep -- --with-methptrgetter),)
-  genreflexflags=
-  cppflags2=-O3 -fPIC
-else
-  genreflexflags=--with-methptrgetter
-  cppflags2=-Wno-pmf-conversions -O3 -fPIC
-endif
-
-
-bench02Dict_reflex.so: bench02.h bench02.cxx bench02.xml
-       $(genreflex) bench02.h $(genreflexflags) --selection=bench02.xml 
-I$(ROOTSYS)/include
-       g++ -o $@ bench02.cxx bench02_rflx.cpp -I$(ROOTSYS)/include -shared 
-std=c++11 -lHistPainter `root-config --libs` $(cppflags) $(cppflags2)
diff --git a/pypy/module/_cppyy/bench/bench02.cxx 
b/pypy/module/_cppyy/bench/bench02.cxx
deleted file mode 100644
--- a/pypy/module/_cppyy/bench/bench02.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "bench02.h"
-
-#include "TROOT.h"
-#include "TApplication.h"
-#include "TDirectory.h"
-#include "TInterpreter.h"
-#include "TSystem.h"
-#include "TBenchmark.h"
-#include "TStyle.h"
-#include "TError.h"
-#include "Getline.h"
-#include "TVirtualX.h"
-
-#include "Api.h"
-
-#include <iostream>
-
-TClass *TClass::GetClass(const char*, Bool_t, Bool_t) {
-    static TClass* dummy = new TClass("__dummy__", kTRUE);
-    return dummy;  // is deleted by gROOT at shutdown
-}
-
-class TTestApplication : public TApplication {
-public:
-    TTestApplication(
-        const char* acn, Int_t* argc, char** argv, Bool_t bLoadLibs = kTRUE);
-    virtual ~TTestApplication();
-};
-
-TTestApplication::TTestApplication(
-        const char* acn, int* argc, char** argv, bool do_load) : 
TApplication(acn, argc, argv) {
-    if (do_load) {
-        // follow TRint to minimize differences with CINT
-        ProcessLine("#include <iostream>", kTRUE);
-        ProcessLine("#include <_string>",  kTRUE); // for std::string iostream.
-        ProcessLine("#include <vector>",   kTRUE); // needed because they're 
used within the
-        ProcessLine("#include <pair>",     kTRUE); //  core ROOT dicts and 
CINT won't be able
-                                                   //  to properly unload 
these files
-    }
-
-    // save current interpreter context
-    gInterpreter->SaveContext();
-    gInterpreter->SaveGlobalsContext();
-
-    // prevent crashes on accessing history
-    Gl_histinit((char*)"-");
-
-    // prevent ROOT from exiting python
-    SetReturnFromRun(kTRUE);
-}
-
-TTestApplication::~TTestApplication() {}
-
-static const char* appname = "pypy-cppyy";
-
-Bench02RootApp::Bench02RootApp() {
-    gROOT->SetBatch(kTRUE);
-    if (!gApplication) {
-        int argc = 1;
-        char* argv[1]; argv[0] = (char*)appname;
-        gApplication = new TTestApplication(appname, &argc, argv, kFALSE);
-    }
-}
-
-Bench02RootApp::~Bench02RootApp() {
-    // TODO: ROOT globals cleanup ... (?)
-}
-
-void Bench02RootApp::report() {
-    std::cout << "gROOT is: " << gROOT << std::endl;
-    std::cout << "gApplication is: " << gApplication << std::endl;
-}
-
-void Bench02RootApp::close_file(TFile* f) {
-    std::cout << "closing file " << f->GetName() << " ... " << std::endl;
-    f->Write();
-    f->Close();
-    std::cout << "... file closed" << std::endl;
-}
diff --git a/pypy/module/_cppyy/bench/bench02.h 
b/pypy/module/_cppyy/bench/bench02.h
deleted file mode 100644
--- a/pypy/module/_cppyy/bench/bench02.h
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "TString.h"
-
-#include "TCanvas.h"
-#include "TFile.h"
-#include "TProfile.h"
-#include "TNtuple.h"
-#include "TH1F.h"
-#include "TH2F.h"
-#include "TRandom.h"
-#include "TRandom3.h"
-
-#include "TROOT.h"
-#include "TApplication.h"
-#include "TSystem.h"
-
-#include "TArchiveFile.h"
-#include "TBasket.h"
-#include "TBenchmark.h"
-#include "TBox.h"
-#include "TBranchRef.h"
-#include "TBrowser.h"
-#include "TClassGenerator.h"
-#include "TClassRef.h"
-#include "TClassStreamer.h"
-#include "TContextMenu.h"
-#include "TEntryList.h"
-#include "TEventList.h"
-#include "TF1.h"
-#include "TFileCacheRead.h"
-#include "TFileCacheWrite.h"
-#include "TFileMergeInfo.h"
-#include "TFitResult.h"
-#include "TFolder.h"
-//#include "TFormulaPrimitive.h"
-#include "TFunction.h"
-#include "TFrame.h"
-#include "TGlobal.h"
-#include "THashList.h"
-#include "TInetAddress.h"
-#include "TInterpreter.h"
-#include "TKey.h"
-#include "TLegend.h"
-#include "TMethodCall.h"
-#include "TPluginManager.h"
-#include "TProcessUUID.h"
-#include "TSchemaRuleSet.h"
-#include "TStyle.h"
-#include "TSysEvtHandler.h"
-#include "TTimer.h"
-#include "TView.h"
-//#include "TVirtualCollectionProxy.h"
-#include "TVirtualFFT.h"
-#include "TVirtualHistPainter.h"
-#include "TVirtualIndex.h"
-#include "TVirtualIsAProxy.h"
-#include "TVirtualPadPainter.h"
-#include "TVirtualRefProxy.h"
-#include "TVirtualStreamerInfo.h"
-#include "TVirtualViewer3D.h"
-
-#include <typeinfo>
-#include <ostream>
-
-
-class Bench02RootApp {
-public:
-   Bench02RootApp();
-   ~Bench02RootApp();
-
-   void report();
-   void close_file(TFile* f);
-};
diff --git a/pypy/module/_cppyy/bench/bench02.xml 
b/pypy/module/_cppyy/bench/bench02.xml
deleted file mode 100644
--- a/pypy/module/_cppyy/bench/bench02.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<lcgdict>
-
-  <selection>
-
-     <!-- ROOT classes -->
-     <class pattern="T[A-Z]*" />
-     <class pattern="ROOT::T[A-Z]*" />
-     <class pattern="ROOT::Fit::*" />
-
-     <!-- ROOT globals -->
-     <variable name="gROOT" />
-     <variable name="gSystem" />
-     <variable name="gRandom" />
-
-     <!-- STL classes actually used -->
-     <class name="std::string" />
-     <class name="std::ostream" />
-     <class name="std::type_info" />
-     <class pattern="std::vector<*>" />
-     <class pattern="std::_Vector_base<*>" />
-
-     <!-- helper -->
-     <class name="Bench02RootApp" />
-
-  </selection>
-
-  <exclusion>
-
-     <struct pattern="TString::*" />
-     <class name="TString" >
-         <field name="fRep" transient="true"/>
-     </class>
-
-     <class name="TUUID::uuid_time_t" />
-
-     <class name="TClass::TNameMapNode" />
-     <class name="TFileOpenHandle" />
-
-  </exclusion>
-
-</lcgdict>
diff --git a/pypy/module/_cppyy/bench/hsimple.C 
b/pypy/module/_cppyy/bench/hsimple.C
deleted file mode 100644
--- a/pypy/module/_cppyy/bench/hsimple.C
+++ /dev/null
@@ -1,109 +0,0 @@
-#include <TFile.h>
-#include <TNtuple.h>
-#include <TH2.h>
-#include <TProfile.h>
-#include <TCanvas.h>
-#include <TFrame.h>
-#include <TROOT.h>
-#include <TSystem.h>
-#include <TRandom3.h>
-#include <TBenchmark.h>
-#include <TInterpreter.h>
-
-TFile *hsimple(Int_t get=0)
-{
-//  This program creates :
-//    - a one dimensional histogram
-//    - a two dimensional histogram
-//    - a profile histogram
-//    - a memory-resident ntuple
-//
-//  These objects are filled with some random numbers and saved on a file.
-//  If get=1 the macro returns a pointer to the TFile of "hsimple.root"
-//          if this file exists, otherwise it is created.
-//  The file "hsimple.root" is created in $ROOTSYS/tutorials if the caller has
-//  write access to this directory, otherwise the file is created in $PWD
-
-   TString filename = "hsimple.root";
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
-   dir.ReplaceAll("hsimple.C","");
-   dir.ReplaceAll("/./","/");
-   TFile *hfile = 0;
-   if (get) {
-      // if the argument get =1 return the file "hsimple.root"
-      // if the file does not exist, it is created
-      TString fullPath = dir+"hsimple.root";
-      if (!gSystem->AccessPathName(fullPath,kFileExists)) {
-        hfile = TFile::Open(fullPath); //in $ROOTSYS/tutorials
-         if (hfile) return hfile;
-      }
-      //otherwise try $PWD/hsimple.root
-      if (!gSystem->AccessPathName("hsimple.root",kFileExists)) {
-         hfile = TFile::Open("hsimple.root"); //in current dir
-         if (hfile) return hfile;
-      }
-   }
-   //no hsimple.root file found. Must generate it !
-   //generate hsimple.root in $ROOTSYS/tutorials if we have write access
-   if (!gSystem->AccessPathName(dir,kWritePermission)) {
-      filename = dir+"hsimple.root";
-   } else if (!gSystem->AccessPathName(".",kWritePermission)) {
-      //otherwise generate hsimple.root in the current directory
-   } else {
-      printf("you must run the script in a directory with write access\n");
-      return 0;
-   }
-   hfile = (TFile*)gROOT->FindObject(filename); if (hfile) hfile->Close();
-   hfile = new TFile(filename,"RECREATE","Demo ROOT file with histograms");
-
-   // Create some histograms, a profile histogram and an ntuple
-   TH1F *hpx = new TH1F("hpx","This is the px distribution",100,-4,4);
-   hpx->SetFillColor(48);
-   TH2F *hpxpy = new TH2F("hpxpy","py vs px",40,-4,4,40,-4,4);
-   TProfile *hprof = new TProfile("hprof","Profile of pz versus 
px",100,-4,4,0,20);
-   TNtuple *ntuple = new TNtuple("ntuple","Demo ntuple","px:py:pz:random:i");
-
-   gBenchmark->Start("hsimple");
-  
-   // Create a new canvas.
-   TCanvas *c1 = new TCanvas("c1","Dynamic Filling Example",200,10,700,500);
-   c1->SetFillColor(42);
-   c1->GetFrame()->SetFillColor(21);
-   c1->GetFrame()->SetBorderSize(6);
-   c1->GetFrame()->SetBorderMode(-1);
-
-
-   // Fill histograms randomly
-   TRandom3 random;
-   Float_t px, py, pz;
-   const Int_t kUPDATE = 1000;
-   for (Int_t i = 0; i < 50000; i++) {
-   //      random.Rannor(px,py);
-      px = random.Gaus(0, 1);
-      py = random.Gaus(0, 1);
-      pz = px*px + py*py;
-      Float_t rnd = random.Rndm(1);
-      hpx->Fill(px);
-      hpxpy->Fill(px,py);
-      hprof->Fill(px,pz);
-      ntuple->Fill(px,py,pz,rnd,i);
-      if (i && (i%kUPDATE) == 0) {
-         if (i == kUPDATE) hpx->Draw();
-         c1->Modified();
-         c1->Update();
-         if (gSystem->ProcessEvents())
-            break;
-      }
-   }
-   gBenchmark->Show("hsimple");
-
-   // Save all objects in this file
-   hpx->SetFillColor(0);
-   hfile->Write();
-   hpx->SetFillColor(48);
-   c1->Modified();
-   return hfile;
-  
-// Note that the file is automatically close when application terminates
-// or when the file destructor is called.
-}
diff --git a/pypy/module/_cppyy/bench/hsimple.py 
b/pypy/module/_cppyy/bench/hsimple.py
deleted file mode 100755
--- a/pypy/module/_cppyy/bench/hsimple.py
+++ /dev/null
@@ -1,110 +0,0 @@
-#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-#*-*
-#*-*  This program creates :
-#*-*    - a one dimensional histogram
-#*-*    - a two dimensional histogram
-#*-*    - a profile histogram
-#*-*    - a memory-resident ntuple
-#*-*
-#*-*  These objects are filled with some random numbers and saved on a file.
-#*-*
-#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-
-_reflex = True     # to keep things equal, set to False for full macro
-
-try:
-    import cppyy, random
-
-    if not hasattr(cppyy.gbl, 'gROOT'):
-        cppyy.load_reflection_info('bench02Dict_reflex.so')
-        _reflex = True
-
-    TCanvas  = cppyy.gbl.TCanvas
-    TFile    = cppyy.gbl.TFile
-    TProfile = cppyy.gbl.TProfile
-    TNtuple  = cppyy.gbl.TNtuple
-    TH1F     = cppyy.gbl.TH1F
-    TH2F     = cppyy.gbl.TH2F
-    TRandom3 = cppyy.gbl.TRandom3
-
-    gROOT      = cppyy.gbl.gROOT
-    gBenchmark = cppyy.gbl.TBenchmark()
-    gSystem    = cppyy.gbl.gSystem
-
-except ImportError:
-    from ROOT import TCanvas, TFile, TProfile, TNtuple, TH1F, TH2F, TRandom3
-    from ROOT import gROOT, gBenchmark, gSystem
-    import random
-
-if _reflex:
-    gROOT.SetBatch(True)
-
-# Create a new ROOT binary machine independent file.
-# Note that this file may contain any kind of ROOT objects, histograms,
-# pictures, graphics objects, detector geometries, tracks, events, etc..
-# This file is now becoming the current directory.
-
-if not _reflex:
-    hfile = gROOT.FindObject('hsimple.root')
-    if hfile:
-        hfile.Close()
-    hfile = TFile('hsimple.root', 'RECREATE', 'Demo ROOT file with histograms' 
)
-
-# Create some histograms, a profile histogram and an ntuple
-hpx    = TH1F('hpx', 'This is the px distribution', 100, -4, 4)
-hpx.SetFillColor(48)
-hpxpy  = TH2F('hpxpy', 'py vs px', 40, -4, 4, 40, -4, 4)
-hprof  = TProfile('hprof', 'Profile of pz versus px', 100, -4, 4, 0, 20)
-if not _reflex:
-    ntuple = TNtuple('ntuple', 'Demo ntuple', 'px:py:pz:random:i')
-
-gBenchmark.Start('hsimple')
-
-# Create a new canvas, and customize it.
-c1 = TCanvas('c1', 'Dynamic Filling Example', 200, 10, 700, 500)
-c1.SetFillColor(42)
-c1.GetFrame().SetFillColor(21)
-c1.GetFrame().SetBorderSize(6)
-c1.GetFrame().SetBorderMode(-1)
-
-# Fill histograms randomly.
-random = TRandom3()
-kUPDATE = 1000
-for i in xrange(50000):
-    # Generate random numbers
-#    px, py = random.gauss(0, 1), random.gauss(0, 1)
-    px, py = random.Gaus(0, 1), random.Gaus(0, 1)
-    pz = px*px + py*py
-#    rnd = random.random()
-    rnd = random.Rndm(1)
-
-    # Fill histograms
-    hpx.Fill(px)
-    hpxpy.Fill(px, py)
-    hprof.Fill(px, pz)
-    if not _reflex:
-        ntuple.Fill(px, py, pz, rnd, i)
-
-    # Update display every kUPDATE events
-    if i and i%kUPDATE == 0:
-        if i == kUPDATE:
-            hpx.Draw()
-
-        c1.Modified(True)
-        c1.Update()
-
-        if gSystem.ProcessEvents():          # allow user interrupt
-            break
-
-gBenchmark.Show( 'hsimple' )
-
-# Save all objects in this file
-hpx.SetFillColor(0)
-if not _reflex:
-    hfile.Write()
-hpx.SetFillColor(48)
-c1.Modified(True)
-c1.Update()
-
-# Note that the file is automatically closed when application terminates
-# or when the file destructor is called.
diff --git a/pypy/module/_cppyy/bench/hsimple_rflx.py 
b/pypy/module/_cppyy/bench/hsimple_rflx.py
deleted file mode 100755
--- a/pypy/module/_cppyy/bench/hsimple_rflx.py
+++ /dev/null
@@ -1,120 +0,0 @@
-#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-#*-*
-#*-*  This program creates :
-#*-*    - a one dimensional histogram
-#*-*    - a two dimensional histogram
-#*-*    - a profile histogram
-#*-*    - a memory-resident ntuple
-#*-*
-#*-*  These objects are filled with some random numbers and saved on a file.
-#*-*
-#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-
-try:
-    import warnings
-    warnings.simplefilter("ignore")
-
-    import cppyy, random
-    cppyy.load_reflection_info('bench02Dict_reflex.so')
-
-    app      = cppyy.gbl.Bench02RootApp()
-    TCanvas  = cppyy.gbl.TCanvas
-    TFile    = cppyy.gbl.TFile
-    TProfile = cppyy.gbl.TProfile
-    TNtuple  = cppyy.gbl.TNtuple
-    TH1F     = cppyy.gbl.TH1F
-    TH2F     = cppyy.gbl.TH2F
-    TRandom  = cppyy.gbl.TRandom
-except ImportError:
-    from ROOT import TCanvas, TFile, TProfile, TNtuple, TH1F, TH2F, TRandom
-    import random
-
-import math
-
-#gROOT      = cppyy.gbl.gROOT
-#gBenchmark = cppyy.gbl.gBenchmark
-#gRandom    = cppyy.gbl.gRandom
-#gSystem    = cppyy.gbl.gSystem
-
-#gROOT.Reset()
-
-# Create a new canvas, and customize it.
-#c1 = TCanvas( 'c1', 'Dynamic Filling Example', 200, 10, 700, 500 )
-#c1.SetFillColor( 42 )
-#c1.GetFrame().SetFillColor( 21 )
-#c1.GetFrame().SetBorderSize( 6 )
-#c1.GetFrame().SetBorderMode( -1 )
-
-# Create a new ROOT binary machine independent file.
-# Note that this file may contain any kind of ROOT objects, histograms,
-# pictures, graphics objects, detector geometries, tracks, events, etc..
-# This file is now becoming the current directory.
-
-#hfile = gROOT.FindObject( 'hsimple.root' )
-#if hfile:
-#   hfile.Close()
-#hfile = TFile( 'hsimple.root', 'RECREATE', 'Demo ROOT file with histograms' )
-
-# Create some histograms, a profile histogram and an ntuple
-hpx    = TH1F('hpx', 'This is the px distribution', 100, -4, 4)
-hpx.Print()
-#hpxpy  = TH2F( 'hpxpy', 'py vs px', 40, -4, 4, 40, -4, 4 )
-#hprof  = TProfile( 'hprof', 'Profile of pz versus px', 100, -4, 4, 0, 20 )
-#ntuple = TNtuple( 'ntuple', 'Demo ntuple', 'px:py:pz:random:i' )
-
-# Set canvas/frame attributes.
-#hpx.SetFillColor( 48 )
-
-#gBenchmark.Start( 'hsimple' )
-
-# Initialize random number generator.
-#gRandom.SetSeed()
-#rannor, rndm = gRandom.Rannor, gRandom.Rndm
-
-random = TRandom()
-random.SetSeed(0)
-
-# Fill histograms randomly.
-#px, py = Double(), Double()
-kUPDATE = 1000
-for i in xrange(2500000):
- # Generate random values.
-#   px, py = random.gauss(0, 1), random.gauss(0, 1)
-    px, py = random.Gaus(0, 1), random.Gaus(0, 1)
-#   pt = (px*px + py*py)**0.5
-    pt = math.sqrt(px*px + py*py)
-#   pt = (px*px + py*py)
-#   random = rndm(1)
-
- # Fill histograms.
-    hpx.Fill(pt)
-#   hpxpyFill( px, py )
-#   hprofFill( px, pz )
-#   ntupleFill( px, py, pz, random, i )
-
- # Update display every kUPDATE events.
-#   if i and i%kUPDATE == 0:
-#      if i == kUPDATE:
-#         hpx.Draw()
-
-#      c1.Modified()
-#      c1.Update()
-
-#      if gSystem.ProcessEvents():            # allow user interrupt
-#         break
-
-#gBenchmark.Show( 'hsimple' )
-
-hpx.Print()
-
-# Save all objects in this file.
-#hpx.SetFillColor( 0 )
-#hfile.Write()
-#hfile.Close()
-#hpx.SetFillColor( 48 )
-#c1.Modified()
-#c1.Update()
-#c1.Draw()
-
-# Note that the file is automatically closed when application terminates
-# or when the file destructor is called.
diff --git a/pypy/module/_cppyy/capi/__init__.py 
b/pypy/module/_cppyy/capi/__init__.py
--- a/pypy/module/_cppyy/capi/__init__.py
+++ b/pypy/module/_cppyy/capi/__init__.py
@@ -1,16 +1,6 @@
 from rpython.rtyper.lltypesystem import rffi, lltype
 
-# There are two possible ways of accessing the backend through the reflection
-# C-API: built it into pypy-c, or load it dynamically. The latter is preferred
-# (and is the default) for use with Reflex. B/c of some builtin pythonizations,
-# the former is recommended (for now) with CINT.
-
-# Note: if builtin_capi is chosen, then inside builtin_capi.py, there is still
-# the selection of the desired backend (default is Reflex).
-
-# choose C-API access method:
 from pypy.module._cppyy.capi.loadable_capi import *
-#from pypy.module._cppyy.capi.builtin_capi import *
 
 from pypy.module._cppyy.capi.capi_types import C_OBJECT,\
     C_NULL_TYPE, C_NULL_OBJECT
diff --git a/pypy/module/_cppyy/capi/builtin_capi.py 
b/pypy/module/_cppyy/capi/builtin_capi.py
deleted file mode 100644
--- a/pypy/module/_cppyy/capi/builtin_capi.py
+++ /dev/null
@@ -1,590 +0,0 @@
-from rpython.rtyper.lltypesystem import rffi, lltype
-from rpython.rlib.rarithmetic import intmask
-from rpython.rlib import jit
-
-import cling_capi as backend
-
-from pypy.module._cppyy.capi.capi_types import C_SCOPE, C_TYPE, C_OBJECT,\
-   C_METHOD, C_INDEX, C_INDEX_ARRAY, WLAVC_INDEX, C_FUNC_PTR
-
-identify  = backend.identify
-pythonize = backend.pythonize
-register_pythonizations = backend.register_pythonizations
-std_string_name = backend.std_string_name
-
-ts_reflect = backend.ts_reflect
-ts_call    = backend.ts_call
-ts_memory  = backend.ts_memory
-ts_helper  = backend.ts_helper
-
-def verify_backend(space):
-    return True                    # by definition
-
-c_load_dictionary = backend.c_load_dictionary
-
-# name to opaque C++ scope representation ------------------------------------
-_c_num_scopes = rffi.llexternal(
-    "cppyy_num_scopes",
-    [C_SCOPE], rffi.INT,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_num_scopes(space, cppscope):
-    return _c_num_scopes(cppscope.handle)
-_c_scope_name = rffi.llexternal(
-    "cppyy_scope_name",
-    [C_SCOPE, rffi.INT], rffi.CCHARP,
-    compilation_info = backend.eci)
-def c_scope_name(space, cppscope, iscope):
-    return charp2str_free(space, _c_scope_name(cppscope.handle, iscope))
-
-_c_resolve_name = rffi.llexternal(
-    "cppyy_resolve_name",
-    [rffi.CCHARP], rffi.CCHARP,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_resolve_name(space, name):
-    return charp2str_free(space, _c_resolve_name(name))
-_c_get_scope_opaque = rffi.llexternal(
-    "cppyy_get_scope",
-    [rffi.CCHARP], C_SCOPE,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_get_scope_opaque(space, name):
-    return _c_get_scope_opaque(name)
-_c_actual_class = rffi.llexternal(
-    "cppyy_actual_class",
-    [C_TYPE, C_OBJECT], C_TYPE,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_actual_class(space, cppclass, cppobj):
-    return _c_actual_class(cppclass.handle, cppobj)
-
-# memory management ----------------------------------------------------------
-_c_allocate = rffi.llexternal(
-    "cppyy_allocate",
-    [C_TYPE], C_OBJECT,
-    releasegil=ts_memory,
-    compilation_info=backend.eci)
-def c_allocate(space, cppclass):
-    return _c_allocate(cppclass.handle)
-_c_deallocate = rffi.llexternal(
-    "cppyy_deallocate",
-    [C_TYPE, C_OBJECT], lltype.Void,
-    releasegil=ts_memory,
-    compilation_info=backend.eci)
-def c_deallocate(space, cppclass, cppobject):
-    _c_deallocate(cppclass.handle, cppobject)
-_c_destruct = rffi.llexternal(
-    "cppyy_destruct",
-    [C_TYPE, C_OBJECT], lltype.Void,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_destruct(space, cppclass, cppobject):
-    _c_destruct(cppclass.handle, cppobject)
-
-# method/function dispatching ------------------------------------------------
-_c_call_v = rffi.llexternal(
-    "cppyy_call_v",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], lltype.Void,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_v(space, cppmethod, cppobject, nargs, args):
-    _c_call_v(cppmethod, cppobject, nargs, args)
-_c_call_b = rffi.llexternal(
-    "cppyy_call_b",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.UCHAR,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_b(space, cppmethod, cppobject, nargs, args):
-    return _c_call_b(cppmethod, cppobject, nargs, args)
-_c_call_c = rffi.llexternal(
-    "cppyy_call_c",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.CHAR,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_c(space, cppmethod, cppobject, nargs, args):
-    return _c_call_c(cppmethod, cppobject, nargs, args)
-_c_call_h = rffi.llexternal(
-    "cppyy_call_h",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.SHORT,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_h(space, cppmethod, cppobject, nargs, args):
-    return _c_call_h(cppmethod, cppobject, nargs, args)
-_c_call_i = rffi.llexternal(
-    "cppyy_call_i",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.INT,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_i(space, cppmethod, cppobject, nargs, args):
-    return _c_call_i(cppmethod, cppobject, nargs, args)
-_c_call_l = rffi.llexternal(
-    "cppyy_call_l",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.LONG,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_l(space, cppmethod, cppobject, nargs, args):
-    return _c_call_l(cppmethod, cppobject, nargs, args)
-_c_call_ll = rffi.llexternal(
-    "cppyy_call_ll",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.LONGLONG,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_ll(space, cppmethod, cppobject, nargs, args):
-    return _c_call_ll(cppmethod, cppobject, nargs, args)
-_c_call_f = rffi.llexternal(
-    "cppyy_call_f",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.FLOAT,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_f(space, cppmethod, cppobject, nargs, args):
-    return _c_call_f(cppmethod, cppobject, nargs, args)
-_c_call_d = rffi.llexternal(
-    "cppyy_call_d",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.DOUBLE,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_d(space, cppmethod, cppobject, nargs, args):
-    return _c_call_d(cppmethod, cppobject, nargs, args)
-_c_call_ld = rffi.llexternal(
-    "cppyy_call_ld",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.LONGDOUBLE,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_ld(space, cppmethod, cppobject, nargs, args):
-    return _c_call_ld(cppmethod, cppobject, nargs, args)
-
-_c_call_r = rffi.llexternal(
-    "cppyy_call_r",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.VOIDP,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_r(space, cppmethod, cppobject, nargs, args):
-    return _c_call_r(cppmethod, cppobject, nargs, args)
-_c_call_s = rffi.llexternal(
-    "cppyy_call_s",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP, rffi.SIZE_TP], rffi.CCHARP,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_s(space, cppmethod, cppobject, nargs, args):
-    length = lltype.malloc(rffi.SIZE_TP.TO, 1, flavor='raw')
-    try:
-        cstr = _c_call_s(cppmethod, cppobject, nargs, args, length)
-        cstr_len = intmask(length[0])
-    finally:
-        lltype.free(length, flavor='raw')
-    return cstr, cstr_len
-
-_c_constructor = rffi.llexternal(
-    "cppyy_constructor",
-    [C_METHOD, C_TYPE, rffi.INT, rffi.VOIDP], C_OBJECT,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_constructor(space, cppmethod, cppobject, nargs, args):
-    return _c_constructor(cppmethod, cppobject, nargs, args)
-_c_call_o = rffi.llexternal(
-    "cppyy_call_o",
-    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP, C_TYPE], rffi.LONG,
-    releasegil=ts_call,
-    compilation_info=backend.eci)
-def c_call_o(space, method, cppobj, nargs, args, cppclass):
-    return _c_call_o(method, cppobj, nargs, args, cppclass.handle)
-
-_c_get_function_address = rffi.llexternal(
-    "cppyy_get_function_address",
-    [C_SCOPE, C_INDEX], C_FUNC_PTR,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci,
-    random_effects_on_gcobjs=False)
-def c_get_function_address(space, cppscope, index):
-    return _c_get_function_address(cppscope.handle, index)
-
-# handling of function argument buffer ---------------------------------------
-_c_allocate_function_args = rffi.llexternal(
-    "cppyy_allocate_function_args",
-    [rffi.SIZE_T], rffi.VOIDP,
-    releasegil=ts_memory,
-    compilation_info=backend.eci)
-def c_allocate_function_args(space, size):
-    return _c_allocate_function_args(size)
-_c_deallocate_function_args = rffi.llexternal(
-    "cppyy_deallocate_function_args",
-    [rffi.VOIDP], lltype.Void,
-    releasegil=ts_memory,
-    compilation_info=backend.eci)
-def c_deallocate_function_args(space, args):
-    _c_deallocate_function_args(args)
-_c_function_arg_sizeof = rffi.llexternal(
-    "cppyy_function_arg_sizeof",
-    [], rffi.SIZE_T,
-    releasegil=ts_memory,
-    compilation_info=backend.eci,
-    random_effects_on_gcobjs=False)
-@jit.elidable
-def c_function_arg_sizeof(space):
-    return _c_function_arg_sizeof()
-_c_function_arg_typeoffset = rffi.llexternal(
-    "cppyy_function_arg_typeoffset",
-    [], rffi.SIZE_T,
-    releasegil=ts_memory,
-    compilation_info=backend.eci,
-    random_effects_on_gcobjs=False)
-@jit.elidable
-def c_function_arg_typeoffset(space):
-    return _c_function_arg_typeoffset()
-
-# scope reflection information -----------------------------------------------
-_c_is_namespace = rffi.llexternal(
-    "cppyy_is_namespace",
-    [C_SCOPE], rffi.INT,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_is_namespace(space, scope):
-    return _c_is_namespace(scope)
-_c_is_template = rffi.llexternal(
-    "cppyy_is_template",
-    [rffi.CCHARP], rffi.INT,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_is_template(space, name):
-    return _c_is_template(name)
-_c_is_abstract = rffi.llexternal(
-    "cppyy_is_abstract",
-    [C_SCOPE], rffi.INT,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_is_abstract(space, cpptype):
-    return _c_is_abstract(cpptype)
-_c_is_enum = rffi.llexternal(
-    "cppyy_is_enum",
-    [rffi.CCHARP], rffi.INT,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_is_enum(space, name):
-    return _c_is_enum(name)
-
-# type/class reflection information ------------------------------------------
-_c_final_name = rffi.llexternal(
-    "cppyy_final_name",
-    [C_TYPE], rffi.CCHARP,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_final_name(space, cpptype):
-    return charp2str_free(space, _c_final_name(cpptype))
-_c_scoped_final_name = rffi.llexternal(
-    "cppyy_scoped_final_name",
-    [C_TYPE], rffi.CCHARP,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_scoped_final_name(space, cpptype):
-    return charp2str_free(space, _c_scoped_final_name(cpptype))
-_c_has_complex_hierarchy = rffi.llexternal(
-    "cppyy_has_complex_hierarchy",
-    [C_TYPE], rffi.INT,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_has_complex_hierarchy(space, cpptype):
-    return _c_has_complex_hierarchy(cpptype)
-_c_num_bases = rffi.llexternal(
-    "cppyy_num_bases",
-    [C_TYPE], rffi.INT,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_num_bases(space, cppclass):
-    return _c_num_bases(cppclass.handle)
-_c_base_name = rffi.llexternal(
-    "cppyy_base_name",
-    [C_TYPE, rffi.INT], rffi.CCHARP,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_base_name(space, cppclass, base_index):
-    return charp2str_free(space, _c_base_name(cppclass.handle, base_index))
-_c_is_subtype = rffi.llexternal(
-    "cppyy_is_subtype",
-    [C_TYPE, C_TYPE], rffi.INT,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci,
-    random_effects_on_gcobjs=False)
-@jit.elidable
-def c_is_subtype(space, derived, base):
-    if derived == base:
-        return 1
-    return _c_is_subtype(derived.handle, base.handle)
-
-_c_base_offset = rffi.llexternal(
-    "cppyy_base_offset",
-    [C_TYPE, C_TYPE, C_OBJECT, rffi.INT], rffi.LONG, # actually ptrdiff_t
-    releasegil=ts_reflect,
-    compilation_info=backend.eci,
-    random_effects_on_gcobjs=False)
-@jit.elidable
-def c_base_offset(space, derived, base, address, direction):
-    if derived == base:
-        return 0
-    return _c_base_offset(derived.handle, base.handle, address, direction)
-def c_base_offset1(space, derived_h, base, address, direction):
-    return _c_base_offset(derived_h, base.handle, address, direction)
-
-# method/function reflection information -------------------------------------
-_c_num_methods = rffi.llexternal(
-    "cppyy_num_methods",
-    [C_SCOPE], rffi.INT,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_num_methods(space, cppscope):
-    return _c_num_methods(cppscope.handle)
-_c_method_index_at = rffi.llexternal(
-    "cppyy_method_index_at",
-    [C_SCOPE, rffi.INT], C_INDEX,
-    releasegil=ts_reflect,
-    compilation_info=backend.eci)
-def c_method_index_at(space, cppscope, imethod):
-    return _c_method_index_at(cppscope.handle, imethod)
-_c_method_indices_from_name = rffi.llexternal(
-    "cppyy_method_indices_from_name",
-    [C_SCOPE, rffi.CCHARP], C_INDEX_ARRAY,
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to