aboutsummaryrefslogtreecommitdiffstats
path: root/erts/configure.in
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-09-19 06:33:06 +0200
committerBjörn Gustavsson <[email protected]>2017-10-05 12:37:56 +0200
commit22d2a00aebf0eef878af95d8b7598adbfca06e7e (patch)
treef5598c7bd2d965fa9416d4e0e1ec11925e71a173 /erts/configure.in
parente1c9772ffdacae4007209ac5a82758b8e0d3cec4 (diff)
downloadotp-22d2a00aebf0eef878af95d8b7598adbfca06e7e.tar.gz
otp-22d2a00aebf0eef878af95d8b7598adbfca06e7e.tar.bz2
otp-22d2a00aebf0eef878af95d8b7598adbfca06e7e.zip
Use 32-bits pointers to C code
On a 64-bit machine, we only need 32 bits to store a pointer to the C code that implements a BEAM instruction. Refactor the code to only use the lower 32 bits of each instruction word, and take care to preserve the high 32 bits.
Diffstat (limited to 'erts/configure.in')
-rw-r--r--erts/configure.in33
1 files changed, 33 insertions, 0 deletions
diff --git a/erts/configure.in b/erts/configure.in
index 85e167b93b..508e99a415 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -3774,6 +3774,39 @@ dnl
LM_FIND_EMU_CC
dnl
+dnl Test whether code pointers are always short (32 bits).
+dnl
+
+AC_MSG_CHECKING([whether the code model is small])
+saved_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $HIPEBEAMLDFLAGS"
+AC_TRY_RUN([
+ #include <stdlib.h>
+ int main() {
+ if ((unsigned long long)&main < (1ull << 32)) {
+ exit(0);
+ }
+ exit(1);
+ }
+],
+erl_code_model_small=yes,
+erl_code_model_small=no,
+erl_code_model_small=no)
+AC_MSG_RESULT([$erl_code_model_small])
+LDFLAGS="$saved_LDFLAGS"
+case $erl_code_model_small in
+ yes)
+ AC_DEFINE(CODE_MODEL_SMALL,[1],
+ [Define if the code model is small (code fits below 2Gb)])
+ CODE_MODEL=small
+ ;;
+ no)
+ CODE_MODEL=unknown
+ ;;
+esac
+AC_SUBST(CODE_MODEL)
+
+dnl
dnl DTrace & LTTNG
dnl
case $DYNAMIC_TRACE_FRAMEWORK in