File: spin.c

package info (click to toggle)
rscheme 0.7.2-1.1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 10,672 kB
  • ctags: 12,430
  • sloc: lisp: 37,104; ansic: 29,763; cpp: 2,630; sh: 1,677; makefile: 568; yacc: 202; lex: 175; perl: 33
file content (86 lines) | stat: -rw-r--r-- 1,993 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*-----------------------------------------------------------------*-C-*---
 * File:    handc/runtime/spin.c
 *
 *          Copyright (C)1997 Donovan Kolbly <d.kolbly@rscheme.org>
 *          as part of the RScheme project, licensed for free use.
 *          See <http://www.rscheme.org/> for the latest information.
 *
 * File version:     1.9
 * File mod date:    1997.11.29 23:10:50
 * System build:     v0.7.2, 97.12.21
 *
 * Purpose:          Top-level quasi-interpretive loop
 *------------------------------------------------------------------------*/

#include "runtime.h"
#include "intrs.h"
#include "vinsns.h"
#include "osglue.h"

void quasi_interp_spin( jump_addr f )
{
  while (1)
    {
      /* eventually, this should be rolled
	 into the prologue of each monotone
	 for now, we probably don't allocate more than 1000 or so
	 words in any given monotone */

      safe_point( SLOT(3000) );

#ifdef SIGUSR_HOOKS
      if (sigusr1_flag)
	{
	  sigusr1_flag = 0;
	  run_sigusr_hook(1);
	}
      if (sigusr2_flag)
	{
	  sigusr2_flag = 0;
	  run_sigusr_hook(2);
	}
#endif
      if (rssig_ready)
	{
	  if (rsprof_active)
	    rsprof_mt_intr();
	  f = dispatch_interrupt(f);
	}
      
#ifdef TIMEPOINT
      timepoint( VAL(literals_reg) + 0x80000000 );
#endif
      if (rsprof_active)
	rsprof_mt_start(f);
      f = (jump_addr) f();
      if (rsprof_active)
	rsprof_mt_done();

#ifdef TIMEPOINT
      timepoint( VAL(literals_reg) + 0x80000000 );
#endif
      if (rsprof_active)
	rsprof_mt_start(f);
      f = (jump_addr) f();
      if (rsprof_active)
	rsprof_mt_done();

#ifdef TIMEPOINT
      timepoint( VAL(literals_reg) + 0x80000000 );
#endif
      if (rsprof_active)
	rsprof_mt_start(f);
      f = (jump_addr) f();
      if (rsprof_active)
	rsprof_mt_done();
      
#ifdef TIMER_IS_MONOTONE_COUNTER
      if (system_timeout && (--system_timeout == 0))
	{
	  struct RSSIG_info t;
	  t.signum = RSSIG_TIMEOUT;
	  os_enqueue_sig( &t );
	}
#endif /* TIMER_IS_MONOTONE_COUNTER */
    }
}