[Python-checkins] CVS: python/dist/src/Objects frameobject.c,2.54,2.55
Neil Schemenauer
nascheme@users.sourceforge.net
Wed, 29 Aug 2001 16:52:20 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv3356/Objects
Modified Files:
frameobject.c
Log Message:
Make frames a PyVarObject. Use new GC API.
Index: frameobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v
retrieving revision 2.54
retrieving revision 2.55
diff -C2 -d -r2.54 -r2.55
*** frameobject.c 2001/08/02 04:15:00 2.54
--- frameobject.c 2001/08/29 23:52:17 2.55
***************
*** 48,52 ****
f_nlocals number of locals
f_stacksize size of value stack
! f_size size of localsplus
Note that the value and block stacks are preserved -- this can save
another malloc() call or two (and two free() calls as well!).
--- 48,52 ----
f_nlocals number of locals
f_stacksize size of value stack
! ob_size size of localsplus
Note that the value and block stacks are preserved -- this can save
another malloc() call or two (and two free() calls as well!).
***************
*** 69,73 ****
Py_TRASHCAN_SAFE_BEGIN(f)
! PyObject_GC_Fini(f);
/* Kill all local variables */
slots = f->f_nlocals + f->f_ncells + f->f_nfreevars;
--- 69,73 ----
Py_TRASHCAN_SAFE_BEGIN(f)
! _PyObject_GC_UNTRACK(f);
/* Kill all local variables */
slots = f->f_nlocals + f->f_ncells + f->f_nfreevars;
***************
*** 126,130 ****
VISIT(*p);
}
-
return 0;
}
--- 126,129 ----
***************
*** 172,177 ****
0,
"frame",
! sizeof(PyFrameObject) + PyGC_HEAD_SIZE,
! 0,
(destructor)frame_dealloc, /* tp_dealloc */
0, /* tp_print */
--- 171,176 ----
0,
"frame",
! sizeof(PyFrameObject),
! sizeof(PyObject *),
(destructor)frame_dealloc, /* tp_dealloc */
0, /* tp_print */
***************
*** 189,193 ****
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */
0, /* tp_doc */
(traverseproc)frame_traverse, /* tp_traverse */
--- 188,192 ----
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
0, /* tp_doc */
(traverseproc)frame_traverse, /* tp_traverse */
***************
*** 242,273 ****
builtins = NULL;
if (free_list == NULL) {
! /* PyObject_New is inlined */
! f = (PyFrameObject *)
! PyObject_MALLOC(sizeof(PyFrameObject) +
! extras*sizeof(PyObject *) +
! PyGC_HEAD_SIZE);
if (f == NULL)
! return (PyFrameObject *)PyErr_NoMemory();
! f = (PyFrameObject *) PyObject_FROM_GC(f);
! PyObject_INIT(f, &PyFrame_Type);
! f->f_size = extras;
}
else {
f = free_list;
free_list = free_list->f_back;
! if (f->f_size < extras) {
! f = (PyFrameObject *) PyObject_AS_GC(f);
! f = (PyFrameObject *)
! PyObject_REALLOC(f, sizeof(PyFrameObject) +
! extras*sizeof(PyObject *) +
! PyGC_HEAD_SIZE);
if (f == NULL)
! return (PyFrameObject *)PyErr_NoMemory();
! f = (PyFrameObject *) PyObject_FROM_GC(f);
! f->f_size = extras;
}
else
! extras = f->f_size;
! PyObject_INIT(f, &PyFrame_Type);
}
if (builtins == NULL) {
--- 241,259 ----
builtins = NULL;
if (free_list == NULL) {
! f = PyObject_GC_NewVar(PyFrameObject, &PyFrame_Type, extras);
if (f == NULL)
! return NULL;
}
else {
f = free_list;
free_list = free_list->f_back;
! if (f->ob_size < extras) {
! f = PyObject_GC_Resize(PyFrameObject, f, extras);
if (f == NULL)
! return NULL;
}
else
! extras = f->ob_size;
! _Py_NewReference(f);
}
if (builtins == NULL) {
***************
*** 324,329 ****
f->f_valuestack = f->f_localsplus + (f->f_nlocals + ncells + nfrees);
f->f_stacktop = f->f_valuestack;
!
! PyObject_GC_Init(f);
return f;
}
--- 310,314 ----
f->f_valuestack = f->f_localsplus + (f->f_nlocals + ncells + nfrees);
f->f_stacktop = f->f_valuestack;
! _PyObject_GC_TRACK(f);
return f;
}
***************
*** 487,492 ****
PyFrameObject *f = free_list;
free_list = free_list->f_back;
! f = (PyFrameObject *) PyObject_AS_GC(f);
! PyObject_DEL(f);
}
}
--- 472,476 ----
PyFrameObject *f = free_list;
free_list = free_list->f_back;
! PyObject_GC_Del(f);
}
}