static void assert_params_aligned(HeapWord* from, HeapWord* to) { #ifdef ASSERT if (mask_bits((uintptr_t)from, MinObjAlignmentInBytes-1) != 0) basic_fatal("not object aligned"); if (mask_bits((uintptr_t)to, MinObjAlignmentInBytes-1) != 0) basic_fatal("not object aligned"); #endif }
static void assert_params_ok(void* from, void* to, intptr_t log_align) { #ifdef ASSERT if (mask_bits((uintptr_t)from, right_n_bits(log_align)) != 0) basic_fatal("not aligned"); if (mask_bits((uintptr_t)to, right_n_bits(log_align)) != 0) basic_fatal("not aligned"); #endif }
// returns integer round-down to the nearest multiple of s (s must be a power of two) inline intptr_t round_down(intptr_t x, uintx s) { #ifdef ASSERT if (!is_power_of_2(s)) basic_fatal("s must be a power of 2"); #endif const uintx m = s - 1; return mask_bits(x, ~m); }
static void assert_byte_count_ok(size_t byte_count, size_t unit_size) { #ifdef ASSERT if ((size_t)round_to(byte_count, unit_size) != byte_count) { basic_fatal("byte count must be aligned"); } #endif }
static void assert_non_zero(size_t count) { #ifdef ASSERT if (count == 0) { basic_fatal("count must be non-zero"); } #endif }
//* the argument must be exactly a power of 2 inline int exact_log2_long(jlong x) { #ifdef ASSERT if (!is_power_of_2_long(x)) basic_fatal("x must be a power of 2"); #endif return log2_long(x); }
//* the argument must be exactly a power of 2 inline int exact_log2(intptr_t x) { #ifdef ASSERT if (!is_power_of_2(x)) basic_fatal("x must be a power of 2"); #endif return log2_intptr(x); }
static void assert_disjoint(HeapWord* from, HeapWord* to, size_t count) { #ifdef ASSERT if (!params_disjoint(from, to, count)) basic_fatal("source and dest overlap"); #endif }