view graal/com.oracle.graal.truffle.test/sl/TestInliningMaxCallerSize.sl @ 18985:867058575979

Truffle: Improved support for "probing" AST nodes: - Node.isSafelyReplacaeableBy(Node) checks in advance if Node.replace(Node) would be unsafe (crash the VM). - Hoist Probe() from language imlementations into Node; now completely language agnostic. - Language implementations support probing by implementing Node.isInstrumentable() and Node.createWrapperNode() - Node.Probe() throws ProbeException (without side effects) if the probe fails. -- ProbeException contains an instance of ProbeFailure that diagnoses the failure in detail - Additional measures to prevent instrumentation from being applied to internal InstrumentationNodes. - Promote ProbeListener to top level interface and add a default implementation
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 27 Jan 2015 20:24:54 -0800
parents 04d6bb76cfb3
children bb7e95512781
line wrap: on
line source

/* 
 * This test verifies that CallTargets cannot exceed the TruffleInliningMaxCallerSize limit when inlining.
 */
function inlinableFunction() { 
    generateDummyNodes(getOption("TruffleInliningMaxCallerSize") - 8);
}

function notInlinableFunction() { 
    generateDummyNodes(getOption("TruffleInliningMaxCallerSize") - 7);
}

function test1() {
    inlinableFunction(); 
}

function test2() {
    notInlinableFunction(); 
}

function main() {
    originalMaxCallerSize = getOption("TruffleInliningMaxCallerSize");
    setOption("TruffleInliningMaxCallerSize", 20);
    callUntilOptimized(test1);
    assertTrue(isInlined(test1, test1, inlinableFunction), "inlinableFunction is not inlined");
    
    callUntilOptimized(test2); 
    assertFalse(isInlined(test2, test2, notInlinableFunction), "notInlinableFunction is inlined"); 
    setOption("TruffleInliningMaxCallerSize", originalMaxCallerSize);
}