[uim-commit] r2053 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Mon Nov 7 04:40:08 PST 2005
Author: yamaken
Date: 2005-11-07 04:40:04 -0800 (Mon, 07 Nov 2005)
New Revision: 2053
Modified:
branches/r5rs/sigscheme/operations-srfi34.c
branches/r5rs/sigscheme/sigschemeinternal.h
branches/r5rs/sigscheme/sigschemetype.h
branches/r5rs/sigscheme/storage-continuation.c
branches/r5rs/sigscheme/storage-gc.c
branches/r5rs/sigscheme/storage.c
Log:
* sigscheme/sigschemeinternal.h
* sigscheme/storage-continuation.c
* sigscheme/storage-gc.c
* sigscheme/operations-srfi34.c
* sigscheme/storage.c
* sigscheme/sigschemetype.h
- Revert r2051 since it conflicts my plan. Please don't touch
around continuation and SRFI-34 until my reorganization
Modified: branches/r5rs/sigscheme/operations-srfi34.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi34.c 2005-11-07 11:10:10 UTC (rev 2052)
+++ branches/r5rs/sigscheme/operations-srfi34.c 2005-11-07 12:40:04 UTC (rev 2053)
@@ -50,6 +50,8 @@
/*=======================================
File Local Macro Declarations
=======================================*/
+#define CONTINUATION_JMPENV SCM_CONTINUATION_OPAQUE0
+#define CONTINUATION_SET_JMPENV SCM_CONTINUATION_SET_OPAQUE0
/*=======================================
Variable Declarations
@@ -100,8 +102,8 @@
ASSERT_PROCEDUREP(handler);
ASSERT_PROCEDUREP(thunk);
- SCM_CONTINUATION_SET_JMPENV(cont, &jmpenv);
- if (setjmp(SCM_CONTINUATION_JMPENV(cont))) {
+ CONTINUATION_SET_JMPENV(cont, &jmpenv);
+ if (setjmp(CONTINUATION_JMPENV(cont))) {
ret = Scm_call(CURRENT_EXCEPTION_HANDLER(), LIST_1(exception_thrown_obj));
POP_EXCEPTION_CONTINUATION();
POP_EXCEPTION_HANDLER();
@@ -141,8 +143,8 @@
ASSERT_SYMBOLP(var);
/* check if return from "raise" */
- SCM_CONTINUATION_SET_JMPENV(cont, &jmpenv);
- if (setjmp(SCM_CONTINUATION_JMPENV(cont))) {
+ CONTINUATION_SET_JMPENV(cont, &jmpenv);
+ if (setjmp(CONTINUATION_JMPENV(cont))) {
POP_EXCEPTION_CONTINUATION();
env = Scm_ExtendEnvironment(LIST_1(var), LIST_1(exception_thrown_obj), env);
return guard_handle_clauses(clauses, env);
@@ -240,7 +242,7 @@
exception_thrown_obj = obj;
- env = SCM_CONTINUATION_JMPENV(CURRENT_EXCEPTION_CONTINUATION());
+ env = CONTINUATION_JMPENV(CURRENT_EXCEPTION_CONTINUATION());
longjmp(*env, 1);
/* never reaches here */
Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h 2005-11-07 11:10:10 UTC (rev 2052)
+++ branches/r5rs/sigscheme/sigschemeinternal.h 2005-11-07 12:40:04 UTC (rev 2053)
@@ -319,6 +319,10 @@
/* Macros For Handling Continuation Object */
#define INVALID_CONTINUATION_JMPENV NULL
+#define CONTINUATION_JMPENV SCM_CONTINUATION_OPAQUE0
+#define CONTINUATION_SET_JMPENV SCM_CONTINUATION_SET_OPAQUE0
+#define CONTINUATION_DYNEXT SCM_CONTINUATION_OPAQUE1
+#define CONTINUATION_SET_DYNEXT SCM_CONTINUATION_SET_OPAQUE1
/* Symbol Name Hash Size */
#define NAMEHASH_SIZE 1024
Modified: branches/r5rs/sigscheme/sigschemetype.h
===================================================================
--- branches/r5rs/sigscheme/sigschemetype.h 2005-11-07 11:10:10 UTC (rev 2052)
+++ branches/r5rs/sigscheme/sigschemetype.h 2005-11-07 12:40:04 UTC (rev 2053)
@@ -38,7 +38,6 @@
System Include
=======================================*/
#include <stdio.h>
-#include <setjmp.h>
/*=======================================
Local Include
@@ -158,11 +157,6 @@
#define SCM_CHARCELL_SIZE 8
-struct ScmContinuationInfo {
- void *jmpenv;
- ScmObj dynext;
-};
-
/* Scheme Object */
struct ScmCell_ {
enum ScmObjType type;
@@ -218,7 +212,8 @@
} port;
struct ScmContinuation {
- struct ScmContinuationInfo *info;
+ void *opaque0;
+ void *opaque1;
} continuation;
#if !SCM_USE_VALUECONS
@@ -340,14 +335,12 @@
#define SCM_PORT_IMPL(a) (SCM_AS_PORT(a)->obj.port.impl)
#define SCM_PORT_SET_IMPL(a, impl) (SCM_PORT_IMPL(a) = (impl))
-#define SCM_CONTINUATIONP(a) (SCM_TYPE(a) == ScmContinuation)
-#define SCM_ENTYPE_CONTINUATION(a) (SCM_ENTYPE((a), ScmContinuation))
-#define SCM_CONTINUATION_INFO(a) (SCM_AS_CONTINUATION(a)->obj.continuation.info)
-#define SCM_CONTINUATION_SET_INFO(a, info) (SCM_CONTINUATION_INFO(a) = info)
-#define SCM_CONTINUATION_JMPENV(a) (SCM_CONTINUATION_INFO(a)->jmpenv)
-#define SCM_CONTINUATION_SET_JMPENV(a, env) (SCM_CONTINUATION_JMPENV(a) = (void*)env)
-#define SCM_CONTINUATION_DYNEXT(a) (SCM_CONTINUATION_INFO(a)->dynext)
-#define SCM_CONTINUATION_SET_DYNEXT(a, dyn) (SCM_CONTINUATION_DYNEXT(a) = dyn)
+#define SCM_CONTINUATIONP(a) (SCM_TYPE(a) == ScmContinuation)
+#define SCM_ENTYPE_CONTINUATION(a) (SCM_ENTYPE((a), ScmContinuation))
+#define SCM_CONTINUATION_OPAQUE0(a) (SCM_AS_CONTINUATION(a)->obj.continuation.opaque0)
+#define SCM_CONTINUATION_SET_OPAQUE0(a, val) (SCM_CONTINUATION_OPAQUE0(a) = (val))
+#define SCM_CONTINUATION_OPAQUE1(a) (SCM_AS_CONTINUATION(a)->obj.continuation.opaque1)
+#define SCM_CONTINUATION_SET_OPAQUE1(a, val) (SCM_CONTINUATION_OPAQUE1(a) = (val))
#if SCM_USE_VALUECONS
/* to modify a VALUECONS, rewrite its type to cons by SCM_ENTYPE_CONS(vcons) */
Modified: branches/r5rs/sigscheme/storage-continuation.c
===================================================================
--- branches/r5rs/sigscheme/storage-continuation.c 2005-11-07 11:10:10 UTC (rev 2052)
+++ branches/r5rs/sigscheme/storage-continuation.c 2005-11-07 12:40:04 UTC (rev 2053)
@@ -227,7 +227,7 @@
cont = continuation_stack_pop();
if (FALSEP(cont))
return SCM_FALSE;
- SCM_CONTINUATION_SET_JMPENV(cont, INVALID_CONTINUATION_JMPENV);
+ CONTINUATION_SET_JMPENV(cont, INVALID_CONTINUATION_JMPENV);
} while (!EQ(dest_cont, cont));
return dest_cont;
@@ -241,7 +241,7 @@
struct trace_frame *saved_trace_stack;
cont = Scm_NewContinuation();
- SCM_CONTINUATION_SET_JMPENV(cont, &env);
+ CONTINUATION_SET_JMPENV(cont, &env);
#if SCM_NESTED_CONTINUATION_ONLY
continuation_stack_push(cont);
#endif
@@ -252,7 +252,7 @@
continuation_thrown_obj = SCM_FALSE; /* make ret sweepable */
trace_stack = saved_trace_stack;
- enter_dynamic_extent(SCM_CONTINUATION_DYNEXT(cont));
+ enter_dynamic_extent(CONTINUATION_DYNEXT(cont));
eval_state->ret_type = SCM_RETTYPE_AS_IS;
return ret;
@@ -285,7 +285,7 @@
{
jmp_buf *env;
- env = SCM_CONTINUATION_JMPENV(cont);
+ env = CONTINUATION_JMPENV(cont);
if (env != INVALID_CONTINUATION_JMPENV
#if SCM_NESTED_CONTINUATION_ONLY
@@ -293,7 +293,7 @@
#endif
)
{
- exit_dynamic_extent(SCM_CONTINUATION_DYNEXT(cont));
+ exit_dynamic_extent(CONTINUATION_DYNEXT(cont));
continuation_thrown_obj = ret;
longjmp(*env, 1);
Modified: branches/r5rs/sigscheme/storage-gc.c
===================================================================
--- branches/r5rs/sigscheme/storage-gc.c 2005-11-07 11:10:10 UTC (rev 2052)
+++ branches/r5rs/sigscheme/storage-gc.c 2005-11-07 12:40:04 UTC (rev 2053)
@@ -564,12 +564,8 @@
SCM_PORT_CLOSE_IMPL(obj);
break;
- case ScmContinuation:
- if (SCM_CONTINUATION_INFO(obj))
- free(SCM_CONTINUATION_INFO(obj));
- break;
-
/* rarely swept objects */
+ case ScmContinuation:
case ScmFunc:
case ScmConstant:
case ScmFreeCell:
Modified: branches/r5rs/sigscheme/storage.c
===================================================================
--- branches/r5rs/sigscheme/storage.c 2005-11-07 11:10:10 UTC (rev 2052)
+++ branches/r5rs/sigscheme/storage.c 2005-11-07 12:40:04 UTC (rev 2053)
@@ -284,14 +284,11 @@
ScmObj Scm_NewContinuation(void)
{
ScmObj obj = SigScm_NewObjFromHeap();
- struct ScmContinuationInfo *info = (struct ScmContinuationInfo*)malloc(sizeof(struct ScmContinuationInfo));
SCM_ENTYPE_CONTINUATION(obj);
+ CONTINUATION_SET_JMPENV(obj, INVALID_CONTINUATION_JMPENV);
+ CONTINUATION_SET_DYNEXT(obj, scm_current_dynamic_extent);
- SCM_CONTINUATION_SET_INFO(obj, info);
- SCM_CONTINUATION_SET_JMPENV(obj, INVALID_CONTINUATION_JMPENV);
- SCM_CONTINUATION_SET_DYNEXT(obj, scm_current_dynamic_extent);
-
return obj;
}
More information about the uim-commit
mailing list