aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2010-02-12 16:17:25 +0100
committerBjörn Gustavsson <[email protected]>2010-03-10 14:25:40 +0100
commit37950725305fb8e911556608402cba6e4e17b87d (patch)
tree94ceada2198b3e7d823e5a45486fa00087a44296 /erts/emulator
parentac0b3f0a64705717d21e4a3d84d91d9c44f3baf7 (diff)
downloadotp-37950725305fb8e911556608402cba6e4e17b87d.tar.gz
otp-37950725305fb8e911556608402cba6e4e17b87d.tar.bz2
otp-37950725305fb8e911556608402cba6e4e17b87d.zip
Fix further test-suite problems
Fix safe_mul in the loader, which caused failures in the bit syntax test cases. Fix yet another Uint in erl_alloc.h (ERTS_CACHE_LINE_SIZE) causing segmentation fault when we have many schedulers (why only in that situation?). Clean up erl_mseg (remove old code for the Linux 32-bit mmap flag). While at it, also remove compilation warnings.
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/beam_emu.c14
-rw-r--r--erts/emulator/beam/beam_load.c18
-rw-r--r--erts/emulator/beam/binary.c2
-rw-r--r--erts/emulator/beam/erl_alloc.h2
-rw-r--r--erts/emulator/beam/erl_bif_info.c9
-rw-r--r--erts/emulator/beam/external.c2
-rw-r--r--erts/emulator/sys/common/erl_mseg.c31
7 files changed, 27 insertions, 51 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index 0d1cce52ca..834cc8df61 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -4906,13 +4906,13 @@ apply_bif_or_nif_epilogue:
em_call_error_handler = OpCode(call_error_handler);
em_call_traced_function = OpCode(call_traced_function);
em_apply_bif = OpCode(apply_bif);
- beam_apply[0] = (Eterm) OpCode(i_apply);
- beam_apply[1] = (Eterm) OpCode(normal_exit);
- beam_exit[0] = (Eterm) OpCode(error_action_code);
- beam_continue_exit[0] = (Eterm) OpCode(continue_exit);
- beam_return_to_trace[0] = (Eterm) OpCode(i_return_to_trace);
- beam_return_trace[0] = (Eterm) OpCode(return_trace);
- beam_exception_trace[0] = (Eterm) OpCode(return_trace); /* UGLY */
+ beam_apply[0] = (BeamInstr) OpCode(i_apply);
+ beam_apply[1] = (BeamInstr) OpCode(normal_exit);
+ beam_exit[0] = (BeamInstr) OpCode(error_action_code);
+ beam_continue_exit[0] = (BeamInstr) OpCode(continue_exit);
+ beam_return_to_trace[0] = (BeamInstr) OpCode(i_return_to_trace);
+ beam_return_trace[0] = (BeamInstr) OpCode(return_trace);
+ beam_exception_trace[0] = (BeamInstr) OpCode(return_trace); /* UGLY */
/*
* Enter all BIFs into the export table.
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index 22c6c39cf5..e4313e6a44 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -3403,21 +3403,21 @@ gen_guard_bif(LoaderState* stp, GenOpArg Fail, GenOpArg Live, GenOpArg Bif,
op->a[1].type = TAG_u;
bf = stp->import[Bif.val].bf;
if (bf == length_1) {
- op->a[1].val = (Uint) (void *) erts_gc_length_1;
+ op->a[1].val = (BeamInstr) (void *) erts_gc_length_1;
} else if (bf == size_1) {
- op->a[1].val = (Uint) (void *) erts_gc_size_1;
+ op->a[1].val = (BeamInstr) (void *) erts_gc_size_1;
} else if (bf == bit_size_1) {
- op->a[1].val = (Uint) (void *) erts_gc_bit_size_1;
+ op->a[1].val = (BeamInstr) (void *) erts_gc_bit_size_1;
} else if (bf == byte_size_1) {
- op->a[1].val = (Uint) (void *) erts_gc_byte_size_1;
+ op->a[1].val = (BeamInstr) (void *) erts_gc_byte_size_1;
} else if (bf == abs_1) {
- op->a[1].val = (Uint) (void *) erts_gc_abs_1;
+ op->a[1].val = (BeamInstr) (void *) erts_gc_abs_1;
} else if (bf == float_1) {
- op->a[1].val = (Uint) (void *) erts_gc_float_1;
+ op->a[1].val = (BeamInstr) (void *) erts_gc_float_1;
} else if (bf == round_1) {
- op->a[1].val = (Uint) (void *) erts_gc_round_1;
+ op->a[1].val = (BeamInstr) (void *) erts_gc_round_1;
} else if (bf == trunc_1) {
- op->a[1].val = (Uint) (void *) erts_gc_trunc_1;
+ op->a[1].val = (BeamInstr) (void *) erts_gc_trunc_1;
} else {
abort();
}
@@ -5306,7 +5306,7 @@ erts_make_stub_module(Process* p, Eterm Mod, Eterm Beam, Eterm Info)
static int safe_mul(UWord a, UWord b, UWord* resp)
{
- UWord res = a * b;
+ Uint res = a * b; /* XXX:Pan - used in bit syntax, the multiplication has to be stored in Uint */
*resp = res;
if (b == 0) {
diff --git a/erts/emulator/beam/binary.c b/erts/emulator/beam/binary.c
index 08c64610a2..59c20398d5 100644
--- a/erts/emulator/beam/binary.c
+++ b/erts/emulator/beam/binary.c
@@ -42,7 +42,7 @@ void
erts_init_binary(void)
{
/* Verify Binary alignment... */
- if ((((Uint) &((Binary *) 0)->orig_bytes[0]) % ((Uint) 8)) != 0) {
+ if ((((UWord) &((Binary *) 0)->orig_bytes[0]) % ((UWord) 8)) != 0) {
/* I assume that any compiler should be able to optimize this
away. If not, this test is not very expensive... */
erl_exit(ERTS_ABORT_EXIT,
diff --git a/erts/emulator/beam/erl_alloc.h b/erts/emulator/beam/erl_alloc.h
index 1080a24214..b7d6674a8a 100644
--- a/erts/emulator/beam/erl_alloc.h
+++ b/erts/emulator/beam/erl_alloc.h
@@ -238,7 +238,7 @@ void *erts_realloc_fnf(ErtsAlcType_t type, void *ptr, Uint size)
#ifndef ERTS_CACHE_LINE_SIZE
/* Assume a cache line size of 64 bytes */
-# define ERTS_CACHE_LINE_SIZE ((Uint) 64)
+# define ERTS_CACHE_LINE_SIZE ((UWord) 64)
# define ERTS_CACHE_LINE_MASK (ERTS_CACHE_LINE_SIZE - 1)
#endif
diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c
index de4d6f9109..18cb09d8cd 100644
--- a/erts/emulator/beam/erl_bif_info.c
+++ b/erts/emulator/beam/erl_bif_info.c
@@ -59,18 +59,19 @@
/* Keep erts_system_version as a global variable for easy access from a core */
static char erts_system_version[] = ("Erlang " ERLANG_OTP_RELEASE
" (erts-" ERLANG_VERSION ")"
-#if HALFWORD_HEAP
- " [halfword]"
-#endif
-#if !HEAP_ON_C_STACK
+#if !HEAP_ON_C_STACK && !HALFWORD_HEAP
" [no-c-stack-objects]"
#endif
#ifndef OTP_RELEASE
" [source]"
#endif
#ifdef ARCH_64
+#if HALFWORD_HEAP
+ " [64-bit halfword]"
+#else
" [64-bit]"
#endif
+#endif
#ifdef ERTS_SMP
" [smp:%bpu:%bpu]"
#endif
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index badefb728d..f41b61d73d 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -1974,7 +1974,7 @@ dec_term(ErtsDistExternal *edep, Eterm** hpp, byte* ep, ErlOffHeap* off_heap, Et
register Eterm* hp = *hpp; /* Please don't take the address of hp */
Eterm* next = objp;
- *next = (Eterm) NULL;
+ *next = (Eterm) (UWord) NULL;
while (next != NULL) {
objp = next;
diff --git a/erts/emulator/sys/common/erl_mseg.c b/erts/emulator/sys/common/erl_mseg.c
index 747c2e2a80..7b42c3e829 100644
--- a/erts/emulator/sys/common/erl_mseg.c
+++ b/erts/emulator/sys/common/erl_mseg.c
@@ -96,21 +96,12 @@ static void *pmremap(void *old_address, size_t old_size,
#define MMAP_PROT (PROT_READ|PROT_WRITE)
-#if HALFWORD_HEAP
-# ifdef MAP_32BIT
-# define RANGE_FLAG (MAP_32BIT)
-# else
-# error "Cannot have halfword heap if unable to restrict mmap areas
-# endif
-#else
-# define RANGE_FLAG (0)
-#endif
#ifdef MAP_ANON
-# define MMAP_FLAGS (MAP_ANON|MAP_PRIVATE|RANGE_FLAG)
+# define MMAP_FLAGS (MAP_ANON|MAP_PRIVATE)
# define MMAP_FD (-1)
#else
-# define MMAP_FLAGS (MAP_PRIVATE|RANGE_FLAG)
+# define MMAP_FLAGS (MAP_PRIVATE)
# define MMAP_FD mmap_fd
static int mmap_fd;
#endif
@@ -1342,20 +1333,6 @@ erts_mseg_unit_size(void)
{
return page_size;
}
-#if HAVE_MMAP && HALFWORD_HEAP
-#ifdef MAP_NORESERVE
-#define RESERVE_FLAGS (MMAP_FLAGS | MAP_NORESERVE)
-#else
-#define RESERVE_FLAGS (MMAP_FLAGS)
-#endif
-static void halfword_reserve(void)
-{
-#if HALFWORD_HEAP
- initialize_pmmap();
-#endif
- return;
-}
-#endif
void
erts_mseg_init(ErtsMsegInit_t *init)
@@ -1385,7 +1362,7 @@ erts_mseg_init(ErtsMsegInit_t *init)
#endif
#if HAVE_MMAP && HALFWORD_HEAP
- halfword_reserve();
+ initialize_pmmap();
#endif
page_size = GET_PAGE_SIZE;
@@ -1740,8 +1717,6 @@ static void *pmmap(size_t size)
/* nice, perfect fit */
res = *block;
*block = (*block)->next;
- //fprintf(stderr,"***** %p,%p,%ld,%p\n",res,*block,num_pages,first);
- //dump_freelist();
} else {
tail = (FreeBlock *) (((char *) ((void *) (*block))) + real_size);
if (!do_map(tail,pagsz)) {