[pypy-svn] r47677 - pypy/dist/pypy/rpython/memory/gctransform

arigo at codespeak.net arigo at codespeak.net
Sun Oct 21 18:03:32 CEST 2007


Author: arigo
Date: Sun Oct 21 18:03:32 2007
New Revision: 47677

Modified:
   pypy/dist/pypy/rpython/memory/gctransform/framework.py
Log:
Some comments.


Modified: pypy/dist/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform/framework.py	(original)
+++ pypy/dist/pypy/rpython/memory/gctransform/framework.py	Sun Oct 21 18:03:32 2007
@@ -551,12 +551,17 @@
         args = [self.c_const_gc, c_type_id, c_size, c_can_collect,
                 c_has_finalizer, c_has_weakptr]
 
+        # push and pop the current live variables *including* the argument
+        # to the weakref_create operation, which must be kept alive and
+        # moved if the GC needs to collect
         livevars = self.push_roots(hop, keep_current_args=True)
         v_result = hop.genop("direct_call", [malloc_ptr] + args,
                              resulttype=llmemory.GCREF)
         v_result = hop.genop("cast_opaque_ptr", [v_result],
                             resulttype=WEAKREFPTR)
         self.pop_roots(hop, livevars)
+        # cast_ptr_to_adr must be done after malloc, as the GC pointer
+        # might have moved just now.
         v_instance, = op.args
         v_addr = hop.genop("cast_ptr_to_adr", [v_instance],
                            resulttype=llmemory.Address)



More information about the Pypy-commit mailing list