aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-02-22 15:46:52 +0100
committerSverker Eriksson <[email protected]>2013-02-22 15:47:02 +0100
commit2ff92dc7c2aa5c052df47776b782500815ce72eb (patch)
treeaacbf3acec409887c39493b59eff785649c4b0ec /erts/emulator
parent17231ca24cbf3b136301f1076bb94247344e9f35 (diff)
parent944fca78d202712848e317ec666647e8db78bcb4 (diff)
downloadotp-2ff92dc7c2aa5c052df47776b782500815ce72eb.tar.gz
otp-2ff92dc7c2aa5c052df47776b782500815ce72eb.tar.bz2
otp-2ff92dc7c2aa5c052df47776b782500815ce72eb.zip
Merge branch 'sverk/win-64-pointer-fix'
* sverk/win-64-pointer-fix: erts: Correct term type for printf %T erts: Correct internal printf integer type for win64 erts: Correct some printf type formatting erts: Fix type bug in get_proc_affinity for windows OTP-10887 Forgot this ticket for sverk/erlang_pid-revert: OTP-10885
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/beam_catches.c7
-rw-r--r--erts/emulator/beam/erl_db_util.c11
-rw-r--r--erts/emulator/beam/erl_gc.c2
-rw-r--r--erts/emulator/beam/erl_printf_term.c63
-rw-r--r--erts/emulator/beam/erl_printf_term.h4
5 files changed, 44 insertions, 43 deletions
diff --git a/erts/emulator/beam/beam_catches.c b/erts/emulator/beam/beam_catches.c
index 7c92408eea..d374d0469e 100644
--- a/erts/emulator/beam/beam_catches.c
+++ b/erts/emulator/beam/beam_catches.c
@@ -160,10 +160,9 @@ void beam_catches_delmod(unsigned head, BeamInstr *code, unsigned code_bytes,
}
if( (char*)p->beam_catches[i].cp - (char*)code >= code_bytes ) {
erl_exit(1,
- "beam_catches_delmod: item %#x has cp %#lx which is not "
- "in module's range [%#lx,%#lx[\r\n",
- i, (long)p->beam_catches[i].cp,
- (long)code, (long)((char*)code + code_bytes));
+ "beam_catches_delmod: item %#x has cp %p which is not "
+ "in module's range [%p,%p[\r\n",
+ i, p->beam_catches[i].cp, code, ((char*)code + code_bytes));
}
p->beam_catches[i].cp = 0;
cdr = p->beam_catches[i].cdr;
diff --git a/erts/emulator/beam/erl_db_util.c b/erts/emulator/beam/erl_db_util.c
index fc1c946c7d..713ac0ba18 100644
--- a/erts/emulator/beam/erl_db_util.c
+++ b/erts/emulator/beam/erl_db_util.c
@@ -3415,8 +3415,7 @@ static DMCRet dmc_one_term(DMCContext *context,
}
default:
erl_exit(1, "db_match_compile: "
- "Bad object on heap: 0x%08lx\n",
- (unsigned long) c);
+ "Bad object on heap: 0x%bex\n", c);
}
return retOk;
}
@@ -4861,7 +4860,7 @@ static Eterm my_copy_struct(Eterm t, Eterm **hp, ErlOffHeap* off_heap)
ret = copy_struct(b,sz,hp,off_heap);
} else {
erl_exit(1, "Trying to constant-copy non constant expression "
- "0x%08x in (d)ets:match compilation.", (unsigned long) t);
+ "0x%bex in (d)ets:match compilation.", t);
}
} else {
sz = size_object(t);
@@ -5395,7 +5394,7 @@ void db_match_dis(Binary *bp)
erts_printf("Caller\n");
break;
default:
- erts_printf("??? (0x%08x)\n", *t);
+ erts_printf("??? (0x%bpx)\n", *t);
++t;
break;
}
@@ -5407,13 +5406,13 @@ void db_match_dis(Binary *bp)
first = 0;
else
erts_printf(", ");
- erts_printf("0x%08x", (unsigned long) tmp);
+ erts_printf("%p", tmp);
}
erts_printf("}\n");
erts_printf("num_bindings: %d\n", prog->num_bindings);
erts_printf("heap_size: %beu\n", prog->heap_size);
erts_printf("stack_offset: %beu\n", prog->stack_offset);
- erts_printf("text: 0x%08x\n", (unsigned long) prog->text);
+ erts_printf("text: %p\n", prog->text);
erts_printf("stack_size: %d (words)\n", prog->heap_size-prog->stack_offset);
}
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index a33085315a..293d9fa3ec 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -231,7 +231,7 @@ erts_next_heap_size(Uint size, Uint offset)
low = mid + 1;
}
}
- erl_exit(1, "no next heap size found: %lu, offset %lu\n", (unsigned long)size, (unsigned long)offset);
+ erl_exit(1, "no next heap size found: %beu, offset %beu\n", size, offset);
}
return 0;
}
diff --git a/erts/emulator/beam/erl_printf_term.c b/erts/emulator/beam/erl_printf_term.c
index 2320b64295..ce544503bd 100644
--- a/erts/emulator/beam/erl_printf_term.c
+++ b/erts/emulator/beam/erl_printf_term.c
@@ -57,17 +57,17 @@ do { \
(CNT) += res__; \
} while (0)
-#define PRINT_ULONG(CNT, FN, ARG, C, P, W, I) \
+#define PRINT_UWORD(CNT, FN, ARG, C, P, W, I) \
do { \
- int res__ = erts_printf_ulong((FN), (ARG), (C), (P), (W), (I)); \
+ int res__ = erts_printf_uword((FN), (ARG), (C), (P), (W), (I)); \
if (res__ < 0) \
return res__; \
(CNT) += res__; \
} while (0)
-#define PRINT_SLONG(CNT, FN, ARG, C, P, W, I) \
+#define PRINT_SWORD(CNT, FN, ARG, C, P, W, I) \
do { \
- int res__ = erts_printf_slong((FN), (ARG), (C), (P), (W), (I)); \
+ int res__ = erts_printf_sword((FN), (ARG), (C), (P), (W), (I)); \
if (res__ < 0) \
return res__; \
(CNT) += res__; \
@@ -153,7 +153,7 @@ static int print_atom_name(fmtfn_t fn, void* arg, Eterm atom, long *dcount)
if ((i < 0) || (i >= atom_table_size()) || (atom_tab(i) == NULL)) {
PRINT_STRING(res, fn, arg, "<bad atom index: ");
- PRINT_SLONG(res, fn, arg, 'd', 0, 1, (signed long) i);
+ PRINT_SWORD(res, fn, arg, 'd', 0, 1, (ErlPfSWord) i);
PRINT_CHAR(res, fn, arg, '>');
return res;
}
@@ -203,7 +203,7 @@ static int print_atom_name(fmtfn_t fn, void* arg, Eterm atom, long *dcount)
default:
if (IS_CNTRL(c)) {
PRINT_CHAR(res, fn, arg, '\\');
- PRINT_ULONG(res, fn, arg, 'o', 1, 3, (unsigned long) c);
+ PRINT_UWORD(res, fn, arg, 'o', 1, 3, (ErlPfUWord) c);
}
else
PRINT_CHAR(res, fn, arg, (char) c);
@@ -334,7 +334,7 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
break;
}
case SMALL_DEF:
- PRINT_SLONG(res, fn, arg, 'd', 0, 1, (signed long) signed_val(obj));
+ PRINT_SWORD(res, fn, arg, 'd', 0, 1, (ErlPfSWord) signed_val(obj));
break;
case BIG_DEF: {
int print_res;
@@ -360,36 +360,36 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
case REF_DEF:
case EXTERNAL_REF_DEF:
PRINT_STRING(res, fn, arg, "#Ref<");
- PRINT_ULONG(res, fn, arg, 'u', 0, 1,
- (unsigned long) ref_channel_no(wobj));
+ PRINT_UWORD(res, fn, arg, 'u', 0, 1,
+ (ErlPfUWord) ref_channel_no(wobj));
ref_num = ref_numbers(wobj);
for (i = ref_no_of_numbers(wobj)-1; i >= 0; i--) {
PRINT_CHAR(res, fn, arg, '.');
- PRINT_ULONG(res, fn, arg, 'u', 0, 1, (unsigned long) ref_num[i]);
+ PRINT_UWORD(res, fn, arg, 'u', 0, 1, (ErlPfUWord) ref_num[i]);
}
PRINT_CHAR(res, fn, arg, '>');
break;
case PID_DEF:
case EXTERNAL_PID_DEF:
PRINT_CHAR(res, fn, arg, '<');
- PRINT_ULONG(res, fn, arg, 'u', 0, 1,
- (unsigned long) pid_channel_no(wobj));
+ PRINT_UWORD(res, fn, arg, 'u', 0, 1,
+ (ErlPfUWord) pid_channel_no(wobj));
PRINT_CHAR(res, fn, arg, '.');
- PRINT_ULONG(res, fn, arg, 'u', 0, 1,
- (unsigned long) pid_number(wobj));
+ PRINT_UWORD(res, fn, arg, 'u', 0, 1,
+ (ErlPfUWord) pid_number(wobj));
PRINT_CHAR(res, fn, arg, '.');
- PRINT_ULONG(res, fn, arg, 'u', 0, 1,
- (unsigned long) pid_serial(wobj));
+ PRINT_UWORD(res, fn, arg, 'u', 0, 1,
+ (ErlPfUWord) pid_serial(wobj));
PRINT_CHAR(res, fn, arg, '>');
break;
case PORT_DEF:
case EXTERNAL_PORT_DEF:
PRINT_STRING(res, fn, arg, "#Port<");
- PRINT_ULONG(res, fn, arg, 'u', 0, 1,
- (unsigned long) port_channel_no(wobj));
+ PRINT_UWORD(res, fn, arg, 'u', 0, 1,
+ (ErlPfUWord) port_channel_no(wobj));
PRINT_CHAR(res, fn, arg, '.');
- PRINT_ULONG(res, fn, arg, 'u', 0, 1,
- (unsigned long) port_number(wobj));
+ PRINT_UWORD(res, fn, arg, 'u', 0, 1,
+ (ErlPfUWord) port_number(wobj));
PRINT_CHAR(res, fn, arg, '>');
break;
case LIST_DEF:
@@ -446,7 +446,7 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
PRINT_STRING(res, fn, arg, "<<1 byte>>");
else {
PRINT_STRING(res, fn, arg, "<<");
- PRINT_ULONG(res, fn, arg, 'u', 0, 1, (unsigned long) pb->size);
+ PRINT_UWORD(res, fn, arg, 'u', 0, 1, (ErlPfUWord) pb->size);
PRINT_STRING(res, fn, arg, " bytes>>");
}
}
@@ -462,8 +462,8 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
PRINT_CHAR(res, fn, arg, '.');
PRINT_BUF(res, fn, arg, name->name, name->len);
PRINT_CHAR(res, fn, arg, '.');
- PRINT_SLONG(res, fn, arg, 'd', 0, 1,
- (signed long) ep->code[2]);
+ PRINT_SWORD(res, fn, arg, 'd', 0, 1,
+ (ErlPfSWord) ep->code[2]);
PRINT_CHAR(res, fn, arg, '>');
}
break;
@@ -475,11 +475,11 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
PRINT_STRING(res, fn, arg, "#Fun<");
PRINT_BUF(res, fn, arg, ap->name, ap->len);
PRINT_CHAR(res, fn, arg, '.');
- PRINT_SLONG(res, fn, arg, 'd', 0, 1,
- (signed long) funp->fe->old_index);
+ PRINT_SWORD(res, fn, arg, 'd', 0, 1,
+ (ErlPfSWord) funp->fe->old_index);
PRINT_CHAR(res, fn, arg, '.');
- PRINT_SLONG(res, fn, arg, 'd', 0, 1,
- (signed long) funp->fe->old_uniq);
+ PRINT_SWORD(res, fn, arg, 'd', 0, 1,
+ (ErlPfSWord) funp->fe->old_uniq);
PRINT_CHAR(res, fn, arg, '>');
}
break;
@@ -498,10 +498,13 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
}
int
-erts_printf_term(fmtfn_t fn, void* arg, unsigned long term, long precision,
- unsigned long* term_base)
+erts_printf_term(fmtfn_t fn, void* arg, ErlPfEterm term, long precision,
+ ErlPfEterm* term_base)
{
- int res = print_term(fn, arg, (Eterm)term, &precision, (Eterm*)term_base);
+ int res;
+ ASSERT(sizeof(ErlPfEterm) == sizeof(Eterm));
+
+ res = print_term(fn, arg, (Eterm)term, &precision, (Eterm*)term_base);
if (res < 0)
return res;
if (precision <= 0)
diff --git a/erts/emulator/beam/erl_printf_term.h b/erts/emulator/beam/erl_printf_term.h
index a48a3de34c..d9bf79a5ce 100644
--- a/erts/emulator/beam/erl_printf_term.h
+++ b/erts/emulator/beam/erl_printf_term.h
@@ -21,6 +21,6 @@
#define ERL_PRINTF_TERM_H__
#include "erl_printf_format.h"
-int erts_printf_term(fmtfn_t fn, void* arg, unsigned long term, long precision,
- unsigned long* term_base);
+int erts_printf_term(fmtfn_t fn, void* arg, ErlPfEterm term, long precision,
+ ErlPfEterm* term_base);
#endif