hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java
author rschatz
Thu, 12 May 2016 12:59:35 +0200
changeset 38678 06d6c40ce33b
parent 38027 8a5693d27400
child 39291 a4efe145313d
child 39423 0f8dc3693499
permissions -rw-r--r--
8156768: [JVMCI] remove support for patching Symbol pointers Reviewed-by: iveresov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     1
/*
35582
c32a0cc19877 8147599: [JVMCI] simplify code installation interface
rschatz
parents: 35137
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     4
 *
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     8
 *
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    13
 * accompanied this code).
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    14
 *
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    18
 *
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    21
 * questions.
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    22
 */
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    23
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    24
/**
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    25
 * @test
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    26
 * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35604
diff changeset
    27
 * @library /
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35604
diff changeset
    28
 * @modules jdk.vm.ci/jdk.vm.ci.hotspot
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35604
diff changeset
    29
 *          jdk.vm.ci/jdk.vm.ci.meta
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35604
diff changeset
    30
 *          jdk.vm.ci/jdk.vm.ci.code
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35604
diff changeset
    31
 *          jdk.vm.ci/jdk.vm.ci.code.site
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35604
diff changeset
    32
 *          jdk.vm.ci/jdk.vm.ci.runtime
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35604
diff changeset
    33
 *          jdk.vm.ci/jdk.vm.ci.amd64
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35604
diff changeset
    34
 *          jdk.vm.ci/jdk.vm.ci.sparc
38027
8a5693d27400 8153439: do not install an empty SpeculationLog in an nmethod
dnsimon
parents: 36842
diff changeset
    35
 * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
8a5693d27400 8153439: do not install an empty SpeculationLog in an nmethod
dnsimon
parents: 36842
diff changeset
    36
 * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.DataPatchTest
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    37
 */
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    38
38027
8a5693d27400 8153439: do not install an empty SpeculationLog in an nmethod
dnsimon
parents: 36842
diff changeset
    39
package jdk.vm.ci.code.test;
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    40
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    41
import jdk.vm.ci.code.Register;
35582
c32a0cc19877 8147599: [JVMCI] simplify code installation interface
rschatz
parents: 35137
diff changeset
    42
import jdk.vm.ci.code.site.DataSectionReference;
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    43
import jdk.vm.ci.hotspot.HotSpotConstant;
36842
8f0d0faa51e2 8152634: generalize exception throwing routines in JVMCIRuntime
rschatz
parents: 36508
diff changeset
    44
