Mercurial > hg > graal-jvmci-8
annotate c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java @ 2276:f58974bce9bd
Up-to-date with CRI changes.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 08 Mar 2011 10:26:25 +0100 |
parents | 2a36994d0967 |
children | 569d3fe7d65c |
rev | line source |
---|---|
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1 /* |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
2 * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved. |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
3 * |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
5 * that is described in this document. In particular, and without limitation, these intellectual property |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
6 * rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
7 * more additional patents or pending patent applications in the U.S. and in other countries. |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
8 * |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
10 * Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
11 * supplements. |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
12 * |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
13 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
14 * registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
15 * are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
16 * U.S. and other countries. |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
17 * |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
18 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
19 * Company, Ltd. |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
20 */ |
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
21 package com.sun.hotspot.c1x; |
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
22 |
1440
4d1d3bd140f9
Updated for changes in CRI.
Doug Simon <doug.simon@oracle.com>
parents:
1438
diff
changeset
|
23 import static com.sun.cri.ci.CiCallingConvention.Type.*; |
4d1d3bd140f9
Updated for changes in CRI.
Doug Simon <doug.simon@oracle.com>
parents:
1438
diff
changeset
|
24 import static com.sun.hotspot.c1x.TemplateFlag.*; |
4d1d3bd140f9
Updated for changes in CRI.
Doug Simon <doug.simon@oracle.com>
parents:
1438
diff
changeset
|
25 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
26 import java.lang.reflect.*; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
27 import java.util.*; |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
28 import java.util.concurrent.*; |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
29 |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
30 import com.sun.c1x.target.amd64.*; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
31 import com.sun.cri.ci.CiAddress.Scale; |
2217
2a36994d0967
Fixed an issue where parameter registers were hard coded to Linux values.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2183
diff
changeset
|
32 import com.sun.cri.ci.CiRegister.*; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
33 import com.sun.cri.ci.*; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
34 import com.sun.cri.ri.*; |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
35 import com.sun.cri.ri.RiType.Representation; |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
36 import com.sun.cri.xir.*; |
1440
4d1d3bd140f9
Updated for changes in CRI.
Doug Simon <doug.simon@oracle.com>
parents:
1438
diff
changeset
|
37 import com.sun.cri.xir.CiXirAssembler.XirLabel; |
4d1d3bd140f9
Updated for changes in CRI.
Doug Simon <doug.simon@oracle.com>
parents:
1438
diff
changeset
|
38 import com.sun.cri.xir.CiXirAssembler.XirMark; |
4d1d3bd140f9
Updated for changes in CRI.
Doug Simon <doug.simon@oracle.com>
parents:
1438
diff
changeset
|
39 import com.sun.cri.xir.CiXirAssembler.XirOperand; |
4d1d3bd140f9
Updated for changes in CRI.
Doug Simon <doug.simon@oracle.com>
parents:
1438
diff
changeset
|
40 import com.sun.cri.xir.CiXirAssembler.XirParameter; |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
41 |
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
42 /** |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
43 * |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
44 * @author Thomas Wuerthinger, Lukas Stadler |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
45 */ |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
46 public class HotSpotXirGenerator implements RiXirGenerator { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
47 |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1427
diff
changeset
|
48 // this needs to correspond to c1x_CodeInstaller.hpp |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
49 // @formatter:off |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
50 private static final Integer MARK_VERIFIED_ENTRY = 0x0001; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
51 private static final Integer MARK_UNVERIFIED_ENTRY = 0x0002; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
52 private static final Integer MARK_OSR_ENTRY = 0x0003; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
53 private static final Integer MARK_UNWIND_ENTRY = 0x0004; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
54 private static final Integer MARK_EXCEPTION_HANDLER_ENTRY = 0x0005; |
1936
8d88c9ac9247
Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1934
diff
changeset
|
55 private static final Integer MARK_DEOPT_HANDLER_ENTRY = 0x0006; |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
56 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
57 private static final Integer MARK_STATIC_CALL_STUB = 0x1000; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
58 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
59 private static final Integer MARK_INVOKE_INVALID = 0x2000; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
60 private static final Integer MARK_INVOKEINTERFACE = 0x2001; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
61 private static final Integer MARK_INVOKESTATIC = 0x2002; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
62 private static final Integer MARK_INVOKESPECIAL = 0x2003; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
63 private static final Integer MARK_INVOKEVIRTUAL = 0x2004; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
64 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
65 private static final Integer MARK_IMPLICIT_NULL = 0x3000; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
66 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
67 private static final Integer MARK_KLASS_PATCHING = 0x4000; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
68 private static final Integer MARK_DUMMY_OOP_RELOCATION = 0x4001; |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
69 private static final Integer MARK_ACCESS_FIELD_PATCHING = 0x4002; |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
70 // @formatter:on |
1427
149b1d2316de
basic invokeinterface and invokevirtual support
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1426
diff
changeset
|
71 |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
72 private final HotSpotVMConfig config; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
73 private final CiTarget target; |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
74 private final RiRegisterConfig registerConfig; |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
75 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
76 private CiXirAssembler asm; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
77 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
78 public HotSpotXirGenerator(HotSpotVMConfig config, CiTarget target, RiRegisterConfig registerConfig) { |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
79 this.config = config; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
80 this.target = target; |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
81 this.registerConfig = registerConfig; |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
82 } |
1417
2c41834aa270
Small adaptations
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1416
diff
changeset
|
83 |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
84 private SimpleTemplates prologueTemplates = new SimpleTemplates(STATIC_METHOD) { |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
85 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
86 @Override |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
87 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
88 asm.restart(CiKind.Void); |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
89 XirOperand framePointer = asm.createRegisterTemp("frame pointer", CiKind.Word, AMD64.rbp); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
90 XirOperand stackPointer = asm.createRegisterTemp("stack pointer", CiKind.Word, AMD64.rsp); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
91 XirLabel unverifiedStub = null; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
92 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
93 asm.mark(MARK_OSR_ENTRY); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
94 asm.mark(MARK_UNVERIFIED_ENTRY); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
95 if (!is(STATIC_METHOD, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
96 unverifiedStub = asm.createOutOfLineLabel("unverified"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
97 |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
98 XirOperand temp = asm.createRegisterTemp("temp (r10)", CiKind.Word, AMD64.r10); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
99 XirOperand cache = asm.createRegisterTemp("cache (rax)", CiKind.Word, AMD64.rax); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
100 |
1448
9196a2b32950
Modified C++ to reflect changes in calling convention CRI code.
Doug Simon <doug.simon@oracle.com>
parents:
1444
diff
changeset
|
101 CiCallingConvention conventions = registerConfig.getCallingConvention(JavaCallee, new CiKind[] {CiKind.Object}, target); |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
102 XirOperand receiver = asm.createRegisterTemp("receiver", CiKind.Word, conventions.locations[0].asRegister()); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
103 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
104 asm.pload(CiKind.Word, temp, receiver, asm.i(config.hubOffset), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
105 asm.jneq(unverifiedStub, cache, temp); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
106 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
107 asm.align(config.codeEntryAlignment); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
108 asm.mark(MARK_VERIFIED_ENTRY); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
109 asm.stackOverflowCheck(); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
110 asm.push(framePointer); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
111 asm.mov(framePointer, stackPointer); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
112 asm.pushFrame(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
113 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
114 // -- out of line ------------------------------------------------------- |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
115 XirOperand thread = asm.createRegisterTemp("thread", CiKind.Word, AMD64.r15); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
116 XirOperand exceptionOop = asm.createTemp("exception oop", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
117 XirLabel unwind = asm.createOutOfLineLabel("unwind"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
118 asm.bindOutOfLine(unwind); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
119 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
120 asm.mark(MARK_UNWIND_ENTRY); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
121 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
122 asm.pload(CiKind.Object, exceptionOop, thread, asm.i(config.threadExceptionOopOffset), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
123 asm.pstore(CiKind.Object, thread, asm.i(config.threadExceptionOopOffset), asm.createConstant(CiConstant.NULL_OBJECT), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
124 asm.pstore(CiKind.Long, thread, asm.i(config.threadExceptionPcOffset), asm.l(0), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
125 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
126 asm.callRuntime(config.unwindExceptionStub, null, exceptionOop); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
127 asm.shouldNotReachHere(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
128 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
129 asm.mark(MARK_EXCEPTION_HANDLER_ENTRY); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
130 asm.callRuntime(config.handleExceptionStub, null); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
131 asm.shouldNotReachHere(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
132 |
1936
8d88c9ac9247
Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1934
diff
changeset
|
133 asm.nop(1); |
8d88c9ac9247
Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1934
diff
changeset
|
134 asm.mark(MARK_DEOPT_HANDLER_ENTRY); |
8d88c9ac9247
Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1934
diff
changeset
|
135 asm.callRuntime(config.handleDeoptStub, null); |
8d88c9ac9247
Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1934
diff
changeset
|
136 asm.shouldNotReachHere(); |
8d88c9ac9247
Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1934
diff
changeset
|
137 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
138 if (!is(STATIC_METHOD, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
139 asm.bindOutOfLine(unverifiedStub); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
140 asm.jmpRuntime(config.inlineCacheMissStub); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
141 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
142 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
143 return asm.finishTemplate(is(STATIC_METHOD, flags) ? "static prologue" : "prologue"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
144 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
145 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
146 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
147 private SimpleTemplates epilogueTemplates = new SimpleTemplates(STATIC_METHOD, SYNCHRONIZED) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
148 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
149 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
150 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
151 asm.restart(CiKind.Void); |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
152 XirOperand framePointer = asm.createRegisterTemp("frame pointer", CiKind.Word, AMD64.rbp); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
153 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
154 asm.popFrame(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
155 asm.pop(framePointer); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
156 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
157 // TODO safepoint check |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
158 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
159 return asm.finishTemplate("epilogue"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
160 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
161 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
162 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
163 private SimpleTemplates safepointTemplates = new SimpleTemplates() { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
164 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
165 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
166 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
167 asm.restart(CiKind.Void); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
168 |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
169 // XirOperand temp = asm.createRegister("temp", CiKind.Word, AMD64.rax); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
170 // asm.pload(CiKind.Word, temp, asm.w(config.safepointPollingAddress), true); |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
171 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
172 return asm.finishTemplate("safepoint"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
173 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
174 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
175 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
176 private SimpleTemplates exceptionObjectTemplates = new SimpleTemplates() { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
177 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
178 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
179 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
180 XirOperand result = asm.restart(CiKind.Object); |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
181 XirOperand thread = asm.createRegisterTemp("thread", CiKind.Word, AMD64.r15); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
182 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
183 asm.pload(CiKind.Object, result, thread, asm.i(config.threadExceptionOopOffset), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
184 asm.pstore(CiKind.Object, thread, asm.i(config.threadExceptionOopOffset), asm.o(null), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
185 asm.pstore(CiKind.Long, thread, asm.i(config.threadExceptionPcOffset), asm.l(0), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
186 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
187 return asm.finishTemplate("exception object"); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
188 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
189 }; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
190 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
191 private SimpleTemplates resolveClassTemplates = new SimpleTemplates(UNRESOLVED) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
192 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
193 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
194 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
195 XirOperand result = asm.restart(CiKind.Word); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
196 if (is(UNRESOLVED, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
197 UnresolvedClassPatching patching = new UnresolvedClassPatching(asm, result, config); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
198 patching.emitInline(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
199 // -- out of line ------------------------------------------------------- |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
200 patching.emitOutOfLine(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
201 } else { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
202 XirOperand type = asm.createConstantInputParameter("type", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
203 asm.mov(result, type); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
204 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
205 return asm.finishTemplate(is(UNRESOLVED, flags) ? "resolve class (unresolved)" : "resolve class"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
206 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
207 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
208 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
209 private SimpleTemplates invokeInterfaceTemplates = new SimpleTemplates(NULL_CHECK) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
210 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
211 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
212 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
213 asm.restart(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
214 XirParameter receiver = asm.createInputParameter("receiver", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
215 XirParameter addr = asm.createConstantInputParameter("addr", CiKind.Word); |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
216 XirOperand temp = asm.createRegisterTemp("temp", CiKind.Word, AMD64.rax); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
217 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
218 if (is(NULL_CHECK, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
219 asm.nop(1); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
220 asm.mark(MARK_IMPLICIT_NULL); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
221 asm.pload(CiKind.Word, temp, receiver, true); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
222 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
223 asm.mark(MARK_INVOKEINTERFACE); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
224 asm.mov(temp, asm.createConstant(CiConstant.forObject(HotSpotProxy.DUMMY_CONSTANT_OBJ))); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
225 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
226 return asm.finishTemplate(addr, "invokeinterface"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
227 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
228 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
229 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
230 private SimpleTemplates invokeVirtualTemplates = new SimpleTemplates(NULL_CHECK) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
231 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
232 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
233 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
234 asm.restart(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
235 XirParameter receiver = asm.createInputParameter("receiver", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
236 XirParameter addr = asm.createConstantInputParameter("addr", CiKind.Word); |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
237 XirOperand temp = asm.createRegisterTemp("temp", CiKind.Word, AMD64.rax); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
238 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
239 if (is(NULL_CHECK, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
240 asm.nop(1); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
241 asm.mark(MARK_IMPLICIT_NULL); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
242 asm.pload(CiKind.Word, temp, receiver, true); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
243 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
244 asm.mark(MARK_INVOKEVIRTUAL); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
245 asm.mov(temp, asm.createConstant(CiConstant.forObject(HotSpotProxy.DUMMY_CONSTANT_OBJ))); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
246 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
247 return asm.finishTemplate(addr, "invokevirtual"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
248 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
249 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
250 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
251 private SimpleTemplates invokeSpecialTemplates = new SimpleTemplates(NULL_CHECK) { |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
252 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
253 @Override |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
254 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
255 asm.restart(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
256 XirParameter receiver = asm.createInputParameter("receiver", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
257 XirParameter addr = asm.createConstantInputParameter("addr", CiKind.Word); |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
258 XirOperand temp = asm.createRegisterTemp("temp", CiKind.Word, AMD64.rax); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
259 XirLabel stub = asm.createOutOfLineLabel("call stub"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
260 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
261 if (is(NULL_CHECK, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
262 asm.nop(1); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
263 asm.mark(MARK_IMPLICIT_NULL); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
264 asm.pload(CiKind.Word, temp, receiver, true); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
265 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
266 asm.mark(MARK_INVOKESPECIAL); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
267 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
268 // -- out of line ------------------------------------------------------- |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
269 asm.bindOutOfLine(stub); |
1465
2c754f3a2722
Inlining of static final field values. Java mirror instead of VmID. Support for PrintMetrics option.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1453
diff
changeset
|
270 XirOperand method = asm.createRegisterTemp("method", CiKind.Word, AMD64.rbx); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
271 asm.mark(MARK_STATIC_CALL_STUB, XirMark.CALLSITE); |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
272 asm.mov(method, asm.w(0L)); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
273 XirLabel dummy = asm.createOutOfLineLabel("dummy"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
274 asm.jmp(dummy); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
275 asm.bindOutOfLine(dummy); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
276 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
277 return asm.finishTemplate(addr, "invokespecial"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
278 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
279 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
280 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
281 private SimpleTemplates invokeStaticTemplates = new SimpleTemplates() { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
282 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
283 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
284 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
285 asm.restart(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
286 XirParameter addr = asm.createConstantInputParameter("addr", CiKind.Word); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
287 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
288 XirLabel stub = asm.createOutOfLineLabel("call stub"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
289 asm.mark(MARK_INVOKESTATIC); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
290 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
291 // -- out of line ------------------------------------------------------- |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
292 asm.bindOutOfLine(stub); |
1465
2c754f3a2722
Inlining of static final field values. Java mirror instead of VmID. Support for PrintMetrics option.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1453
diff
changeset
|
293 XirOperand method = asm.createRegisterTemp("method", CiKind.Word, AMD64.rbx); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
294 asm.mark(MARK_STATIC_CALL_STUB, XirMark.CALLSITE); |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
295 asm.mov(method, asm.w(0L)); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
296 XirLabel dummy = asm.createOutOfLineLabel("dummy"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
297 asm.jmp(dummy); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
298 asm.bindOutOfLine(dummy); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
299 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
300 return asm.finishTemplate(addr, "invokestatic"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
301 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
302 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
303 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
304 private SimpleTemplates monitorEnterTemplates = new SimpleTemplates(NULL_CHECK) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
305 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
306 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
307 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
308 asm.restart(CiKind.Void); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
309 XirParameter object = asm.createInputParameter("object", CiKind.Object); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
310 XirParameter lock = asm.createInputParameter("lock", CiKind.Word); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
311 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
312 if (is(NULL_CHECK, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
313 asm.nop(1); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
314 asm.mark(MARK_IMPLICIT_NULL); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
315 asm.pload(CiKind.Word, asm.createTemp("temp", CiKind.Word), object, true); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
316 } |
1453
d603bdbec024
Enable monitorenter/monitorexit runtime calls.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1452
diff
changeset
|
317 |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
318 |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
319 // (tw) It is important to use for this runtime call the debug info AFTER the monitor enter. Otherwise the monitor object |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
320 // is not correctly garbage collected. |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
321 final boolean useInfoAfter = true; |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
322 |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
323 if (config.useFastLocking) { |
2217
2a36994d0967
Fixed an issue where parameter registers were hard coded to Linux values.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2183
diff
changeset
|
324 useRegisters(asm, AMD64.rax, AMD64.rbx); |
2a36994d0967
Fixed an issue where parameter registers were hard coded to Linux values.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2183
diff
changeset
|
325 useRegisters(asm, getGeneralParameterRegister(0)); |
2a36994d0967
Fixed an issue where parameter registers were hard coded to Linux values.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2183
diff
changeset
|
326 useRegisters(asm, getGeneralParameterRegister(1)); |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
327 asm.callRuntime(config.fastMonitorEnterStub, null, useInfoAfter, object, lock); |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
328 } else { |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
329 asm.reserveOutgoingStack(target.wordSize * 2); |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
330 asm.pstore(CiKind.Object, asm.createRegister("rsp", CiKind.Word, AMD64.RSP.asRegister()), asm.i(target.wordSize), object, false); |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
331 asm.pstore(CiKind.Word, asm.createRegister("rsp", CiKind.Word, AMD64.RSP.asRegister()), asm.i(0), lock, false); |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
332 asm.callRuntime(config.monitorEnterStub, null, useInfoAfter); |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
333 } |
1453
d603bdbec024
Enable monitorenter/monitorexit runtime calls.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1452
diff
changeset
|
334 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
335 return asm.finishTemplate("monitorEnter"); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
336 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
337 }; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
338 |
2217
2a36994d0967
Fixed an issue where parameter registers were hard coded to Linux values.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2183
diff
changeset
|
339 private static CiRegister getGeneralParameterRegister(int index) { |
2a36994d0967
Fixed an issue where parameter registers were hard coded to Linux values.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2183
diff
changeset
|
340 return Compiler.getInstance().getRegisterConfig().getCallingConventionRegisters(CiCallingConvention.Type.RuntimeCall, RegisterFlag.CPU)[index]; |
2a36994d0967
Fixed an issue where parameter registers were hard coded to Linux values.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2183
diff
changeset
|
341 } |
2a36994d0967
Fixed an issue where parameter registers were hard coded to Linux values.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2183
diff
changeset
|
342 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
343 private SimpleTemplates monitorExitTemplates = new SimpleTemplates(NULL_CHECK) { |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
344 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
345 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
346 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
347 asm.restart(CiKind.Void); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
348 XirParameter object = asm.createInputParameter("object", CiKind.Object); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
349 XirParameter lock = asm.createInputParameter("lock", CiKind.Word); |
1453
d603bdbec024
Enable monitorenter/monitorexit runtime calls.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1452
diff
changeset
|
350 |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
351 if (config.useFastLocking) { |
2217
2a36994d0967
Fixed an issue where parameter registers were hard coded to Linux values.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2183
diff
changeset
|
352 useRegisters(asm, AMD64.rax, AMD64.rbx); |
2a36994d0967
Fixed an issue where parameter registers were hard coded to Linux values.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2183
diff
changeset
|
353 useRegisters(asm, getGeneralParameterRegister(0)); |
2a36994d0967
Fixed an issue where parameter registers were hard coded to Linux values.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2183
diff
changeset
|
354 useRegisters(asm, getGeneralParameterRegister(1)); |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
355 asm.callRuntime(config.fastMonitorExitStub, null, object, lock); |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
356 } else { |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
357 asm.reserveOutgoingStack(target.wordSize); |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
358 asm.pstore(CiKind.Word, asm.createRegister("rsp", CiKind.Word, AMD64.RSP.asRegister()), asm.i(0), lock, false); |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
359 asm.callRuntime(config.monitorExitStub, null); |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1936
diff
changeset
|
360 } |
1453
d603bdbec024
Enable monitorenter/monitorexit runtime calls.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1452
diff
changeset
|
361 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
362 return asm.finishTemplate("monitorExit"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
363 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
364 }; |
1422
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
365 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
366 private KindTemplates getFieldTemplates = new KindTemplates(NULL_CHECK, UNRESOLVED) { |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
367 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
368 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
369 protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) { |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
370 XirOperand result = asm.restart(kind); |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
371 XirParameter object = asm.createInputParameter("object", CiKind.Object); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
372 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
373 if (is(UNRESOLVED, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
374 UnresolvedFieldPatching fieldPatching = new UnresolvedFieldPatching(asm, object, result, false, is(NULL_CHECK, flags), config); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
375 fieldPatching.emitInline(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
376 // -- out of line ------------------------------------------------------- |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
377 fieldPatching.emitOutOfLine(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
378 return asm.finishTemplate("getfield<" + kind + ">"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
379 } |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
380 XirParameter fieldOffset = asm.createConstantInputParameter("fieldOffset", CiKind.Int); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
381 if (is(NULL_CHECK, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
382 asm.nop(1); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
383 asm.mark(MARK_IMPLICIT_NULL); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
384 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
385 asm.pload(kind, result, object, fieldOffset, is(NULL_CHECK, flags)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
386 return asm.finishTemplate("getfield<" + kind + ">"); |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
387 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
388 }; |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
389 |
2055
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
390 private KindTemplates writeBarrierTemplate = new KindTemplates() { |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
391 |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
392 @Override |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
393 protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) { |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
394 asm.restart(CiKind.Void); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
395 XirParameter object = asm.createInputParameter("object", CiKind.Object); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
396 |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
397 // Need temp operand, because the write barrier destroys the object pointer. |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
398 XirOperand temp = asm.createTemp("temp", CiKind.Object); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
399 asm.mov(temp, object); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
400 |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
401 writeBarrier(asm, temp); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
402 return asm.finishTemplate("writeBarrier"); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
403 } |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
404 }; |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
405 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
406 private KindTemplates putFieldTemplates = new KindTemplates(WRITE_BARRIER, NULL_CHECK, UNRESOLVED) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
407 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
408 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
409 protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) { |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
410 asm.restart(CiKind.Void); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
411 XirParameter object = asm.createInputParameter("object", CiKind.Object); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
412 XirParameter value = asm.createInputParameter("value", kind); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
413 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
414 if (is(UNRESOLVED, flags)) { |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
415 UnresolvedFieldPatching fieldPatching = new UnresolvedFieldPatching(asm, object, value, true, is(NULL_CHECK, flags), config); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
416 fieldPatching.emitInline(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
417 // -- out of line ------------------------------------------------------- |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
418 fieldPatching.emitOutOfLine(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
419 return asm.finishTemplate("putfield<" + kind + ">"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
420 } |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
421 XirParameter fieldOffset = asm.createConstantInputParameter("fieldOffset", CiKind.Int); |
1478
5571b97fc1ec
More JNI global handle clean ups.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1465
diff
changeset
|
422 if (kind == CiKind.Object) { |
5571b97fc1ec
More JNI global handle clean ups.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1465
diff
changeset
|
423 verifyPointer(asm, value); |
5571b97fc1ec
More JNI global handle clean ups.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1465
diff
changeset
|
424 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
425 if (is(NULL_CHECK, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
426 asm.nop(1); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
427 asm.mark(MARK_IMPLICIT_NULL); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
428 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
429 asm.pstore(kind, object, fieldOffset, value, is(NULL_CHECK, flags)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
430 if (is(WRITE_BARRIER, flags)) { |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
431 XirOperand temp = asm.createTemp("temp", CiKind.Word); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
432 asm.mov(temp, object); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
433 writeBarrier(asm, temp); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
434 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
435 return asm.finishTemplate("putfield<" + kind + ">"); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
436 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
437 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
438 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
439 private final IndexTemplates newInstanceTemplates = new IndexTemplates() { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
440 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
441 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
442 protected XirTemplate create(CiXirAssembler asm, long flags, int size) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
443 XirOperand result = asm.restart(CiKind.Word); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
444 XirOperand type = asm.createInputParameter("type", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
445 |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
446 XirOperand temp1 = asm.createRegisterTemp("temp1", CiKind.Word, AMD64.rcx); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
447 XirOperand temp2 = asm.createRegisterTemp("temp2", CiKind.Word, AMD64.rbx); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
448 XirOperand temp2i = asm.createRegisterTemp("temp2i", CiKind.Int, AMD64.rbx); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
449 useRegisters(asm, AMD64.rsi); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
450 XirLabel tlabFull = asm.createOutOfLineLabel("tlab full"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
451 XirLabel resume = asm.createInlineLabel("resume"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
452 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
453 // check if the class is already initialized |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
454 asm.pload(CiKind.Int, temp2i, type, asm.i(config.klassStateOffset), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
455 asm.jneq(tlabFull, temp2i, asm.i(config.klassStateFullyInitialized)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
456 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
457 XirOperand thread = asm.createRegisterTemp("thread", CiKind.Word, AMD64.r15); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
458 asm.pload(CiKind.Word, result, thread, asm.i(config.threadTlabTopOffset), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
459 asm.add(temp1, result, asm.w(size)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
460 asm.pload(CiKind.Word, temp2, thread, asm.i(config.threadTlabEndOffset), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
461 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
462 asm.jgt(tlabFull, temp1, temp2); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
463 asm.pstore(CiKind.Word, thread, asm.i(config.threadTlabTopOffset), temp1, false); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
464 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
465 asm.bindInline(resume); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
466 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
467 asm.pload(CiKind.Word, temp1, type, asm.i(config.instanceHeaderPrototypeOffset), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
468 asm.pstore(CiKind.Word, result, temp1, false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
469 asm.pstore(CiKind.Object, result, asm.i(config.hubOffset), type, false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
470 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
471 if (size > 2 * target.wordSize) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
472 asm.mov(temp1, asm.w(0)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
473 for (int offset = 2 * target.wordSize; offset < size; offset += target.wordSize) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
474 asm.pstore(CiKind.Word, result, asm.i(offset), temp1, false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
475 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
476 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
477 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
478 // -- out of line ------------------------------------------------------- |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
479 asm.bindOutOfLine(tlabFull); |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
480 XirOperand arg = asm.createRegisterTemp("runtime call argument", CiKind.Object, AMD64.rdx); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
481 asm.mov(arg, type); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
482 useRegisters(asm, AMD64.rax); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
483 asm.callRuntime(config.newInstanceStub, result); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
484 asm.jmp(resume); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
485 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
486 return asm.finishTemplate("new instance"); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
487 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
488 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
489 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
490 private SimpleTemplates newInstanceUnresolvedTemplates = new SimpleTemplates() { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
491 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
492 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
493 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
494 XirOperand result = asm.restart(CiKind.Word); |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
495 XirOperand arg = asm.createRegisterTemp("runtime call argument", CiKind.Object, AMD64.rdx); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
496 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
497 UnresolvedClassPatching patching = new UnresolvedClassPatching(asm, arg, config); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
498 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
499 patching.emitInline(); |
1444
c0e244017dad
Corrections of oop map generation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1440
diff
changeset
|
500 useRegisters(asm, AMD64.rbx, AMD64.rcx, AMD64.rsi, AMD64.rax); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
501 asm.callRuntime(config.unresolvedNewInstanceStub, result); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
502 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
503 // -- out of line ------------------------------------------------------- |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
504 patching.emitOutOfLine(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
505 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
506 return asm.finishTemplate("new instance"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
507 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
508 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
509 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
510 private SimpleTemplates newObjectArrayCloneTemplates = new SimpleTemplates() { |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
511 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
512 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
513 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
514 XirOperand result = asm.restart(CiKind.Object); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
515 XirParameter lengthParam = asm.createInputParameter("length", CiKind.Int, true); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
516 XirParameter src = asm.createInputParameter("src", CiKind.Object); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
517 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
518 // Set up length and hub. |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
519 XirOperand length = asm.createRegisterTemp("length", CiKind.Int, AMD64.rbx); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
520 XirOperand hub = asm.createRegisterTemp("hub", CiKind.Object, AMD64.rdx); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
521 asm.pload(CiKind.Object, hub, src, asm.i(config.hubOffset), false); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
522 asm.mov(length, lengthParam); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
523 |
1444
c0e244017dad
Corrections of oop map generation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1440
diff
changeset
|
524 useRegisters(asm, AMD64.rsi, AMD64.rcx, AMD64.rdi, AMD64.rax); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
525 asm.callRuntime(config.newObjectArrayStub, result); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
526 return asm.finishTemplate("objectArrayClone"); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
527 } |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
528 }; |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
529 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
530 private SimpleTemplates newObjectArrayTemplates = new SimpleTemplates(UNRESOLVED) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
531 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
532 @Override |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
533 protected XirTemplate create(CiXirAssembler asm, long flags) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
534 emitNewTypeArray(asm, flags, CiKind.Object, config.useFastNewObjectArray, config.newObjectArrayStub); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
535 return asm.finishTemplate(is(UNRESOLVED, flags) ? "newObjectArray (unresolved)" : "newObjectArray"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
536 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
537 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
538 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
539 private void emitNewTypeArray(CiXirAssembler asm, long flags, CiKind kind, boolean useFast, long slowPathStub) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
540 XirOperand result = asm.restart(CiKind.Word); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
541 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
542 XirParameter lengthParam = asm.createInputParameter("length", CiKind.Int, true); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
543 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
544 XirOperand length = asm.createRegisterTemp("length", CiKind.Int, AMD64.rbx); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
545 XirOperand hub = asm.createRegisterTemp("hub", CiKind.Object, AMD64.rdx); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
546 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
547 // Registers rsi, rcx, rdi, and rax are needed by the runtime call. |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
548 // Hub needs to be on rdx, length on rbx. |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
549 XirOperand temp1 = asm.createRegisterTemp("temp1", CiKind.Word, AMD64.rcx); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
550 XirOperand temp2 = asm.createRegisterTemp("temp2", CiKind.Word, AMD64.rax); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
551 XirOperand temp3 = asm.createRegisterTemp("temp3", CiKind.Word, AMD64.rdi); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
552 XirOperand size = asm.createRegisterTemp("size", CiKind.Int, AMD64.rsi); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
553 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
554 UnresolvedClassPatching patching = null; |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
555 if (is(UNRESOLVED, flags)) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
556 // insert the patching code for class resolving - the hub will end up in "hub" |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
557 patching = new UnresolvedClassPatching(asm, hub, config); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
558 patching.emitInline(); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
559 } else { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
560 asm.mov(hub, asm.createConstantInputParameter("hub", CiKind.Object)); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
561 } |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
562 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
563 asm.mov(length, lengthParam); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
564 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
565 if (useFast) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
566 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
567 XirLabel slowPath = asm.createOutOfLineLabel("slowPath"); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
568 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
569 XirLabel done = asm.createInlineLabel("done"); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
570 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
571 // Check for negative array size. |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
572 // TODO: Also check for upper bound |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
573 asm.jlt(slowPath, length, asm.i(0)); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
574 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
575 final int aligning = target.wordSize; |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
576 final int arrayLengthOffset = target.wordSize * 2; |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
577 final int arrayElementOffset = config.getArrayOffset(kind); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
578 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
579 // Calculate aligned size |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
580 asm.mov(size, length); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
581 int scale = CiUtil.log2(kind.sizeInBytes(target.wordSize)); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
582 if (scale != 0) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
583 asm.shl(size, size, asm.i(scale)); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
584 } |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
585 asm.add(size, size, asm.i(arrayElementOffset + aligning - 1)); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
586 long mask = 0xFFFFFFFFL; |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
587 mask <<= CiUtil.log2(aligning); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
588 asm.and(size, size, asm.i((int) mask)); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
589 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
590 // Try tlab allocation |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
591 XirOperand thread = asm.createRegisterTemp("thread", CiKind.Word, AMD64.r15); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
592 asm.pload(CiKind.Word, result, thread, asm.i(config.threadTlabTopOffset), false); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
593 asm.add(temp1, result, size); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
594 asm.pload(CiKind.Word, temp2, thread, asm.i(config.threadTlabEndOffset), false); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
595 asm.jgt(slowPath, temp1, temp2); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
596 asm.pstore(CiKind.Word, thread, asm.i(config.threadTlabTopOffset), temp1, false); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
597 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
598 // Now the new object is in result, store mark word and klass |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
599 asm.pload(CiKind.Word, temp1, hub, asm.i(config.instanceHeaderPrototypeOffset), false); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
600 asm.pstore(CiKind.Word, result, temp1, false); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
601 asm.pstore(CiKind.Object, result, asm.i(config.hubOffset), hub, false); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
602 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
603 // Store array length |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
604 asm.pstore(CiKind.Int, result, asm.i(arrayLengthOffset), length, false); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
605 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
606 // Initialize with 0 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
607 XirLabel top = asm.createInlineLabel("top"); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
608 asm.sub(size, size, asm.i(arrayElementOffset)); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
609 asm.shr(size, size, asm.i(Scale.Times8.log2)); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
610 asm.jeq(done, size, asm.i(0)); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
611 asm.xor(temp3, temp3, temp3); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
612 asm.bindInline(top); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
613 asm.pstore(CiKind.Word, result, size, temp3, arrayElementOffset - target.wordSize, Scale.Times8, false); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
614 asm.decAndJumpNotZero(top, size); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
615 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
616 asm.bindInline(done); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
617 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
618 // Slow path |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
619 asm.bindOutOfLine(slowPath); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
620 asm.callRuntime(slowPathStub, result); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
621 asm.jmp(done); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
622 } else { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
623 asm.callRuntime(slowPathStub, result); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
624 } |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
625 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
626 if (patching != null) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
627 patching.emitOutOfLine(); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
628 } |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
629 } |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
630 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
631 private KindTemplates newTypeArrayTemplates = new KindTemplates() { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
632 @Override |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
633 protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
634 emitNewTypeArray(asm, flags, kind, config.useFastNewTypeArray, config.newTypeArrayStub); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
635 return asm.finishTemplate("newTypeArray<" + kind.toString() + ">"); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
636 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
637 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
638 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
639 private final IndexTemplates multiNewArrayTemplate = new IndexTemplates(UNRESOLVED) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
640 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
641 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
642 protected XirTemplate create(CiXirAssembler asm, long flags, int dimensions) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
643 XirOperand result = asm.restart(CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
644 |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
645 XirOperand hub = asm.createRegisterTemp("hub", CiKind.Object, AMD64.rax); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
646 XirOperand rank = asm.createRegisterTemp("rank", CiKind.Int, AMD64.rbx); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
647 XirOperand sizes = asm.createRegisterTemp("sizes", CiKind.Long, AMD64.rcx); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
648 XirOperand thread = asm.createRegisterTemp("thread", CiKind.Long, AMD64.r15); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
649 asm.add(sizes, thread, asm.l(config.threadMultiNewArrayStorage)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
650 for (int i = 0; i < dimensions; i++) { |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
651 XirParameter length = asm.createInputParameter("length" + i, CiKind.Int, true); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
652 asm.pstore(CiKind.Int, sizes, asm.i(i * target.sizeInBytes(CiKind.Int)), length, false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
653 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
654 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
655 UnresolvedClassPatching patching = null; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
656 if (is(UNRESOLVED, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
657 // insert the patching code for class resolving - the hub will end up in "hub" |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
658 patching = new UnresolvedClassPatching(asm, hub, config); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
659 patching.emitInline(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
660 } else { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
661 asm.mov(hub, asm.createConstantInputParameter("hub", CiKind.Object)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
662 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
663 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
664 asm.mov(rank, asm.i(dimensions)); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
665 useRegisters(asm, AMD64.rax); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
666 asm.callRuntime(config.newMultiArrayStub, result); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
667 if (is(UNRESOLVED, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
668 patching.emitOutOfLine(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
669 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
670 return asm.finishTemplate(is(UNRESOLVED, flags) ? "multiNewArray" + dimensions + " (unresolved)" : "multiNewArray" + dimensions); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
671 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
672 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
673 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
674 private SimpleTemplates checkCastTemplates = new SimpleTemplates(NULL_CHECK, UNRESOLVED) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
675 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
676 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
677 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
678 asm.restart(); |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
679 XirParameter object = asm.createInputParameter("object", CiKind.Object); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
680 final XirOperand hub; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
681 final UnresolvedClassPatching patching; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
682 if (is(UNRESOLVED, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
683 hub = asm.createTemp("hub", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
684 // insert the patching code for class resolving - the hub will end up in "hub" |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
685 patching = new UnresolvedClassPatching(asm, hub, config); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
686 patching.emitInline(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
687 } else { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
688 hub = asm.createConstantInputParameter("hub", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
689 patching = null; |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
690 } |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
691 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
692 XirOperand objHub = asm.createTemp("objHub", CiKind.Object); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
693 |
1422
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
694 XirLabel end = asm.createInlineLabel("end"); |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
695 XirLabel slowPath = asm.createOutOfLineLabel("slow path"); |
1422
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
696 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
697 if (is(NULL_CHECK, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
698 // null can be cast to anything |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
699 asm.jeq(end, object, asm.o(null)); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
700 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
701 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
702 asm.pload(CiKind.Object, objHub, object, asm.i(config.hubOffset), false); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
703 // if we get an exact match: succeed immediately |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
704 asm.jneq(slowPath, objHub, hub); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
705 asm.bindInline(end); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
706 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
707 // -- out of line ------------------------------------------------------- |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
708 asm.bindOutOfLine(slowPath); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
709 checkSubtype(asm, objHub, objHub, hub); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
710 asm.jneq(end, objHub, asm.o(null)); |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
711 XirOperand scratch = asm.createRegisterTemp("scratch", CiKind.Object, AMD64.r10); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
712 asm.mov(scratch, object); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
713 asm.callRuntime(config.throwClassCastException, null); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
714 asm.shouldNotReachHere(); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
715 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
716 if (is(UNRESOLVED, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
717 patching.emitOutOfLine(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
718 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
719 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
720 return asm.finishTemplate(object, "instanceof"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
721 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
722 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
723 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
724 private SimpleTemplates instanceOfTemplates = new SimpleTemplates(NULL_CHECK, UNRESOLVED) { |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
725 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
726 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
727 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
728 XirOperand result = asm.restart(CiKind.Boolean); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
729 XirParameter object = asm.createInputParameter("object", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
730 final XirOperand hub; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
731 final UnresolvedClassPatching patching; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
732 if (is(UNRESOLVED, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
733 hub = asm.createTemp("hub", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
734 // insert the patching code for class resolving - the hub will end up in "hub" |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
735 patching = new UnresolvedClassPatching(asm, hub, config); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
736 patching.emitInline(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
737 } else { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
738 hub = asm.createConstantInputParameter("hub", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
739 patching = null; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
740 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
741 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
742 XirOperand objHub = asm.createTemp("objHub", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
743 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
744 XirLabel end = asm.createInlineLabel("end"); |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
745 XirLabel slowPath = asm.createOutOfLineLabel("slow path"); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
746 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
747 if (is(NULL_CHECK, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
748 // null isn't "instanceof" anything |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
749 asm.mov(result, asm.b(false)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
750 asm.jeq(end, object, asm.o(null)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
751 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
752 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
753 asm.pload(CiKind.Object, objHub, object, asm.i(config.hubOffset), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
754 // if we get an exact match: succeed immediately |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
755 asm.mov(result, asm.b(true)); |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
756 asm.jneq(slowPath, objHub, hub); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
757 asm.bindInline(end); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
758 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
759 // -- out of line ------------------------------------------------------- |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
760 asm.bindOutOfLine(slowPath); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
761 checkSubtype(asm, result, objHub, hub); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
762 asm.jmp(end); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
763 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
764 if (is(UNRESOLVED, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
765 patching.emitOutOfLine(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
766 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
767 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
768 return asm.finishTemplate("instanceof"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
769 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
770 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
771 |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
772 private XirOperand genArrayLength(XirOperand array, boolean implicitNullException) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
773 XirOperand length = asm.createTemp("length", CiKind.Int); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
774 genArrayLength(asm, length, array, implicitNullException); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
775 return length; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
776 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
777 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
778 private void genArrayLength(CiXirAssembler asm, XirOperand length, XirOperand array, boolean implicitNullException) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
779 if (implicitNullException) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
780 // asm.nop(1); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
781 asm.mark(MARK_IMPLICIT_NULL); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
782 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
783 asm.pload(CiKind.Int, length, array, asm.i(config.arrayLengthOffset), implicitNullException); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
784 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
785 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
786 private KindTemplates arrayLoadTemplates = new KindTemplates(NULL_CHECK, READ_BARRIER, BOUNDS_CHECK, GIVEN_LENGTH) { |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
787 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
788 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
789 protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
790 XirOperand result = asm.restart(kind); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
791 XirParameter array = asm.createInputParameter("array", CiKind.Object); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
792 XirParameter index = asm.createInputParameter("index", CiKind.Int, true); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
793 XirLabel failBoundsCheck = null; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
794 // if the length is known the array cannot be null |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
795 boolean implicitNullException = is(NULL_CHECK, flags); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
796 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
797 if (is(BOUNDS_CHECK, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
798 // load the array length and check the index |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
799 failBoundsCheck = asm.createOutOfLineLabel("failBoundsCheck"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
800 XirOperand length; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
801 if (is(GIVEN_LENGTH, flags)) { |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
802 length = asm.createInputParameter("length", CiKind.Int, true); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
803 } else { |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
804 length = genArrayLength(array, implicitNullException); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
805 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
806 asm.jugteq(failBoundsCheck, index, length); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
807 implicitNullException = false; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
808 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
809 int elemSize = target.sizeInBytes(kind); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
810 if (implicitNullException) { |
1430
949ade3f2ff3
added assertions, nop added to implicit exception sites
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
811 asm.nop(1); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
812 asm.mark(MARK_IMPLICIT_NULL); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
813 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
814 asm.pload(kind, result, array, index, config.getArrayOffset(kind), Scale.fromInt(elemSize), implicitNullException); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
815 if (is(BOUNDS_CHECK, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
816 asm.bindOutOfLine(failBoundsCheck); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
817 asm.callRuntime(config.throwArrayIndexException, null); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
818 asm.shouldNotReachHere(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
819 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
820 return asm.finishTemplate("arrayload<" + kind + ">"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
821 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
822 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
823 |
2060
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
824 private SimpleTemplates getClassTemplates = new SimpleTemplates() { |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
825 @Override |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
826 protected XirTemplate create(CiXirAssembler asm, long flags) { |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
827 XirOperand result = asm.restart(CiKind.Object); |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
828 XirOperand object = asm.createInputParameter("object", CiKind.Object); |
2108
50b45e2d9725
Fixed bug in getClass() XIR snippet
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2061
diff
changeset
|
829 if (is(NULL_CHECK, flags)) { |
50b45e2d9725
Fixed bug in getClass() XIR snippet
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2061
diff
changeset
|
830 asm.nop(1); |
50b45e2d9725
Fixed bug in getClass() XIR snippet
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2061
diff
changeset
|
831 } |
2060
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
832 asm.pload(CiKind.Object, result, object, asm.i(config.hubOffset), is(NULL_CHECK, flags)); |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
833 asm.pload(CiKind.Object, result, result, asm.i(config.classMirrorOffset), false); |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
834 return asm.finishTemplate("currentThread"); |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
835 } |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
836 }; |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
837 |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
838 private SimpleTemplates currentThreadTemplates = new SimpleTemplates() { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
839 @Override |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
840 protected XirTemplate create(CiXirAssembler asm, long flags) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
841 XirOperand result = asm.restart(CiKind.Object); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
842 XirOperand thread = asm.createRegisterTemp("thread", CiKind.Word, AMD64.r15); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
843 asm.pload(CiKind.Object, result, thread, asm.i(config.threadObjectOffset), false); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
844 return asm.finishTemplate("currentThread"); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
845 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
846 }; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
847 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
848 @Override |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
849 public XirSnippet genCurrentThread(XirSite site) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
850 return new XirSnippet(currentThreadTemplates.get(site)); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
851 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
852 |
2060
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
853 @Override |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
854 public XirSnippet genGetClass(XirSite site, XirArgument object) { |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
855 return new XirSnippet(getClassTemplates.get(site), object); |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
856 } |
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
857 |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
858 private KindTemplates arrayCopyTemplates = new KindTemplates() { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
859 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
860 @Override |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
861 protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
862 asm.restart(CiKind.Void); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
863 XirParameter src = asm.createInputParameter("src", CiKind.Object); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
864 XirParameter srcPos = asm.createInputParameter("srcPos", CiKind.Int, true); |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
865 XirParameter dest = asm.createInputParameter("dest", CiKind.Object); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
866 XirParameter destPos = asm.createInputParameter("destPos", CiKind.Int, true); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
867 XirParameter length = asm.createInputParameter("length", CiKind.Int, true); |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
868 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
869 XirOperand tempSrc = asm.createTemp("tempSrc", CiKind.Word); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
870 XirOperand tempDest = asm.createTemp("tempDest", CiKind.Word); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
871 XirOperand lengthOperand = asm.createRegisterTemp("lengthOperand", CiKind.Int, AMD64.rax); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
872 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
873 XirOperand compHub = null; |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
874 XirOperand valueHub = null; |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
875 XirOperand temp = null; |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
876 XirLabel store = null; |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
877 XirLabel slowStoreCheck = null; |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
878 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
879 if (is(STORE_CHECK, flags)) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
880 valueHub = asm.createRegisterTemp("valueHub", CiKind.Word, AMD64.rdi); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
881 compHub = asm.createRegisterTemp("compHub", CiKind.Word, AMD64.rsi); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
882 temp = asm.createRegisterTemp("temp", CiKind.Word, AMD64.r10); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
883 } |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
884 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
885 // Calculate the factor for the repeat move instruction. |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
886 int elementSize = kind.sizeInBytes(target.wordSize); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
887 int factor; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
888 boolean wordSize; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
889 if (elementSize >= target.wordSize) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
890 assert elementSize % target.wordSize == 0; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
891 wordSize = true; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
892 factor = elementSize / target.wordSize; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
893 } else { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
894 factor = elementSize; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
895 wordSize = false; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
896 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
897 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
898 // Adjust the length if the factor is not 1. |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
899 if (factor != 1) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
900 asm.shl(lengthOperand, length, asm.i(CiUtil.log2(factor))); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
901 } else { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
902 asm.mov(lengthOperand, length); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
903 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
904 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
905 // Set the start and the end pointer. |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
906 asm.lea(tempSrc, src, srcPos, config.getArrayOffset(kind), Scale.fromInt(elementSize)); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
907 asm.lea(tempDest, dest, destPos, config.getArrayOffset(kind), Scale.fromInt(elementSize)); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
908 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
909 XirLabel reverse = null; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
910 XirLabel normal = null; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
911 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
912 if (is(STORE_CHECK, flags)) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
913 reverse = asm.createInlineLabel("reverse"); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
914 asm.jneq(reverse, src, dest); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
915 } |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
916 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
917 if (!is(STORE_CHECK, flags) && !is(INPUTS_DIFFERENT, flags) && !is(INPUTS_SAME, flags)) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
918 normal = asm.createInlineLabel("normal"); |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
919 asm.jneq(normal, src, dest); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
920 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
921 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
922 if (!is(INPUTS_DIFFERENT, flags)) { |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
923 if (reverse == null) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
924 reverse = asm.createInlineLabel("reverse"); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
925 } |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
926 asm.jlt(reverse, srcPos, destPos); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
927 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
928 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
929 if (!is(STORE_CHECK, flags) && !is(INPUTS_DIFFERENT, flags) && !is(INPUTS_SAME, flags)) { |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
930 asm.bindInline(normal); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
931 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
932 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
933 // Everything set up => repeat mov. |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
934 if (wordSize) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
935 asm.repmov(tempSrc, tempDest, lengthOperand); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
936 } else { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
937 asm.repmovb(tempSrc, tempDest, lengthOperand); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
938 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
939 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
940 if (!is(INPUTS_DIFFERENT, flags) || is(STORE_CHECK, flags)) { |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
941 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
942 XirLabel end = asm.createInlineLabel("end"); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
943 asm.jmp(end); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
944 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
945 // Implement reverse copy, because srcPos < destPos and src == dest. |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
946 asm.bindInline(reverse); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
947 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
948 if (is(STORE_CHECK, flags)) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
949 asm.pload(CiKind.Object, compHub, dest, asm.i(config.hubOffset), false); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
950 asm.pload(CiKind.Object, compHub, compHub, asm.i(config.arrayClassElementOffset), false); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
951 } |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
952 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
953 CiKind copyKind = wordSize ? CiKind.Object : CiKind.Byte; |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
954 XirOperand tempValue = asm.createTemp("tempValue", copyKind); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
955 XirLabel start = asm.createInlineLabel("start"); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
956 asm.bindInline(start); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
957 asm.sub(lengthOperand, lengthOperand, asm.i(1)); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
958 asm.jlt(end, lengthOperand, asm.i(0)); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
959 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
960 Scale scale = wordSize ? Scale.fromInt(target.wordSize) : Scale.Times1; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
961 asm.pload(copyKind, tempValue, tempSrc, lengthOperand, 0, scale, false); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
962 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
963 if (is(STORE_CHECK, flags)) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
964 slowStoreCheck = asm.createOutOfLineLabel("slowStoreCheck"); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
965 store = asm.createInlineLabel("store"); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
966 asm.jeq(store, tempValue, asm.o(null)); // first check if value is null |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
967 asm.pload(CiKind.Object, valueHub, tempValue, asm.i(config.hubOffset), false); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
968 asm.jneq(slowStoreCheck, compHub, valueHub); // then check component hub matches value hub |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
969 asm.bindInline(store); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
970 } |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
971 |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
972 asm.pstore(copyKind, tempDest, lengthOperand, tempValue, 0, scale, false); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
973 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
974 asm.jmp(start); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
975 asm.bindInline(end); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
976 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
977 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
978 if (kind == CiKind.Object) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
979 // Do write barriers |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
980 asm.lea(tempDest, dest, destPos, config.getArrayOffset(kind), Scale.fromInt(elementSize)); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
981 asm.shr(tempDest, tempDest, asm.i(config.cardtableShift)); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
982 asm.pstore(CiKind.Boolean, asm.w(config.cardtableStartAddress), tempDest, asm.b(false), false); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
983 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
984 XirOperand tempDestEnd = tempSrc; // Reuse src temp |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
985 asm.lea(tempDestEnd, dest, destPos, config.getArrayOffset(kind), Scale.fromInt(elementSize)); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
986 asm.add(tempDestEnd, tempDestEnd, length); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
987 asm.shr(tempDestEnd, tempDestEnd, asm.i(config.cardtableShift)); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
988 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
989 // Jump to out-of-line write barrier loop if the array is big. |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
990 XirLabel writeBarrierLoop = asm.createOutOfLineLabel("writeBarrierLoop"); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
991 asm.jneq(writeBarrierLoop, tempDest, tempSrc); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
992 XirLabel back = asm.createInlineLabel("back"); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
993 asm.bindInline(back); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
994 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
995 asm.bindOutOfLine(writeBarrierLoop); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
996 asm.pstore(CiKind.Boolean, asm.w(config.cardtableStartAddress), tempDestEnd, asm.b(false), false); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
997 asm.sub(tempDestEnd, tempDestEnd, asm.i(1)); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
998 asm.jneq(writeBarrierLoop, tempDestEnd, tempDest); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
999 asm.jmp(back); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1000 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1001 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1002 if (is(STORE_CHECK, flags)) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1003 assert kind == CiKind.Object; |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1004 useRegisters(asm, AMD64.rax); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1005 asm.bindOutOfLine(slowStoreCheck); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1006 checkSubtype(asm, temp, valueHub, compHub); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1007 asm.jneq(store, temp, asm.w(0)); |
2183
eed52202caea
Added parameter to array store exception runtime call (new in HotSpot).
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2108
diff
changeset
|
1008 XirOperand scratch = asm.createRegisterTemp("scratch", CiKind.Object, AMD64.r10); |
eed52202caea
Added parameter to array store exception runtime call (new in HotSpot).
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2108
diff
changeset
|
1009 asm.mov(scratch, valueHub); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1010 asm.callRuntime(config.throwArrayStoreException, null); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1011 asm.jmp(store); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1012 } |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1013 |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1014 return asm.finishTemplate("arraycopy<" + kind + ">"); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1015 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1016 }; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1017 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1018 private KindTemplates arrayStoreTemplates = new KindTemplates(NULL_CHECK, WRITE_BARRIER, BOUNDS_CHECK, STORE_CHECK, GIVEN_LENGTH) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1019 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1020 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1021 protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1022 asm.restart(CiKind.Void); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1023 XirParameter array = asm.createInputParameter("array", CiKind.Object); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1024 XirParameter index = asm.createInputParameter("index", CiKind.Int, true); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1025 XirParameter value = asm.createInputParameter("value", kind, kind != CiKind.Object); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1026 XirOperand temp = asm.createTemp("temp", CiKind.Word); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1027 XirOperand valueHub = null; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1028 XirOperand compHub = null; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1029 XirLabel store = asm.createInlineLabel("store"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1030 XirLabel failBoundsCheck = null; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1031 XirLabel slowStoreCheck = null; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1032 // if the length is known the array cannot be null |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1033 boolean implicitNullException = is(NULL_CHECK, flags); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1034 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1035 if (is(BOUNDS_CHECK, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1036 // load the array length and check the index |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1037 failBoundsCheck = asm.createOutOfLineLabel("failBoundsCheck"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1038 XirOperand length; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1039 if (is(GIVEN_LENGTH, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1040 length = asm.createInputParameter("length", CiKind.Int); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1041 } else { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1042 length = asm.createTemp("length", CiKind.Int); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1043 if (implicitNullException) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1044 asm.nop(1); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1045 asm.mark(MARK_IMPLICIT_NULL); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1046 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1047 asm.pload(CiKind.Int, length, array, asm.i(config.arrayLengthOffset), implicitNullException); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1048 implicitNullException = false; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1049 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1050 asm.jugteq(failBoundsCheck, index, length); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1051 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1052 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1053 if (is(STORE_CHECK, flags) && kind == CiKind.Object) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1054 slowStoreCheck = asm.createOutOfLineLabel("slowStoreCheck"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1055 asm.jeq(store, value, asm.o(null)); // first check if value is null |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1056 valueHub = asm.createTemp("valueHub", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1057 compHub = asm.createTemp("compHub", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1058 if (implicitNullException) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1059 asm.mark(MARK_IMPLICIT_NULL); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1060 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1061 asm.pload(CiKind.Object, compHub, array, asm.i(config.hubOffset), implicitNullException); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1062 asm.pload(CiKind.Object, compHub, compHub, asm.i(config.arrayClassElementOffset), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1063 asm.pload(CiKind.Object, valueHub, value, asm.i(config.hubOffset), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1064 asm.jneq(slowStoreCheck, compHub, valueHub); // then check component hub matches value hub |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1065 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1066 implicitNullException = false; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1067 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1068 asm.bindInline(store); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1069 int elemSize = target.sizeInBytes(kind); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1070 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1071 if (implicitNullException) { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1072 asm.mark(MARK_IMPLICIT_NULL); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1073 } |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1074 int disp = config.getArrayOffset(kind); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1075 Scale scale = Scale.fromInt(elemSize); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1076 if (kind == CiKind.Object) { |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1077 verifyPointer(asm, value); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1078 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1079 if (is(WRITE_BARRIER, flags)) { |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1080 asm.lea(temp, array, index, disp, scale); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1081 asm.pstore(kind, temp, value, implicitNullException); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1082 writeBarrier(asm, temp); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1083 } else { |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1084 asm.pstore(kind, array, index, value, disp, scale, implicitNullException); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1085 } |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1086 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1087 // -- out of line ------------------------------------------------------- |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1088 if (is(BOUNDS_CHECK, flags)) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1089 asm.bindOutOfLine(failBoundsCheck); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1090 asm.callRuntime(config.throwArrayIndexException, null); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1091 asm.shouldNotReachHere(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1092 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1093 if (is(STORE_CHECK, flags) && kind == CiKind.Object) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1094 useRegisters(asm, AMD64.rax); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1095 asm.bindOutOfLine(slowStoreCheck); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1096 checkSubtype(asm, temp, valueHub, compHub); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1097 asm.jneq(store, temp, asm.w(0)); |
2183
eed52202caea
Added parameter to array store exception runtime call (new in HotSpot).
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2108
diff
changeset
|
1098 XirOperand scratch = asm.createRegisterTemp("scratch", CiKind.Object, AMD64.r10); |
eed52202caea
Added parameter to array store exception runtime call (new in HotSpot).
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2108
diff
changeset
|
1099 asm.mov(scratch, valueHub); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1100 asm.callRuntime(config.throwArrayStoreException, null); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1101 asm.jmp(store); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1102 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1103 return asm.finishTemplate("arraystore<" + kind + ">"); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
1104 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1105 }; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1106 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1107 private SimpleTemplates arrayLengthTemplates = new SimpleTemplates(NULL_CHECK) { |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
1108 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1109 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1110 protected XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1111 XirOperand result = asm.restart(CiKind.Int); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1112 XirParameter object = asm.createInputParameter("object", CiKind.Object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1113 if (is(NULL_CHECK, flags)) { |
1430
949ade3f2ff3
added assertions, nop added to implicit exception sites
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
1114 asm.nop(1); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1115 asm.mark(MARK_IMPLICIT_NULL); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1116 } |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1117 verifyPointer(asm, object); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1118 asm.pload(CiKind.Int, result, object, asm.i(config.arrayLengthOffset), true); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1119 return asm.finishTemplate("arrayLength"); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1120 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1121 }; |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1122 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1123 @Override |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1124 public XirSnippet genPrologue(XirSite site, RiMethod method) { |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1125 boolean staticMethod = Modifier.isStatic(method.accessFlags()); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1126 return new XirSnippet(staticMethod ? prologueTemplates.get(site, STATIC_METHOD) : prologueTemplates.get(site)); |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1127 } |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1128 |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1129 @Override |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1130 public XirSnippet genEpilogue(XirSite site, RiMethod method) { |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1131 return new XirSnippet(epilogueTemplates.get(site)); |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1132 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1133 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1134 @Override |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1135 public XirSnippet genSafepoint(XirSite site) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1136 return new XirSnippet(safepointTemplates.get(site)); |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1137 } |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1138 |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1139 @Override |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1140 public XirSnippet genExceptionObject(XirSite site) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1141 return new XirSnippet(exceptionObjectTemplates.get(site)); |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1142 } |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1143 |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1144 @Override |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
1145 public XirSnippet genResolveClass(XirSite site, RiType type, Representation rep) { |
1452
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1451
diff
changeset
|
1146 assert rep == Representation.ObjectHub || rep == Representation.StaticFields || rep == Representation.JavaClass : "unexpected representation: " + rep; |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1147 if (type instanceof HotSpotTypeResolved) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1148 return new XirSnippet(resolveClassTemplates.get(site), XirArgument.forObject(type)); |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1149 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1150 return new XirSnippet(resolveClassTemplates.get(site, UNRESOLVED)); |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1151 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1152 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1153 @Override |
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1154 public XirSnippet genIntrinsic(XirSite site, XirArgument[] arguments, RiMethod method) { |
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1155 return null; |
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1156 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1157 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1158 @Override |
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1159 public XirSnippet genInvokeInterface(XirSite site, XirArgument receiver, RiMethod method) { |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1160 return new XirSnippet(invokeInterfaceTemplates.get(site), receiver, XirArgument.forWord(0)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1161 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1162 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1163 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1164 public XirSnippet genInvokeVirtual(XirSite site, XirArgument receiver, RiMethod method) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1165 return new XirSnippet(invokeVirtualTemplates.get(site), receiver, XirArgument.forWord(0)); |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1166 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1167 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1168 @Override |
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1169 public XirSnippet genInvokeSpecial(XirSite site, XirArgument receiver, RiMethod method) { |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1170 return new XirSnippet(invokeSpecialTemplates.get(site), receiver, XirArgument.forWord(0)); |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1171 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1172 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1173 @Override |
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1174 public XirSnippet genInvokeStatic(XirSite site, RiMethod method) { |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1175 return new XirSnippet(invokeStaticTemplates.get(site), XirArgument.forWord(0)); |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1176 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1177 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1178 @Override |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
1179 public XirSnippet genMonitorEnter(XirSite site, XirArgument receiver, XirArgument lockAddress) { |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
1180 return new XirSnippet(monitorEnterTemplates.get(site), receiver, lockAddress); |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1181 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1182 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1183 @Override |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
1184 public XirSnippet genMonitorExit(XirSite site, XirArgument receiver, XirArgument lockAddress) { |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
1185 return new XirSnippet(monitorExitTemplates.get(site), receiver, lockAddress); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1186 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1187 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1188 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1189 public XirSnippet genGetField(XirSite site, XirArgument object, RiField field) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1190 if (field.isResolved()) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1191 return new XirSnippet(getFieldTemplates.get(site, field.kind()), object, XirArgument.forInt(((HotSpotField) field).offset())); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1192 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1193 return new XirSnippet(getFieldTemplates.get(site, field.kind(), UNRESOLVED), object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1194 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1195 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1196 @Override |
2055
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
1197 public XirSnippet genWriteBarrier(XirArgument object) { |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
1198 return new XirSnippet(writeBarrierTemplate.get(null, CiKind.Void), object); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
1199 } |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
1200 |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
1201 @Override |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1202 public XirSnippet genPutField(XirSite site, XirArgument object, RiField field, XirArgument value) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1203 if (field.isResolved()) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1204 return new XirSnippet(putFieldTemplates.get(site, field.kind()), object, value, XirArgument.forInt(((HotSpotField) field).offset())); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1205 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1206 return new XirSnippet(putFieldTemplates.get(site, field.kind(), UNRESOLVED), object, value); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1207 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1208 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1209 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1210 public XirSnippet genGetStatic(XirSite site, XirArgument object, RiField field) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1211 if (field.isResolved()) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1212 return new XirSnippet(getFieldTemplates.get(site, field.kind()), object, XirArgument.forInt(((HotSpotField) field).offset())); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1213 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1214 return new XirSnippet(getFieldTemplates.get(site, field.kind(), UNRESOLVED), object); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1215 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1216 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1217 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1218 public XirSnippet genPutStatic(XirSite site, XirArgument object, RiField field, XirArgument value) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1219 if (field.isResolved()) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1220 return new XirSnippet(putFieldTemplates.get(site, field.kind()), object, value, XirArgument.forInt(((HotSpotField) field).offset())); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1221 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1222 return new XirSnippet(putFieldTemplates.get(site, field.kind(), UNRESOLVED), object, value); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1223 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1224 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1225 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1226 public XirSnippet genNewInstance(XirSite site, RiType type) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1227 if (type instanceof HotSpotTypeResolved) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1228 int instanceSize = ((HotSpotTypeResolved) type).instanceSize(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1229 return new XirSnippet(newInstanceTemplates.get(site, instanceSize), XirArgument.forObject(type)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1230 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1231 return new XirSnippet(newInstanceUnresolvedTemplates.get(site)); |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1232 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1233 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1234 @Override |
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1235 public XirSnippet genNewArray(XirSite site, XirArgument length, CiKind elementKind, RiType componentType, RiType arrayType) { |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1236 if (elementKind == CiKind.Object) { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1237 if (arrayType instanceof HotSpotTypeResolved) { |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1238 return new XirSnippet(newObjectArrayTemplates.get(site), length, XirArgument.forObject(arrayType)); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1239 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1240 return new XirSnippet(newObjectArrayTemplates.get(site, UNRESOLVED), length); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1241 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1242 assert arrayType == null; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1243 arrayType = Compiler.getVMEntries().getPrimitiveArrayType(elementKind); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1244 return new XirSnippet(newTypeArrayTemplates.get(site, elementKind), length, XirArgument.forObject(arrayType)); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1245 } |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1246 |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1247 @Override |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1248 public XirSnippet genNewObjectArrayClone(XirSite site, XirArgument newLength, XirArgument referenceArray) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1249 return new XirSnippet(newObjectArrayCloneTemplates.get(site), newLength, referenceArray); |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1250 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1251 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1252 @Override |
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1253 public XirSnippet genNewMultiArray(XirSite site, XirArgument[] lengths, RiType type) { |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1254 if (type instanceof HotSpotTypeResolved) { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1255 XirArgument[] params = Arrays.copyOf(lengths, lengths.length + 1); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1256 params[lengths.length] = XirArgument.forObject(type); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1257 return new XirSnippet(multiNewArrayTemplate.get(site, lengths.length), params); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1258 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1259 return new XirSnippet(multiNewArrayTemplate.get(site, lengths.length, UNRESOLVED), lengths); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1260 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1261 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1262 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1263 public XirSnippet genCheckCast(XirSite site, XirArgument receiver, XirArgument hub, RiType type) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1264 if (type.isResolved()) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1265 return new XirSnippet(checkCastTemplates.get(site), receiver, hub); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1266 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1267 return new XirSnippet(checkCastTemplates.get(site, UNRESOLVED), receiver); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1268 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1269 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1270 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1271 public XirSnippet genInstanceOf(XirSite site, XirArgument object, XirArgument hub, RiType type) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1272 if (type.isResolved()) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1273 return new XirSnippet(instanceOfTemplates.get(site), object, hub); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1274 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1275 return new XirSnippet(instanceOfTemplates.get(site, UNRESOLVED), object); |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1276 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1277 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1278 @Override |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1279 public XirSnippet genArrayLoad(XirSite site, XirArgument array, XirArgument index, XirArgument length, CiKind elementKind, RiType elementType) { |
1934
b1f2e875300a
Small fix to make Graal snippets work with bounds check elimination.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1480
diff
changeset
|
1280 if (length == null || !site.requiresBoundsCheck()) { |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1281 return new XirSnippet(arrayLoadTemplates.get(site, elementKind), array, index); |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1420
diff
changeset
|
1282 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1283 return new XirSnippet(arrayLoadTemplates.get(site, elementKind, GIVEN_LENGTH), array, index, length); |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1284 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1285 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1286 @Override |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1287 public XirSnippet genArrayStore(XirSite site, XirArgument array, XirArgument index, XirArgument length, XirArgument value, CiKind elementKind, RiType elementType) { |
1934
b1f2e875300a
Small fix to make Graal snippets work with bounds check elimination.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1480
diff
changeset
|
1288 if (length == null || !site.requiresBoundsCheck()) { |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1289 return new XirSnippet(arrayStoreTemplates.get(site, elementKind), array, index, value); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1290 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1291 return new XirSnippet(arrayStoreTemplates.get(site, elementKind, GIVEN_LENGTH), array, index, value, length); |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1292 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1293 |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1294 @Override |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1295 public XirSnippet genArrayCopy(XirSite site, XirArgument src, XirArgument srcPos, XirArgument dest, XirArgument destPos, XirArgument length, RiType elementType, boolean inputsSame, boolean inputsDifferent) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1296 if (elementType == null) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1297 return null; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1298 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1299 assert !inputsDifferent || !inputsSame; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1300 XirTemplate template = null; |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1301 if (inputsDifferent) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1302 template = arrayCopyTemplates.get(site, elementType.kind(), INPUTS_DIFFERENT); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1303 } else if (inputsSame) { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1304 template = arrayCopyTemplates.get(site, elementType.kind(), INPUTS_SAME); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1305 } else { |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1306 template = arrayCopyTemplates.get(site, elementType.kind()); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1307 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1308 return new XirSnippet(template, src, srcPos, dest, destPos, length); |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1309 } |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1310 |
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
1311 @Override |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1312 public XirSnippet genArrayLength(XirSite site, XirArgument array) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1313 return new XirSnippet(arrayLengthTemplates.get(site), array); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1314 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1315 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1316 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1317 public List<XirTemplate> buildTemplates(CiXirAssembler asm) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1318 this.asm = asm; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1319 List<XirTemplate> templates = new ArrayList<XirTemplate>(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1320 return templates; |
1420
44efca8a02d6
reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1321 } |
1419
7bf6a77b9c5a
implement recent safepoint & exceptionobject ci changes, HotSpotVMConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1417
diff
changeset
|
1322 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1323 private static class UnresolvedClassPatching { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1324 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1325 private final XirLabel patchSite; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1326 private final XirLabel replacement; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1327 private final XirLabel patchStub; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1328 private final CiXirAssembler asm; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1329 private final HotSpotVMConfig config; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1330 private final XirOperand arg; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1331 private State state; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1332 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1333 private enum State { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1334 New, Inline, Finished |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1335 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1336 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1337 public UnresolvedClassPatching(CiXirAssembler asm, XirOperand arg, HotSpotVMConfig config) { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1338 this.asm = asm; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1339 this.arg = arg; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1340 this.config = config; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1341 patchSite = asm.createInlineLabel("patch site"); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1342 replacement = asm.createOutOfLineLabel("replacement"); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1343 patchStub = asm.createOutOfLineLabel("patch stub"); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1344 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1345 state = State.New; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1346 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1347 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1348 public void emitInline() { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1349 assert state == State.New; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1350 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1351 asm.bindInline(patchSite); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1352 asm.mark(MARK_DUMMY_OOP_RELOCATION); |
1480
2fe369533fed
Additional debug output.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1478
diff
changeset
|
1353 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1354 asm.jmp(patchStub); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1355 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1356 // TODO: make this more generic & safe - this is needed to create space for patching |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1357 asm.nop(5); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1358 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1359 state = State.Inline; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1360 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1361 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1362 public void emitOutOfLine() { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1363 assert state == State.Inline; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1364 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1365 asm.bindOutOfLine(replacement); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1366 XirMark begin = asm.mark(null); |
1465
2c754f3a2722
Inlining of static final field values. Java mirror instead of VmID. Support for PrintMetrics option.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1453
diff
changeset
|
1367 asm.mov(arg, asm.createConstant(CiConstant.NULL_OBJECT)); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1368 XirMark end = asm.mark(null); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1369 // make this piece of data look like an instruction |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
1370 asm.rawBytes(new byte[] {(byte) 0xb8, 0, 0, 0x05, 0}); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1371 asm.mark(MARK_KLASS_PATCHING, begin, end); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1372 asm.bindOutOfLine(patchStub); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1373 asm.callRuntime(config.loadKlassStub, null); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1374 asm.jmp(patchSite); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1375 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1376 state = State.Finished; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1377 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1378 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1379 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1380 private static class UnresolvedFieldPatching { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1381 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1382 private final XirLabel patchSite; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1383 private final XirLabel replacement; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1384 private final XirLabel patchStub; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1385 private final CiXirAssembler asm; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1386 private final HotSpotVMConfig config; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1387 private State state; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1388 private final XirOperand receiver; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1389 private final XirOperand value; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1390 private final boolean put; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1391 private final boolean nullCheck; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1392 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1393 private enum State { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1394 New, Inline, Finished |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1395 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1396 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1397 public UnresolvedFieldPatching(CiXirAssembler asm, XirOperand receiver, XirOperand value, boolean put, boolean nullCheck, HotSpotVMConfig config) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1398 this.asm = asm; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1399 this.receiver = receiver; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1400 this.value = value; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1401 this.put = put; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1402 this.nullCheck = nullCheck; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1403 this.config = config; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1404 patchSite = asm.createInlineLabel("patch site"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1405 replacement = asm.createOutOfLineLabel("replacement"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1406 patchStub = asm.createOutOfLineLabel("patch stub"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1407 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1408 state = State.New; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1409 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1410 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1411 public void emitInline() { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1412 assert state == State.New; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1413 if (nullCheck) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1414 asm.nop(1); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1415 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1416 asm.bindInline(patchSite); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1417 asm.mark(MARK_DUMMY_OOP_RELOCATION); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1418 if (nullCheck) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1419 asm.mark(MARK_IMPLICIT_NULL); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1420 } |
1452
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1451
diff
changeset
|
1421 asm.safepoint(); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1422 asm.jmp(patchStub); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1423 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1424 // TODO: make this more generic & safe - this is needed to create space for patching |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1425 asm.nop(5); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1426 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1427 state = State.Inline; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1428 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1429 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1430 public void emitOutOfLine() { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1431 assert state == State.Inline; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1432 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1433 asm.bindOutOfLine(replacement); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1434 XirMark begin = asm.mark(null); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1435 if (put) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1436 asm.pstore(value.kind, receiver, asm.i(Integer.MAX_VALUE), value, false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1437 } else { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1438 asm.pload(value.kind, value, receiver, asm.i(Integer.MAX_VALUE), false); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1439 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1440 XirMark end = asm.mark(null); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1441 // make this piece of data look like an instruction |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
1442 asm.rawBytes(new byte[] {(byte) 0xb8, 0, 0, 0x05, 0}); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1443 asm.mark(MARK_ACCESS_FIELD_PATCHING, begin, end); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1444 asm.bindOutOfLine(patchStub); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1445 asm.callRuntime(config.accessFieldStub, null); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1446 asm.jmp(patchSite); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1447 |
1936
8d88c9ac9247
Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1934
diff
changeset
|
1448 // Check if we need NOP instructions like in C1 to "not destroy the world". |
8d88c9ac9247
Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1934
diff
changeset
|
1449 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1450 state = State.Finished; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1451 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1452 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1453 |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1454 private void verifyPointer(CiXirAssembler asm, XirOperand pointer) { |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1455 if (config.verifyPointers) { |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1456 // The verify pointer stub wants the argument in a fixed register. |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1457 XirOperand fixed = asm.createRegisterTemp("fixed", CiKind.Object, AMD64.r13); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1458 asm.push(fixed); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1459 asm.mov(fixed, pointer); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1460 asm.callRuntime(config.verifyPointerStub, null); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1461 asm.pop(fixed); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1462 } |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1463 } |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1464 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1465 private void checkSubtype(CiXirAssembler asm, XirOperand result, XirOperand objHub, XirOperand hub) { |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1466 asm.push(objHub); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1467 asm.push(hub); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1468 asm.callRuntime(config.instanceofStub, null); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1469 asm.pop(result); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1470 asm.pop(result); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1471 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1472 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1473 private void useRegisters(CiXirAssembler asm, CiRegister... registers) { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1474 if (registers != null) { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1475 for (CiRegister register : registers) { |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1444
diff
changeset
|
1476 asm.createRegisterTemp("reg", CiKind.Illegal, register); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1477 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1478 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1479 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1480 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1481 private void writeBarrier(CiXirAssembler asm, XirOperand base) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1482 asm.shr(base, base, asm.i(config.cardtableShift)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1483 asm.pstore(CiKind.Boolean, asm.w(config.cardtableStartAddress), base, asm.b(false), false); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1484 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1485 |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1486 public boolean is(TemplateFlag check, long flags) { |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1487 return (flags & check.bits()) == check.bits(); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1488 } |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
1489 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1490 /** |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1491 * Base class for all the ondemand template generators. It is not normally subclassed directly, but through one of |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1492 * its subclasses (SimpleTemplates, KindTemplates, IndexTemplates). |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1493 * |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1494 * @author Lukas Stadler |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1495 */ |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1496 private abstract class Templates { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1497 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1498 private ConcurrentHashMap<Long, XirTemplate> templates = new ConcurrentHashMap<Long, XirTemplate>(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1499 private final long mask; |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1500 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1501 /** |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1502 * Each flag passed to this method will cause templates with and without it to be generated. |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1503 */ |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1504 public Templates(TemplateFlag... flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1505 this.mask = getBits((int) INDEX_MASK, null, flags); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1506 } |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1507 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1508 protected abstract XirTemplate create(CiXirAssembler asm, long flags); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1509 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1510 protected long getBits(int index, XirSite site, TemplateFlag... flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1511 long bits = index; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1512 if (site != null) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1513 bits |= site.requiresNullCheck() ? NULL_CHECK.bits() : 0; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1514 bits |= site.requiresReadBarrier() ? READ_BARRIER.bits() : 0; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1515 bits |= site.requiresWriteBarrier() ? WRITE_BARRIER.bits() : 0; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1516 bits |= site.requiresArrayStoreCheck() ? STORE_CHECK.bits() : 0; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1517 bits |= site.requiresBoundsCheck() ? BOUNDS_CHECK.bits() : 0; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1518 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1519 if (flags != null) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1520 for (TemplateFlag flag : flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1521 bits |= flag.bits(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1522 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1523 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1524 return bits; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1525 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1526 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1527 protected XirTemplate getInternal(long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1528 flags = flags & mask; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1529 XirTemplate template = templates.get(flags); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1530 if (template == null) { |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1531 template = create(HotSpotXirGenerator.this.asm.copy(), flags); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1532 templates.put(flags, template); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1533 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1534 return template; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1535 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
1536 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1537 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1538 private abstract class SimpleTemplates extends Templates { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1539 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1540 public SimpleTemplates(TemplateFlag... flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1541 super(flags); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1542 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1543 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1544 public XirTemplate get(XirSite site, TemplateFlag... flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1545 return getInternal(getBits(0, site, flags)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1546 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1547 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1548 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1549 private abstract class IndexTemplates extends Templates { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1550 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1551 public IndexTemplates(TemplateFlag... flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1552 super(flags); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1553 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1554 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1555 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1556 protected final XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1557 return create(asm, flags & FLAGS_MASK, (int) (flags & INDEX_MASK)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1558 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1559 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1560 protected abstract XirTemplate create(CiXirAssembler asm, long flags, int index); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1561 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1562 public XirTemplate get(XirSite site, int size, TemplateFlag... flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1563 return getInternal(getBits(size, site, flags)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1564 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1565 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1566 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1567 private abstract class KindTemplates extends Templates { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1568 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1569 public KindTemplates(TemplateFlag... flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1570 super(flags); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1571 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1572 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1573 @Override |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1574 protected final XirTemplate create(CiXirAssembler asm, long flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1575 return create(asm, flags & FLAGS_MASK, CiKind.VALUES[(int) (flags & INDEX_MASK)]); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1576 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1577 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1578 protected abstract XirTemplate create(CiXirAssembler asm, long flags, CiKind kind); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1579 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1580 public XirTemplate get(XirSite site, CiKind kind, TemplateFlag... flags) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1581 return getInternal(getBits(kind.ordinal(), site, flags)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1582 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1430
diff
changeset
|
1583 } |
1416
1b41af477605
Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
1584 } |