Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java @ 6495:75f130f2b30f
moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 03 Oct 2012 01:18:03 +0200 |
parents | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/HotSpotBackend.java@df02fa2bce58 |
children | 2a0c9f20baa1 |
rev | line source |
---|---|
6479
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
6495
75f130f2b30f
moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents:
6494
diff
changeset
|
23 package com.oracle.graal.hotspot; |
6479
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import java.util.*; |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import com.oracle.graal.api.code.*; |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 import com.oracle.graal.api.meta.*; |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 import com.oracle.graal.compiler.target.*; |
6494
df02fa2bce58
refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents:
6490
diff
changeset
|
30 import com.oracle.graal.hotspot.meta.*; |
6479
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 /** |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 * HotSpot specific backend. |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 */ |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 public abstract class HotSpotBackend extends Backend { |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 |
6490
9892bfd8a48f
refactored stub names into constants shared between definition and usage sites
Doug Simon <doug.simon@oracle.com>
parents:
6482
diff
changeset
|
37 public static final String VM_ERROR_STUB_NAME = "vm_error"; |
9892bfd8a48f
refactored stub names into constants shared between definition and usage sites
Doug Simon <doug.simon@oracle.com>
parents:
6482
diff
changeset
|
38 public static final String VERIFY_OOP_STUB_NAME = "verify_oop"; |
9892bfd8a48f
refactored stub names into constants shared between definition and usage sites
Doug Simon <doug.simon@oracle.com>
parents:
6482
diff
changeset
|
39 public static final String NEW_MULTI_ARRAY_STUB_NAME = "new_multi_array"; |
9892bfd8a48f
refactored stub names into constants shared between definition and usage sites
Doug Simon <doug.simon@oracle.com>
parents:
6482
diff
changeset
|
40 public static final String NEW_INSTANCE_STUB_NAME = "new_instance"; |
9892bfd8a48f
refactored stub names into constants shared between definition and usage sites
Doug Simon <doug.simon@oracle.com>
parents:
6482
diff
changeset
|
41 public static final String NEW_TYPE_ARRAY_STUB_NAME = "new_type_array"; |
9892bfd8a48f
refactored stub names into constants shared between definition and usage sites
Doug Simon <doug.simon@oracle.com>
parents:
6482
diff
changeset
|
42 public static final String NEW_OBJECT_ARRAY_STUB_NAME = "new_object_array"; |
9892bfd8a48f
refactored stub names into constants shared between definition and usage sites
Doug Simon <doug.simon@oracle.com>
parents:
6482
diff
changeset
|
43 public static final String MONITOREXIT_STUB_NAME = "monitorexit"; |
9892bfd8a48f
refactored stub names into constants shared between definition and usage sites
Doug Simon <doug.simon@oracle.com>
parents:
6482
diff
changeset
|
44 public static final String MONITORENTER_STUB_NAME = "monitorenter"; |
9892bfd8a48f
refactored stub names into constants shared between definition and usage sites
Doug Simon <doug.simon@oracle.com>
parents:
6482
diff
changeset
|
45 |
6479
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 private final Map<String, HotSpotStub> stubsMap = new HashMap<>(); |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 |
6494
df02fa2bce58
refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents:
6490
diff
changeset
|
48 public HotSpotBackend(HotSpotRuntime runtime, TargetDescription target) { |
6479
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 super(runtime, target); |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 } |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 |
6494
df02fa2bce58
refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents:
6490
diff
changeset
|
52 @Override |
df02fa2bce58
refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents:
6490
diff
changeset
|
53 public HotSpotRuntime runtime() { |
df02fa2bce58
refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents:
6490
diff
changeset
|
54 return (HotSpotRuntime) super.runtime(); |
df02fa2bce58
refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents:
6490
diff
changeset
|
55 } |
df02fa2bce58
refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents:
6490
diff
changeset
|
56 |
6479
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 /** |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 * Gets the linkage information for a global stub. |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 */ |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 public HotSpotStub getStub(String name) { |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 HotSpotStub stub = stubsMap.get(name); |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 assert stub != null : "no stub named " + name; |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 return stub; |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 } |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 /** |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 * Registers the details for linking a global stub. |
6482
f0db2c717f6e
modified NewArrayStubCall to use information provided by the (platform independent) backend instead of AMD64 specific nodes for linking the stub call
Doug Simon <doug.simon@oracle.com>
parents:
6479
diff
changeset
|
68 * |
f0db2c717f6e
modified NewArrayStubCall to use information provided by the (platform independent) backend instead of AMD64 specific nodes for linking the stub call
Doug Simon <doug.simon@oracle.com>
parents:
6479
diff
changeset
|
69 * @param name name of the stub |
f0db2c717f6e
modified NewArrayStubCall to use information provided by the (platform independent) backend instead of AMD64 specific nodes for linking the stub call
Doug Simon <doug.simon@oracle.com>
parents:
6479
diff
changeset
|
70 * @param address address of the stub |
f0db2c717f6e
modified NewArrayStubCall to use information provided by the (platform independent) backend instead of AMD64 specific nodes for linking the stub call
Doug Simon <doug.simon@oracle.com>
parents:
6479
diff
changeset
|
71 * @param tempRegs temporary registers used (and killed) by the stub (null if none) |
f0db2c717f6e
modified NewArrayStubCall to use information provided by the (platform independent) backend instead of AMD64 specific nodes for linking the stub call
Doug Simon <doug.simon@oracle.com>
parents:
6479
diff
changeset
|
72 * @param ret where the stub returns its result |
f0db2c717f6e
modified NewArrayStubCall to use information provided by the (platform independent) backend instead of AMD64 specific nodes for linking the stub call
Doug Simon <doug.simon@oracle.com>
parents:
6479
diff
changeset
|
73 * @param args where arguments are passed to the stub |
6479
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 */ |
6482
f0db2c717f6e
modified NewArrayStubCall to use information provided by the (platform independent) backend instead of AMD64 specific nodes for linking the stub call
Doug Simon <doug.simon@oracle.com>
parents:
6479
diff
changeset
|
75 protected void addStub(String name, long address, Register[] tempRegs, Value ret, Value... args) { |
f0db2c717f6e
modified NewArrayStubCall to use information provided by the (platform independent) backend instead of AMD64 specific nodes for linking the stub call
Doug Simon <doug.simon@oracle.com>
parents:
6479
diff
changeset
|
76 Value[] temps = tempRegs == null || tempRegs.length == 0 ? Value.NONE : new Value[tempRegs.length]; |
6479
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 for (int i = 0; i < temps.length; i++) { |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 temps[i] = tempRegs[i].asValue(); |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 } |
6482
f0db2c717f6e
modified NewArrayStubCall to use information provided by the (platform independent) backend instead of AMD64 specific nodes for linking the stub call
Doug Simon <doug.simon@oracle.com>
parents:
6479
diff
changeset
|
80 HotSpotStub stub = new HotSpotStub(name, address, new CallingConvention(temps, 0, ret, args)); |
f0db2c717f6e
modified NewArrayStubCall to use information provided by the (platform independent) backend instead of AMD64 specific nodes for linking the stub call
Doug Simon <doug.simon@oracle.com>
parents:
6479
diff
changeset
|
81 stubsMap.put(name, stub); |
6479
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 } |
e8be2bb3760e
introduced platform independent HotSpotBackend to manage stub linkage information
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 } |