Mercurial > hg > truffle
comparison src/share/vm/runtime/virtualspace.cpp @ 7433:730cc4ddd550
7173959: Jvm crashed during coherence exabus (tmb) testing
Summary: Mapping of aligned memory needs to be MT safe. Also reviewed by: vitalyd@gmail.com
Reviewed-by: dholmes, coleenp, zgu
author | brutisso |
---|---|
date | Mon, 17 Dec 2012 08:49:20 +0100 |
parents | da91efe96a93 |
children | 203f64878aab |
comparison
equal
deleted
inserted
replaced
7432:0b3d19153cc6 | 7433:730cc4ddd550 |
---|---|
327 | 327 |
328 // Check alignment constraints | 328 // Check alignment constraints |
329 if ((((size_t)base + noaccess_prefix) & (alignment - 1)) != 0) { | 329 if ((((size_t)base + noaccess_prefix) & (alignment - 1)) != 0) { |
330 // Base not aligned, retry | 330 // Base not aligned, retry |
331 if (!os::release_memory(base, size)) fatal("os::release_memory failed"); | 331 if (!os::release_memory(base, size)) fatal("os::release_memory failed"); |
332 // Reserve size large enough to do manual alignment and | 332 // Make sure that size is aligned |
333 // increase size to a multiple of the desired alignment | |
334 size = align_size_up(size, alignment); | 333 size = align_size_up(size, alignment); |
335 size_t extra_size = size + alignment; | 334 base = os::reserve_memory_aligned(size, alignment); |
336 do { | |
337 char* extra_base = os::reserve_memory(extra_size, NULL, alignment); | |
338 if (extra_base == NULL) return; | |
339 // Do manual alignement | |
340 base = (char*) align_size_up((uintptr_t) extra_base, alignment); | |
341 assert(base >= extra_base, "just checking"); | |
342 // Re-reserve the region at the aligned base address. | |
343 os::release_memory(extra_base, extra_size); | |
344 base = os::reserve_memory(size, base); | |
345 } while (base == NULL); | |
346 | 335 |
347 if (requested_address != 0 && | 336 if (requested_address != 0 && |
348 failed_to_reserve_as_requested(base, requested_address, size, false)) { | 337 failed_to_reserve_as_requested(base, requested_address, size, false)) { |
349 // As a result of the alignment constraints, the allocated base differs | 338 // As a result of the alignment constraints, the allocated base differs |
350 // from the requested address. Return back to the caller who can | 339 // from the requested address. Return back to the caller who can |