annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java @ 21596:47a3d4b3ccb3

AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
author Josef Eisl <josef.eisl@jku.at>
date Wed, 27 May 2015 16:26:10 +0200
parents 3de3699ecac1
children c0f9aa6dc4cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
19866
ac254887bfcd Make LIRGeneratorTool.append(op) return the op.
Roland Schatz <roland.schatz@oracle.com>
parents: 19131
diff changeset
2 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.hotspot.amd64;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
25 import com.oracle.jvmci.code.RegisterValue;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
26 import com.oracle.jvmci.code.Register;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
27 import com.oracle.jvmci.code.RegisterConfig;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
28 import com.oracle.jvmci.code.ForeignCallLinkage;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
29 import com.oracle.jvmci.code.CallingConvention;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
30 import com.oracle.jvmci.code.VirtualStackSlot;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
31 import com.oracle.jvmci.code.StackSlotValue;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
32 import com.oracle.jvmci.code.StackSlot;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
33 import com.oracle.jvmci.meta.Value;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
34 import com.oracle.jvmci.meta.LIRKind;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
35 import com.oracle.jvmci.meta.JavaConstant;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
36 import com.oracle.jvmci.meta.DeoptimizationAction;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
37 import com.oracle.jvmci.meta.PlatformKind;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
38 import com.oracle.jvmci.meta.DeoptimizationReason;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
39 import com.oracle.jvmci.meta.PrimitiveConstant;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
40 import com.oracle.jvmci.meta.AllocatableValue;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21554
diff changeset
41 import com.oracle.jvmci.meta.Kind;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 import static com.oracle.graal.amd64.AMD64.*;
19867
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
43 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic.*;
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
44 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64RMOp.*;
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
45 import static com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize.*;
15926
af0e42dad358 reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents: 15910
diff changeset
46 import static com.oracle.graal.hotspot.HotSpotBackend.*;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
47
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
48 import java.util.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
49
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
50 import com.oracle.graal.amd64.*;
19972
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
51 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MIOp;
19867
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
52 import com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
53 import com.oracle.graal.compiler.amd64.*;
15193
96bb07a5d667 Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents: 15104
diff changeset
54 import com.oracle.graal.compiler.common.*;
18390
ce15cc6af5fe Additional constructor for AMD64HotSpotLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 18358
diff changeset
55 import com.oracle.graal.compiler.common.spi.*;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
56 import com.oracle.graal.hotspot.*;
19910
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
57 import com.oracle.graal.hotspot.debug.*;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
58 import com.oracle.graal.hotspot.meta.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
59 import com.oracle.graal.hotspot.stubs.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
60 import com.oracle.graal.lir.*;
15301
468b2428c403 Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents: 15297
diff changeset
61 import com.oracle.graal.lir.StandardOp.NoOp;
468b2428c403 Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents: 15297
diff changeset
62 import com.oracle.graal.lir.StandardOp.SaveRegistersOp;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
63 import com.oracle.graal.lir.amd64.*;
14850
Josef Eisl <josef.eisl@jku.at>
parents: 14842 14707
diff changeset
64 import com.oracle.graal.lir.amd64.AMD64Move.LeaDataOp;
8643
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8641
diff changeset
65 import com.oracle.graal.lir.amd64.AMD64Move.MoveFromRegOp;
19910
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
66 import com.oracle.graal.lir.asm.*;
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
67 import com.oracle.graal.lir.framemap.*;
15292
a38d791982e1 Move LIRGenerationResult* to graal.lir.
Josef Eisl <josef.eisl@jku.at>
parents: 15251
diff changeset
68 import com.oracle.graal.lir.gen.*;
21543
93c50cefb9e8 moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
69 import com.oracle.jvmci.common.*;
21554
b1530a6cce8c renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
70 import com.oracle.jvmci.debug.*;
21551
5324104ac4f3 moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21543
diff changeset
71 import com.oracle.jvmci.hotspot.*;
21554
b1530a6cce8c renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
72 import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
73
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
74 /**
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
75 * LIR generator specialized for AMD64 HotSpot.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
76 */
9431
c0488f573091 Make AMD64 LIR generator extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
77 public class AMD64HotSpotLIRGenerator extends AMD64LIRGenerator implements HotSpotLIRGenerator {
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
78
14841
47e4d2e01c6e Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents: 14834
diff changeset
79 final HotSpotVMConfig config;
15293
adc7d7aad51c Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 15292
diff changeset
80 private HotSpotLockStack lockStack;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
81
14842
f2e61bf2a2d8 Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents: 14841
diff changeset
82 protected AMD64HotSpotLIRGenerator(HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) {
18481
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents: 18434
diff changeset
83 this(new DefaultLIRKindTool(providers.getCodeCache().getTarget().wordKind), providers, config, cc, lirGenRes);
18390
ce15cc6af5fe Additional constructor for AMD64HotSpotLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 18358
diff changeset
84 }
ce15cc6af5fe Additional constructor for AMD64HotSpotLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 18358
diff changeset
85
ce15cc6af5fe Additional constructor for AMD64HotSpotLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 18358
diff changeset
86 protected AMD64HotSpotLIRGenerator(LIRKindTool lirKindTool, HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) {
ce15cc6af5fe Additional constructor for AMD64HotSpotLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 18358
diff changeset
87 super(lirKindTool, providers, cc, lirGenRes);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
88 assert config.basicLockSize == 8;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
89 this.config = config;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
90 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
91
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
92 @Override
12787
9b62c748c9ae get thread register from generator when lowering CurrentJavaThreadNode node instead of getting it from the host provider
Doug Simon <doug.simon@oracle.com>
parents: 12757
diff changeset
93 public HotSpotProviders getProviders() {
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
94 return (HotSpotProviders) super.getProviders();
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
95 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
96
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
97 /**
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
98 * Utility for emitting the instruction to save RBP.
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
99 */
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
100 class SaveRbp {
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
101
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
102 private final NoOp placeholder0;
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
103 private final NoOp placeholder1;
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
104
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
105 /**
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
106 * The slot reserved for saving RBP.
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
107 */
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
108 private final StackSlot reservedSlot;
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
109 /**
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
110 * The variable reserved for saving RBP.
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
111 *
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
112 * This should be either allocated to RBP, or to reserved stack slot.
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
113 */
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
114 private final AllocatableValue rescueSlot;
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
115
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
116 public SaveRbp(NoOp placeholder0, NoOp placeholder1) {
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
117 this.placeholder0 = placeholder0;
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
118 this.placeholder1 = placeholder1;
18424
5afaa02c53dd Introduce AMD64FrameMapBuilder to support special stack slot allocation for RBP.
Josef Eisl <josef.eisl@jku.at>
parents: 18390
diff changeset
119 AMD64FrameMapBuilder frameMapBuilder = (AMD64FrameMapBuilder) getResult().getFrameMapBuilder();
5afaa02c53dd Introduce AMD64FrameMapBuilder to support special stack slot allocation for RBP.
Josef Eisl <josef.eisl@jku.at>
parents: 18390
diff changeset
120 this.reservedSlot = frameMapBuilder.allocateRBPSpillSlot();
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
121 this.rescueSlot = newVariable(LIRKind.value(Kind.Long));
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
122 }
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
123
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
124 /**
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
125 * Replaces this operation with the appropriate move for saving rbp.
14859
4f5c312d676e Fix merge regressions.
Josef Eisl <josef.eisl@jku.at>
parents: 14850
diff changeset
126 *
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
127 * @param useStack specifies if rbp must be saved to the stack
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
128 * @return true if an instruction has been remove (i.e. replace by {@code null}).
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
129 */
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
130 public boolean finalize(boolean useStack) {
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
131 // move to variable
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
132 placeholder0.replace(getResult().getLIR(), new MoveFromRegOp(Kind.Long, rescueSlot, rbp.asValue(LIRKind.value(Kind.Long))));
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
133 // move to stack
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
134 MoveFromRegOp moveToStack;
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
135 if (useStack) {
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
136 moveToStack = new MoveFromRegOp(Kind.Long, reservedSlot, rescueSlot);
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
137 } else {
18434
06624c98ed8b Handel RBP and deoptimization rescue slot in AMD64FrameMapBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 18426
diff changeset
138 ((AMD64FrameMapBuilder) getResult().getFrameMapBuilder()).freeRBPSpillSlot();
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
139 moveToStack = null;
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
140 }
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
141 placeholder1.replace(getResult().getLIR(), moveToStack);
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
142 return moveToStack == null;
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
143
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
144 }
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
145
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
146 AllocatableValue getRbpRescueSlot() {
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
147 return rescueSlot;
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
148 }
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
149 }
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
150
21595
3de3699ecac1 Encapsulate AMD64HotSpotLIRGenerator#saveRbp.
Josef Eisl <josef.eisl@jku.at>
parents: 21556
diff changeset
151 private SaveRbp saveRbp;
3de3699ecac1 Encapsulate AMD64HotSpotLIRGenerator#saveRbp.
Josef Eisl <josef.eisl@jku.at>
parents: 21556
diff changeset
152
3de3699ecac1 Encapsulate AMD64HotSpotLIRGenerator#saveRbp.
Josef Eisl <josef.eisl@jku.at>
parents: 21556
diff changeset
153 protected void emitSaveRbp() {
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
154 NoOp placeholder0 = new NoOp(getCurrentBlock(), getResult().getLIR().getLIRforBlock(getCurrentBlock()).size());
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
155 append(placeholder0);
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
156 NoOp placeholder1 = new NoOp(getCurrentBlock(), getResult().getLIR().getLIRforBlock(getCurrentBlock()).size());
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
157 append(placeholder1);
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
158 saveRbp = new SaveRbp(placeholder0, placeholder1);
21595
3de3699ecac1 Encapsulate AMD64HotSpotLIRGenerator#saveRbp.
Josef Eisl <josef.eisl@jku.at>
parents: 21556
diff changeset
159 }
3de3699ecac1 Encapsulate AMD64HotSpotLIRGenerator#saveRbp.
Josef Eisl <josef.eisl@jku.at>
parents: 21556
diff changeset
160
3de3699ecac1 Encapsulate AMD64HotSpotLIRGenerator#saveRbp.
Josef Eisl <josef.eisl@jku.at>
parents: 21556
diff changeset
161 protected SaveRbp getSaveRbp() {
3de3699ecac1 Encapsulate AMD64HotSpotLIRGenerator#saveRbp.
Josef Eisl <josef.eisl@jku.at>
parents: 21556
diff changeset
162 return saveRbp;
3de3699ecac1 Encapsulate AMD64HotSpotLIRGenerator#saveRbp.
Josef Eisl <josef.eisl@jku.at>
parents: 21556
diff changeset
163 }
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
164
20072
bd3246bc0aaa AMD64HotSpotLIRGenerator.RescueSlotDummyOp: add javadoc.
Josef Eisl <josef.eisl@jku.at>
parents: 20071
diff changeset
165 /**
bd3246bc0aaa AMD64HotSpotLIRGenerator.RescueSlotDummyOp: add javadoc.
Josef Eisl <josef.eisl@jku.at>
parents: 20071
diff changeset
166 * Helper instruction to reserve a stack slot for the whole method. Note that the actual users
bd3246bc0aaa AMD64HotSpotLIRGenerator.RescueSlotDummyOp: add javadoc.
Josef Eisl <josef.eisl@jku.at>
parents: 20071
diff changeset
167 * of the stack slot might be inserted after stack slot allocation. This dummy instruction
bd3246bc0aaa AMD64HotSpotLIRGenerator.RescueSlotDummyOp: add javadoc.
Josef Eisl <josef.eisl@jku.at>
parents: 20071
diff changeset
168 * ensures that the stack slot is alive and gets a real stack slot assigned.
bd3246bc0aaa AMD64HotSpotLIRGenerator.RescueSlotDummyOp: add javadoc.
Josef Eisl <josef.eisl@jku.at>
parents: 20071
diff changeset
169 */
19910
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
170 private static final class RescueSlotDummyOp extends LIRInstruction {
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
171 public static final LIRInstructionClass<RescueSlotDummyOp> TYPE = LIRInstructionClass.create(RescueSlotDummyOp.class);
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
172
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
173 @Alive({OperandFlag.STACK, OperandFlag.UNINITIALIZED}) private StackSlotValue slot;
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
174
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
175 public RescueSlotDummyOp(FrameMapBuilder frameMapBuilder, LIRKind kind) {
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
176 super(TYPE);
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
177 slot = frameMapBuilder.allocateSpillSlot(kind);
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
178 }
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
179
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
180 public StackSlotValue getSlot() {
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
181 return slot;
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
182 }
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
183
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
184 @Override
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
185 public void emitCode(CompilationResultBuilder crb) {
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
186 }
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
187 }
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
188
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
189 private RescueSlotDummyOp rescueSlotOp;
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
190
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
191 private StackSlotValue getOrInitRescueSlot() {
20071
32e2857bb2bb AMD64HotSpotLIRGenerator: insert RescueSlotDummyOp only in #beforeRegisterAllocation.
Josef Eisl <josef.eisl@jku.at>
parents: 19972
diff changeset
192 RescueSlotDummyOp op = getOrInitRescueSlotOp();
32e2857bb2bb AMD64HotSpotLIRGenerator: insert RescueSlotDummyOp only in #beforeRegisterAllocation.
Josef Eisl <josef.eisl@jku.at>
parents: 19972
diff changeset
193 return op.getSlot();
32e2857bb2bb AMD64HotSpotLIRGenerator: insert RescueSlotDummyOp only in #beforeRegisterAllocation.
Josef Eisl <josef.eisl@jku.at>
parents: 19972
diff changeset
194 }
32e2857bb2bb AMD64HotSpotLIRGenerator: insert RescueSlotDummyOp only in #beforeRegisterAllocation.
Josef Eisl <josef.eisl@jku.at>
parents: 19972
diff changeset
195
32e2857bb2bb AMD64HotSpotLIRGenerator: insert RescueSlotDummyOp only in #beforeRegisterAllocation.
Josef Eisl <josef.eisl@jku.at>
parents: 19972
diff changeset
196 private RescueSlotDummyOp getOrInitRescueSlotOp() {
19910
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
197 if (rescueSlotOp == null) {
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
198 // create dummy instruction to keep the rescue slot alive
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
199 rescueSlotOp = new RescueSlotDummyOp(getResult().getFrameMapBuilder(), getLIRKindTool().getWordKind());
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
200 }
20071
32e2857bb2bb AMD64HotSpotLIRGenerator: insert RescueSlotDummyOp only in #beforeRegisterAllocation.
Josef Eisl <josef.eisl@jku.at>
parents: 19972
diff changeset
201 return rescueSlotOp;
19910
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
202 }
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
203
8586
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
204 @Override
18425
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18424
diff changeset
205 public StackSlotValue getLockSlot(int lockDepth) {
15293
adc7d7aad51c Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 15292
diff changeset
206 return getLockStack().makeLockSlot(lockDepth);
adc7d7aad51c Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 15292
diff changeset
207 }
adc7d7aad51c Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 15292
diff changeset
208
adc7d7aad51c Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 15292
diff changeset
209 private HotSpotLockStack getLockStack() {
adc7d7aad51c Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 15292
diff changeset
210 assert lockStack != null;
adc7d7aad51c Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 15292
diff changeset
211 return lockStack;
adc7d7aad51c Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 15292
diff changeset
212 }
adc7d7aad51c Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 15292
diff changeset
213
adc7d7aad51c Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 15292
diff changeset
214 protected void setLockStack(HotSpotLockStack lockStack) {
adc7d7aad51c Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 15292
diff changeset
215 assert this.lockStack == null;
adc7d7aad51c Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 15292
diff changeset
216 this.lockStack = lockStack;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
217 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
218
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
219 private Register findPollOnReturnScratchRegister() {
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
220 RegisterConfig regConfig = getProviders().getCodeCache().getRegisterConfig();
20913
9b6ea36013c4 RegisterConfig: pass registers array to getAllocatableRegisters(PlatformKind).
Josef Eisl <josef.eisl@jku.at>
parents: 20072
diff changeset
221 for (Register r : regConfig.getAllocatableRegisters()) {
18357
09550eb6ddfb replace use of '==' with .equals()
Doug Simon <doug.simon@oracle.com>
parents: 18289
diff changeset
222 if (!r.equals(regConfig.getReturnRegister(Kind.Long)) && !r.equals(AMD64.rbp)) {
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
223 return r;
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
224 }
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
225 }
21543
93c50cefb9e8 moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
226 throw JVMCIError.shouldNotReachHere();
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
227 }
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
228
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
229 private Register pollOnReturnScratchRegister;
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
230
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
231 @Override
14841
47e4d2e01c6e Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents: 14834
diff changeset
232 public void emitReturn(Value input) {
14949
b65036798097 Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14945
diff changeset
233 AllocatableValue operand = Value.ILLEGAL;
b65036798097 Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14945
diff changeset
234 if (input != null) {
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
235 operand = resultOperandFor(input.getLIRKind());
14949
b65036798097 Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14945
diff changeset
236 emitMove(operand, input);
b65036798097 Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14945
diff changeset
237 }
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
238 if (pollOnReturnScratchRegister == null) {
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
239 pollOnReturnScratchRegister = findPollOnReturnScratchRegister();
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
240 }
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
241 append(new AMD64HotSpotReturnOp(operand, getStub() != null, pollOnReturnScratchRegister, config, saveRbp.getRbpRescueSlot()));
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
242 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
243
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
244 @Override
15297
3a6151ed5a25 Move LIRGenerator to graal.lir (errors).
Josef Eisl <josef.eisl@jku.at>
parents: 15293
diff changeset
245 public boolean needOnlyOopMaps() {
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
246 // Stubs only need oop maps
14921
88dfaf6448e0 Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14859
diff changeset
247 return ((AMD64HotSpotLIRGenerationResult) getResult()).getStub() != null;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
248 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
249
14859
4f5c312d676e Fix merge regressions.
Josef Eisl <josef.eisl@jku.at>
parents: 14850
diff changeset
250 @Override
14850
Josef Eisl <josef.eisl@jku.at>
parents: 14842 14707
diff changeset
251 public void emitData(AllocatableValue dst, byte[] data) {
Josef Eisl <josef.eisl@jku.at>
parents: 14842 14707
diff changeset
252 append(new LeaDataOp(dst, data));
Josef Eisl <josef.eisl@jku.at>
parents: 14842 14707
diff changeset
253 }
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
254
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
255 private LIRFrameState currentRuntimeCallInfo;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
256
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
257 @Override
18976
3faa4f98d5c8 renamed LIRGenerator.emitForeignCall to emitForeignCallOp to avoid confusion
Doug Simon <doug.simon@oracle.com>
parents: 18935
diff changeset
258 protected void emitForeignCallOp(ForeignCallLinkage linkage, Value result, Value[] arguments, Value[] temps, LIRFrameState info) {
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
259 currentRuntimeCallInfo = info;
18976
3faa4f98d5c8 renamed LIRGenerator.emitForeignCall to emitForeignCallOp to avoid confusion
Doug Simon <doug.simon@oracle.com>
parents: 18935
diff changeset
260 super.emitForeignCallOp(linkage, result, arguments, temps, info);
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
261 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
262
15456
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
263 public void emitLeaveCurrentStackFrame(SaveRegistersOp saveRegisterOp) {
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
264 append(new AMD64HotSpotLeaveCurrentStackFrameOp(saveRegisterOp, saveRbp.getRbpRescueSlot()));
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
265 }
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
266
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
267 public void emitLeaveDeoptimizedStackFrame(Value frameSize, Value initialInfo) {
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
268 Variable frameSizeVariable = load(frameSize);
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
269 Variable initialInfoVariable = load(initialInfo);
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
270 append(new AMD64HotSpotLeaveDeoptimizedStackFrameOp(frameSizeVariable, initialInfoVariable, saveRbp.getRbpRescueSlot()));
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
271 }
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
272
15456
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
273 public void emitEnterUnpackFramesStackFrame(Value framePc, Value senderSp, Value senderFp, SaveRegistersOp saveRegisterOp) {
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
274 Register threadRegister = getProviders().getRegisters().getThreadRegister();
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
275 Variable framePcVariable = load(framePc);
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
276 Variable senderSpVariable = load(senderSp);
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
277 Variable senderFpVariable = load(senderFp);
15456
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
278 append(new AMD64HotSpotEnterUnpackFramesStackFrameOp(threadRegister, config.threadLastJavaSpOffset(), config.threadLastJavaPcOffset(), config.threadLastJavaFpOffset(), framePcVariable,
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
279 senderSpVariable, senderFpVariable, saveRegisterOp));
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
280 }
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
281
15456
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
282 public void emitLeaveUnpackFramesStackFrame(SaveRegistersOp saveRegisterOp) {
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
283 Register threadRegister = getProviders().getRegisters().getThreadRegister();
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
284 append(new AMD64HotSpotLeaveUnpackFramesStackFrameOp(threadRegister, config.threadLastJavaSpOffset(), config.threadLastJavaPcOffset(), config.threadLastJavaFpOffset(), saveRegisterOp));
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
285 }
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
286
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18554
diff changeset
287 @Override
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18554
diff changeset
288 public Value emitCardTableShift() {
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18554
diff changeset
289 Variable result = newVariable(LIRKind.value(Kind.Long));
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21371
diff changeset
290 append(new AMD64HotSpotCardTableShiftOp(result, config));
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18554
diff changeset
291 return result;
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18554
diff changeset
292 }
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18554
diff changeset
293
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18554
diff changeset
294 @Override
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18554
diff changeset
295 public Value emitCardTableAddress() {
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18554
diff changeset
296 Variable result = newVariable(LIRKind.value(Kind.Long));
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21371
diff changeset
297 append(new AMD64HotSpotCardTableAddressOp(result, config));
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18554
diff changeset
298 return result;
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18554
diff changeset
299 }
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18554
diff changeset
300
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
301 /**
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
302 * @param savedRegisters the registers saved by this operation which may be subject to pruning
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
303 * @param savedRegisterLocations the slots to which the registers are saved
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
304 * @param supportsRemove determines if registers can be pruned
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
305 */
18425
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18424
diff changeset
306 protected AMD64SaveRegistersOp emitSaveRegisters(Register[] savedRegisters, StackSlotValue[] savedRegisterLocations, boolean supportsRemove) {
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
307 AMD64SaveRegistersOp save = new AMD64SaveRegistersOp(savedRegisters, savedRegisterLocations, supportsRemove);
9507
3df71c132731 Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9506
diff changeset
308 append(save);
3df71c132731 Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9506
diff changeset
309 return save;
3df71c132731 Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9506
diff changeset
310 }
3df71c132731 Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9506
diff changeset
311
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
312 /**
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
313 * Adds a node to the graph that saves all allocatable registers to the stack.
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
314 *
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
315 * @param supportsRemove determines if registers can be pruned
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
316 * @return the register save node
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
317 */
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
318 private AMD64SaveRegistersOp emitSaveAllRegisters(Register[] savedRegisters, boolean supportsRemove) {
18425
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18424
diff changeset
319 StackSlotValue[] savedRegisterLocations = new StackSlotValue[savedRegisters.length];
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
320 for (int i = 0; i < savedRegisters.length; i++) {
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
321 PlatformKind kind = target().arch.getLargestStorableKind(savedRegisters[i].getRegisterCategory());
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
322 assert kind != Kind.Illegal;
18425
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18424
diff changeset
323 VirtualStackSlot spillSlot = getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(kind));
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
324 savedRegisterLocations[i] = spillSlot;
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
325 }
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
326 return emitSaveRegisters(savedRegisters, savedRegisterLocations, supportsRemove);
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
327 }
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
328
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
329 @Override
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
330 public SaveRegistersOp emitSaveAllRegisters() {
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
331 // We are saving all registers.
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
332 // TODO Save upper half of YMM registers.
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
333 return emitSaveAllRegisters(cpuxmmRegisters, false);
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
334 }
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
335
9507
3df71c132731 Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9506
diff changeset
336 protected void emitRestoreRegisters(AMD64SaveRegistersOp save) {
3df71c132731 Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9506
diff changeset
337 append(new AMD64RestoreRegistersOp(save.getSlots().clone(), save));
3df71c132731 Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9506
diff changeset
338 }
3df71c132731 Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9506
diff changeset
339
14807
c3242028cc44 Introduce specialized LIRGenerationResults for Targets if needed.
Josef Eisl <josef.eisl@jku.at>
parents: 14806
diff changeset
340 public Stub getStub() {
14921
88dfaf6448e0 Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14859
diff changeset
341 return ((AMD64HotSpotLIRGenerationResult) getResult()).getStub();
9613
0c17815817a4 removed LIRGenerator.method field
Doug Simon <doug.simon@oracle.com>
parents: 9612
diff changeset
342 }
0c17815817a4 removed LIRGenerator.method field
Doug Simon <doug.simon@oracle.com>
parents: 9612
diff changeset
343
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
344 @Override
15301
468b2428c403 Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents: 15297
diff changeset
345 public Variable emitForeignCall(ForeignCallLinkage linkage, LIRFrameState state, Value... args) {
14955
be6fc21b25f8 Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14949
diff changeset
346 HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage;
be6fc21b25f8 Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14949
diff changeset
347 boolean destroysRegisters = hotspotLinkage.destroysRegisters();
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
348
9415
016523a011b7 simplified register preservation in compiled stubs to avoid the need for using ParametersOp
Doug Simon <doug.simon@oracle.com>
parents: 9352
diff changeset
349 AMD64SaveRegistersOp save = null;
9693
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9613
diff changeset
350 if (destroysRegisters) {
14142
4eac66a9b87d Remove reference to graph in LIRGenerator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14003
diff changeset
351 if (getStub() != null) {
4eac66a9b87d Remove reference to graph in LIRGenerator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14003
diff changeset
352 if (getStub().preservesRegisters()) {
18149
c6086a18c9ce Rename LIRGenerationResult.getFrameMap() to getFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18123
diff changeset
353 Register[] savedRegisters = getResult().getFrameMapBuilder().getRegisterConfig().getAllocatableRegisters();
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
354 save = emitSaveAllRegisters(savedRegisters, true);
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
355 }
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
356 }
9731
f7bd4594cbbf added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
357 }
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
358
9768
cbf274a92e5b a leaf foreign call does not need debug info
Doug Simon <doug.simon@oracle.com>
parents: 9742
diff changeset
359 Variable result;
15301
468b2428c403 Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents: 15297
diff changeset
360 // TODO (je) check if we can remove this
468b2428c403 Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents: 15297
diff changeset
361 LIRFrameState deoptInfo = null;
14955
be6fc21b25f8 Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14949
diff changeset
362 if (hotspotLinkage.canDeoptimize()) {
15301
468b2428c403 Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents: 15297
diff changeset
363 deoptInfo = state;
14955
be6fc21b25f8 Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14949
diff changeset
364 assert deoptInfo != null || getStub() != null;
be6fc21b25f8 Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14949
diff changeset
365 assert hotspotLinkage.needsJavaFrameAnchor();
be6fc21b25f8 Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14949
diff changeset
366 }
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
367
14955
be6fc21b25f8 Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14949
diff changeset
368 if (hotspotLinkage.needsJavaFrameAnchor()) {
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
369 Register thread = getProviders().getRegisters().getThreadRegister();
12559
ae412befde21 read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents: 12456
diff changeset
370 append(new AMD64HotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread));
14955
be6fc21b25f8 Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14949
diff changeset
371 result = super.emitForeignCall(hotspotLinkage, deoptInfo, args);
12559
ae412befde21 read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents: 12456
diff changeset
372 append(new AMD64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), thread));
9768
cbf274a92e5b a leaf foreign call does not need debug info
Doug Simon <doug.simon@oracle.com>
parents: 9742
diff changeset
373 } else {
15377
ad5c1c4434ed AMD64HotSpotLIRGenerator.emitForeignCall: add assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15370
diff changeset
374 assert deoptInfo == null;
ad5c1c4434ed AMD64HotSpotLIRGenerator.emitForeignCall: add assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15370
diff changeset
375 result = super.emitForeignCall(hotspotLinkage, null, args);
9731
f7bd4594cbbf added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
376 }
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
377
9731
f7bd4594cbbf added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
378 if (destroysRegisters) {
14142
4eac66a9b87d Remove reference to graph in LIRGenerator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14003
diff changeset
379 if (getStub() != null) {
4eac66a9b87d Remove reference to graph in LIRGenerator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14003
diff changeset
380 if (getStub().preservesRegisters()) {
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
381 AMD64HotSpotLIRGenerationResult generationResult = (AMD64HotSpotLIRGenerationResult) getResult();
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
382 assert !generationResult.getCalleeSaveInfo().containsKey(currentRuntimeCallInfo);
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
383 generationResult.getCalleeSaveInfo().put(currentRuntimeCallInfo, save);
9731
f7bd4594cbbf added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
384 emitRestoreRegisters(save);
f7bd4594cbbf added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
385 } else {
f7bd4594cbbf added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
386 assert zapRegisters();
f7bd4594cbbf added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents: 9693
diff changeset
387 }
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
388 }
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
389 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
390
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
391 return result;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
392 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
393
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
394 public Value emitUncommonTrapCall(Value trapRequest, SaveRegistersOp saveRegisterOp) {
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
395 ForeignCallLinkage linkage = getForeignCalls().lookupForeignCall(UNCOMMON_TRAP);
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
396
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
397 Register thread = getProviders().getRegisters().getThreadRegister();
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
398 append(new AMD64HotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread));
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
399 Variable result = super.emitForeignCall(linkage, null, thread.asValue(LIRKind.value(Kind.Long)), trapRequest);
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
400 append(new AMD64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), thread));
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
401
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
402 Map<LIRFrameState, SaveRegistersOp> calleeSaveInfo = ((AMD64HotSpotLIRGenerationResult) getResult()).getCalleeSaveInfo();
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
403 assert !calleeSaveInfo.containsKey(currentRuntimeCallInfo);
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
404 calleeSaveInfo.put(currentRuntimeCallInfo, saveRegisterOp);
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
405
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
406 return result;
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
407 }
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
408
15456
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
409 public Value emitDeoptimizationFetchUnrollInfoCall(SaveRegistersOp saveRegisterOp) {
15968
42eaa579e134 more improvements to runtime initialization:
Doug Simon <doug.simon@oracle.com>
parents: 15947
diff changeset
410 ForeignCallLinkage linkage = getForeignCalls().lookupForeignCall(FETCH_UNROLL_INFO);
15456
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
411
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
412 Register thread = getProviders().getRegisters().getThreadRegister();
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
413 append(new AMD64HotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread));
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
414 Variable result = super.emitForeignCall(linkage, null, thread.asValue(LIRKind.value(Kind.Long)));
15456
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
415 append(new AMD64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), thread));
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
416
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
417 Map<LIRFrameState, SaveRegistersOp> calleeSaveInfo = ((AMD64HotSpotLIRGenerationResult) getResult()).getCalleeSaveInfo();
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
418 assert !calleeSaveInfo.containsKey(currentRuntimeCallInfo);
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
419 calleeSaveInfo.put(currentRuntimeCallInfo, saveRegisterOp);
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
420
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
421 return result;
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
422 }
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15412
diff changeset
423
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
424 protected AMD64ZapRegistersOp emitZapRegisters(Register[] zappedRegisters, JavaConstant[] zapValues) {
9506
6703dca691d7 Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents: 9505
diff changeset
425 AMD64ZapRegistersOp zap = new AMD64ZapRegistersOp(zappedRegisters, zapValues);
6703dca691d7 Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents: 9505
diff changeset
426 append(zap);
6703dca691d7 Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents: 9505
diff changeset
427 return zap;
6703dca691d7 Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents: 9505
diff changeset
428 }
6703dca691d7 Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents: 9505
diff changeset
429
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
430 protected boolean zapRegisters() {
18149
c6086a18c9ce Rename LIRGenerationResult.getFrameMap() to getFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18123
diff changeset
431 Register[] zappedRegisters = getResult().getFrameMapBuilder().getRegisterConfig().getAllocatableRegisters();
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
432 JavaConstant[] zapValues = new JavaConstant[zappedRegisters.length];
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
433 for (int i = 0; i < zappedRegisters.length; i++) {
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
434 PlatformKind kind = target().arch.getLargestStorableKind(zappedRegisters[i].getRegisterCategory());
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
435 assert kind != Kind.Illegal;
9506
6703dca691d7 Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents: 9505
diff changeset
436 zapValues[i] = zapValueForKind(kind);
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
437 }
14921
88dfaf6448e0 Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14859
diff changeset
438 ((AMD64HotSpotLIRGenerationResult) getResult()).getCalleeSaveInfo().put(currentRuntimeCallInfo, emitZapRegisters(zappedRegisters, zapValues));
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
439 return true;
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
440 }
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
441
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
442 @Override
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
443 public void emitTailcall(Value[] args, Value address) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
444 append(new AMD64TailcallOp(args, address));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
445 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
446
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
447 @Override
13837
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13726
diff changeset
448 public void emitCCall(long address, CallingConvention nativeCallingConvention, Value[] args, int numberOfFloatingPointArguments) {
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13726
diff changeset
449 Value[] argLocations = new Value[args.length];
18149
c6086a18c9ce Rename LIRGenerationResult.getFrameMap() to getFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18123
diff changeset
450 getResult().getFrameMapBuilder().callsMethod(nativeCallingConvention);
13839
5fb138b6a92f GNFI fixes
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13837
diff changeset
451 // TODO(mg): in case a native function uses floating point varargs, the ABI requires that
5fb138b6a92f GNFI fixes
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13837
diff changeset
452 // RAX contains the length of the varargs
18692
d6c33eb93b9f Use Register.asValue(LIRKind) where appropriate.
Josef Eisl <josef.eisl@jku.at>
parents: 18661
diff changeset
453 PrimitiveConstant intConst = JavaConstant.forInt(numberOfFloatingPointArguments);
d6c33eb93b9f Use Register.asValue(LIRKind) where appropriate.
Josef Eisl <josef.eisl@jku.at>
parents: 18661
diff changeset
454 AllocatableValue numberOfFloatingPointArgumentsRegister = AMD64.rax.asValue(intConst.getLIRKind());
d6c33eb93b9f Use Register.asValue(LIRKind) where appropriate.
Josef Eisl <josef.eisl@jku.at>
parents: 18661
diff changeset
455 emitMove(numberOfFloatingPointArgumentsRegister, intConst);
13837
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13726
diff changeset
456 for (int i = 0; i < args.length; i++) {
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13726
diff changeset
457 Value arg = args[i];
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13726
diff changeset
458 AllocatableValue loc = nativeCallingConvention.getArgument(i);
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13726
diff changeset
459 emitMove(loc, arg);
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13726
diff changeset
460 argLocations[i] = loc;
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13726
diff changeset
461 }
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
462 Value ptr = emitMove(JavaConstant.forLong(address));
13837
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13726
diff changeset
463 append(new AMD64CCall(nativeCallingConvention.getReturn(), ptr, numberOfFloatingPointArgumentsRegister, argLocations));
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13726
diff changeset
464 }
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13726
diff changeset
465
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13726
diff changeset
466 @Override
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
467 public void emitUnwind(Value exception) {
12363
78e5badf4b8e moved lookupForeignCall() from CodeCacheProvider to ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 12058
diff changeset
468 ForeignCallLinkage linkage = getForeignCalls().lookupForeignCall(HotSpotBackend.UNWIND_EXCEPTION_TO_CALLER);
10873
de55425d3cf5 small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents: 10870
diff changeset
469 CallingConvention outgoingCc = linkage.getOutgoingCallingConvention();
de55425d3cf5 small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents: 10870
diff changeset
470 assert outgoingCc.getArgumentCount() == 2;
de55425d3cf5 small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents: 10870
diff changeset
471 RegisterValue exceptionParameter = (RegisterValue) outgoingCc.getArgument(0);
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
472 emitMove(exceptionParameter, exception);
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
473 append(new AMD64HotSpotUnwindOp(exceptionParameter, saveRbp.getRbpRescueSlot()));
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
474 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
475
13641
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
476 private void moveDeoptValuesToThread(Value actionAndReason, Value speculation) {
18526
be44c1ca8f00 removed static access to HotSpotGraalRuntime from some AMD64 HotSpot classes
Doug Simon <doug.simon@oracle.com>
parents: 18490
diff changeset
477 moveValueToThread(actionAndReason, config.pendingDeoptimizationOffset);
be44c1ca8f00 removed static access to HotSpotGraalRuntime from some AMD64 HotSpot classes
Doug Simon <doug.simon@oracle.com>
parents: 18490
diff changeset
478 moveValueToThread(speculation, config.pendingFailedSpeculationOffset);
13641
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
479 }
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
480
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
481 private void moveValueToThread(Value v, int offset) {
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
482 LIRKind wordKind = LIRKind.value(getProviders().getCodeCache().getTarget().wordKind);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
483 RegisterValue thread = getProviders().getRegisters().getThreadRegister().asValue(wordKind);
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
484 AMD64AddressValue address = new AMD64AddressValue(wordKind, thread, offset);
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
485 emitStore(v.getLIRKind(), address, v, null);
11832
97d6932a309b CodeCacheProvider.encodeDeoptActionAndReason now returns a Constant
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11790
diff changeset
486 }
97d6932a309b CodeCacheProvider.encodeDeoptActionAndReason now returns a Constant
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11790
diff changeset
487
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
488 @Override
15301
468b2428c403 Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents: 15297
diff changeset
489 public void emitDeoptimize(Value actionAndReason, Value speculation, LIRFrameState state) {
13641
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
490 moveDeoptValuesToThread(actionAndReason, speculation);
15301
468b2428c403 Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents: 15297
diff changeset
491 append(new AMD64DeoptimizeOp(state));
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
492 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
493
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
494 @Override
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
495 public void emitDeoptimizeCaller(DeoptimizationAction action, DeoptimizationReason reason) {
18490
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18481
diff changeset
496 moveDeoptValuesToThread(getMetaAccess().encodeDeoptActionAndReason(action, reason, 0), JavaConstant.NULL_POINTER);
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
497 append(new AMD64HotSpotDeoptimizeCallerOp(saveRbp.getRbpRescueSlot()));
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
498 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
499
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
500 @Override
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
501 public void beforeRegisterAllocation() {
13313
6dd9a1455e64 renamed PlaceholderOp to NoOp
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
502 super.beforeRegisterAllocation();
14921
88dfaf6448e0 Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14859
diff changeset
503 boolean hasDebugInfo = getResult().getLIR().hasDebugInfo();
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
504 boolean removedInstruction = saveRbp.finalize(hasDebugInfo);
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
505 if (hasDebugInfo) {
18434
06624c98ed8b Handel RBP and deoptimization rescue slot in AMD64FrameMapBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 18426
diff changeset
506 ((AMD64HotSpotLIRGenerationResult) getResult()).setDeoptimizationRescueSlot(((AMD64FrameMapBuilder) getResult().getFrameMapBuilder()).allocateDeoptimizationRescueSlot());
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
507 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
508
19910
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
509 if (BenchmarkCounters.enabled) {
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
510 // ensure that the rescue slot is available
20071
32e2857bb2bb AMD64HotSpotLIRGenerator: insert RescueSlotDummyOp only in #beforeRegisterAllocation.
Josef Eisl <josef.eisl@jku.at>
parents: 19972
diff changeset
511 LIRInstruction op = getOrInitRescueSlotOp();
32e2857bb2bb AMD64HotSpotLIRGenerator: insert RescueSlotDummyOp only in #beforeRegisterAllocation.
Josef Eisl <josef.eisl@jku.at>
parents: 19972
diff changeset
512 // insert dummy instruction into the start block
32e2857bb2bb AMD64HotSpotLIRGenerator: insert RescueSlotDummyOp only in #beforeRegisterAllocation.
Josef Eisl <josef.eisl@jku.at>
parents: 19972
diff changeset
513 LIR lir = getResult().getLIR();
32e2857bb2bb AMD64HotSpotLIRGenerator: insert RescueSlotDummyOp only in #beforeRegisterAllocation.
Josef Eisl <josef.eisl@jku.at>
parents: 19972
diff changeset
514 List<LIRInstruction> instructions = lir.getLIRforBlock(lir.getControlFlowGraph().getStartBlock());
32e2857bb2bb AMD64HotSpotLIRGenerator: insert RescueSlotDummyOp only in #beforeRegisterAllocation.
Josef Eisl <josef.eisl@jku.at>
parents: 19972
diff changeset
515 instructions.add(1, op);
32e2857bb2bb AMD64HotSpotLIRGenerator: insert RescueSlotDummyOp only in #beforeRegisterAllocation.
Josef Eisl <josef.eisl@jku.at>
parents: 19972
diff changeset
516 Debug.dump(lir, "created rescue dummy op");
19910
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
517 }
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
518 if (removedInstruction) {
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
519 // remove null from instruction list
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
520 LIR lir = getResult().getLIR();
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
521 List<LIRInstruction> instructions = lir.getLIRforBlock(lir.getControlFlowGraph().getStartBlock());
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
522 instructions.remove(null);
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21595
diff changeset
523 }
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
524 }
9885
ed86945795d5 Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9768
diff changeset
525
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
526 public void emitPushInterpreterFrame(Value frameSize, Value framePc, Value senderSp, Value initialInfo) {
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
527 Variable frameSizeVariable = load(frameSize);
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
528 Variable framePcVariable = load(framePc);
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
529 Variable senderSpVariable = load(senderSp);
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
530 Variable initialInfoVariable = load(initialInfo);
18526
be44c1ca8f00 removed static access to HotSpotGraalRuntime from some AMD64 HotSpot classes
Doug Simon <doug.simon@oracle.com>
parents: 18490
diff changeset
531 append(new AMD64HotSpotPushInterpreterFrameOp(frameSizeVariable, framePcVariable, senderSpVariable, initialInfoVariable, config));
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
532 }
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15058
diff changeset
533
9885
ed86945795d5 Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9768
diff changeset
534 @Override
21371
2c2c85ce7f4d Move VM-independent code out of HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents: 21080
diff changeset
535 protected void emitStoreConst(Kind kind, AMD64AddressValue address, JavaConstant value, LIRFrameState state) {
2c2c85ce7f4d Move VM-independent code out of HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents: 21080
diff changeset
536 if (value instanceof HotSpotConstant && value.isNonNull()) {
19972
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
537 HotSpotConstant c = (HotSpotConstant) value;
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
538 if (c.isCompressed()) {
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
539 assert kind == Kind.Int;
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
540 if (!target().inlineObjects && c instanceof HotSpotObjectConstant) {
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
541 emitStore(kind, address, asAllocatable(value), state);
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
542 } else {
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
543 append(new AMD64HotSpotBinaryConsumer.MemoryConstOp(AMD64MIOp.MOV, address, c, state));
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
544 }
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
545 } else {
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
546 emitStore(kind, address, asAllocatable(value), state);
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
547 }
f259c81821ef Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 19971
diff changeset
548 } else {
21371
2c2c85ce7f4d Move VM-independent code out of HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents: 21080
diff changeset
549 super.emitStoreConst(kind, address, value, state);
9885
ed86945795d5 Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9768
diff changeset
550 }
ed86945795d5 Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9768
diff changeset
551 }
ed86945795d5 Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9768
diff changeset
552
14943
e5a55d280f24 Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 14921
diff changeset
553 @Override
15058
895e9ecedfe8 Fix code generation for compressed metaspace pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15024
diff changeset
554 public Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull) {
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
555 LIRKind inputKind = pointer.getLIRKind();
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
556 assert inputKind.getPlatformKind() == Kind.Long || inputKind.getPlatformKind() == Kind.Object;
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
557 if (inputKind.isReference(0)) {
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
558 // oop
16116
9e5a323e0a1e Remove hotspot specific NarrowOop kind, use LIRKind.reference(Kind.Int) instead.
Roland Schatz <roland.schatz@oracle.com>
parents: 16104
diff changeset
559 Variable result = newVariable(LIRKind.reference(Kind.Int));
15058
895e9ecedfe8 Fix code generation for compressed metaspace pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15024
diff changeset
560 append(new AMD64HotSpotMove.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull));
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
561 return result;
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
562 } else {
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
563 // metaspace pointer
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
564 Variable result = newVariable(LIRKind.value(Kind.Int));
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
565 AllocatableValue base = Value.ILLEGAL;
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
566 if (encoding.base != 0) {
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
567 base = emitMove(JavaConstant.forLong(encoding.base));
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
568 }
15058
895e9ecedfe8 Fix code generation for compressed metaspace pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15024
diff changeset
569 append(new AMD64HotSpotMove.CompressPointer(result, asAllocatable(pointer), base, encoding, nonNull));
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
570 return result;
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
571 }
14943
e5a55d280f24 Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 14921
diff changeset
572 }
e5a55d280f24 Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 14921
diff changeset
573
e5a55d280f24 Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 14921
diff changeset
574 @Override
15058
895e9ecedfe8 Fix code generation for compressed metaspace pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15024
diff changeset
575 public Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull) {
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
576 LIRKind inputKind = pointer.getLIRKind();
16116
9e5a323e0a1e Remove hotspot specific NarrowOop kind, use LIRKind.reference(Kind.Int) instead.
Roland Schatz <roland.schatz@oracle.com>
parents: 16104
diff changeset
577 assert inputKind.getPlatformKind() == Kind.Int;
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
578 if (inputKind.isReference(0)) {
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
579 // oop
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
580 Variable result = newVariable(LIRKind.reference(Kind.Object));
15058
895e9ecedfe8 Fix code generation for compressed metaspace pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15024
diff changeset
581 append(new AMD64HotSpotMove.UncompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull));
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
582 return result;
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
583 } else {
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
584 // metaspace pointer
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16083
diff changeset
585 Variable result = newVariable(LIRKind.value(Kind.Long));
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
586 AllocatableValue base = Value.ILLEGAL;
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
587 if (encoding.base != 0) {
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
588 base = emitMove(JavaConstant.forLong(encoding.base));
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
589 }
15058
895e9ecedfe8 Fix code generation for compressed metaspace pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15024
diff changeset
590 append(new AMD64HotSpotMove.UncompressPointer(result, asAllocatable(pointer), base, encoding, nonNull));
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
591 return result;
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
592 }
14943
e5a55d280f24 Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 14921
diff changeset
593 }
e5a55d280f24 Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 14921
diff changeset
594
14945
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14943
diff changeset
595 @Override
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14943
diff changeset
596 protected AMD64LIRInstruction createMove(AllocatableValue dst, Value src) {
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
597 if (src instanceof JavaConstant) {
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
598 return new AMD64HotSpotMove.HotSpotLoadConstantOp(dst, (JavaConstant) src);
14945
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14943
diff changeset
599 } else {
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14943
diff changeset
600 return super.createMove(dst, src);
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14943
diff changeset
601 }
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14943
diff changeset
602 }
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14943
diff changeset
603
21371
2c2c85ce7f4d Move VM-independent code out of HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents: 21080
diff changeset
604 @Override
15554
cf994cc23b54 Move emitNullCheck from NodeLIRBuilderTool to LIRGeneratorTool.
Josef Eisl <josef.eisl@jku.at>
parents: 15456
diff changeset
605 public void emitNullCheck(Value address, LIRFrameState state) {
16710
56bcde831179 support for compressed inputs to NullCheckNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16116
diff changeset
606 if (address.getLIRKind().getPlatformKind() == Kind.Int) {
56bcde831179 support for compressed inputs to NullCheckNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16116
diff changeset
607 CompressEncoding encoding = config.getOopEncoding();
21080
3253fe1bed41 Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents: 20913
diff changeset
608 Value uncompressed;
16710
56bcde831179 support for compressed inputs to NullCheckNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16116
diff changeset
609 if (encoding.shift <= 3) {
21080
3253fe1bed41 Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents: 20913
diff changeset
610 uncompressed = emitAddress(getProviders().getRegisters().getHeapBaseRegister().asValue(), 0, load(address), 1 << encoding.shift);
16710
56bcde831179 support for compressed inputs to NullCheckNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16116
diff changeset
611 } else {
21080
3253fe1bed41 Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents: 20913
diff changeset
612 uncompressed = emitUncompress(address, encoding, false);
16710
56bcde831179 support for compressed inputs to NullCheckNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16116
diff changeset
613 }
21080
3253fe1bed41 Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents: 20913
diff changeset
614 append(new AMD64Move.NullCheckOp(asAddressValue(uncompressed), state));
16710
56bcde831179 support for compressed inputs to NullCheckNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16116
diff changeset
615 } else {
21371
2c2c85ce7f4d Move VM-independent code out of HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents: 21080
diff changeset
616 super.emitNullCheck(address, state);
16710
56bcde831179 support for compressed inputs to NullCheckNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16116
diff changeset
617 }
15554
cf994cc23b54 Move emitNullCheck from NodeLIRBuilderTool to LIRGeneratorTool.
Josef Eisl <josef.eisl@jku.at>
parents: 15456
diff changeset
618 }
15909
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15554
diff changeset
619
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15554
diff changeset
620 @Override
16104
4dd2cedc7f57 Revert using LIRKind.reference(Kind.Int) instead of hotspot specific NarrowOop kind (part of c0b8d395368b).
Roland Schatz <roland.schatz@oracle.com>
parents: 16094
diff changeset
621 protected void emitCompareOp(PlatformKind cmpKind, Variable left, Value right) {
19867
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
622 if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(right)) {
19971
46dde3e92715 Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents: 19910
diff changeset
623 append(new AMD64BinaryConsumer.Op(TEST, DWORD, left, left));
19867
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
624 } else if (right instanceof HotSpotConstant) {
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
625 HotSpotConstant c = (HotSpotConstant) right;
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
626
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
627 boolean isImmutable = GraalOptions.ImmutableCode.getValue();
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
628 boolean generatePIC = GraalOptions.GeneratePIC.getValue();
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
629 if (c.isCompressed() && !(isImmutable && generatePIC)) {
19971
46dde3e92715 Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents: 19910
diff changeset
630 append(new AMD64HotSpotBinaryConsumer.ConstOp(CMP.getMIOpcode(DWORD, false), left, c));
19867
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
631 } else {
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
632 OperandSize size = c.isCompressed() ? DWORD : QWORD;
19971
46dde3e92715 Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents: 19910
diff changeset
633 append(new AMD64BinaryConsumer.DataOp(CMP.getRMOpcode(size), size, left, c));
19867
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
634 }
15910
79a0d9065849 Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15909
diff changeset
635 } else {
79a0d9065849 Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15909
diff changeset
636 super.emitCompareOp(cmpKind, left, right);
79a0d9065849 Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15909
diff changeset
637 }
79a0d9065849 Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15909
diff changeset
638 }
79a0d9065849 Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15909
diff changeset
639
79a0d9065849 Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15909
diff changeset
640 @Override
19867
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
641 protected boolean emitCompareMemoryConOp(OperandSize size, JavaConstant a, AMD64AddressValue b, LIRFrameState state) {
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
642 if (a.isNull()) {
19971
46dde3e92715 Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents: 19910
diff changeset
643 append(new AMD64BinaryConsumer.MemoryConstOp(CMP, size, b, 0, state));
19867
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
644 return true;
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
645 } else if (a instanceof HotSpotConstant && size == DWORD) {
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
646 assert ((HotSpotConstant) a).isCompressed();
19971
46dde3e92715 Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents: 19910
diff changeset
647 append(new AMD64HotSpotBinaryConsumer.MemoryConstOp(CMP.getMIOpcode(size, false), b, (HotSpotConstant) a, state));
19867
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
648 return true;
15910
79a0d9065849 Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15909
diff changeset
649 } else {
19867
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 19866
diff changeset
650 return super.emitCompareMemoryConOp(size, a, b, state);
15910
79a0d9065849 Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15909
diff changeset
651 }
79a0d9065849 Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15909
diff changeset
652 }
79a0d9065849 Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15909
diff changeset
653
79a0d9065849 Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15909
diff changeset
654 @Override
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
655 public boolean canInlineConstant(JavaConstant c) {
15909
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15554
diff changeset
656 if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15554
diff changeset
657 return true;
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15554
diff changeset
658 } else if (c instanceof HotSpotObjectConstant) {
18289
7acff34abbf7 replaced HotSpotObjectConstantImpl.isCompressed() with HotSpotObjectConstant.isCompressed()
Doug Simon <doug.simon@oracle.com>
parents: 18266
diff changeset
659 return ((HotSpotObjectConstant) c).isCompressed();
15909
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15554
diff changeset
660 } else {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15554
diff changeset
661 return super.canInlineConstant(c);
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15554
diff changeset
662 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15554
diff changeset
663 }
19910
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
664
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
665 @Override
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
666 public LIRInstruction createBenchmarkCounter(String name, String group, Value increment) {
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
667 if (BenchmarkCounters.enabled) {
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
668 return new AMD64HotSpotCounterOp(name, group, increment, getProviders().getRegisters(), config, getOrInitRescueSlot());
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
669 }
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
670 return null;
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
671 }
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
672
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
673 @Override
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
674 public LIRInstruction createMultiBenchmarkCounter(String[] names, String[] groups, Value[] increments) {
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
675 if (BenchmarkCounters.enabled) {
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
676 return new AMD64HotSpotCounterOp(names, groups, increments, getProviders().getRegisters(), config, getOrInitRescueSlot());
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
677 }
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
678 return null;
3bc0ac89fa5a {AMD64,SPARC}HotSpotLIRGenerator: implement createBenchmarkCounter().
Josef Eisl <josef.eisl@jku.at>
parents: 19867
diff changeset
679 }
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
680 }