Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.12.1+esy #64

Open
wants to merge 3 commits into
base: 4.12.1+esy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ OCaml 4.12, maintenance version
code or an OCaml thread stops.
(Xavier Leroy, review by David Allsopp, Florian Angeletti and Damien Doligez)

- #11358, #11378: Refactor the initialization of bytecode threading.
This avoids a "dangling pointer" warning of GCC 12.1.
(Xavier Leroy, report by Armaël Guéneau, review by Gabriel Scherer)

OCaml 4.12.1 (24 September 2021)
--------------------------------

Expand Down
3 changes: 1 addition & 2 deletions runtime/caml/fix_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ void caml_set_instruction (code_t pos, opcode_t instr);
int caml_is_instruction (opcode_t instr1, opcode_t instr2);

#ifdef THREADED_CODE
extern char ** caml_instr_table;
extern char * caml_instr_base;
void caml_init_thread_code(void ** instr_table, void * instr_base);
void caml_thread_code (code_t code, asize_t len);
#endif

Expand Down
10 changes: 8 additions & 2 deletions runtime/fix_code.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,14 @@ void caml_fixup_endianness(code_t code, asize_t len)

#ifdef THREADED_CODE

char ** caml_instr_table;
char * caml_instr_base;
static char ** caml_instr_table;
static char * caml_instr_base;

void caml_init_thread_code(void ** instr_table, void * instr_base)
{
caml_instr_table = (char **) instr_table;
caml_instr_base = (char *) instr_base;
}

static int* opcode_nargs = NULL;
int* caml_init_opcode_nargs(void)
Expand Down
7 changes: 3 additions & 4 deletions runtime/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ sp is a local copy of the global variable Caml_state->extern_sp. */
#ifdef THREADED_CODE
# define Instruct(name) lbl_##name
# if defined(ARCH_SIXTYFOUR) && !defined(ARCH_CODE32)
# define Jumptbl_base ((char *) &&lbl_ACC0)
# define Jumptbl_base &&lbl_ACC0
# else
# define Jumptbl_base ((char *) 0)
# define Jumptbl_base 0
# define jumptbl_base ((char *) 0)
# endif
# ifdef DEBUG
Expand Down Expand Up @@ -249,8 +249,7 @@ value caml_interprete(code_t prog, asize_t prog_size)

if (prog == NULL) { /* Interpreter is initializing */
#ifdef THREADED_CODE
caml_instr_table = (char **) jumptable;
caml_instr_base = Jumptbl_base;
caml_init_thread_code(jumptable, Jumptbl_base);
#endif
return Val_unit;
}
Expand Down