author | malenkov |
Thu, 22 May 2014 21:05:30 +0400 | |
changeset 25100 | d527cc827d7d |
parent 22214 | c551021e75b2 |
child 25379 | d50969e81568 |
permissions | -rw-r--r-- |
16689 | 1 |
/* |
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/* |
|
25 |
* @test EnqueueMethodForCompilationTest |
|
19332 | 26 |
* @bug 8006683 8007288 8022832 |
16689 | 27 |
* @library /testlibrary /testlibrary/whitebox |
28 |
* @build EnqueueMethodForCompilationTest |
|
29 |
* @run main ClassFileInstaller sun.hotspot.WhiteBox |
|
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
20294
diff
changeset
|
30 |
* @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* EnqueueMethodForCompilationTest |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
31 |
* @summary testing of WB::enqueueMethodForCompilation() |
16689 | 32 |
* @author igor.ignatyev@oracle.com |
33 |
*/ |
|
34 |
public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest { |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
35 |
|
16689 | 36 |
public static void main(String[] args) throws Exception { |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
20294
diff
changeset
|
37 |
CompilerWhiteBoxTest.main(EnqueueMethodForCompilationTest::new, args); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
38 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
39 |
|
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
20294
diff
changeset
|
40 |
private EnqueueMethodForCompilationTest(TestCase testCase) { |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
41 |
super(testCase); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
42 |
// to prevent inlining of #method |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
43 |
WHITE_BOX.testSetDontInlineMethod(method, true); |
16689 | 44 |
} |
45 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
46 |
@Override |
16689 | 47 |
protected void test() throws Exception { |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
48 |
checkNotCompiled(); |
16689 | 49 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
50 |
// method can not be compiled on level 'none' |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
51 |
WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_NONE); |
19332 | 52 |
if (isCompilable(COMP_LEVEL_NONE)) { |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
53 |
throw new RuntimeException(method |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
54 |
+ " is compilable at level COMP_LEVEL_NONE"); |
16689 | 55 |
} |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
56 |
checkNotCompiled(); |
16689 | 57 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
58 |
// COMP_LEVEL_ANY is inapplicable as level for compilation |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
59 |
WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_ANY); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
60 |
checkNotCompiled(); |
16689 | 61 |
|
19332 | 62 |
// not existing comp level |
63 |
WHITE_BOX.enqueueMethodForCompilation(method, 42); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
64 |
checkNotCompiled(); |
16689 | 65 |
|
66 |
compile(); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
67 |
checkCompiled(); |
19332 | 68 |
|
69 |
int compLevel = getCompLevel(); |
|
70 |
int bci = WHITE_BOX.getMethodEntryBci(method); |
|
71 |
deoptimize(); |
|
72 |
checkNotCompiled(); |
|
20294
af95d17f2e04
8023452: TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents:
19332
diff
changeset
|
73 |
WHITE_BOX.clearMethodState(method); |
af95d17f2e04
8023452: TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents:
19332
diff
changeset
|
74 |
|
19332 | 75 |
WHITE_BOX.enqueueMethodForCompilation(method, compLevel, bci); |
76 |
checkCompiled(); |
|
77 |
deoptimize(); |
|
78 |
checkNotCompiled(); |
|
79 |
||
80 |
compile(); |
|
81 |
checkCompiled(); |
|
82 |
deoptimize(); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
83 |
checkNotCompiled(); |
16689 | 84 |
} |
85 |
} |