431 } 432 } 433 434 private static final class GreedyInliningPolicy extends AbstractInliningPolicy { 435 436 public GreedyInliningPolicy(Replacements replacements, Map<Invoke, Double> hints) { 437 super(replacements, hints); 438 } 439 440 public boolean continueInlining(StructuredGraph currentGraph) { 441 if (currentGraph.getNodeCount() >= MaximumDesiredSize.getValue()) { 442 InliningUtil.logInliningDecision("inlining is cut off by MaximumDesiredSize"); 443 metricInliningStoppedByMaxDesiredSize.increment(); 444 return false; 445 } 446 return true; 447 } 448 449 @Override 450 public boolean isWorthInlining(InlineInfo info, int inliningDepth, double probability, double relevance, boolean fullyProcessed) { 451 if (isIntrinsic(info)) { 452 return InliningUtil.logInlinedMethod(info, inliningDepth, fullyProcessed, "intrinsic"); 453 } 454 455 double inliningBonus = getInliningBonus(info); 456 int nodes = determineNodeCount(info); 457 int lowLevelGraphSize = previousLowLevelGraphSize(info); 458 459 if (SmallCompiledLowLevelGraphSize.getValue() > 0 && lowLevelGraphSize > SmallCompiledLowLevelGraphSize.getValue() * inliningBonus) { 460 return InliningUtil.logNotInlinedMethod(info, inliningDepth, "too large previous low-level graph (low-level-nodes: %d, relevance=%f, probability=%f, bonus=%f, nodes=%d)", 461 lowLevelGraphSize, relevance, probability, inliningBonus, nodes); 462 } 463 464 if (nodes < TrivialInliningSize.getValue() * inliningBonus) { 465 return InliningUtil.logInlinedMethod(info, inliningDepth, fullyProcessed, "trivial (relevance=%f, probability=%f, bonus=%f, nodes=%d)", relevance, probability, inliningBonus, nodes); 466 } 467 468 /* 469 * TODO (chaeubl): invoked methods that are on important paths but not yet compiled -> 470 * will be compiled anyways and it is likely that we are the only caller... might be | 431 } 432 } 433 434 private static final class GreedyInliningPolicy extends AbstractInliningPolicy { 435 436 public GreedyInliningPolicy(Replacements replacements, Map<Invoke, Double> hints) { 437 super(replacements, hints); 438 } 439 440 public boolean continueInlining(StructuredGraph currentGraph) { 441 if (currentGraph.getNodeCount() >= MaximumDesiredSize.getValue()) { 442 InliningUtil.logInliningDecision("inlining is cut off by MaximumDesiredSize"); 443 metricInliningStoppedByMaxDesiredSize.increment(); 444 return false; 445 } 446 return true; 447 } 448 449 @Override 450 public boolean isWorthInlining(InlineInfo info, int inliningDepth, double probability, double relevance, boolean fullyProcessed) { 451 if (InlineEverything.getValue()) { 452 return InliningUtil.logInlinedMethod(info, inliningDepth, fullyProcessed, "inline everything"); 453 } 454 455 if (isIntrinsic(info)) { 456 return InliningUtil.logInlinedMethod(info, inliningDepth, fullyProcessed, "intrinsic"); 457 } 458 459 double inliningBonus = getInliningBonus(info); 460 int nodes = determineNodeCount(info); 461 int lowLevelGraphSize = previousLowLevelGraphSize(info); 462 463 if (SmallCompiledLowLevelGraphSize.getValue() > 0 && lowLevelGraphSize > SmallCompiledLowLevelGraphSize.getValue() * inliningBonus) { 464 return InliningUtil.logNotInlinedMethod(info, inliningDepth, "too large previous low-level graph (low-level-nodes: %d, relevance=%f, probability=%f, bonus=%f, nodes=%d)", 465 lowLevelGraphSize, relevance, probability, inliningBonus, nodes); 466 } 467 468 if (nodes < TrivialInliningSize.getValue() * inliningBonus) { 469 return InliningUtil.logInlinedMethod(info, inliningDepth, fullyProcessed, "trivial (relevance=%f, probability=%f, bonus=%f, nodes=%d)", relevance, probability, inliningBonus, nodes); 470 } 471 472 /* 473 * TODO (chaeubl): invoked methods that are on important paths but not yet compiled -> 474 * will be compiled anyways and it is likely that we are the only caller... might be |