From 3769a48cd726115b039b0c20361ebb069b637edc Mon Sep 17 00:00:00 2001 From: theraven Date: Fri, 27 May 2011 09:44:12 +0000 Subject: [PATCH] Add an ugly hack to prevent a clever optimiser from realising that it can completely optimise objc_clear_stack() away. --- gc_boehm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gc_boehm.c b/gc_boehm.c index 343b383..960ba3e 100644 --- a/gc_boehm.c +++ b/gc_boehm.c @@ -489,6 +489,10 @@ void objc_clear_stack(unsigned long options) // portably. int i[1024]; memset(&i, 0, 1024); + // Tell the compiler that something that it doesn't know about is touching + // this memory, so it shouldn't optimise the allocation and memset away. + __asm__ volatile ("" : : "m"(i) : "memory"); + } // FIXME: These are all stub implementations that should be replaced with // something better