1 /* { dg-do compile } */
2 /* { dg-require-effective-target int32plus } */
3 /* { dg-require-effective-target label_values } */
4 /* { dg-require-effective-target indirect_jumps } */
5 
6 typedef int int32_t;
7 typedef unsigned char uint8_t;
8 typedef unsigned long int uintptr_t;
9 typedef uint8_t scm_t_uint8;
10 typedef int32_t scm_t_int32;
11 typedef uintptr_t scm_t_uintptr;
12 typedef scm_t_uintptr scm_t_bits;
13 typedef struct scm_unused_struct {
14 } *SCM;
15 enum scm_tc8_tags {
16     scm_tc8_flag = 4 + 0x00,   scm_tc8_char = 4 + 0x08,   scm_tc8_unused_0 = 4 + 0x10,   scm_tc8_unused_1 = 4 + 0x18 };
17 struct __jmp_buf_tag   {
18 };
19 typedef struct __jmp_buf_tag jmp_buf[1];
20 typedef struct scm_t_cell {
21 } scm_t_cell;
22 struct scm_prompt_registers {
23     jmp_buf regs;
24 };
25 enum {
26     SCM_VM_APPLY_HOOK,   SCM_VM_PUSH_CONTINUATION_HOOK,   SCM_VM_POP_CONTINUATION_HOOK,   SCM_VM_NEXT_HOOK,   SCM_VM_ABORT_CONTINUATION_HOOK,   SCM_VM_RESTORE_CONTINUATION_HOOK,   SCM_VM_NUM_HOOKS, };
27 typedef SCM (*scm_t_vm_engine) (SCM vm, SCM program, SCM *argv, int nargs);
28 struct scm_vm {
29     scm_t_uint8 *ip;
30     SCM *sp;
31     SCM *fp;
32     int engine;
33     int trace_level;
34 };
vm_regular_engine(SCM vm,SCM program,SCM * argv,int nargs)35 static SCM vm_regular_engine (SCM vm, SCM program, SCM *argv, int nargs) {
36 }
37 void vm_dispatch_hook ();
38 int _setjmp ();
vm_debug_engine(SCM vm,SCM program,SCM * argv,int nargs)39 static SCM vm_debug_engine (SCM vm, SCM program, SCM *argv, int nargs) {
40     register scm_t_uint8 *ip ;
41     register SCM *sp ;
42     register SCM *fp ;
43     struct scm_vm *vp = ((struct scm_vm *) ((((scm_t_bits) (0? (*(SCM*)0=((((SCM *)((scm_t_cell *) (((scm_t_bits) (0? (*(SCM*)0=((((vm))))): (((vm)))))))) [((1))]))): (((SCM *)((scm_t_cell *) (((scm_t_bits) (0? (*(SCM*)0=((((vm))))): (((vm)))))))) [((1))]))))));
44     static const void **jump_table_pointer = ((void *)0);
45     const void **jump_table;
46     if (__builtin_expect ((!jump_table_pointer), 0))     {
47 	jump_table_pointer[0] = &&l_nop;
48     }
49 l_nop:
50       {
51 	SCM *old_sp;
52 	scm_t_int32 n;
53 	old_sp = sp;
54 	sp = (fp - 1) + n;
55 	if (old_sp < sp)     {
56 	    while (old_sp < sp)         *++old_sp = ((SCM) ((((((9)) << 8) + scm_tc8_flag))));
57 	}
58 	  {
59 	      { if (__builtin_expect ((vp->trace_level > 0), 0)) { { vp->ip = ip; vp->sp = sp; vp->fp = fp; }; vm_dispatch_hook (vm, SCM_VM_NEXT_HOOK); } };
60 	  };
61       }
62       {
63 	SCM k, prompt;
64 	if ((_setjmp (((struct scm_prompt_registers*)((((scm_t_bits) (0? (*(SCM*)0=((((SCM *)((scm_t_cell *) (((scm_t_bits) (0? (*(SCM*)0=((((prompt))))): (((prompt)))))))) [((2))]))): (((SCM *)((scm_t_cell *) (((scm_t_bits) (0? (*(SCM*)0=((((prompt))))): (((prompt)))))))) [((2))]))))))->regs)))     {
65 	      { ip = vp->ip; sp = vp->sp; fp = vp->fp; };
66 	      { { if (__builtin_expect ((vp->trace_level > 0), 0)) { { vp->ip = ip; vp->sp = sp; vp->fp = fp; }; vm_dispatch_hook (vm, SCM_VM_NEXT_HOOK); } }; ; goto *jump_table[(*ip++) & ((1<<8)-1)]; };
67 	}
68 
69 	if (__builtin_expect ((vp->trace_level > 0), 0)) { { vp->ip = ip; vp->sp = sp; vp->fp = fp; }; vm_dispatch_hook (vm, SCM_VM_NEXT_HOOK); } ;
70 
71       }
72 }
73 static const scm_t_vm_engine vm_engines[] =   {
74     vm_regular_engine, vm_debug_engine };
scm_c_vm_run(SCM vm,SCM program,SCM * argv,int nargs)75 SCM scm_c_vm_run (SCM vm, SCM program, SCM *argv, int nargs) {
76     struct scm_vm *vp = ((struct scm_vm *) ((((scm_t_bits) (0? (*(SCM*)0=((((SCM *)((scm_t_cell *) (((scm_t_bits) (0? (*(SCM*)0=((((vm))))): (((vm)))))))) [((1))]))): (((SCM *)((scm_t_cell *) (((scm_t_bits) (0? (*(SCM*)0=((((vm))))): (((vm)))))))) [((1))]))))));
77     return vm_engines[vp->engine](vm, program, argv, nargs);
78 }
79