--- a/src/hotspot/share/opto/c2compiler.cpp Mon Oct 29 17:11:46 2018 -0400
+++ b/src/hotspot/share/opto/c2compiler.cpp Tue Oct 30 09:06:08 2018 +0100
@@ -604,7 +604,9 @@
return true;
}
-int C2Compiler::initial_code_buffer_size() {
- assert(SegmentedCodeCache, "Should be only used with a segmented code cache");
- return Compile::MAX_inst_size + Compile::MAX_locs_size + initial_const_capacity;
+int C2Compiler::initial_code_buffer_size(int const_size) {
+ // See Compile::init_scratch_buffer_blob
+ int locs_size = sizeof(relocInfo) * Compile::MAX_locs_size;
+ int slop = 2 * CodeSection::end_slop(); // space between sections
+ return Compile::MAX_inst_size + Compile::MAX_stubs_size + const_size + slop + locs_size;
}