162 sourcesPerCompile = numSources;
163 Log.debug("Compiling as a single source code chunk to stay within heap size limitations!");
164 } else if (sourcesPerCompile > 500) {
165 // This number is very low, and tuned to dealing with the OpenJDK
166 // where the source is >very< circular! In normal application,
167 // with less circularity the number could perhaps be increased.
168 numCompiles = numSources / 500;
169 sourcesPerCompile = numSources/numCompiles;
170 Log.debug("Compiling source as "+numCompiles+" code chunks serially to stay within heap size limitations!");
171 }
172 } else {
173 if (numCompiles > 1) {
174 // Ok, we can fit at least one full compilation on the heap.
175 float usagePerCompile = (float)numRequiredMBytes / ((float)numCompiles * (float)0.7);
176 int usage = (int)(usagePerCompile * (float)numCompiles);
177 Log.debug("Heuristics say that for "+numCompiles+" concurrent compiles we need "+usage+"MiB");
178 if (usage > numMBytes) {
179 // Ouch it does not fit. Reduce to a single chunk.
180 numCompiles = 1;
181 sourcesPerCompile = numSources;
182 // What if the relationship betweem number of compile_chunks and num_required_mbytes
183 // is not linear? Then perhaps 2 chunks would fit where 3 does not. Well, this is
184 // something to experiment upon in the future.
185 Log.debug("Limiting compile to a single thread to stay within heap size limitations!");
186 }
187 }
188 }
189
190 Log.debug("Compiling sources in "+numCompiles+" chunk(s)");
191
192 // Create the chunks to be compiled.
193 final CompileChunk[] compileChunks = createCompileChunks(pkgSrcs, oldPackageDependents,
194 numCompiles, sourcesPerCompile);
195
196 if (Log.isDebugging()) {
197 int cn = 1;
198 for (CompileChunk cc : compileChunks) {
199 Log.debug("Chunk "+cn+" for "+id+" ---------------");
200 cn++;
201 for (URI u : cc.srcs) {
202 Log.debug(""+u);
|
162 sourcesPerCompile = numSources;
163 Log.debug("Compiling as a single source code chunk to stay within heap size limitations!");
164 } else if (sourcesPerCompile > 500) {
165 // This number is very low, and tuned to dealing with the OpenJDK
166 // where the source is >very< circular! In normal application,
167 // with less circularity the number could perhaps be increased.
168 numCompiles = numSources / 500;
169 sourcesPerCompile = numSources/numCompiles;
170 Log.debug("Compiling source as "+numCompiles+" code chunks serially to stay within heap size limitations!");
171 }
172 } else {
173 if (numCompiles > 1) {
174 // Ok, we can fit at least one full compilation on the heap.
175 float usagePerCompile = (float)numRequiredMBytes / ((float)numCompiles * (float)0.7);
176 int usage = (int)(usagePerCompile * (float)numCompiles);
177 Log.debug("Heuristics say that for "+numCompiles+" concurrent compiles we need "+usage+"MiB");
178 if (usage > numMBytes) {
179 // Ouch it does not fit. Reduce to a single chunk.
180 numCompiles = 1;
181 sourcesPerCompile = numSources;
182 // What if the relationship between number of compile_chunks and num_required_mbytes
183 // is not linear? Then perhaps 2 chunks would fit where 3 does not. Well, this is
184 // something to experiment upon in the future.
185 Log.debug("Limiting compile to a single thread to stay within heap size limitations!");
186 }
187 }
188 }
189
190 Log.debug("Compiling sources in "+numCompiles+" chunk(s)");
191
192 // Create the chunks to be compiled.
193 final CompileChunk[] compileChunks = createCompileChunks(pkgSrcs, oldPackageDependents,
194 numCompiles, sourcesPerCompile);
195
196 if (Log.isDebugging()) {
197 int cn = 1;
198 for (CompileChunk cc : compileChunks) {
199 Log.debug("Chunk "+cn+" for "+id+" ---------------");
200 cn++;
201 for (URI u : cc.srcs) {
202 Log.debug(""+u);
|