A compiler (JIT or AOT) can certainly make decisions which are more or less cache-friendly. It does depend on the language and the amount of freedom the compiler has, but just as one example, struct/object field reordering can reduce padding and thus fit more useful data in a cache line.