test/hotspot/jtreg/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java
author kvn
Fri, 07 Jun 2019 13:57:08 -0700
changeset 55295 14283f280695
parent 50858 2d3e99a72541
permissions -rw-r--r--
8225350: compiler/jvmci/compilerToVM/IsCompilableTest.java timed out Reviewed-by: iignatyev
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;
50858
2d3e99a72541 8205824: Update Graal
never
parents: 47216
diff changeset
    29
import jdk.vm.ci.hotspot.CompilerToVMHelper;
33632
038347770a9e 8139170: JVMCI refresh
twisti
parents: 33160
diff changeset
    30
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
39421
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
    31
import jdk.vm.ci.meta.ResolvedJavaMethod;
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    32
import sun.hotspot.WhiteBox;
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    33
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    34
import java.util.HashMap;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    35
import java.util.Map;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    36
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    37
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_CLASS;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    38
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_DOUBLE;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    39
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    40
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FLOAT;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    41
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTEGER;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    42
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    43
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVALID;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    44
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    45
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_LONG;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    46
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODHANDLE;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    47
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    48
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODTYPE;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    49
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_NAMEANDTYPE;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    50
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_STRING;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39421
diff changeset
    51
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_UTF8;
33160
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
/**
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    54
 * Common class for jdk.vm.ci.hotspot.CompilerToVM constant pool tests
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    55
 */
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    56
public class ConstantPoolTestCase {
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    57
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    58
    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
    59
    static {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    60
        TAG_TO_TYPE_MAP = new HashMap<>();
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    61
        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
    62
        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
    63
        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
    64
        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
    65
        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
    66
        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
    67
        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
    68
        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
    69
        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
    70
        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
    71
        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
    72
        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
    73
        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
    74
        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
    75
        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
    76
    }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    77
    private static final WhiteBox WB = WhiteBox.getWhiteBox();
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    78
    private final Map<ConstantTypes, Validator> typeTests;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    79
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    80
    public static enum ConstantTypes {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    81
        CONSTANT_CLASS {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    82
            @Override
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    83
            public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    84
                ConstantPool constantPoolSS = dummyClass.constantPoolSS;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    85
                checkIndex(constantPoolSS, index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    86
                Class<?> klass = constantPoolSS.getClassAt(index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    87
                String klassName = klass.getName();
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    88
                TestedCPEntry[] testedEntries = dummyClass.testedCP.get(this);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    89
                for (TestedCPEntry entry : testedEntries) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    90
                    if (entry.klass.replaceAll("/", "\\.").equals(klassName)) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    91
                        return entry;
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
                }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    94
                return null;
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
        },
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    97
        CONSTANT_FIELDREF {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    98
            @Override
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
    99
            public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   100
                return this.getTestedCPEntryForMethodAndField(dummyClass, index);
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
        },
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   103
        CONSTANT_METHODREF {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   104
            @Override
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   105
            public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   106
                return this.getTestedCPEntryForMethodAndField(dummyClass, index);
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
        },
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   109
        CONSTANT_INTERFACEMETHODREF {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   110
            @Override
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   111
            public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   112
                return this.getTestedCPEntryForMethodAndField(dummyClass, index);
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
        },
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   115
        CONSTANT_STRING {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   116
            @Override
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   117
            public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   118
                ConstantPool constantPoolSS = dummyClass.constantPoolSS;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   119
                checkIndex(constantPoolSS, index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   120
                String value = constantPoolSS.getStringAt(index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   121
                TestedCPEntry[] testedEntries = dummyClass.testedCP.get(this);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   122
                for (TestedCPEntry entry : testedEntries) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   123
                    if (entry.name.equals(value)) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   124
                        return entry;
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
                }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   127
                return null;
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
        },
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   130
        CONSTANT_INTEGER,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   131
        CONSTANT_FLOAT,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   132
        CONSTANT_LONG,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   133
        CONSTANT_DOUBLE,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   134
        CONSTANT_NAMEANDTYPE,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   135
        CONSTANT_UTF8,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   136
        CONSTANT_METHODHANDLE,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   137
        CONSTANT_METHODTYPE,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   138
        CONSTANT_INVOKEDYNAMIC {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   139
            @Override
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   140
            public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   141
                ConstantPool constantPoolSS = dummyClass.constantPoolSS;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   142
                checkIndex(constantPoolSS, index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   143
                int nameAndTypeIndex = constantPoolSS.getNameAndTypeRefIndexAt(index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   144
                String[] info = constantPoolSS.getNameAndTypeRefInfoAt(nameAndTypeIndex);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   145
                TestedCPEntry[] testedEntries = dummyClass.testedCP.get(this);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   146
                for (TestedCPEntry entry : testedEntries) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   147
                    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
   148
                        return entry;
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
                }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   151
                return null;
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
        },
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   154
        CONSTANT_INVALID;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   155
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   156
        public TestedCPEntry getTestedCPEntry(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   157
            return null; // returning null by default
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
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   160
        public TestedCPEntry[] getAllCPEntriesForType(DummyClasses dummyClass) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   161
            TestedCPEntry[] toReturn = dummyClass.testedCP.get(this);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   162
            if (toReturn == null) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   163
                return new TestedCPEntry[0];
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   164
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   165
            return dummyClass.testedCP.get(this);
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
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   168
        protected TestedCPEntry getTestedCPEntryForMethodAndField(DummyClasses dummyClass, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   169
            ConstantPool constantPoolSS = dummyClass.constantPoolSS;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   170
            checkIndex(constantPoolSS, index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   171
            String[] info = constantPoolSS.getMemberRefInfoAt(index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   172
            TestedCPEntry[] testedEntries = dummyClass.testedCP.get(this);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   173
            for (TestedCPEntry entry : testedEntries) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   174
                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
   175
                    return entry;
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
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   178
            return null;
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
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   181
        protected void checkIndex(ConstantPool constantPoolSS, int index) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   182
            ConstantPool.Tag tag = constantPoolSS.getTagAt(index);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   183
            ConstantTypes type = mapTagToCPType(tag);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   184
            if (!this.equals(type)) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   185
                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
   186
                                           this.name(),
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   187
                                           type.name());
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   188
               throw new Error(msg);
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
        }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   191
    }
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   192
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   193
    public static interface Validator {
33632
038347770a9e 8139170: JVMCI refresh
twisti
parents: 33160
diff changeset
   194
        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
   195
                      ConstantTypes cpType,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   196
                      DummyClasses dummyClass,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   197
                      int index);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   198
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   199
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   200
    public static class TestedCPEntry {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   201
        public final String klass;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   202
        public final String name;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   203
        public final String type;
39421
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   204
        public final ResolvedJavaMethod[] methods;
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   205
        public final byte[] opcodes;
43939
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 41705
diff changeset
   206
        public final int accFlags;
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   207
43939
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 41705
diff changeset
   208
        public TestedCPEntry(String klass, String name, String type, byte[] opcodes, int accFlags) {
39421
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   209
                this(klass, name, type, null, opcodes, accFlags);
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
43939
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 41705
diff changeset
   212
        public TestedCPEntry(String klass, String name, String type, ResolvedJavaMethod[] methods, byte[] opcodes, int accFlags) {
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   213
            this.klass = klass;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   214
            this.name = name;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   215
            this.type = type;
39421
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   216
            if (methods != null) {
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   217
                this.methods = new ResolvedJavaMethod[methods.length];
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   218
                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
   219
            } else {
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   220
                this.methods = null;
a9652c919db8 8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents: 37301
diff changeset
   221
            }
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   222
            if (opcodes != null) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   223
                this.opcodes = new byte[opcodes.length];
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   224
                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
   225
            } else {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   226
                this.opcodes = null;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   227
            }
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   228
            this.accFlags = accFlags;
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
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   231
        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
   232
            this(klass, name, type, opcodes, 0);
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
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   235
        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
   236
            this(klass, name, type, null, 0);
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
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   240
    public static ConstantTypes mapTagToCPType(Tag tag) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   241
        return TAG_TO_TYPE_MAP.get(tag);
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
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   244
    public ConstantPoolTestCase(Map<ConstantTypes, Validator> typeTests) {
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   245
        this.typeTests = new HashMap<>();
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   246
        this.typeTests.putAll(typeTests);
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
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   249
    public void test() {
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   250
        for (DummyClasses dummyClass : DummyClasses.values()) {
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   251
            boolean isCPCached = WB.getConstantPoolCacheLength(dummyClass.klass) > -1;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   252
            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
   253
                              dummyClass.klass,
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   254
                              isCPCached);
50858
2d3e99a72541 8205824: Update Graal
never
parents: 47216
diff changeset
   255
            HotSpotResolvedObjectType holder = CompilerToVMHelper.fromObjectClass(dummyClass.klass);
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   256
            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
   257
            ConstantPool constantPoolSS = dummyClass.constantPoolSS;
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   258
            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
   259
                Tag tag = constantPoolSS.getTagAt(i);
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   260
                ConstantTypes cpType = mapTagToCPType(tag);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   261
                if (!typeTests.keySet().contains(cpType)) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   262
                    continue;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   263
                }
36305
55c7fe59d6d7 8141618: Change JVMCI compilerToVM constant pool tests to support CP cache
kshefov
parents: 33632
diff changeset
   264
                typeTests.get(cpType).validate(constantPoolCTVM, cpType, dummyClass, i);
33160
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
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   268
}