mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Fix --disable-jit compilation
* libguile/jit.c: Wrap the whole thing in ENABLE_JIT. * libguile/threads.c (on_thread_exit): * libguile/vm.c (scm_call_n): * libguile/init.c (scm_i_init_guile): * libguile/vm-engine.c (VM_NAME): Wrap calls into jit.c with ENABLE_JIT. * configure.ac: Move up AC_CANONICAL_TARGET, as autoconf was complaining about it coming after AC_ARG_PROGRAM. * acinclude.m4 (GUILE_ENABLE_JIT): Fix to honor --enable-jit arg.
This commit is contained in:
parent
f03ff5304a
commit
ce9169804e
7 changed files with 27 additions and 8 deletions
10
acinclude.m4
10
acinclude.m4
|
@ -581,7 +581,6 @@ AC_DEFUN([GUILE_CONFIG_SCRIPT],[AC_CONFIG_FILES([$1],[chmod +x $1])])
|
|||
|
||||
AC_DEFUN([GUILE_ENABLE_JIT], [
|
||||
JIT_AVAILABLE=no
|
||||
AC_CANONICAL_TARGET
|
||||
AC_MSG_CHECKING([if JIT code generation supported for target CPU])
|
||||
case "$target_cpu" in
|
||||
i?86|x86_64|amd64) JIT_AVAILABLE=yes ;;
|
||||
|
@ -611,12 +610,11 @@ AC_DEFUN([GUILE_ENABLE_JIT], [
|
|||
[AS_HELP_STRING([--enable-jit[=yes/no/auto]],
|
||||
[enable just-in-time code generation [default=auto]])])
|
||||
|
||||
enable_jit=auto
|
||||
AC_MSG_CHECKING([whether to enable JIT code generation])
|
||||
case "$enable_jit" in
|
||||
y*) enable_jit=yes ;;
|
||||
n*) enable_jit=no ;;
|
||||
a*) enable_jit=$JIT_AVAILABLE ;;
|
||||
case "x$enable_jit" in
|
||||
xy*) enable_jit=yes ;;
|
||||
xn*) enable_jit=no ;;
|
||||
xa* | x) enable_jit=$JIT_AVAILABLE ;;
|
||||
*) AC_MSG_ERROR(bad value $enable_jit for --enable-jit) ;;
|
||||
esac
|
||||
AC_MSG_RESULT($enable_jit)
|
||||
|
|
|
@ -31,6 +31,8 @@ AC_CONFIG_AUX_DIR([build-aux])
|
|||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_SRCDIR(GUILE-VERSION)
|
||||
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
dnl Use `serial-tests' so the output `check-guile' is not hidden
|
||||
dnl (`parallel-tests' is the default in Automake 1.13.)
|
||||
dnl `serial-tests' was introduced in Automake 1.12.
|
||||
|
|
|
@ -513,7 +513,9 @@ scm_i_init_guile (void *base)
|
|||
scm_bootstrap_i18n ();
|
||||
scm_init_script ();
|
||||
scm_init_unicode ();
|
||||
#if ENABLE_JIT
|
||||
scm_init_jit ();
|
||||
#endif
|
||||
|
||||
scm_init_goops ();
|
||||
|
||||
|
|
|
@ -22,12 +22,13 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* All of this whole file is within an ENABLE_JIT flag. */
|
||||
#if ENABLE_JIT
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#if ENABLE_JIT
|
||||
#include <lightning.h>
|
||||
#endif
|
||||
|
||||
#include "frames.h"
|
||||
#include "gsubr.h"
|
||||
|
@ -4779,3 +4780,5 @@ scm_init_jit (void)
|
|||
jit_pause_when_stopping = scm_getenv_int ("GUILE_JIT_PAUSE_WHEN_STOPPING", 0);
|
||||
jit_log_level = scm_getenv_int ("GUILE_JIT_LOG", 0);
|
||||
}
|
||||
|
||||
#endif /* ENABLE_JIT */
|
||||
|
|
|
@ -514,7 +514,9 @@ on_thread_exit (void *v)
|
|||
t->dynstack.top = NULL;
|
||||
t->dynstack.limit = NULL;
|
||||
scm_i_vm_free_stack (&t->vm);
|
||||
#if ENABLE_JIT
|
||||
scm_jit_state_free (t->jit_state);
|
||||
#endif
|
||||
t->jit_state = NULL;
|
||||
|
||||
#ifdef SCM_HAVE_THREAD_STORAGE_CLASS
|
||||
|
|
|
@ -458,6 +458,7 @@ VM_NAME (scm_thread *thread)
|
|||
*/
|
||||
VM_DEFINE_OP (5, instrument_entry, "instrument-entry", OP2 (X32, N32))
|
||||
{
|
||||
#if ENABLE_JIT
|
||||
if (!VP->disable_mcode)
|
||||
{
|
||||
struct scm_jit_function_data *data;
|
||||
|
@ -490,6 +491,7 @@ VM_NAME (scm_thread *thread)
|
|||
else
|
||||
data->counter += SCM_JIT_COUNTER_ENTRY_INCREMENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
APPLY_HOOK ();
|
||||
|
||||
|
@ -575,6 +577,7 @@ VM_NAME (scm_thread *thread)
|
|||
old_fp = VP->fp;
|
||||
VP->fp = SCM_FRAME_DYNAMIC_LINK (old_fp);
|
||||
|
||||
#if ENABLE_JIT
|
||||
if (!VP->disable_mcode)
|
||||
{
|
||||
mcode = SCM_FRAME_MACHINE_RETURN_ADDRESS (old_fp);
|
||||
|
@ -585,6 +588,7 @@ VM_NAME (scm_thread *thread)
|
|||
NEXT (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ip = SCM_FRAME_VIRTUAL_RETURN_ADDRESS (old_fp);
|
||||
NEXT (0);
|
||||
|
@ -699,6 +703,7 @@ VM_NAME (scm_thread *thread)
|
|||
SYNC_IP ();
|
||||
mcode = CALL_INTRINSIC (compose_continuation, (thread, vmcont));
|
||||
|
||||
#if ENABLE_JIT
|
||||
if (mcode && !VP->disable_mcode)
|
||||
{
|
||||
scm_jit_enter_mcode (thread, mcode);
|
||||
|
@ -706,6 +711,7 @@ VM_NAME (scm_thread *thread)
|
|||
NEXT (0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
CACHE_REGISTER ();
|
||||
NEXT (0);
|
||||
|
@ -721,6 +727,7 @@ VM_NAME (scm_thread *thread)
|
|||
*/
|
||||
VM_DEFINE_OP (14, instrument_loop, "instrument-loop", OP2 (X32, N32))
|
||||
{
|
||||
#if ENABLE_JIT
|
||||
if (!VP->disable_mcode)
|
||||
{
|
||||
int32_t data_offset = ip[1];
|
||||
|
@ -745,6 +752,7 @@ VM_NAME (scm_thread *thread)
|
|||
else
|
||||
data->counter += SCM_JIT_COUNTER_LOOP_INCREMENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
NEXT (2);
|
||||
}
|
||||
|
@ -789,8 +797,10 @@ VM_NAME (scm_thread *thread)
|
|||
|
||||
ABORT_HOOK ();
|
||||
|
||||
#if ENABLE_JIT
|
||||
if (mcode && !VP->disable_mcode)
|
||||
scm_jit_enter_mcode (thread, mcode);
|
||||
#endif
|
||||
|
||||
CACHE_REGISTER ();
|
||||
NEXT (0);
|
||||
|
|
|
@ -1588,8 +1588,10 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
|
|||
/* Non-local return. */
|
||||
if (vp->abort_hook_enabled)
|
||||
invoke_abort_hook (thread);
|
||||
#if ENABLE_JIT
|
||||
if (mcode && !vp->disable_mcode)
|
||||
scm_jit_enter_mcode (thread, mcode);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
vp->ip = get_callee_vcode (thread);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue