@Test public void testTooLargeToInline() throws Exception { final StringBuilder program = new StringBuilder(); program.append("int donotinlineme(int x) { int y = 2;"); for (int i = 0; i < 100; i++) { program.append(" y = y + x;"); } program.append("}"); program.append("void main() { int z = donotinlineme(5); }"); final TranslationUnit tu = ParseHelper.parse(program.toString()); final ShaderJob shaderJob = MakeShaderJobFromFragmentShader.make(tu); final List<InlineFunctionReductionOpportunity> ops = InlineFunctionReductionOpportunities.findOpportunities(shaderJob, new ReducerContext(true, ShadingLanguageVersion.ESSL_100, new RandomWrapper(0), new IdGenerator())); assertEquals(0, ops.size()); }
static List<InlineFunctionReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); }
InlineFunctionReductionOpportunities extends StandardVisitor { static List<InlineFunctionReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } }
InlineFunctionReductionOpportunities extends StandardVisitor { static List<InlineFunctionReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  InlineFunctionReductionOpportunities(TranslationUnit tu,
        ReducerContext context); }
InlineFunctionReductionOpportunities extends StandardVisitor { static List<InlineFunctionReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  InlineFunctionReductionOpportunities(TranslationUnit tu,
        ReducerContext context); @Override void visitFunctionCallExpr(FunctionCallExpr functionCallExpr); }
InlineFunctionReductionOpportunities extends StandardVisitor { static List<InlineFunctionReductionOpportunity> findOpportunities( ShaderJob shaderJob, ReducerContext context) { return shaderJob.getShaders() .stream() .map(item -> findOpportunitiesForShader(item, context)) .reduce(Arrays.asList(), ListConcat::concatenate); } private  InlineFunctionReductionOpportunities(TranslationUnit tu,
        ReducerContext context); @Override void visitFunctionCallExpr(FunctionCallExpr functionCallExpr);  }