hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java
author amurillo
Mon, 11 Apr 2016 14:21:25 -0700
changeset 37297 d65d53a0ecc7
parent 36851 03e2f4d0a421
parent 37273 b4b83dd8f471
child 40059 c2304140ed64
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27700
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
     1
/*
37273
b4b83dd8f471 8136798: TestMonomorphicObjectCall.java fails with compilation error
thartmann
parents: 36508
diff changeset
     2
 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
27700
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
     4
 *
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
     7
 * published by the Free Software Foundation.
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
     8
 *
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    13
 * accompanied this code).
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    14
 *
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    18
 *
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    21
 * questions.
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    22
 */
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    23
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    24
/*
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    25
 * @test
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    26
 * @bug 8050079
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    27
 * @summary Compiles a monomorphic call to finalizeObject() on a modified java.lang.Object to test C1 CHA.
37273
b4b83dd8f471 8136798: TestMonomorphicObjectCall.java fails with compilation error
thartmann
parents: 36508
diff changeset
    28
 * @build java.base/java.lang.Object
b4b83dd8f471 8136798: TestMonomorphicObjectCall.java fails with compilation error
thartmann
parents: 36508
diff changeset
    29
 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-VerifyDependencies
b4b83dd8f471 8136798: TestMonomorphicObjectCall.java fails with compilation error
thartmann
parents: 36508
diff changeset
    30
 *                   -XX:TieredStopAtLevel=1 -XX:CompileOnly=TestMonomorphicObjectCall::callFinalize
b4b83dd8f471 8136798: TestMonomorphicObjectCall.java fails with compilation error
thartmann
parents: 36508
diff changeset
    31
 *                   -XX:CompileOnly=java.lang.Object::finalizeObject TestMonomorphicObjectCall
27700
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    32
 */
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    33
public class TestMonomorphicObjectCall {
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    34
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    35
    private static void callFinalize(Object object) throws Throwable {
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    36
        // Call modified version of java.lang.Object::finalize() that is
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    37
        // not overridden by any subclass. C1 CHA should mark the call site
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    38
        // as monomorphic and inline the method.
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    39
        object.finalizeObject();
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    40
    }
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    41
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    42
    public static void main(String[] args) throws Throwable {
37273
b4b83dd8f471 8136798: TestMonomorphicObjectCall.java fails with compilation error
thartmann
parents: 36508
diff changeset
    43
        // Trigger compilation of 'callFinalize'
b4b83dd8f471 8136798: TestMonomorphicObjectCall.java fails with compilation error
thartmann
parents: 36508
diff changeset
    44
        callFinalize(new Object());
27700
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    45
    }
a402738ebfcf 8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff changeset
    46
}