[MLton] cvs commit: changed profile labels in the C codegen

sweeks@mlton.org sweeks@mlton.org
Fri, 12 Dec 2003 11:32:04 -0800


sweeks      03/12/12 11:32:04

  Modified:    include  c-chunk.h
  Log:
  MAIL changed profile labels in the C codegen
  
  There was a problem that would show up when using the C codegen and
  newer gcc's.  We used to have DeclareProfileLabel and ProfileLabel in
  the C codegen defined as
  
  #define DeclareProfileLabel(l)			\
  	void l() __attribute__ ((weak))
  
  #define ProfileLabel(l)				\
  	__asm__ __volatile__ (#l ":" : : )
  
  DeclareProfileLabel caused the label to be a global symbol defined in
  the text segment, where the actual definition got stuck into the
  assembly code.  But, with newer gcc's (3.2.2, 3.3.2), for some reason
  the symbol is not global, and hence is not available to the profiling
  infrastructure.  So, I changed DeclareProfileLabel and ProfileLabel to
  
  #define DeclareProfileLabel(l)			\
  	void l() __attribute__ ((alias (#l "_internal")))
  
  #define ProfileLabel(l)				\
  	__asm__ __volatile__ (#l "_internal:" : : )
  
  This does cause the label to be global with both newer and older
  gcc's.

Revision  Changes    Path
1.19      +2 -2      mlton/include/c-chunk.h

Index: c-chunk.h
===================================================================
RCS file: /cvsroot/mlton/mlton/include/c-chunk.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- c-chunk.h	10 Dec 2003 19:15:21 -0000	1.18
+++ c-chunk.h	12 Dec 2003 19:32:03 -0000	1.19
@@ -175,10 +175,10 @@
 	} while (0)								\
 
 #define DeclareProfileLabel(l)			\
-	void l() __attribute__ ((weak))
+	void l() __attribute__ ((alias (#l "_internal")))
 
 #define ProfileLabel(l)				\
-	__asm__ __volatile__ (#l ":" : : )
+	__asm__ __volatile__ (#l "_internal:" : : )
 
 #define SmallIntInf(n) ((Pointer)(n))