summaryrefslogtreecommitdiff
path: root/runtime/caml/stack.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/caml/stack.h')
-rw-r--r--runtime/caml/stack.h75
1 files changed, 10 insertions, 65 deletions
diff --git a/runtime/caml/stack.h b/runtime/caml/stack.h
index 6b7df0e670..85d9b391e1 100644
--- a/runtime/caml/stack.h
+++ b/runtime/caml/stack.h
@@ -25,9 +25,9 @@
#ifdef TARGET_i386
#define Saved_return_address(sp) *((intnat *)((sp) - 4))
#ifndef SYS_win32
-#define Callback_link(sp) ((struct caml_context *)((sp) + 16))
+#define Callback_link(sp) ((struct caml_context *)((sp) + 16)) //FIXME KC
#else
-#define Callback_link(sp) ((struct caml_context *)((sp) + 8))
+#define Callback_link(sp) ((struct caml_context *)((sp) + 8)) //FIXME KC
#endif
#endif
@@ -52,22 +52,23 @@
#ifdef TARGET_s390x
#define Saved_return_address(sp) *((intnat *)((sp) - SIZEOF_PTR))
#define Trap_frame_size 16
-#define Callback_link(sp) ((struct caml_context *)((sp) + Trap_frame_size))
+#define Callback_link(sp) ((struct caml_context *)((sp) + Trap_frame_size)) //FIXME KC
#endif
#ifdef TARGET_arm
#define Saved_return_address(sp) *((intnat *)((sp) - 4))
-#define Callback_link(sp) ((struct caml_context *)((sp) + 8))
+#define Callback_link(sp) ((struct caml_context *)((sp) + 8)) //FIXME KC
#endif
#ifdef TARGET_amd64
+/* Size of the gc_regs structure, in words. See amd64.S and amd64/proc.ml for the indices */
+#define Wosize_gc_regs (13 /* int regs */ + 16 /* float regs */)
#define Saved_return_address(sp) *((intnat *)((sp) - 8))
-#define Callback_link(sp) ((struct caml_context *)((sp) + 16))
#endif
#ifdef TARGET_arm64
#define Saved_return_address(sp) *((intnat *)((sp) - 8))
-#define Callback_link(sp) ((struct caml_context *)((sp) + 16))
+#define Context_needs_padding /* keep stack 16-byte aligned */
#endif
#ifdef TARGET_riscv
@@ -78,72 +79,16 @@
/* Structure of OCaml callback contexts */
struct caml_context {
- char * bottom_of_stack; /* beginning of OCaml stack chunk */
- uintnat last_retaddr; /* last return address in OCaml code */
+ uintnat exception_ptr; /* exception pointer */
value * gc_regs; /* pointer to register block */
-#ifdef WITH_SPACETIME
- void* trie_node;
+#ifdef Context_needs_padding
+ value padding;
#endif
};
-/* Structure of frame descriptors */
-
-typedef struct {
- uintnat retaddr;
- unsigned short frame_size;
- unsigned short num_live;
- unsigned short live_ofs[1 /* num_live */];
- /*
- If frame_size & 2, then allocation info follows:
- unsigned char num_allocs;
- unsigned char alloc_lengths[num_alloc];
-
- If frame_size & 1, then debug info follows:
- uint32_t debug_info_offset[num_debug];
-
- Debug info is stored as relative offsets to debuginfo structures.
- num_debug is num_alloc if frame_size & 2, otherwise 1. */
-} frame_descr;
-
-/* Allocation lengths are encoded as 0-255, giving sizes 1-256 */
-#define Wosize_encoded_alloc_len(n) ((uintnat)(n) + 1)
-
-/* Used to compute offsets in frame tables.
- ty must have power-of-2 size */
-#define Align_to(p, ty) \
- (void*)(((uintnat)(p) + sizeof(ty) - 1) & -sizeof(ty))
-
-
-/* Hash table of frame descriptors */
-
-extern frame_descr ** caml_frame_descriptors;
-extern uintnat caml_frame_descriptors_mask;
-
-#define Hash_retaddr(addr) \
- (((uintnat)(addr) >> 3) & caml_frame_descriptors_mask)
-
-extern void caml_init_frame_descriptors(void);
-extern void caml_register_frametable(intnat *);
-extern void caml_unregister_frametable(intnat *);
-extern void caml_register_dyn_global(void *);
-
-extern uintnat caml_stack_usage (void);
-extern uintnat (*caml_stack_usage_hook)(void);
-
/* Declaration of variables used in the asm code */
extern value * caml_globals[];
-extern char caml_globals_map[];
extern intnat caml_globals_inited;
-extern intnat * caml_frametable[];
-
-/* Global variables moved to Caml_state in 4.10 */
-#define caml_top_of_stack (Caml_state_field(top_of_stack))
-#define caml_bottom_of_stack (Caml_state_field(bottom_of_stack))
-#define caml_last_return_address (Caml_state_field(last_return_address))
-#define caml_gc_regs (Caml_state_field(gc_regs))
-#define caml_exception_pointer (Caml_state_field(exception_pointer))
-
-CAMLextern frame_descr * caml_next_frame_descriptor(uintnat * pc, char ** sp);
#endif /* CAML_INTERNALS */