Commits

wlav committed 4d8e57f Merge

merge reflex-support into default

Comments (0)

Files changed (328)

 ^pypy/module/cpyext/test/.+\.obj$
 ^pypy/module/cpyext/test/.+\.manifest$
 ^pypy/module/test_lib_pypy/ctypes_tests/.+\.o$
+^pypy/module/cppyy/src/.+\.o$
+^pypy/module/cppyy/bench/.+\.so$
+^pypy/module/cppyy/bench/.+\.root$
+^pypy/module/cppyy/bench/.+\.d$
+^pypy/module/cppyy/src/.+\.errors$
+^pypy/module/cppyy/test/.+_rflx\.cpp$
+^pypy/module/cppyy/test/.+\.so$
+^pypy/module/cppyy/test/.+\.rootmap$
+^pypy/module/cppyy/test/.+\.exe$
+^pypy/module/cppyy/test/.+_cint.h$
 ^pypy/doc/.+\.html$
 ^pypy/doc/config/.+\.rst$
 ^pypy/doc/basicblock\.asc$
     DFKI GmbH, Germany 
     Impara, Germany
     Change Maker, Sweden 
+    University of California Berkeley, USA
 
 The PyPy Logo as used by http://speed.pypy.org and others was created
 by Samuel Reis and is distributed on terms of Creative Commons Share Alike

lib_pypy/_ctypes/function.py

File contents unchanged.

lib_pypy/_ctypes/structure.py

File contents unchanged.

pypy/config/pypyoption.py

File contents unchanged.

pypy/doc/_ref.txt

File contents unchanged.

pypy/doc/config/commandline.txt

File contents unchanged.

pypy/doc/config/objspace.allworkingmodules.txt

File contents unchanged.

pypy/doc/config/objspace.disable_call_speedhacks.txt

File contents unchanged.

pypy/doc/config/objspace.geninterp.txt

File contents unchanged.

pypy/doc/config/objspace.honor__builtins__.txt

File contents unchanged.

pypy/doc/config/objspace.logbytecodes.txt

File contents unchanged.

pypy/doc/config/objspace.lonepycfiles.txt

File contents unchanged.

pypy/doc/config/objspace.name.txt

File contents unchanged.

pypy/doc/config/objspace.nofaking.txt

File contents unchanged.

pypy/doc/config/objspace.opcodes.CALL_METHOD.txt

File contents unchanged.

pypy/doc/config/objspace.opcodes.txt

File contents unchanged.

pypy/doc/config/objspace.soabi.txt

File contents unchanged.

pypy/doc/config/objspace.std.builtinshortcut.txt

File contents unchanged.

pypy/doc/config/objspace.std.getattributeshortcut.txt

File contents unchanged.

pypy/doc/config/objspace.std.logspaceoptypes.txt

File contents unchanged.

pypy/doc/config/objspace.std.methodcachesizeexp.txt

File contents unchanged.

pypy/doc/config/objspace.std.multimethods.txt

File contents unchanged.

pypy/doc/config/objspace.std.mutable_builtintypes.txt

File contents unchanged.

pypy/doc/config/objspace.std.newshortcut.txt

File contents unchanged.

pypy/doc/config/objspace.std.optimized_comparison_op.txt

File contents unchanged.

pypy/doc/config/objspace.std.optimized_int_add.txt

File contents unchanged.

pypy/doc/config/objspace.std.optimized_list_getitem.txt

File contents unchanged.

pypy/doc/config/objspace.std.prebuiltintfrom.txt

File contents unchanged.

pypy/doc/config/objspace.std.prebuiltintto.txt

File contents unchanged.

pypy/doc/config/objspace.std.sharesmallstr.txt

File contents unchanged.

pypy/doc/config/objspace.std.txt

File contents unchanged.

pypy/doc/config/objspace.std.withcelldict.txt

File contents unchanged.

pypy/doc/config/objspace.std.withmapdict.txt

File contents unchanged.

pypy/doc/config/objspace.std.withmethodcache.txt

File contents unchanged.

pypy/doc/config/objspace.std.withmethodcachecounter.txt

File contents unchanged.

pypy/doc/config/objspace.std.withprebuiltchar.txt

File contents unchanged.

pypy/doc/config/objspace.std.withprebuiltint.txt

