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], [
|
AC_DEFUN([GUILE_ENABLE_JIT], [
|
||||||
JIT_AVAILABLE=no
|
JIT_AVAILABLE=no
|
||||||
AC_CANONICAL_TARGET
|
|
||||||
AC_MSG_CHECKING([if JIT code generation supported for target CPU])
|
AC_MSG_CHECKING([if JIT code generation supported for target CPU])
|
||||||
case "$target_cpu" in
|
case "$target_cpu" in
|
||||||
i?86|x86_64|amd64) JIT_AVAILABLE=yes ;;
|
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]],
|
[AS_HELP_STRING([--enable-jit[=yes/no/auto]],
|
||||||
[enable just-in-time code generation [default=auto]])])
|
[enable just-in-time code generation [default=auto]])])
|
||||||
|
|
||||||
enable_jit=auto
|
|
||||||
AC_MSG_CHECKING([whether to enable JIT code generation])
|
AC_MSG_CHECKING([whether to enable JIT code generation])
|
||||||
case "$enable_jit" in
|
case "x$enable_jit" in
|
||||||
y*) enable_jit=yes ;;
|
xy*) enable_jit=yes ;;
|
||||||
n*) enable_jit=no ;;
|
xn*) enable_jit=no ;;
|
||||||
a*) enable_jit=$JIT_AVAILABLE ;;
|
xa* | x) enable_jit=$JIT_AVAILABLE ;;
|
||||||
*) AC_MSG_ERROR(bad value $enable_jit for --enable-jit) ;;
|
*) AC_MSG_ERROR(bad value $enable_jit for --enable-jit) ;;
|
||||||
esac
|
esac
|
||||||
AC_MSG_RESULT($enable_jit)
|
AC_MSG_RESULT($enable_jit)
|
||||||
|
|
|
@ -31,6 +31,8 @@ AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AC_CONFIG_SRCDIR(GUILE-VERSION)
|
AC_CONFIG_SRCDIR(GUILE-VERSION)
|
||||||
|
|
||||||
|
AC_CANONICAL_TARGET
|
||||||
|
|
||||||
dnl Use `serial-tests' so the output `check-guile' is not hidden
|
dnl Use `serial-tests' so the output `check-guile' is not hidden
|
||||||
dnl (`parallel-tests' is the default in Automake 1.13.)
|
dnl (`parallel-tests' is the default in Automake 1.13.)
|
||||||
dnl `serial-tests' was introduced in Automake 1.12.
|
dnl `serial-tests' was introduced in Automake 1.12.
|
||||||
|
|
|
@ -513,7 +513,9 @@ scm_i_init_guile (void *base)
|
||||||
scm_bootstrap_i18n ();
|
scm_bootstrap_i18n ();
|
||||||
scm_init_script ();
|
scm_init_script ();
|
||||||
scm_init_unicode ();
|
scm_init_unicode ();
|
||||||
|
#if ENABLE_JIT
|
||||||
scm_init_jit ();
|
scm_init_jit ();
|
||||||
|
#endif
|
||||||
|
|
||||||
scm_init_goops ();
|
scm_init_goops ();
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,13 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* All of this whole file is within an ENABLE_JIT flag. */
|
||||||
|
#if ENABLE_JIT
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
#if ENABLE_JIT
|
|
||||||
#include <lightning.h>
|
#include <lightning.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "frames.h"
|
#include "frames.h"
|
||||||
#include "gsubr.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_pause_when_stopping = scm_getenv_int ("GUILE_JIT_PAUSE_WHEN_STOPPING", 0);
|
||||||
jit_log_level = scm_getenv_int ("GUILE_JIT_LOG", 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.top = NULL;
|
||||||
t->dynstack.limit = NULL;
|
t->dynstack.limit = NULL;
|
||||||
scm_i_vm_free_stack (&t->vm);
|
scm_i_vm_free_stack (&t->vm);
|
||||||
|
#if ENABLE_JIT
|
||||||
scm_jit_state_free (t->jit_state);
|
scm_jit_state_free (t->jit_state);
|
||||||
|
#endif
|
||||||
t->jit_state = NULL;
|
t->jit_state = NULL;
|
||||||
|
|
||||||
#ifdef SCM_HAVE_THREAD_STORAGE_CLASS
|
#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))
|
VM_DEFINE_OP (5, instrument_entry, "instrument-entry", OP2 (X32, N32))
|
||||||
{
|
{
|
||||||
|
#if ENABLE_JIT
|
||||||
if (!VP->disable_mcode)
|
if (!VP->disable_mcode)
|
||||||
{
|
{
|
||||||
struct scm_jit_function_data *data;
|
struct scm_jit_function_data *data;
|
||||||
|
@ -490,6 +491,7 @@ VM_NAME (scm_thread *thread)
|
||||||
else
|
else
|
||||||
data->counter += SCM_JIT_COUNTER_ENTRY_INCREMENT;
|
data->counter += SCM_JIT_COUNTER_ENTRY_INCREMENT;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
APPLY_HOOK ();
|
APPLY_HOOK ();
|
||||||
|
|
||||||
|
@ -575,6 +577,7 @@ VM_NAME (scm_thread *thread)
|
||||||
old_fp = VP->fp;
|
old_fp = VP->fp;
|
||||||
VP->fp = SCM_FRAME_DYNAMIC_LINK (old_fp);
|
VP->fp = SCM_FRAME_DYNAMIC_LINK (old_fp);
|
||||||
|
|
||||||
|
#if ENABLE_JIT
|
||||||
if (!VP->disable_mcode)
|
if (!VP->disable_mcode)
|
||||||
{
|
{
|
||||||
mcode = SCM_FRAME_MACHINE_RETURN_ADDRESS (old_fp);
|
mcode = SCM_FRAME_MACHINE_RETURN_ADDRESS (old_fp);
|
||||||
|
@ -585,6 +588,7 @@ VM_NAME (scm_thread *thread)
|
||||||
NEXT (0);
|
NEXT (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ip = SCM_FRAME_VIRTUAL_RETURN_ADDRESS (old_fp);
|
ip = SCM_FRAME_VIRTUAL_RETURN_ADDRESS (old_fp);
|
||||||
NEXT (0);
|
NEXT (0);
|
||||||
|
@ -699,6 +703,7 @@ VM_NAME (scm_thread *thread)
|
||||||
SYNC_IP ();
|
SYNC_IP ();
|
||||||
mcode = CALL_INTRINSIC (compose_continuation, (thread, vmcont));
|
mcode = CALL_INTRINSIC (compose_continuation, (thread, vmcont));
|
||||||
|
|
||||||
|
#if ENABLE_JIT
|
||||||
if (mcode && !VP->disable_mcode)
|
if (mcode && !VP->disable_mcode)
|
||||||
{
|
{
|
||||||
scm_jit_enter_mcode (thread, mcode);
|
scm_jit_enter_mcode (thread, mcode);
|
||||||
|
@ -706,6 +711,7 @@ VM_NAME (scm_thread *thread)
|
||||||
NEXT (0);
|
NEXT (0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
CACHE_REGISTER ();
|
CACHE_REGISTER ();
|
||||||
NEXT (0);
|
NEXT (0);
|
||||||
|
@ -721,6 +727,7 @@ VM_NAME (scm_thread *thread)
|
||||||
*/
|
*/
|
||||||
VM_DEFINE_OP (14, instrument_loop, "instrument-loop", OP2 (X32, N32))
|
VM_DEFINE_OP (14, instrument_loop, "instrument-loop", OP2 (X32, N32))
|
||||||
{
|
{
|
||||||
|
#if ENABLE_JIT
|
||||||
if (!VP->disable_mcode)
|
if (!VP->disable_mcode)
|
||||||
{
|
{
|
||||||
int32_t data_offset = ip[1];
|
int32_t data_offset = ip[1];
|
||||||
|
@ -745,6 +752,7 @@ VM_NAME (scm_thread *thread)
|
||||||
else
|
else
|
||||||
data->counter += SCM_JIT_COUNTER_LOOP_INCREMENT;
|
data->counter += SCM_JIT_COUNTER_LOOP_INCREMENT;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
NEXT (2);
|
NEXT (2);
|
||||||
}
|
}
|
||||||
|
@ -789,8 +797,10 @@ VM_NAME (scm_thread *thread)
|
||||||
|
|
||||||
ABORT_HOOK ();
|
ABORT_HOOK ();
|
||||||
|
|
||||||
|
#if ENABLE_JIT
|
||||||
if (mcode && !VP->disable_mcode)
|
if (mcode && !VP->disable_mcode)
|
||||||
scm_jit_enter_mcode (thread, mcode);
|
scm_jit_enter_mcode (thread, mcode);
|
||||||
|
#endif
|
||||||
|
|
||||||
CACHE_REGISTER ();
|
CACHE_REGISTER ();
|
||||||
NEXT (0);
|
NEXT (0);
|
||||||
|
|
|
@ -1588,8 +1588,10 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
|
||||||
/* Non-local return. */
|
/* Non-local return. */
|
||||||
if (vp->abort_hook_enabled)
|
if (vp->abort_hook_enabled)
|
||||||
invoke_abort_hook (thread);
|
invoke_abort_hook (thread);
|
||||||
|
#if ENABLE_JIT
|
||||||
if (mcode && !vp->disable_mcode)
|
if (mcode && !vp->disable_mcode)
|
||||||
scm_jit_enter_mcode (thread, mcode);
|
scm_jit_enter_mcode (thread, mcode);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vp->ip = get_callee_vcode (thread);
|
vp->ip = get_callee_vcode (thread);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue