Attempting to compile src/hotspot/share/runtime/sharedRuntime.cpp with Xcode 12.0 for a slowdebug build produces
/Users/hohensee/workspaces/jdk/src/hotspot/share/runtime/sharedRuntime.cpp:2849:85: error: expression does not compute the number of elements in this array; element type is 'double', not 'relocInfo' [-Werror,-Wsizeof-array-div]
buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo));
~~~~~~~~ ^
/Users/hohensee/workspaces/jdk/src/hotspot/share/runtime/sharedRuntime.cpp:2848:14: note: array 'locs_buf' declared here
double locs_buf[20];
^
/Users/hohensee/workspaces/jdk/src/hotspot/share/runtime/sharedRuntime.cpp:2849:85: note: place parentheses around the 'sizeof(relocInfo)' expression to silence this warning
buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo));
^
1 error generated.
Correct code to do the same thing exists in src/hotspot/share/c1/c1_Compilation.cpp at line 325, vis
int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo));
char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
code->insts()->initialize_shared_locs((relocInfo*)locs_buffer,
locs_buffer_size / sizeof(relocInfo));
A quick fix would be just to copy it into sharedRuntime.cpp, but a better one would define a macro in relocInfo.hpp for use in such circumstances, e.g.
#define RELOCINFO_BUFFER_SIZE (20 * (relocInfo::length_limit + sizeof(relocInfo)))