File contents unchanged.

pypy/doc/config/objspace.std.withrangelist.txt

File contents unchanged.

pypy/doc/config/objspace.std.withrope.txt

File contents unchanged.

pypy/doc/config/objspace.std.withropeunicode.txt

File contents unchanged.

pypy/doc/config/objspace.std.withsmallint.txt

File contents unchanged.

pypy/doc/config/objspace.std.withstrbuf.txt

File contents unchanged.

pypy/doc/config/objspace.std.withstrjoin.txt

File contents unchanged.

pypy/doc/config/objspace.std.withstrslice.txt

File contents unchanged.

pypy/doc/config/objspace.std.withtproxy.txt

File contents unchanged.

pypy/doc/config/objspace.std.withtypeversion.txt

File contents unchanged.

pypy/doc/config/objspace.timing.txt

File contents unchanged.

pypy/doc/config/objspace.translationmodules.txt

File contents unchanged.

pypy/doc/config/objspace.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.__builtin__.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.__pypy__.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._ast.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._bisect.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._codecs.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._continuation.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._demo.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._ffi.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._file.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._locale.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._lsprof.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._minimal_curses.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._pickle_support.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._random.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._rawffi.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._socket.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._sre.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._ssl.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._testing.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._weakref.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules._winreg.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.array.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.binascii.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.bz2.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.cStringIO.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.clr.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.cpyext.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.crypt.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.errno.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.exceptions.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.fcntl.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.gc.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.imp.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.itertools.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.marshal.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.math.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.micronumpy.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.mmap.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.operator.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.oracle.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.parser.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.posix.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.pyexpat.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.pypyjit.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.rbench.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.rctime.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.select.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.signal.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.struct.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.symbol.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.sys.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.termios.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.thread.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.time.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.token.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.unicodedata.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.zipimport.txt

File contents unchanged.

pypy/doc/config/objspace.usemodules.zlib.txt

File contents unchanged.

pypy/doc/config/objspace.usepycfiles.txt

File contents unchanged.

pypy/doc/config/translation.backend.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.clever_malloc_removal.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.clever_malloc_removal_heuristic.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.clever_malloc_removal_threshold.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.constfold.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.inline.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.inline_heuristic.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.inline_threshold.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.mallocs.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.merge_if_blocks.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.none.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.print_statistics.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.profile_based_inline.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.profile_based_inline_heuristic.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.profile_based_inline_threshold.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.raisingop2direct_call.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.really_remove_asserts.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.remove_asserts.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.stack_optimization.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.storesink.txt

File contents unchanged.

pypy/doc/config/translation.backendopt.txt

File contents unchanged.

pypy/doc/config/translation.builtins_can_raise_exceptions.txt

File contents unchanged.

pypy/doc/config/translation.cc.txt

File contents unchanged.

pypy/doc/config/translation.cli.exception_transformer.txt

File contents unchanged.

pypy/doc/config/translation.cli.trace_calls.txt

File contents unchanged.

pypy/doc/config/translation.cli.txt

File contents unchanged.

pypy/doc/config/translation.compilerflags.txt

File contents unchanged.

pypy/doc/config/translation.continuation.txt

File contents unchanged.

pypy/doc/config/translation.countmallocs.txt

File contents unchanged.

pypy/doc/config/translation.debug.txt

File contents unchanged.

pypy/doc/config/translation.dump_static_data_info.txt

File contents unchanged.

pypy/doc/config/translation.fork_before.txt

File contents unchanged.

pypy/doc/config/translation.gc.txt

File contents unchanged.

pypy/doc/config/translation.gcremovetypeptr.txt

File contents unchanged.

pypy/doc/config/translation.gcrootfinder.txt

File contents unchanged.

pypy/doc/config/translation.gctransformer.txt

File contents unchanged.

pypy/doc/config/translation.insist.txt

File contents unchanged.

pypy/doc/config/translation.instrument.txt

File contents unchanged.

pypy/doc/config/translation.instrumentctl.txt

File contents unchanged.

pypy/doc/config/translation.jit.txt

File contents unchanged.

pypy/doc/config/translation.jit_backend.txt

File contents unchanged.

pypy/doc/config/translation.jit_ffi.txt

File contents unchanged.

pypy/doc/config/translation.jit_profiler.txt

