Skip to content

Commit

Permalink
Conditionally moved some contextual C globals back out of the struct,…
Browse files Browse the repository at this point in the history
… if they are accessed by the assembly runtime in some ports; this lets us keep existing assembly runtimes with no changes
  • Loading branch information
luca committed Sep 16, 2013
1 parent 0a0c1b3 commit 68c37b3
Show file tree
Hide file tree
Showing 7 changed files with 312 additions and 257 deletions.
5 changes: 5 additions & 0 deletions asmrun/backtrace.c
Expand Up @@ -113,6 +113,11 @@ void caml_stash_backtrace_r(CAML_R, value exn, uintnat pc, char * sp, char * tra
}
}

/* Compatibility version, called by the assembly runtime in some ports: */
void caml_stash_backtrace(value exn, uintnat pc, char * sp, char * trapsp){
caml_stash_backtrace_r(caml_get_thread_local_context(), exn, pc, sp, trapsp);
}

/* Extract location information for the given frame descriptor */

struct loc_info {
Expand Down
6 changes: 6 additions & 0 deletions asmrun/fail.c
Expand Up @@ -223,6 +223,12 @@ void caml_array_bound_error_r(CAML_R)
caml_raise_r(ctx, (value) &array_bound_error_bucket.exn);
}

/* Compatibility version, called by the assembly runtime in some ports: */
void caml_array_bound_error(void){
caml_array_bound_error_r(caml_get_thread_local_context());
}


int caml_is_special_exception_r(CAML_R, value exn) {
return exn == (value) caml_exn_Match_failure
|| exn == (value) caml_exn_Assert_failure
Expand Down
38 changes: 19 additions & 19 deletions asmrun/power-elf.S
Expand Up @@ -11,25 +11,25 @@
/* */
/***********************************************************************/

/* experimental hack: begin */
/* This works and isn't too complicated, but has to be done by hand on
each architecture (on all shitty asseblers, actually; with GNU as
everywhere it wouldn't be that hard). Sadly, it will have to go.
--L.S. */
#define BYTES_PER_WORD 4
.equiv caml_young_limit, the_one_and_only_context_struct + BYTES_PER_WORD*0
.equiv caml_young_ptr, the_one_and_only_context_struct + BYTES_PER_WORD*1
.equiv caml_last_return_address, the_one_and_only_context_struct + BYTES_PER_WORD*2
.equiv caml_bottom_of_stack, the_one_and_only_context_struct + BYTES_PER_WORD*3
.equiv caml_gc_regs, the_one_and_only_context_struct + BYTES_PER_WORD*4
.equiv caml_exception_pointer, the_one_and_only_context_struct + BYTES_PER_WORD*5
.equiv caml_backtrace_active, the_one_and_only_context_struct + BYTES_PER_WORD*6
.section ".data"
.globl caml_globals_inited
/* .type caml_globals_inited, @object */
caml_globals_inited:
.long 1 /* one descriptor */
/* experimental hack: end */
;; /* experimental hack: begin */
;; /* This works and isn't too complicated, but has to be done by hand on
;; each architecture (on all shitty asseblers, actually; with GNU as
;; everywhere it wouldn't be that hard). Sadly, it will have to go.
;; --L.S. */
;; #define BYTES_PER_WORD 4
;; .equiv caml_young_limit, the_one_and_only_context_struct + BYTES_PER_WORD*0
;; .equiv caml_young_ptr, the_one_and_only_context_struct + BYTES_PER_WORD*1
;; .equiv caml_last_return_address, the_one_and_only_context_struct + BYTES_PER_WORD*2
;; .equiv caml_bottom_of_stack, the_one_and_only_context_struct + BYTES_PER_WORD*3
;; .equiv caml_gc_regs, the_one_and_only_context_struct + BYTES_PER_WORD*4
;; .equiv caml_exception_pointer, the_one_and_only_context_struct + BYTES_PER_WORD*5
;; .equiv caml_backtrace_active, the_one_and_only_context_struct + BYTES_PER_WORD*6
;; .section ".data"
;; .globl caml_globals_inited
;; /* .type caml_globals_inited, @object */
;; caml_globals_inited:
;; .long 1 /* one descriptor */
;; /* experimental hack: end */

/* $Id$ */

Expand Down
Binary file modified boot/ocamlrun
Binary file not shown.
Binary file modified boot/ocamlrun.boot
Binary file not shown.

0 comments on commit 68c37b3

Please sign in to comment.