[pypy-commit] pypy reflex-support: - add fix to genreflex patch to allow proper code generation for inner union

wlav noreply at buildbot.pypy.org
Thu Aug 4 03:07:27 CEST 2011


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r46264:1e368b38ccd1
Date: 2011-08-03 18:09 -0700
http://bitbucket.org/pypy/pypy/changeset/1e368b38ccd1/

Log:	- add fix to genreflex patch to allow proper code generation for
	inner union
	- more hsimple bench mark fixes

diff --git a/pypy/module/cppyy/bench/Makefile b/pypy/module/cppyy/bench/Makefile
--- a/pypy/module/cppyy/bench/Makefile
+++ b/pypy/module/cppyy/bench/Makefile
@@ -24,6 +24,6 @@
 endif
 
 
-bench02Dict_reflex.so: bench02.h bench02.xml
+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)
diff --git a/pypy/module/cppyy/bench/bench02.cxx b/pypy/module/cppyy/bench/bench02.cxx
--- a/pypy/module/cppyy/bench/bench02.cxx
+++ b/pypy/module/cppyy/bench/bench02.cxx
@@ -15,6 +15,10 @@
 
 #include <iostream>
 
+TClass *TClass::GetClass(const char*, Bool_t, Bool_t) {
+   static TClass dummy("dummy");
+   return &dummy;
+}
 
 class TTestApplication : public TApplication {
 public:
@@ -53,7 +57,7 @@
     if (!gApplication) {
         int argc = 1;
         char* argv[1]; argv[0] = (char*)appname;
-        gApplication = new TTestApplication(appname, &argc, argv, kTRUE);
+        gApplication = new TTestApplication(appname, &argc, argv, kFALSE);
     }
 }
 
diff --git a/pypy/module/cppyy/bench/bench02.h b/pypy/module/cppyy/bench/bench02.h
--- a/pypy/module/cppyy/bench/bench02.h
+++ b/pypy/module/cppyy/bench/bench02.h
@@ -15,6 +15,7 @@
 #include "TBasket.h"
 #include "TBox.h"
 #include "TBranchRef.h"
+#include "TBrowser.h"
 #include "TClassGenerator.h"
 #include "TClassRef.h"
 #include "TClassStreamer.h"
diff --git a/pypy/module/cppyy/bench/bench02.xml b/pypy/module/cppyy/bench/bench02.xml
--- a/pypy/module/cppyy/bench/bench02.xml
+++ b/pypy/module/cppyy/bench/bench02.xml
@@ -5,11 +5,14 @@
      <!-- ROOT classes -->
      <class pattern="T[A-Z]*" />
      <class pattern="ROOT::T[A-Z]*" />
+     <class pattern="ROOT::Fit::*" />
 
      <!-- STL classes actually used -->
+     <class name="std::string" />
      <class name="std::ostream" />
      <class name="std::type_info" />
-     <class pattern="std::_Vector_base<*> >" />
+     <class pattern="std::vector<*>" />
+     <class pattern="std::_Vector_base<*>" />
 
      <!-- helper -->
      <class name="Bench02RootApp" />
@@ -18,15 +21,13 @@
 
   <exclusion>
 
+     <struct pattern="TString::*" />
      <class name="TString" >
          <field name="fRep" transient="true"/>
      </class>
 
      <class name="TUUID::uuid_time_t" />
 
-     <class pattern="TString::*" />
-     <class name="TString::Rep_t" />
-
      <class name="TClass::TNameMapNode" />
      <class name="TFileOpenHandle" />
 
diff --git a/pypy/module/cppyy/genreflex-methptrgetter.patch b/pypy/module/cppyy/genreflex-methptrgetter.patch
--- a/pypy/module/cppyy/genreflex-methptrgetter.patch
+++ b/pypy/module/cppyy/genreflex-methptrgetter.patch
@@ -1,6 +1,6 @@
 Index: cint/reflex/python/genreflex/gendict.py
 ===================================================================
---- cint/reflex/python/genreflex/gendict.py	(revision 40173)
+--- cint/reflex/python/genreflex/gendict.py	(revision 40448)
 +++ cint/reflex/python/genreflex/gendict.py	(working copy)
 @@ -52,6 +52,7 @@
      self.typedefs_for_usr = []
@@ -10,7 +10,25 @@
      # The next is to avoid a known problem with gccxml that it generates a
      # references to id equal '_0' which is not defined anywhere
      self.xref['_0'] = {'elem':'Unknown', 'attrs':{'id':'_0','name':''}, 'subelems':[]}
-@@ -1956,8 +1957,15 @@
+@@ -1281,6 +1282,8 @@
+     bases = self.getBases( attrs['id'] )
+     if inner and attrs.has_key('demangled') and self.isUnnamedType(attrs['demangled']) :
+       cls = attrs['demangled']
++      if self.xref[attrs['id']]['elem'] == 'Union':
++         return 80*' '
+       clt = ''
+     else:
+       cls = self.genTypeName(attrs['id'],const=True,colon=True)
+@@ -1318,7 +1321,7 @@
+       # Inner class/struct/union/enum.
+       for m in memList :
+         member = self.xref[m]
+-        if member['elem'] in ('Class','Struct','Union','Enumeration') \
++        if member['elem'] in ('Class','Struct','Enumeration') \
+            and member['attrs'].get('access') in ('private','protected') \
+            and not self.isUnnamedType(member['attrs'].get('demangled')):
+           cmem = self.genTypeName(member['attrs']['id'],const=True,colon=True)
+@@ -1956,8 +1959,15 @@
      else    : params  = '0'
      s = '  .AddFunctionMember(%s, Reflex::Literal("%s"), %s%s, 0, %s, %s)' % (self.genTypeID(id), name, type, id, params, mod)
      s += self.genCommentProperty(attrs)
@@ -26,7 +44,7 @@
    def genMCODef(self, type, name, attrs, args):
      id       = attrs['id']
      cl       = self.genTypeName(attrs['context'],colon=True)
-@@ -2024,8 +2032,44 @@
+@@ -2024,8 +2034,44 @@
            if returns == 'void' : body += '  }\n'
            else :                 body += '  }\n'
      body += '}\n'
@@ -74,7 +92,7 @@
      for a in args :
 Index: cint/reflex/python/genreflex/genreflex.py
 ===================================================================
---- cint/reflex/python/genreflex/genreflex.py	(revision 40173)
+--- cint/reflex/python/genreflex/genreflex.py	(revision 40448)
 +++ cint/reflex/python/genreflex/genreflex.py	(working copy)
 @@ -108,6 +108,10 @@
           Print extra debug information while processing. Keep intermediate files\n


More information about the pypy-commit mailing list