File contents unchanged.

pypy/doc/config/translation.linkerflags.txt

File contents unchanged.

pypy/doc/config/translation.list_comprehension_operations.txt

File contents unchanged.

pypy/doc/config/translation.log.txt

File contents unchanged.

pypy/doc/config/translation.make_jobs.txt

File contents unchanged.

pypy/doc/config/translation.no__thread.txt

File contents unchanged.

pypy/doc/config/translation.noprofopt.txt

File contents unchanged.

pypy/doc/config/translation.ootype.mangle.txt

File contents unchanged.

pypy/doc/config/translation.ootype.txt

File contents unchanged.

pypy/doc/config/translation.output.txt

File contents unchanged.

pypy/doc/config/translation.platform.txt

File contents unchanged.

pypy/doc/config/translation.profopt.txt

File contents unchanged.

pypy/doc/config/translation.rweakref.txt

File contents unchanged.

pypy/doc/config/translation.sandbox.txt

File contents unchanged.

pypy/doc/config/translation.secondaryentrypoints.txt

File contents unchanged.

pypy/doc/config/translation.shared.txt

File contents unchanged.

pypy/doc/config/translation.simplifying.txt

File contents unchanged.

pypy/doc/config/translation.taggedpointers.txt

File contents unchanged.

pypy/doc/config/translation.thread.txt

File contents unchanged.

pypy/doc/config/translation.txt

File contents unchanged.

pypy/doc/config/translation.type_system.txt

File contents unchanged.

pypy/doc/config/translation.vanilla.txt

File contents unchanged.

pypy/doc/config/translation.verbose.txt

File contents unchanged.

pypy/doc/config/translation.withsmallfuncsets.txt

File contents unchanged.

pypy/doc/cppyy.rst

 The cppyy module provides C++ bindings for PyPy by using the reflection
 information extracted from C++ header files by means of the
 `Reflex package`_.
-For this to work, you have to both install Reflex and build PyPy from the
-reflex-support branch.
+For this to work, you have to both install Reflex and build PyPy from source,
+as the cppyy module is not enabled by default.
+Note that the development version of cppyy lives in the reflex-support
+branch.
 As indicated by this being a branch, support for Reflex is still
 experimental.
 However, it is functional enough to put it in the hands of those who want
 .. _`recent snapshot`: http://cern.ch/wlav/reflex-2012-05-02.tar.bz2
 .. _`gccxml`: http://www.gccxml.org
 
