/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @summary smoke tests for CallSite
*
* @build indify.Indify
* @compile CallSiteTest.java
* indify.Indify
* --expand-properties --classpath ${test.classes}
* --java test.java.lang.invoke.CallSiteTest
*/
public class CallSiteTest {
static {
try {
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
// warm-up
for (int i = 0; i < 20000; i++) {
}
// run
for (int n = 0; n < 2; n++) {
for (int i = 0; i < 5; i++) {
}
for (int i = 0; i < 5; i++) {
}
}
}
// warm-up
for (int i = 0; i < 20000; i++) {
}
// run
for (int n = 0; n < 2; n++) {
for (int i = 0; i < 5; i++) {
}
for (int i = 0; i < 5; i++) {
}
}
}
int sum = 0;
for (int i = 0; i < N; i++) {
}
return sum;
}
int sum = 0;
for (int i = 0; i < N; i++) {
}
return sum;
}
static int foo(int a, int b) { return a + b; }
static int bar(int a, int b) { return a - b; }
}
private static CallSite bsm_mcs(Lookup caller, String name, MethodType type) throws ReflectiveOperationException {
return mcs;
}
}
return ((CallSite) MH_bsm_mcs().invoke(lookup(), "foo", methodType(int.class, int.class, int.class))).dynamicInvoker();
}
private static CallSite bsm_vcs(Lookup caller, String name, MethodType type) throws ReflectiveOperationException {
return vcs;
}
}
return ((CallSite) MH_bsm_vcs().invoke(lookup(), "foo", methodType(int.class, int.class, int.class))).dynamicInvoker();
}
private static void shouldNotCallThis() {
// if this gets called, the transformation has not taken place
throw new AssertionError("this code should be statically transformed away by Indify");
}
}