[pypy-commit] pypy vmprof-0.4.8: more fixes for mvsc (copied over from vmprof-python)

plan_rich pypy.commits at gmail.com
Mon Jun 5 16:52:00 EDT 2017


Author: Richard Plangger <planrichi at gmail.com>
Branch: vmprof-0.4.8
Changeset: r91545:32433b2340ea
Date: 2017-06-05 16:51 -0400
http://bitbucket.org/pypy/pypy/changeset/32433b2340ea/

Log:	more fixes for mvsc (copied over from vmprof-python)

diff --git a/rpython/rlib/rvmprof/__init__.py b/rpython/rlib/rvmprof/__init__.py
--- a/rpython/rlib/rvmprof/__init__.py
+++ b/rpython/rlib/rvmprof/__init__.py
@@ -9,7 +9,6 @@
 # See README.txt.
 #
 
-
 #vmprof_execute_code(): implemented directly in rvmprof.py
 
 def register_code_object_class(CodeClass, full_name_func):
diff --git a/rpython/rlib/rvmprof/src/shared/_vmprof.c b/rpython/rlib/rvmprof/src/shared/_vmprof.c
--- a/rpython/rlib/rvmprof/src/shared/_vmprof.c
+++ b/rpython/rlib/rvmprof/src/shared/_vmprof.c
@@ -83,8 +83,11 @@
 
 static int _look_for_code_object(PyObject *o, void * param)
 {
-    PyObject * all_codes = (PyObject*)((void**)param)[0];
-    PyObject * seen_codes = (PyObject*)((void**)param)[1];
+    int i;
+    PyObject * all_codes, * seen_codes;
+
+    all_codes = (PyObject*)((void**)param)[0];
+    seen_codes = (PyObject*)((void**)param)[1];
     if (PyCode_Check(o) && !PySet_Contains(all_codes, o)) {
         PyCodeObject *co = (PyCodeObject *)o;
         PyObject * id = PyLong_FromVoidPtr((void*)CODE_ADDR_TO_UID(co));
@@ -101,7 +104,7 @@
            objects are not created as GC-aware in CPython, so we need
            to hack like this to hope to find most of them. 
         */
-        int i = PyTuple_Size(co->co_consts);
+        i = PyTuple_Size(co->co_consts);
         while (i > 0) {
             --i;
             if (_look_for_code_object(PyTuple_GET_ITEM(co->co_consts, i),
@@ -117,6 +120,7 @@
 {
     PyObject *gc_module = NULL, *lst = NULL, *all_codes = NULL;
     Py_ssize_t i, size;
+    void * param[2];
 
     gc_module = PyImport_ImportModuleNoBlock("gc");
     if (gc_module == NULL)
@@ -132,7 +136,6 @@
     if (all_codes == NULL)
         goto error;
 
-    void * param[2];
     param[0] = all_codes;
     param[1] = seen_code_ids;
 


More information about the pypy-commit mailing list