[pypy-svn] r30337 - in pypy/dist/pypy/translator: backendopt c/src
cfbolz at codespeak.net
cfbolz at codespeak.net
Fri Jul 21 22:27:03 CEST 2006
Author: cfbolz
Date: Fri Jul 21 22:27:02 2006
New Revision: 30337
Modified:
pypy/dist/pypy/translator/backendopt/escape.py
pypy/dist/pypy/translator/c/src/mem.h
Log:
(arigo, cfbolz mostly watching): argh! two bugs in heap2stack analysis:
* alloca'ed memory was not zero'ed
* problem in the dependency handling of escape analysis
Modified: pypy/dist/pypy/translator/backendopt/escape.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/escape.py (original)
+++ pypy/dist/pypy/translator/backendopt/escape.py Fri Jul 21 22:27:02 2006
@@ -217,13 +217,11 @@
"state1 depends on state2: if state2 does escape/change, so does state1"
# change state1 according to how state2 is now
#print "registering dependency of %s on %s" % (state1, state2)
- escapes = state2.does_escape()
- if escapes and not state1.does_escape():
- changed = state1.setescapes()
- self.handle_changed(changed)
- changes = state2.does_change()
- if changes and not state1.does_change():
- changed = state1.setchanges()
+ if state2.does_escape():
+ changed = state1.setescapes() # mark all crep's as escaping
+ self.handle_changed(changed)
+ if state2.does_change():
+ changed = state1.setchanges() # mark all crep's as changing
self.handle_changed(changed)
# register a dependency of the current block on state2:
# that means that if state2 changes the current block will be reflown
Modified: pypy/dist/pypy/translator/c/src/mem.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/mem.h (original)
+++ pypy/dist/pypy/translator/c/src/mem.h Fri Jul 21 22:27:02 2006
@@ -10,10 +10,11 @@
#define alloca _alloca
#endif
-#define OP_STACK_MALLOC(size,r,restype) \
- r = (restype) alloca(size); \
- if (r == NULL) FAIL_EXCEPTION(PyExc_MemoryError, "out of memory");\
-
+#define OP_STACK_MALLOC(size,r,restype) \
+ r = (restype) alloca(size); \
+ if (r == NULL) FAIL_EXCEPTION(PyExc_MemoryError, "out of memory"); \
+ memset((void*) r, 0, size);
+
#define OP_RAW_FREE(x,r) OP_FREE(x)
#define OP_RAW_MEMCOPY(x,y,size,r) memcpy(y,x,size);
More information about the Pypy-commit
mailing list