aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/hipe/hipe_mkliterals.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2015-08-31 16:56:02 +0200
committerSverker Eriksson <[email protected]>2015-08-31 16:56:02 +0200
commit6e3a0870ebd992ed410298e859066894134be9f6 (patch)
treecbf491004dc00c90dbc4a7aa5d757cfd1444d9bc /erts/emulator/hipe/hipe_mkliterals.c
parentb5eba8b61ce3ea0058ba37df288738586c68d6ac (diff)
downloadotp-6e3a0870ebd992ed410298e859066894134be9f6.tar.gz
otp-6e3a0870ebd992ed410298e859066894134be9f6.tar.bz2
otp-6e3a0870ebd992ed410298e859066894134be9f6.zip
erts,hipe,dialyzer: Fix hipe checkum of target runtime system
Main problem: A faulty HIPE_LITERAL_CRC was not detected by the loader. Strangeness #1: Dialyzer should ask the hipe compiler about the target checksum, not an internal bif. Strangeness #2: The HIPE_SYSTEM_CRC checksum was based on the HIPE_LITERALS_CRC checksum. Solution: New HIPE_ERTS_CHECKSUM which is an bxor of the two (now independent) HIPE_LITERALS_CRC and HIPE_SYSTEM_CRC. HIPE_LITERALS_CRC represents values that are assumed to stay constant for different VM configurations of the same arch, and are therefor hard coded into the hipe compiler. HIPE_SYSTEM_CRC represents values that may differ between VM variants. By default the hipe compiler asks the running VM for this checksum, in order to create beam files for the same running VM. The hipe compiler can be configured (with "make XCOMP=yes ...") to create beam files for another VM variant, in which case HIPE_SYSTEM_CRC is also hard coded. ToDo: Treat all erts properties the same. Either ask the running VM or hard coded into hipe (if XCOMP=yes). This will simplify and reduce the risk of dangerous mismatches. One concern might be the added overhead from more frequent calls to hipe_bifs:get_rts_param.
Diffstat (limited to 'erts/emulator/hipe/hipe_mkliterals.c')
-rw-r--r--erts/emulator/hipe/hipe_mkliterals.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/erts/emulator/hipe/hipe_mkliterals.c b/erts/emulator/hipe/hipe_mkliterals.c
index b7009aec77..dfa5313739 100644
--- a/erts/emulator/hipe/hipe_mkliterals.c
+++ b/erts/emulator/hipe/hipe_mkliterals.c
@@ -542,6 +542,8 @@ static void compute_crc(void)
crc_value = crc_update_int(crc_value, &literals[i].value);
crc_value &= 0x07FFFFFF;
literals_crc = crc_value;
+
+ crc_value = crc_init();
for (i = 0; i < NR_PARAMS; ++i)
if (rts_params[i].is_defined)
crc_value = crc_update_int(crc_value, &rts_params[i].value);
@@ -627,6 +629,7 @@ static int do_c(FILE *fp, const char* this_exe)
print_params(fp, c_define_param);
fprintf(fp, "#define HIPE_LITERALS_CRC %uU\n", literals_crc);
fprintf(fp, "#define HIPE_SYSTEM_CRC %uU\n", system_crc);
+ fprintf(fp, "#define HIPE_ERTS_CHECKSUM (HIPE_LITERALS_CRC ^ HIPE_SYSTEM_CRC)\n");
fprintf(fp, "\n");
fprintf(fp, "#define RTS_PARAMS_CASES");
print_params(fp, c_case_param);
@@ -644,12 +647,14 @@ static int do_e(FILE *fp, const char* this_exe)
fprintf(fp, "\n");
print_params(fp, e_define_param);
fprintf(fp, "\n");
+ fprintf(fp, "-define(HIPE_LITERALS_CRC, %u).\n", literals_crc);
if (is_xcomp) {
fprintf(fp, "-define(HIPE_SYSTEM_CRC, %u).\n", system_crc);
}
else {
fprintf(fp, "-define(HIPE_SYSTEM_CRC, hipe_bifs:system_crc()).\n");
}
+ fprintf(fp, "-define(HIPE_ERTS_CHECKSUM, (?HIPE_LITERALS_CRC bxor ?HIPE_SYSTEM_CRC)).\n");
return 0;
}