hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java
author stsmirno
Mon, 17 Oct 2016 18:54:12 -0400
changeset 41705 332239c052cc
parent 40059 c2304140ed64
child 43939 39f5b59549de
permissions -rw-r--r--
8165687: Fix license and copyright headers in jd9 under hotspot/test Summary: Legal notices and Oracle copyrights were updated (white and blank space, commas) in tests files for uniformity to meet Oracle requirements. Reviewed-by: dholmes, iris Contributed-by: Stanislav Smirnov <stanislav.smirnov@oracle.com>, Vassili Igouchkine <vassili.igouchkine@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     1
/*
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     4
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     8
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    13
 * accompanied this code).
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    14
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    18
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    21
 * questions.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    22
 */
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    23
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    24
package compiler.jvmci.compilerToVM;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    25
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    26
import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    27
import jdk.internal.reflect.ConstantPool;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    28
import jdk.internal.reflect.ConstantPool.Tag;
33632
038347770a9e 8139170: JVMCI refresh
twisti
parents: 33160
diff changeset
    29
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
39421
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
    30
import jdk.vm.ci.meta.ResolvedJavaMethod;
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    31
import sun.hotspot.WhiteBox;
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    32
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    33
import java.util.HashMap;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    34
import java.util.Map;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    35
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    36
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_CLASS;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    37
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_DOUBLE;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    38
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    39
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FLOAT;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    40
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTEGER;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    41
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    42
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVALID;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    43
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    44
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_LONG;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    45
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODHANDLE;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    46
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    47
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODTYPE;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    48
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_NAMEANDTYPE;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    49
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_STRING;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    50
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_UTF8;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    51
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    52
/**
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    53
 * Common class for jdk.vm.ci.hotspot.CompilerToVM constant pool tests
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    54
 */
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    55
public class ConstantPoolTestCase {
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    56
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    57
    private static final Map<Tag, ConstantTypes> TAG_TO_TYPE_MAP;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    58
    static {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    59
        TAG_TO_TYPE_MAP = new HashMap<>();
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    60
        TAG_TO_TYPE_MAP.put(Tag.CLASS, CONSTANT_CLASS);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    61
        TAG_TO_TYPE_MAP.put(Tag.FIELDREF, CONSTANT_FIELDREF);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    62
        TAG_TO_TYPE_MAP.put(Tag.METHODREF, CONSTANT_METHODREF);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    63
        TAG_TO_TYPE_MAP.put(Tag.INTERFACEMETHODREF, CONSTANT_INTERFACEMETHODREF);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    64
        TAG_TO_TYPE_MAP.put(Tag.STRING, CONSTANT_STRING);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    65
        TAG_TO_TYPE_MAP.put(Tag.INTEGER, CONSTANT_INTEGER);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    66
        TAG_TO_TYPE_MAP.put(Tag.FLOAT, CONSTANT_FLOAT);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    67
        TAG_TO_TYPE_MAP.put(Tag.LONG, CONSTANT_LONG);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    68
        TAG_TO_TYPE_MAP.put(Tag.DOUBLE, CONSTANT_DOUBLE);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    69
        TAG_TO_TYPE_MAP.put(Tag.NAMEANDTYPE, CONSTANT_NAMEANDTYPE);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    70
        TAG_TO_TYPE_MAP.put(Tag.UTF8, CONSTANT_UTF8);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    71
        TAG_TO_TYPE_MAP.put(Tag.METHODHANDLE, CONSTANT_METHODHANDLE);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    72
        TAG_TO_TYPE_MAP.put(Tag.METHODTYPE, CONSTANT_METHODTYPE);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    73
        TAG_TO_TYPE_MAP.put(Tag.INVOKEDYNAMIC, CONSTANT_INVOKEDYNAMIC);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    74
        TAG_TO_TYPE_MAP.put(Tag.INVALID, CONSTANT_INVALID);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    75
    }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    76
    private static final WhiteBox WB = WhiteBox.getWhiteBox();
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    77
    private final Map<ConstantTypes, Validator> typeTests;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    78
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    79
    public static enum ConstantTypes {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    80
        CONSTANT_CLASS {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    81
            @Override
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    82
            public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    83
                ConstantPool constantPoolSS = dummyClass.constantPoolSS;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    84
                checkIndex(constantPoolSS, index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    85
                Class<?> klass = constantPoolSS.getClassAt(index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    86
                String klassName = klass.getName();
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    87
                TestedCPEntry[] testedEntries = dummyClass.testedCP.get(this);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    88
                for (TestedCPEntry entry : testedEntries) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    89
                    if (entry.klass.replaceAll("/", "\\.").equals(klassName)) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    90
                        return entry;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    91
                    }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    92
                }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    93
                return null;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    94
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    95
        },
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    96
        CONSTANT_FIELDREF {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    97
            @Override
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    98
            public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    99
                return this.getTestedCPEntryForMethodAndField(dummyClass, index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   100
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   101
        },
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   102
        CONSTANT_METHODREF {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   103
            @Override
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   104
            public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   105
                return this.getTestedCPEntryForMethodAndField(dummyClass, index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   106
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   107
        },
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   108
        CONSTANT_INTERFACEMETHODREF {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   109
            @Override
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   110
            public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   111
                return this.getTestedCPEntryForMethodAndField(dummyClass, index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   112
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   113
        },
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   114
        CONSTANT_STRING {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   115
            @Override
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   116
            public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   117
                ConstantPool constantPoolSS = dummyClass.constantPoolSS;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   118
                checkIndex(constantPoolSS, index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   119
                String value = constantPoolSS.getStringAt(index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   120
                TestedCPEntry[] testedEntries = dummyClass.testedCP.get(this);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   121
                for (TestedCPEntry entry : testedEntries) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   122
                    if (entry.name.equals(value)) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   123
                        return entry;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   124
                    }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   125
                }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   126
                return null;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   127
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   128
        },
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   129
        CONSTANT_INTEGER,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   130
        CONSTANT_FLOAT,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   131
        CONSTANT_LONG,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   132
        CONSTANT_DOUBLE,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   133
        CONSTANT_NAMEANDTYPE,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   134
        CONSTANT_UTF8,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   135
        CONSTANT_METHODHANDLE,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   136
        CONSTANT_METHODTYPE,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   137
        CONSTANT_INVOKEDYNAMIC {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   138
            @Override
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   139
            public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   140
                ConstantPool constantPoolSS = dummyClass.constantPoolSS;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   141
                checkIndex(constantPoolSS, index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   142
                int nameAndTypeIndex = constantPoolSS.getNameAndTypeRefIndexAt(index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   143
                String[] info = constantPoolSS.getNameAndTypeRefInfoAt(nameAndTypeIndex);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   144
                TestedCPEntry[] testedEntries = dummyClass.testedCP.get(this);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   145
                for (TestedCPEntry entry : testedEntries) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   146
                    if (info[0].equals(entry.name) && info[1].equals(entry.type)) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   147
                        return entry;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   148
                    }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   149
                }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   150
                return null;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   151
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   152
        },
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   153
        CONSTANT_INVALID;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   154
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   155
        public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   156
            return null; // returning null by default
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   157
        }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   158
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   159
        public TestedCPEntry[] getAllCPEntriesForType(DummyClasses dummyClass) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   160
            TestedCPEntry[] toReturn = dummyClass.testedCP.get(this);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   161
            if (toReturn == null) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   162
                return new TestedCPEntry[0];
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   163
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   164
            return dummyClass.testedCP.get(this);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   165
        }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   166
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   167
        protected TestedCPEntry getTestedCPEntryForMethodAndField(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   168
            ConstantPool constantPoolSS = dummyClass.constantPoolSS;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   169
            checkIndex(constantPoolSS, index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   170
            String[] info = constantPoolSS.getMemberRefInfoAt(index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   171
            TestedCPEntry[] testedEntries = dummyClass.testedCP.get(this);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   172
            for (TestedCPEntry entry : testedEntries) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   173
                if (info[0].equals(entry.klass) && info[1].equals(entry.name) && info[2].equals(entry.type)) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   174
                    return entry;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   175
                }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   176
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   177
            return null;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   178
        }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   179
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   180
        protected void checkIndex(ConstantPool constantPoolSS, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   181
            ConstantPool.Tag tag = constantPoolSS.getTagAt(index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   182
            ConstantTypes type = mapTagToCPType(tag);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   183
            if (!this.equals(type)) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   184
                String msg = String.format("TESTBUG: CP tag should be a %s, but is %s",
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   185
                                           this.name(),
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   186
                                           type.name());
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   187
               throw new Error(msg);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   188
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   189
        }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   190
    }
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   191
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   192
    public static interface Validator {
33632
038347770a9e 8139170: JVMCI refresh
twisti
parents: 33160
diff changeset
   193
        void validate(jdk.vm.ci.meta.ConstantPool constantPoolCTVM,
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   194
                      ConstantTypes cpType,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   195
                      DummyClasses dummyClass,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   196
                      int index);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   197
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   198
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   199
    public static class TestedCPEntry {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   200
        public final String klass;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   201
        public final String name;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   202
        public final String type;
39421
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   203
        public final ResolvedJavaMethod[] methods;
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   204
        public final byte[] opcodes;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   205
        public final long accFlags;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   206
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   207
        public TestedCPEntry(String klass, String name, String type, byte[] opcodes, long accFlags) {
39421
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   208
                this(klass, name, type, null, opcodes, accFlags);
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   209
        }
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   210
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   211
        public TestedCPEntry(String klass, String name, String type, ResolvedJavaMethod[] methods, byte[] opcodes, long accFlags) {
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   212
            this.klass = klass;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   213
            this.name = name;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   214
            this.type = type;
39421
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   215
            if (methods != null) {
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   216
                this.methods = new ResolvedJavaMethod[methods.length];
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   217
                System.arraycopy(methods, 0, this.methods, 0, methods.length);
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   218
            } else {
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   219
                this.methods = null;
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   220
            }
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   221
            if (opcodes != null) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   222
                this.opcodes = new byte[opcodes.length];
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   223
                System.arraycopy(opcodes, 0, this.opcodes, 0, opcodes.length);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   224
            } else {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   225
                this.opcodes = null;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   226
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   227
            this.accFlags = accFlags;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   228
        }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   229
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   230
        public TestedCPEntry(String klass, String name, String type, byte[] opcodes) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   231
            this(klass, name, type, opcodes, 0);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   232
        }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   233
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   234
        public TestedCPEntry(String klass, String name, String type) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   235
            this(klass, name, type, null, 0);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   236
        }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   237
    }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   238
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   239
    public static ConstantTypes mapTagToCPType(Tag tag) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   240
        return TAG_TO_TYPE_MAP.get(tag);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   241
    }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   242
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   243
    public ConstantPoolTestCase(Map<ConstantTypes, Validator> typeTests) {
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   244
        this.typeTests = new HashMap<>();
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   245
        this.typeTests.putAll(typeTests);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   246
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   247
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   248
    public void test() {
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   249
        for (DummyClasses dummyClass : DummyClasses.values()) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   250
            boolean isCPCached = WB.getConstantPoolCacheLength(dummyClass.klass) > -1;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   251
            System.out.printf("Testing dummy %s with constant pool cached = %b%n",
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   252
                              dummyClass.klass,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   253
                              isCPCached);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   254
            HotSpotResolvedObjectType holder = HotSpotResolvedObjectType.fromObjectClass(dummyClass.klass);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   255
            jdk.vm.ci.meta.ConstantPool constantPoolCTVM = holder.getConstantPool();
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   256
            ConstantPool constantPoolSS = dummyClass.constantPoolSS;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   257
            for (int i = 0; i < constantPoolSS.getSize(); i++) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   258
                Tag tag = constantPoolSS.getTagAt(i);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   259
                ConstantTypes cpType = mapTagToCPType(tag);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   260
                if (!typeTests.keySet().contains(cpType)) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   261
                    continue;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   262
                }
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   263
                typeTests.get(cpType).validate(constantPoolCTVM, cpType, dummyClass, i);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   264
            }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   265
        }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   266
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   267
}