chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] remove enable/disable interrupt flag


From: Alan Post
Subject: Re: [Chicken-users] remove enable/disable interrupt flag
Date: Thu, 29 Sep 2011 07:17:09 -0600

On Thu, Sep 29, 2011 at 07:12:20AM -0600, Alan Post wrote:
> This patch removes the enable/disable interrupt flag from the
> scheduled.
> 
> I can't see that this code is referenced.  I'm not sure someone
> would just write this feature for fun, however.  Is this code
> actually used?
> 
> I'm preparing a larger patch for the signal handling code, so
> knowing whether this is used (and how) is important for getting
> my next set of patches correct.
> 
> -Alan
> -- 
> .i ma'a lo bradi cu penmi gi'e du

Let's attach the patch, shall we?  Reviewing this, I had to add a
thunk to the "C_fudge" routine, case 14.  It is not the least bit
obvious what that routine does, or how case 14 gets called.  What
is that?  It's the only part I don't consider straightforward, other
than my already mentioned use of this feature I'm not seeing.

diff --git a/chicken.h b/chicken.h
index 8c6eff3..1739fb9 100644
--- a/chicken.h
+++ b/chicken.h
@@ -1527,8 +1527,6 @@ C_fctexport C_word C_fcall C_callback_wrapper(void *proc, 
int argc);
 C_fctexport void C_fcall C_callback_adjust_stack(C_word *base, int size);
 C_fctexport void CHICKEN_parse_command_line(int argc, char *argv[], C_word 
*heap, C_word *stack, C_word *symbols);
 C_fctexport void C_fcall C_toplevel_entry(C_char *name) C_regparm;
-C_fctexport C_word C_fcall C_enable_interrupts(void) C_regparm;
-C_fctexport C_word C_fcall C_disable_interrupts(void) C_regparm;
 C_fctexport void C_fcall C_paranoid_check_for_interrupt(void) C_regparm;
 C_fctexport void C_zap_strings(C_word str);
 C_fctexport void C_set_or_change_heap_size(C_word heap, int reintern);
diff --git a/runtime.c b/runtime.c
index c0c91bc..980f303 100644
--- a/runtime.c
+++ b/runtime.c
@@ -331,7 +331,6 @@ C_TLS int
   C_gui_mode = 0,
   C_abort_on_thread_exceptions,
   C_enable_repl,
-  C_interrupts_enabled,
   C_disable_overflow_check,
 #ifdef C_COLLECT_ALL_SYMBOLS
   C_enable_gcweak = 1,
@@ -697,7 +696,6 @@ int CHICKEN_initialize(int heap, int stack, int symbols, 
void *toplevel)
   chicken_is_running = chicken_ran_once = 0;
   interrupt_reason = 0;
   last_interrupt_latency = 0;
-  C_interrupts_enabled = 1;
   C_initial_timer_interrupt_period = INITIAL_TIMER_INTERRUPT_PERIOD;
   C_timer_interrupt_counter = INITIAL_TIMER_INTERRUPT_PERIOD;
   memset(signal_mapping_table, 0, sizeof(int) * NSIG);
@@ -2669,7 +2667,7 @@ C_regparm void C_fcall C_reclaim(void *trampoline, void 
*proc)
 
   /* assert(C_timer_interrupt_counter >= 0); */
 
-  if(interrupt_reason && C_interrupts_enabled)
+  if(interrupt_reason)
     handle_interrupt(trampoline, proc);
 
   /* Note: the mode argument will always be GC_MINOR or GC_REALLOC. */
@@ -4102,8 +4100,9 @@ C_regparm C_word C_fcall C_fudge(C_word fudge_factor)
   case C_fix(13):              /* debug mode */
     return C_mk_bool(debug_mode);
 
+  /* XXX: Where is this called from, how do we deprecate it? */
   case C_fix(14):              /* interrupts enabled? */
-    return C_mk_bool(C_interrupts_enabled);
+    return C_mk_bool(1);
 
   case C_fix(15):              /* symbol-gc enabled? */
     return C_mk_bool(C_enable_gcweak);
@@ -4244,34 +4243,16 @@ C_regparm void C_fcall 
C_paranoid_check_for_interrupt(void)
 
 C_regparm void C_fcall C_raise_interrupt(int reason)
 {
-  if(C_interrupts_enabled) {
-    saved_stack_limit = C_stack_limit;
+  saved_stack_limit = C_stack_limit;
 
 #if C_STACK_GROWS_DOWNWARD
-    C_stack_limit = C_stack_pointer + 1000;
+  C_stack_limit = C_stack_pointer + 1000;
 #else
-    C_stack_limit = C_stack_pointer - 1000;
+  C_stack_limit = C_stack_pointer - 1000;
 #endif
 
-    interrupt_reason = reason;
-    interrupt_time = C_cpu_milliseconds();
-  }
-}
-
-
-C_regparm C_word C_fcall C_enable_interrupts(void)
-{
-  C_timer_interrupt_counter = C_initial_timer_interrupt_period;
-  /* assert(C_timer_interrupt_counter > 0); */
-  C_interrupts_enabled = 1;
-  return C_SCHEME_UNDEFINED;
-}
-
-
-C_regparm C_word C_fcall C_disable_interrupts(void)
-{
-  C_interrupts_enabled = 0;
-  return C_SCHEME_UNDEFINED;
+  interrupt_reason = reason;
+  interrupt_time = C_cpu_milliseconds();
 }
 
 
-- 
.i ma'a lo bradi cu penmi gi'e du



reply via email to

[Prev in Thread] Current Thread [Next in Thread]