-Next, get the `PyPy sources`_, select the reflex-support branch, and build.
+Next, get the `PyPy sources`_, optionally select the reflex-support branch,
+and build it.
 For the build to succeed, the ``$ROOTSYS`` environment variable must point to
 the location of your ROOT (or standalone Reflex) installation, or the
 ``root-config`` utility must be accessible through ``PATH`` (e.g. by adding
 
     $ hg clone https://bitbucket.org/pypy/pypy
     $ cd pypy
-    $ hg up reflex-support
+    $ hg up reflex-support         # optional
     $ cd pypy/translator/goal
     $ python translate.py -O jit --gcrootfinder=shadowstack targetpypystandalone.py --withmod-cppyy
 
   The C++ side will not see any overridden methods on the python side, as
   cross-inheritance is planned but not yet supported.
 
+* **memory**: C++ instances created by calling their constructor from python
+  are owned by python.
+  You can check/change the ownership with the _python_owns flag that every
+  bound instance carries.
+
 * **methods**: Are represented as python methods and work as expected.
   They are first class objects and can be bound to an instance.
   Virtual C++ methods work as expected.

pypy/doc/extending.rst

 
 * Write them in RPython as mixedmodule_, using *rffi* as bindings.
 
-* Write them in C++ and bind them through Reflex_ (EXPERIMENTAL)
+* Write them in C++ and bind them through Reflex_
 
 .. _ctypes: #CTypes
 .. _\_ffi: #LibFFI

pypy/doc/jit/_ref.txt

File contents unchanged.

pypy/doc/project-ideas.rst

File contents unchanged.

pypy/doc/stackless.rst

File contents unchanged.

pypy/doc/whatsnew-head.rst

 .. branch: default
 .. branch: app_main-refactor
 .. branch: win-ordinal
+.. branch: reflex-support
+Provides cppyy module (disabled by default) for access to C++ through Reflex.
+See doc/cppyy.rst for full details and functionality.
 
 
 .. "uninteresting" branches that we should just ignore for the whatsnew:

pypy/interpreter/baseobjspace.py

File contents unchanged.

pypy/interpreter/buffer.py

         # May be overridden.  No bounds checks.
         return ''.join([self.getitem(i) for i in range(start, stop, step)])
 
+    def get_raw_address(self):
+        raise ValueError("no raw buffer")
+
     # __________ app-level support __________
 
     def descr_len(self, space):

pypy/interpreter/executioncontext.py

File contents unchanged.

pypy/interpreter/function.py

File contents unchanged.

pypy/interpreter/gateway.py

File contents unchanged.

pypy/interpreter/pyparser/parsestring.py

File contents unchanged.

pypy/jit/backend/llgraph/test/test_llgraph.py

File contents unchanged.

pypy/jit/backend/test/runner_test.py

File contents unchanged.

pypy/jit/backend/test/test_random.py

File contents unchanged.

pypy/jit/backend/x86/assembler.py

File contents unchanged.

pypy/jit/backend/x86/regalloc.py

File contents unchanged.

pypy/jit/codewriter/effectinfo.py

File contents unchanged.

pypy/jit/codewriter/jtransform.py

File contents unchanged.

pypy/jit/codewriter/support.py

File contents unchanged.

pypy/jit/codewriter/test/test_effectinfo.py

File contents unchanged.

pypy/jit/codewriter/test/test_flatten.py

File contents unchanged.

pypy/jit/metainterp/blackhole.py

File contents unchanged.

pypy/jit/metainterp/optimizeopt/fficall.py

     optimize_CALL_MAY_FORCE = optimize_CALL
 
     def optimize_FORCE_TOKEN(self, op):
-        # The handling of force_token needs a bit of exaplanation.
+        # The handling of force_token needs a bit of explanation.
         # The original trace which is getting optimized looks like this:
         #    i1 = force_token()
         #    setfield_gc(p0, i1, ...)

pypy/jit/metainterp/optimizeopt/heap.py

File contents unchanged.

pypy/jit/metainterp/pyjitpl.py

File contents unchanged.

pypy/jit/metainterp/resoperation.py

File contents unchanged.

pypy/jit/metainterp/test/support.py

File contents unchanged.

pypy/jit/metainterp/test/test_ajit.py

File contents unchanged.

pypy/jit/metainterp/warmspot.py

File contents unchanged.

pypy/jit/tl/pypyjit.py

 config.objspace.usemodules._lsprof = False
 #
 config.objspace.usemodules._ffi = True
+#config.objspace.usemodules.cppyy = True
 config.objspace.usemodules.micronumpy = False
 #
 set_pypy_opt_level(config, level='jit')

pypy/jit/tl/pypyjit_child.py

File contents unchanged.

pypy/jit/tl/pypyjit_demo.py

File contents unchanged.

pypy/module/_rawffi/interp_rawffi.py

File contents unchanged.

pypy/module/array/interp_array.py

         data[index] = char
         array._charbuf_stop()
 
+    def get_raw_address(self):
+        return self.array._charbuf_start()
 
 def make_array(mytype):
     W_ArrayBase = globals()['W_ArrayBase']

pypy/module/array/test/test_array.py

File contents unchanged.

pypy/module/cppyy/__init__.py

+from pypy.interpreter.mixedmodule import MixedModule
+
+class Module(MixedModule):
+    """    """
+
+    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',
+        '_set_class_generator'   : 'interp_cppyy.set_class_generator',
+        '_register_class'        : 'interp_cppyy.register_class',
+        'CPPInstance'            : 'interp_cppyy.W_CPPInstance',
+        'addressof'              : 'interp_cppyy.addressof',
+        'bind_object'            : 'interp_cppyy.bind_object',
+    }
+
+    appleveldefs = {
+        'gbl'                    : 'pythonify.gbl',
+        'load_reflection_info'   : 'pythonify.load_reflection_info',
+        'add_pythonization'      : 'pythonify.add_pythonization',
+    }

pypy/module/cppyy/bench/Makefile

+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 -lReflex -lHistPainter `root-config --libs` $(cppflags) $(cppflags2)