import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider;
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    45
import jdk.vm.ci.hotspot.HotSpotVMConfig;
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    46
import jdk.vm.ci.meta.ResolvedJavaType;
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    47
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    48
import org.junit.Assume;
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    49
import org.junit.Test;
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    50
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    51
/**
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    52
 * Test code installation with data patches.
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    53
 */
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    54
public class DataPatchTest extends CodeInstallationTest {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    55
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    56
    public static Class<?> getConstClass() {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    57
        return DataPatchTest.class;
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    58
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    59
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    60
    private void test(TestCompiler compiler) {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    61
        test(compiler, getMethod("getConstClass"));
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    62
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    63
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    64
    @Test
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    65
    public void testInlineObject() {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    66
        test(asm -> {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    67
            ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
35604
7b6aa6e00062 8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents: 35582
diff changeset
    68
            HotSpotConstant c = (HotSpotConstant) constantReflection.asJavaClass(type);
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    69
            Register ret = asm.emitLoadPointer(c);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    70
            asm.emitPointerRet(ret);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    71
        });
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    72
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    73
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    74
    @Test
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    75
    public void testInlineNarrowObject() {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    76
        Assume.assumeTrue(HotSpotVMConfig.config().useCompressedOops);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    77
        test(asm -> {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    78
            ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
35604
7b6aa6e00062 8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents: 35582
diff changeset
    79
            HotSpotConstant c = (HotSpotConstant) constantReflection.asJavaClass(type);
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    80
            Register compressed = asm.emitLoadPointer((HotSpotConstant) c.compress());
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    81
            Register ret = asm.emitUncompressPointer(compressed, HotSpotVMConfig.config().narrowOopBase, HotSpotVMConfig.config().narrowOopShift);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    82
            asm.emitPointerRet(ret);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    83
        });
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    84
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    85
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    86
    @Test
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    87
    public void testDataSectionReference() {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    88
        test(asm -> {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    89
            ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
35604
7b6aa6e00062 8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents: 35582
diff changeset
    90
            HotSpotConstant c = (HotSpotConstant) constantReflection.asJavaClass(type);
35582
c32a0cc19877 8147599: [JVMCI] simplify code installation interface
rschatz
parents: 35137
diff changeset
    91
            DataSectionReference ref = asm.emitDataItem(c);
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    92
            Register ret = asm.emitLoadPointer(ref);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    93
            asm.emitPointerRet(ret);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    94
        });
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    95
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    96
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    97
    @Test
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    98
    public void testNarrowDataSectionReference() {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    99
        Assume.assumeTrue(HotSpotVMConfig.config().useCompressedOops);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   100
        test(asm -> {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   101
            ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
35604
7b6aa6e00062 8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents: 35582
diff changeset
   102
            HotSpotConstant c = (HotSpotConstant) constantReflection.asJavaClass(type);
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   103
            HotSpotConstant cCompressed = (HotSpotConstant) c.compress();
35582
c32a0cc19877 8147599: [JVMCI] simplify code installation interface
rschatz
parents: 35137
diff changeset
   104
            DataSectionReference ref = asm.emitDataItem(cCompressed);
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   105
            Register compressed = asm.emitLoadNarrowPointer(ref);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   106
            Register ret = asm.emitUncompressPointer(compressed, HotSpotVMConfig.config().narrowOopBase, HotSpotVMConfig.config().narrowOopShift);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   107
            asm.emitPointerRet(ret);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   108
        });
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   109
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   110
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   111
    @Test
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   112
    public void testInlineMetadata() {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   113
        test(asm -> {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   114
            ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
35604
7b6aa6e00062 8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents: 35582
diff changeset
   115
            Register klass = asm.emitLoadPointer((HotSpotConstant) constantReflection.asObjectHub(type));
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   116
            Register ret = asm.emitLoadPointer(klass, HotSpotVMConfig.config().classMirrorOffset);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   117
            asm.emitPointerRet(ret);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   118
        });
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   119
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   120
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   121
    @Test
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   122
    public void testInlineNarrowMetadata() {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   123
        Assume.assumeTrue(HotSpotVMConfig.config().useCompressedClassPointers);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   124
        test(asm -> {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   125
            ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
35604
7b6aa6e00062 8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents: 35582
diff changeset
   126
            HotSpotConstant hub = (HotSpotConstant) constantReflection.asObjectHub(type);
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   127
            Register narrowKlass = asm.emitLoadPointer((HotSpotConstant) hub.compress());
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   128
            Register klass = asm.emitUncompressPointer(narrowKlass, HotSpotVMConfig.config().narrowKlassBase, HotSpotVMConfig.config().narrowKlassShift);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   129
            Register ret = asm.emitLoadPointer(klass, HotSpotVMConfig.config().classMirrorOffset);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   130
            asm.emitPointerRet(ret);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   131
        });
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   132
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   133
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   134
    @Test
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   135
    public void testMetadataInDataSection() {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   136
        test(asm -> {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   137
            ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
35604
7b6aa6e00062 8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents: 35582
diff changeset
   138
            HotSpotConstant hub = (HotSpotConstant) constantReflection.asObjectHub(type);
35582
c32a0cc19877 8147599: [JVMCI] simplify code installation interface
rschatz
parents: 35137
diff changeset
   139
            DataSectionReference ref = asm.emitDataItem(hub);
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   140
            Register klass = asm.emitLoadPointer(ref);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   141
            Register ret = asm.emitLoadPointer(klass, HotSpotVMConfig.config().classMirrorOffset);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   142
            asm.emitPointerRet(ret);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   143
        });
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   144
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   145
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   146
    @Test
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   147
    public void testNarrowMetadataInDataSection() {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   148
        Assume.assumeTrue(HotSpotVMConfig.config().useCompressedClassPointers);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   149
        test(asm -> {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   150
            ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
35604
7b6aa6e00062 8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents: 35582
diff changeset
   151
            HotSpotConstant hub = (HotSpotConstant) constantReflection.asObjectHub(type);
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   152
            HotSpotConstant narrowHub = (HotSpotConstant) hub.compress();
35582
c32a0cc19877 8147599: [JVMCI] simplify code installation interface
rschatz
parents: 35137
diff changeset
   153
            DataSectionReference ref = asm.emitDataItem(narrowHub);
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   154
            Register narrowKlass = asm.emitLoadNarrowPointer(ref);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   155
            Register klass = asm.emitUncompressPointer(narrowKlass, HotSpotVMConfig.config().narrowKlassBase, HotSpotVMConfig.config().narrowKlassShift);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   156
            Register ret = asm.emitLoadPointer(klass, HotSpotVMConfig.config().classMirrorOffset);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   157
            asm.emitPointerRet(ret);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   158
        });
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   159
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
   160
}