[uim-commit] r1567 - branches/r5rs/sigscheme

yamaken at freedesktop.org yamaken at freedesktop.org
Sat Sep 24 06:05:22 PDT 2005


Author: yamaken
Date: 2005-09-24 06:05:18 -0700 (Sat, 24 Sep 2005)
New Revision: 1567

Modified:
   branches/r5rs/sigscheme/sigscheme.h
   branches/r5rs/sigscheme/storage-protection.c
Log:
* This commit makes the GCC4-ready GC certainly workable on other
  compilers that performs the optimization like GCC4 (out-of-order
  variable layout in a frame)

* sigscheme/sigscheme.h
  - (scm_gc_protect_stack, scm_gc_ensure_uninlined_func): New variable
    decl
  - (SigScm_GC_EnsureUninlinedFuncInternal,
    SigScm_GC_ProtectStackInternal): New function decl
  - (SigScm_GC_ProtectStack, SigScm_GC_EnsureUninlinedFunc): Replace
    with alias to real function reflecting the enviroment by macro
    definition
  - Move "Variable Declarations" section to after "Macro Declarations"
    section since the declarations needs macro
* sigscheme/storage-protection.c
  - (scm_gc_protect_stack, scm_gc_ensure_uninlined_func): New variable
  - (SigScm_GC_ProtectStack): Rename to SigScm_GC_ProtectStackInternal
  - (SigScm_GC_ProtectStackInternal): Renamed from SigScm_GC_ProtectStack
  - (SigScm_GC_EnsureUninlinedFunc): Rename to
    SigScm_GC_EnsureUninlinedFuncInternal
  - (SigScm_GC_EnsureUninlinedFuncInternal): Renamed from
    SigScm_GC_EnsureUninlinedFunc


Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h	2005-09-24 11:52:21 UTC (rev 1566)
+++ branches/r5rs/sigscheme/sigscheme.h	2005-09-24 13:05:18 UTC (rev 1567)
@@ -59,10 +59,6 @@
 #include "sigschemetype.h"
 
 /*=======================================
-   Variable Declarations
-=======================================*/
-
-/*=======================================
    Macro Declarations
 =======================================*/
 /* FIXME: split off to config.h */
@@ -156,6 +152,19 @@
 #endif /* SCM_GCC4_READY_GC */
 
 /*=======================================
+   Variable Declarations
+=======================================*/
+/* storage-protection.c */
+#if SCM_GCC4_READY_GC
+/*
+ * For ensuring that these function calls be uninlined. Dont' access these
+ * variables directly.
+ */
+extern ScmObj (*scm_gc_protect_stack)(ScmObj *);
+extern ScmCFunc (*scm_gc_ensure_uninlined_func)(ScmCFunc);
+#endif /* SCM_GCC4_READY_GC */
+
+/*=======================================
    Function Declarations
 =======================================*/
 /*===========================================================================
@@ -213,9 +222,17 @@
  * Ordinary programs should not call these functions directly. Use
  * SCM_GC_CALL_PROTECTED_*FUNC() instead.
  */
-ScmObj *SigScm_GC_ProtectStack(ScmObj *designated_stack_start) SCM_NOINLINE;
+#ifdef __GNUC__
+#define SigScm_GC_ProtectStack SigScm_GC_ProtectStackInternal
+#define SigScm_GC_EnsureUninlinedFunc SigScm_GC_EnsureUninlinedFuncInternal
+#else /* __GNUC__ */
+#define SigScm_GC_ProtectStack (*scm_gc_protect_stack)
+#define SigScm_GC_EnsureUninlinedFunc (*scm_gc_ensure_uninlined_func)
+#endif /* __GNUC__ */
 void SigScm_GC_UnprotectStack(ScmObj *stack_start);
-ScmCFunc SigScm_GC_EnsureUninlinedFunc(ScmCFunc func) SCM_NOINLINE;
+
+ScmObj *SigScm_GC_ProtectStackInternal(ScmObj *designated_stack_start) SCM_NOINLINE;
+ScmCFunc SigScm_GC_EnsureUninlinedFuncInternal(ScmCFunc func) SCM_NOINLINE;
 #endif /* SCM_GCC4_READY_GC */
 
 /* eval.c */

Modified: branches/r5rs/sigscheme/storage-protection.c
===================================================================
--- branches/r5rs/sigscheme/storage-protection.c	2005-09-24 11:52:21 UTC (rev 1566)
+++ branches/r5rs/sigscheme/storage-protection.c	2005-09-24 13:05:18 UTC (rev 1567)
@@ -212,6 +212,19 @@
 /*=======================================
   Variable Declarations
 =======================================*/
+#if SCM_GCC4_READY_GC
+/*
+ * For ensuring that these function calls be uninlined. Don't access these
+ * variables directly.
+ *
+ * Exporting the variables ensures that a expression (*f)() is certainly real
+ * function call since the variables can be updated from outside of
+ * libsscm. Therefore, be avoid making the variables static by combining
+ * libsscm into other codes which enables function inlining for them.
+ */
+ScmObj (*scm_gc_protect_stack)(ScmObj *) = &SigScm_GC_ProtectStackInternal;
+ScmCFunc (*scm_gc_ensure_uninlined_func)(ScmCFunc) = &SigScm_GC_EnsureUninlinedFuncInternal;
+#endif /* SCM_GCC4_READY_GC */
 
 /*=======================================
   File Local Function Declarations
@@ -225,7 +238,7 @@
   Function Implementations
 =======================================*/
 #if SCM_GCC4_READY_GC
-ScmObj *SigScm_GC_ProtectStack(ScmObj *designated_stack_start)
+ScmObj *SigScm_GC_ProtectStackInternal(ScmObj *designated_stack_start)
 {
     /*
      * &stack_start will be relocated to start of the frame of subsequent
@@ -249,7 +262,7 @@
         scm_stack_start_pointer = NULL;
 }
 
-ScmCFunc SigScm_GC_EnsureUninlinedFunc(ScmCFunc func)
+ScmCFunc SigScm_GC_EnsureUninlinedFuncInternal(ScmCFunc func)
 {
     return func;
 }



More information about the uim-commit mailing list