pypy/module/cppyy/bench/bench02.cxx

+#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;
+}

pypy/module/cppyy/bench/bench02.h

+#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);
+};

pypy/module/cppyy/bench/bench02.xml

+<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>

pypy/module/cppyy/bench/hsimple.C

+#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.
+}

pypy/module/cppyy/bench/hsimple.py

+#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+#*-*
+#*-*  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.

pypy/module/cppyy/bench/hsimple_rflx.py

+#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+#*-*
+#*-*  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.

pypy/module/cppyy/capi/__init__.py

+from pypy.rpython.lltypesystem import rffi, lltype
+from pypy.rlib import jit
+
+import reflex_capi as backend
+#import cint_capi as backend
+
+identify = backend.identify
+ts_reflect = backend.ts_reflect
+ts_call    = backend.ts_call
+ts_memory  = backend.ts_memory
+ts_helper  = backend.ts_helper
+
+_C_OPAQUE_PTR = rffi.LONG
+_C_OPAQUE_NULL = lltype.nullptr(rffi.LONGP.TO)# ALT: _C_OPAQUE_PTR.TO
+
+C_SCOPE = _C_OPAQUE_PTR
+C_NULL_SCOPE = rffi.cast(C_SCOPE, _C_OPAQUE_NULL)
+
+C_TYPE = C_SCOPE
+C_NULL_TYPE = C_NULL_SCOPE
+
+C_OBJECT = _C_OPAQUE_PTR
+C_NULL_OBJECT = rffi.cast(C_OBJECT, _C_OPAQUE_NULL)
+
+C_METHOD = _C_OPAQUE_PTR
+
+C_METHPTRGETTER = lltype.FuncType([C_OBJECT], rffi.VOIDP)
+C_METHPTRGETTER_PTR = lltype.Ptr(C_METHPTRGETTER)
+
+def direct_ptradd(ptr, offset):
+    offset = rffi.cast(rffi.SIZE_T, offset)
+    jit.promote(offset)
+    assert lltype.typeOf(ptr) == C_OBJECT
+    address = rffi.cast(rffi.CCHARP, ptr)
+    return rffi.cast(C_OBJECT, lltype.direct_ptradd(address, offset))
+
+c_load_dictionary = backend.c_load_dictionary
+
+# name to opaque C++ scope representation ------------------------------------
+_c_resolve_name = rffi.llexternal(
+    "cppyy_resolve_name",
+    [rffi.CCHARP], rffi.CCHARP,
+    threadsafe=ts_reflect,
+    compilation_info=backend.eci)
+def c_resolve_name(name):
+    return charp2str_free(_c_resolve_name(name))
+c_get_scope_opaque = rffi.llexternal(
+    "cppyy_get_scope",
+    [rffi.CCHARP], C_SCOPE,
+    threadsafe=ts_reflect,
+    compilation_info=backend.eci)
+c_get_template = rffi.llexternal(
+    "cppyy_get_template",
+    [rffi.CCHARP], C_TYPE,
+    threadsafe=ts_reflect,
+    compilation_info=backend.eci)
+_c_actual_class = rffi.llexternal(
+    "cppyy_actual_class",
+    [C_TYPE, C_OBJECT], C_TYPE,
+    threadsafe=ts_reflect,
+    compilation_info=backend.eci)
+def c_actual_class(cppclass, cppobj):
+    return _c_actual_class(cppclass.handle, cppobj)
+
+# memory management ----------------------------------------------------------
+_c_allocate = rffi.llexternal(
+    "cppyy_allocate",
+    [C_TYPE], C_OBJECT,
+    threadsafe=ts_memory,
+    compilation_info=backend.eci)
+def c_allocate(cppclass):
+    return _c_allocate(cppclass.handle)
+_c_deallocate = rffi.llexternal(
+    "cppyy_deallocate",
+    [C_TYPE, C_OBJECT], lltype.Void,
+    threadsafe=ts_memory,
+    compilation_info=backend.eci)
+def c_deallocate(cppclass, cppobject):
+    _c_deallocate(cppclass.handle, cppobject)
+_c_destruct = rffi.llexternal(
+    "cppyy_destruct",
+    [C_TYPE, C_OBJECT], lltype.Void,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+def c_destruct(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,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+c_call_b = rffi.llexternal(
+    "cppyy_call_b",
+    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.INT,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+c_call_c = rffi.llexternal(
+    "cppyy_call_c",
+    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.CHAR,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+c_call_h = rffi.llexternal(
+    "cppyy_call_h",
+    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.SHORT,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+c_call_i = rffi.llexternal(
+    "cppyy_call_i",
+    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.INT,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+c_call_l = rffi.llexternal(
+    "cppyy_call_l",
+    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.LONG,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+c_call_ll = rffi.llexternal(
+    "cppyy_call_ll",
+    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.LONGLONG,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+c_call_f = rffi.llexternal(
+    "cppyy_call_f",
+    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.DOUBLE,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+c_call_d = rffi.llexternal(
+    "cppyy_call_d",
+    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.DOUBLE,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+
+c_call_r = rffi.llexternal(
+    "cppyy_call_r",
+    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.VOIDP,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+c_call_s = rffi.llexternal(
+    "cppyy_call_s",
+    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.CCHARP,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+
+c_constructor = rffi.llexternal(
+    "cppyy_constructor",
+    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], lltype.Void,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+
+_c_call_o = rffi.llexternal(
+    "cppyy_call_o",
+    [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP, C_TYPE], rffi.LONG,
+    threadsafe=ts_call,
+    compilation_info=backend.eci)
+def c_call_o(method_index, cppobj, nargs, args, cppclass):
+    return _c_call_o(method_index, cppobj, nargs, args, cppclass.handle)
+
+_c_get_methptr_getter = rffi.llexternal(
+    "cppyy_get_methptr_getter",
+    [C_SCOPE, rffi.INT], C_METHPTRGETTER_PTR,
+    threadsafe=ts_reflect,
+    compilation_info=backend.eci,
+    elidable_function=True)
+def c_get_methptr_getter(cppscope, method_index):
+    return _c_get_methptr_getter(cppscope.handle, method_index)
+
+# handling of function argument buffer ---------------------------------------
+c_allocate_function_args = rffi.llexternal(
+    "cppyy_allocate_function_args",
+    [rffi.SIZE_T], rffi.VOIDP,
+    threadsafe=ts_memory,
+    compilation_info=backend.eci)
+c_deallocate_function_args = rffi.llexternal(
+    "cppyy_deallocate_function_args",
+    [rffi.VOIDP], lltype.Void,
+    threadsafe=ts_memory,
+    compilation_info=backend.eci)
+c_function_arg_sizeof = rffi.llexternal(
+    "cppyy_function_arg_sizeof",
+    [], rffi.SIZE_T,
+    threadsafe=ts_memory,
+    compilation_info=backend.eci,
+    elidable_function=True)
+c_function_arg_typeoffset = rffi.llexternal(
+    "cppyy_function_arg_typeoffset",
+    [], rffi.SIZE_T,
+    threadsafe=ts_memory,
+    compilation_info=backend.eci,
+    elidable_function=True)
+
+# scope reflection information -----------------------------------------------
+c_is_namespace = rffi.llexternal(
+    "cppyy_is_namespace",
+    [C_SCOPE], rffi.INT,
+    threadsafe=ts_reflect,
+    compilation_info=backend.eci)
+c_is_enum = rffi.llexternal(
+    "cppyy_is_enum",
+    [rffi.CCHARP], rffi.INT,
+    threadsafe=ts_reflect,
+    compilation_info=backend.eci)
+
+# type/class reflection information ------------------------------------------
+_c_final_name = rffi.llexternal(
+    "cppyy_final_name",
+    [C_TYPE], rffi.CCHARP,
+    threadsafe=ts_reflect,
+    compilation_info=backend.eci)
+def c_final_name(cpptype):
+    return charp2str_free(_c_final_name(cpptype))
+_c_scoped_final_name = rffi.llexternal(
+    "cppyy_scoped_final_name",
+    [C_TYPE], rffi.CCHARP,
+    threadsafe=ts_reflect,
+    compilation_info=backend.eci)
+def c_scoped_final_name(cpptype):
+    return charp2str_free(_c_scoped_final_name(cpptype))
+c_has_complex_hierarchy = rffi.llexternal(
+    "cppyy_has_complex_hierarchy",