Browse Source

If you pick this up you need to re interigate every thing you have

Roger Hughston 18 years ago
parent
commit
ad4aa44a6b
2 changed files with 22 additions and 4 deletions
  1. 3 3
      dtool/src/interrogatedb/py_panda.cxx
  2. 19 1
      dtool/src/interrogatedb/py_panda.h

+ 3 - 3
dtool/src/interrogatedb/py_panda.cxx

@@ -23,9 +23,9 @@
 
 PyMemberDef standard_type_members[] = {
   {"this", T_INT, offsetof(Dtool_PyInstDef,_ptr_to_object),READONLY,"C++ This if any"},
-  {"this_ownership", T_INT, offsetof(Dtool_PyInstDef, _memory_rules), READONLY,"C++ 'this' ownership rules"},
-  {"this_const", T_INT, offsetof(Dtool_PyInstDef, _is_const), READONLY,"C++ 'this' const flag"},
-  {"this_signature", T_INT, offsetof(Dtool_PyInstDef, _signature), READONLY,"A type check signature"},
+//  {"this_ownership", T_INT, offsetof(Dtool_PyInstDef, _memory_rules), READONLY,"C++ 'this' ownership rules"},
+//  {"this_const", T_INT, offsetof(Dtool_PyInstDef, _is_const), READONLY,"C++ 'this' const flag"},
+//  {"this_signature", T_INT, offsetof(Dtool_PyInstDef, _signature), READONLY,"A type check signature"},
   {"this_metatype", T_OBJECT, offsetof(Dtool_PyInstDef, _My_Type), READONLY,"The dtool meta object"},
   {NULL}  /* Sentinel */
 };

+ 19 - 1
dtool/src/interrogatedb/py_panda.h

@@ -61,6 +61,8 @@
 
 using namespace std;
 
+#define PY_PANDA_SMALLER_FOOTPRINT  1
+
 ///////////////////////////////////////////////////////////////////////////////////
 // this is tempory .. untill this is glued better into the panda build system
 ///////////////////////////////////////////////////////////////////////////////////
@@ -84,7 +86,7 @@ EXPCL_DTOOLCONFIG   RunTimeTypeList & GetRunTimeTypeList();
 
 //////////////////////////////////////////////////////////
 // used to stamp dtool instance.. 
-#define PY_PANDA_SIGNATURE 0xdeadbeaf
+#define PY_PANDA_SIGNATURE 0xbeaf
 typedef  void * ( * ConvertFunctionType  )(PyObject *,Dtool_PyTypedObject * );
 typedef  void * ( * ConvertFunctionType1  )(void *, Dtool_PyTypedObject *);
 typedef  void   ( *FreeFunction  )(PyObject *);
@@ -96,6 +98,21 @@ inline void     Dtool_Deallocate_General(PyObject * self);
 ////////////////////////////////////////////////////////////////////////
 // THIS IS THE INSTANCE CONTAINER FOR ALL panda py objects....
 ////////////////////////////////////////////////////////////////////////
+#ifdef  PY_PANDA_SMALLER_FOOTPRINT
+// this should save   8 bytes per object ....
+struct Dtool_PyInstDef 
+{
+  PyObject_HEAD
+  void *_ptr_to_object;
+  struct Dtool_PyTypedObject *_My_Type;
+  unsigned short _signature ; 
+  int _memory_rules : 1;   // true if we own the pointer and should delete it or unref it
+  int _is_const     : 1;       // true if this is a "const" pointer.
+};
+
+
+
+#else
 struct Dtool_PyInstDef {
   PyObject_HEAD
   void *_ptr_to_object;
@@ -104,6 +121,7 @@ struct Dtool_PyInstDef {
   unsigned long _signature;
   struct Dtool_PyTypedObject *_My_Type;
 };
+#endif
 
 ////////////////////////////////////////////////////////////////////////
 // A Offset Dictionary Defining How to read the Above Object..