~ubuntu-branches/debian/sid/ocaml/sid

« back to all changes in this revision

Viewing changes to byterun/interp.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Zacchiroli
  • Date: 2009-02-22 08:49:13 UTC
  • mfrom: (12.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090222084913-3i0uw2bhd0lgw0ok
* Uploading to unstable
* debian/control: bump dh-ocaml to (>= 0.4) to avoid buggy ocamlinit.mk

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
/*                                                                     */
12
12
/***********************************************************************/
13
13
 
14
 
/* $Id: interp.c,v 1.96 2006/08/18 14:51:59 xleroy Exp $ */
 
14
/* $Id: interp.c,v 1.97 2008/08/01 11:52:31 xleroy Exp $ */
15
15
 
16
16
/* The bytecode interpreter */
17
17
#include <stdio.h>
66
66
 
67
67
#define Setup_for_gc \
68
68
  { sp -= 2; sp[0] = accu; sp[1] = env; caml_extern_sp = sp; }
69
 
#define Restore_after_gc { accu = sp[0]; env = sp[1]; sp += 2; }
70
 
#define Setup_for_c_call { saved_pc = pc; *--sp = env; caml_extern_sp = sp; }
71
 
#define Restore_after_c_call { sp = caml_extern_sp; env = *sp++; }
 
69
#define Restore_after_gc \
 
70
  { accu = sp[0]; env = sp[1]; sp += 2; }
 
71
#define Setup_for_c_call \
 
72
  { saved_pc = pc; *--sp = env; caml_extern_sp = sp; }
 
73
#define Restore_after_c_call \
 
74
  { sp = caml_extern_sp; env = *sp++; saved_pc = NULL; }
72
75
 
73
76
/* An event frame must look like accu + a C_CALL frame + a RETURN 1 frame */
74
77
#define Setup_for_event \
211
214
  /* volatile ensures that initial_local_roots and saved_pc
212
215
     will keep correct value across longjmp */
213
216
  struct caml__roots_block * volatile initial_local_roots;
214
 
  volatile code_t saved_pc;
 
217
  volatile code_t saved_pc = NULL;
215
218
  struct longjmp_buffer raise_buf;
216
219
  value * modify_dest, modify_newval;
217
220
#ifndef THREADED_CODE
245
248
    caml_local_roots = initial_local_roots;
246
249
    sp = caml_extern_sp;
247
250
    accu = caml_exn_bucket;
248
 
    pc = saved_pc + 2; /* +2 adjustement for the sole purpose of backtraces */
 
251
    pc = saved_pc; saved_pc = NULL;
 
252
    if (pc != NULL) pc += 2;
 
253
        /* +2 adjustement for the sole purpose of backtraces */
249
254
    goto raise_exception;
250
255
  }
251
256
  caml_external_raise = &raise_buf;