VM: cache line size?
Aleksey Shipilev
aleksey.shipilev at oracle.com
Wed Nov 21 03:20:34 PST 2012
Hi,
I need the VM to get the info about the cache line size on the current
system. Looking around the Hotspot code, I had found the usages like this:
intx cache_line_size = prefetch_data_size();
...where:
vm_version_sparc.hpp:
static intx prefetch_data_size() {
return is_T4() ? 32 : 64; // default prefetch block size on sparc
}
vm_version_x86.hpp:
static intx prefetch_data_size() {
intx result = 0;
if (is_intel()) {
result = (_cpuid_info.dcp_cpuid4_ebx.bits.L1_line_size + 1);
} else if (is_amd()) {
result = _cpuid_info.ext_cpuid5_ecx.bits.L1_line_size;
}
if (result < 32) // not defined ?
result = 32; // 32 bytes by default on x86 and other x64
return result;
}
At this point, I have a few questions:
0. Is this the method one should use to determine the cache line size?
1. Shouldn't that method be called cache_line_size()?
2. Is that correct at this point that we default to 32-byte cache lines
on x86? Should we instead default for 64?
Thanks,
Aleksey.
More information about the hotspot-runtime-dev
mailing list