[uim-commit] r1571 - branches/r5rs/uim

yamaken at freedesktop.org yamaken at freedesktop.org
Sat Sep 24 06:57:10 PDT 2005


Author: yamaken
Date: 2005-09-24 06:57:08 -0700 (Sat, 24 Sep 2005)
New Revision: 1571

Modified:
   branches/r5rs/uim/uim-scm-gc.c
   branches/r5rs/uim/uim-scm.h
Log:
* uim/uim-scm-gc.c
* uim/uim-scm.h
  - Port r1570 from trunk


Modified: branches/r5rs/uim/uim-scm-gc.c
===================================================================
--- branches/r5rs/uim/uim-scm-gc.c	2005-09-24 13:52:34 UTC (rev 1570)
+++ branches/r5rs/uim/uim-scm-gc.c	2005-09-24 13:57:08 UTC (rev 1571)
@@ -41,6 +41,23 @@
 #error "UIM_SCM_GCC4_READY_GC requires SCM_GCC4_READY_GC-enabled SigScheme"
 #endif
 
+/*
+ * 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
+ * libuim. Therefore, be avoid making the variables static by combining libuim
+ * into other codes which enables function inlining for them.
+ */
+uim_lisp *(*uim_scm_gc_protect_stack_ptr)(void)
+     = &uim_scm_gc_protect_stack_internal;
+uim_func_ptr (*uim_scm_gc_ensure_uninlined_func_ptr)(uim_func_ptr)
+     = &uim_scm_gc_ensure_uninlined_func_internal;
+#endif /* UIM_SCM_GCC4_READY_GC */
+
+#if UIM_SCM_GCC4_READY_GC
+
 void
 uim_scm_gc_protect(uim_lisp *location)
 {
@@ -48,7 +65,7 @@
 }
 
 uim_lisp *
-uim_scm_gc_protect_stack(void)
+uim_scm_gc_protect_stack_internal(void)
 {
   /*
    * &stack_start will be relocated to start of the frame of subsequent
@@ -56,6 +73,7 @@
    */
   ScmObj stack_start;
 
+  /* intentionally returns invalidated local address */
   return (uim_lisp *)SigScm_GC_ProtectStack(&stack_start);
 }
 
@@ -66,7 +84,7 @@
 }
 
 uim_func_ptr
-uim_scm_gc_ensure_uninlined_func(uim_func_ptr func)
+uim_scm_gc_ensure_uninlined_func_internal(uim_func_ptr func)
 {
   return func;
 }

Modified: branches/r5rs/uim/uim-scm.h
===================================================================
--- branches/r5rs/uim/uim-scm.h	2005-09-24 13:52:34 UTC (rev 1570)
+++ branches/r5rs/uim/uim-scm.h	2005-09-24 13:57:08 UTC (rev 1571)
@@ -85,6 +85,21 @@
 #define NFALSEP(x) (!uim_scm_eq(x, uim_scm_f()))
 
 
+#if UIM_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
+ * libuim. Therefore, be avoid making the variables static by combining libuim
+ * into other codes which enables function inlining for them.
+ */
+extern uim_lisp *(*uim_scm_gc_protect_stack_ptr)(void);
+extern uim_func_ptr (*uim_scm_gc_ensure_uninlined_func_ptr)(uim_func_ptr);
+#endif /* UIM_SCM_GCC4_READY_GC */
+
+
 /* 'uim_scm' prefix is not appropriate for these functions... any ideas? */
 FILE *
 uim_scm_get_output(void);
@@ -131,14 +146,26 @@
         uim_scm_gc_unprotect_stack(stack_start);                             \
     } while (/* CONSTCOND */ 0)
 
+/*
+ * Ordinary programs should not call these functions directly. Use
+ * UIM_SCM_GC_CALL_PROTECTED_*FUNC() instead.
+ */
+#ifdef __GNUC__
+#define uim_scm_gc_protect_stack uim_scm_gc_protect_stack_internal
+#define uim_scm_gc_ensure_uninlined_func uim_scm_gc_ensure_uninlined_func_internal
+#else /* __GNUC__ */
+#define uim_scm_gc_protect_stack (*uim_scm_gc_protect_stack_ptr)
+#define uim_scm_gc_ensure_uninlined_func (*uim_scm_gc_ensure_uninlined_func_ptr)
+#endif /* __GNUC__ */
 void
 uim_scm_gc_protect(uim_lisp *location);
-uim_lisp *
-uim_scm_gc_protect_stack(void) UIM_SCM_NOINLINE;
 void
 uim_scm_gc_unprotect_stack(uim_lisp *stack_start);
+
+uim_lisp *
+uim_scm_gc_protect_stack_internal(void) UIM_SCM_NOINLINE;
 uim_func_ptr
-uim_scm_gc_ensure_uninlined_func(uim_func_ptr func) UIM_SCM_NOINLINE;
+uim_scm_gc_ensure_uninlined_func_internal(uim_func_ptr func) UIM_SCM_NOINLINE;
 #else /* UIM_SCM_GCC4_READY_GC */
 void
 uim_scm_gc_protect(uim_lisp *location);



More information about the uim-commit mailing list