[uim-commit] r1570 - trunk/uim
yamaken at freedesktop.org
yamaken at freedesktop.org
Sat Sep 24 06:52:40 PDT 2005
Author: yamaken
Date: 2005-09-24 06:52:34 -0700 (Sat, 24 Sep 2005)
New Revision: 1570
Modified:
trunk/uim/uim-scm-gc.c
trunk/uim/uim-scm.h
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).
Although the codes are closely similar to the equivalent for
SigScheme rescently implemented by me, I commit these codes under
the copyright of uim as separately originated from me
* uim/uim-scm.h
- (uim_scm_gc_protect_stack_ptr,
uim_scm_gc_ensure_uninlined_func_ptr): New variable decl
- (uim_scm_gc_protect_stack_internal,
uim_scm_gc_ensure_uninlined_func_internal): New function decl
- (uim_scm_gc_protect_stack, uim_scm_gc_ensure_uninlined_func):
Replace with alias to real function reflecting the enviroment by
macro definition
* uim/uim-scm-gc.c
- (uim_scm_gc_protect_stack_ptr,
uim_scm_gc_ensure_uninlined_func_ptr): New variable
- (uim_scm_gc_protect_stack): Rename to
uim_scm_gc_protect_stack_internal
- (uim_scm_gc_protect_stack_internal): Renamed from
uim_scm_gc_protect_stack
- (uim_scm_gc_ensure_uninlined_func): Rename to
uim_scm_gc_ensure_uninlined_func_internal
- (uim_scm_gc_ensure_uninlined_func_internal): Renamed from
uim_scm_gc_ensure_uninlined_func
Modified: trunk/uim/uim-scm-gc.c
===================================================================
--- trunk/uim/uim-scm-gc.c 2005-09-24 13:43:32 UTC (rev 1569)
+++ trunk/uim/uim-scm-gc.c 2005-09-24 13:52:34 UTC (rev 1570)
@@ -36,6 +36,22 @@
#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.
+ */
+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)
{
@@ -43,7 +59,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
@@ -53,6 +69,7 @@
siod_gc_protect_stack(&stack_start);
+ /* intentionally returns invalidated local address */
return (uim_lisp *)&stack_start;
}
@@ -63,7 +80,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: trunk/uim/uim-scm.h
===================================================================
--- trunk/uim/uim-scm.h 2005-09-24 13:43:32 UTC (rev 1569)
+++ trunk/uim/uim-scm.h 2005-09-24 13:52:34 UTC (rev 1570)
@@ -75,6 +75,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);
@@ -121,14 +136,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