diff options
author | Sverker Eriksson <[email protected]> | 2011-05-25 11:25:31 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2011-10-26 18:22:56 +0200 |
commit | 37d25fa469a6a084737abf8f980c1e4bb34ca9d9 (patch) | |
tree | 2456c81ac2c03b63f83b116af52400627a2449f3 | |
parent | 01c734e6a60bb9579c00079f7d81d197b684c9e3 (diff) | |
download | otp-37d25fa469a6a084737abf8f980c1e4bb34ca9d9.tar.gz otp-37d25fa469a6a084737abf8f980c1e4bb34ca9d9.tar.bz2 otp-37d25fa469a6a084737abf8f980c1e4bb34ca9d9.zip |
erts-hipe: Change THE_NON_VALUE for HiPE enabled debug emulator
This is a work-around as there are hipe BIFs that return untagged
integers that may be intepreted as THE_NON_VALUE (24).
Hipe bifs that return offsets as untagged integers:
hipe_bs_put_utf8
hipe_bs_put_utf16be
hipe_bs_put_utf16le
Hipe bifs that return raw pointers:
hipe_find_na_or_make_stub
hipe_nonclosure_address
-rw-r--r-- | erts/emulator/beam/erl_term.h | 8 | ||||
-rw-r--r-- | erts/emulator/hipe/hipe_mkliterals.c | 16 |
2 files changed, 15 insertions, 9 deletions
diff --git a/erts/emulator/beam/erl_term.h b/erts/emulator/beam/erl_term.h index 1d75fa313c..bc20b2d798 100644 --- a/erts/emulator/beam/erl_term.h +++ b/erts/emulator/beam/erl_term.h @@ -331,7 +331,13 @@ _ET_DECLARE_CHECKED(Uint,thing_subtag,Eterm) * we now use a non-zero bit-pattern in debug mode. */ #if ET_DEBUG -#define THE_NON_VALUE _make_header(0,_TAG_HEADER_FLOAT) +# ifdef HIPE + /* A very large (or negative) value as work-around for ugly hipe-bifs + that return untagged integers (eg hipe_bs_put_utf8) */ +# define THE_NON_VALUE _make_header((Uint)~0,_TAG_HEADER_FLOAT) +# else +# define THE_NON_VALUE _make_header(0,_TAG_HEADER_FLOAT) +# endif #else #define THE_NON_VALUE (0) #endif diff --git a/erts/emulator/hipe/hipe_mkliterals.c b/erts/emulator/hipe/hipe_mkliterals.c index 715764f4d0..f5edc36778 100644 --- a/erts/emulator/hipe/hipe_mkliterals.c +++ b/erts/emulator/hipe/hipe_mkliterals.c @@ -243,7 +243,7 @@ crc_update_buf(unsigned int crc_value, } static unsigned int -crc_update_int(unsigned int crc_value, const unsigned int *p) +crc_update_int(unsigned int crc_value, const int *p) { return crc_update_buf(crc_value, p, sizeof *p); } @@ -256,7 +256,7 @@ crc_update_int(unsigned int crc_value, const unsigned int *p) */ static const struct literal { const char *name; - unsigned int value; + int value; } literals[] = { /* Field offsets in a process struct */ { "P_HP", offsetof(struct process, htop) }, @@ -301,7 +301,7 @@ static const struct literal { { "FREASON_TRAP", TRAP }, /* special Erlang constants */ - { "THE_NON_VALUE", THE_NON_VALUE }, + { "THE_NON_VALUE", (int)THE_NON_VALUE }, /* funs */ #ifdef HIPE @@ -455,7 +455,7 @@ static const struct rts_param { unsigned int nr; const char *name; unsigned int is_defined; - unsigned int value; + int value; } rts_params[] = { { 1, "P_OFF_HEAP_FUNS", #if !defined(HYBRID) @@ -531,12 +531,12 @@ static void compute_crc(void) static void c_define_literal(FILE *fp, const struct literal *literal) { - fprintf(fp, "#define %s %u\n", literal->name, literal->value); + fprintf(fp, "#define %s %d\n", literal->name, literal->value); } static void e_define_literal(FILE *fp, const struct literal *literal) { - fprintf(fp, "-define(%s, %u).\n", literal->name, literal->value); + fprintf(fp, "-define(%s, %d).\n", literal->name, literal->value); } static void print_literals(FILE *fp, void (*print_literal)(FILE*, const struct literal*)) @@ -563,7 +563,7 @@ static void print_atom_literals(FILE *fp, void (*print_atom_literal)(FILE*, cons static void c_define_param(FILE *fp, const struct rts_param *param) { if (param->is_defined) - fprintf(fp, "#define %s %u\n", param->name, param->value); + fprintf(fp, "#define %s %d\n", param->name, param->value); } static void c_case_param(FILE *fp, const struct rts_param *param) @@ -571,7 +571,7 @@ static void c_case_param(FILE *fp, const struct rts_param *param) fprintf(fp, " \\\n"); fprintf(fp, "\tcase %u: ", param->nr); if (param->is_defined) - fprintf(fp, "value = %u", param->value); + fprintf(fp, "value = %d", param->value); else fprintf(fp, "is_defined = 0"); fprintf(fp, "; break;"); |