Mercurial > hg > truffle
annotate graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java @ 12734:2caa21ef52bb
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 08 Nov 2013 18:34:57 +0100 |
parents | 5124eeec1a7b |
children | 38c881305352 |
rev | line source |
---|---|
10956 | 1 /* |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.oracle.graal.lir.sparc; | |
24 | |
25 import com.oracle.graal.api.code.*; | |
26 import com.oracle.graal.api.meta.*; | |
27 import com.oracle.graal.lir.*; | |
28 | |
29 /** | |
30 * SPARC specific frame map. | |
31 * | |
32 * This is the format of a SPARC stack frame: | |
33 * | |
34 * <pre> | |
35 * Base Contents | |
36 * | |
37 * : : ----- | |
38 * caller | incoming overflow argument n | ^ | |
39 * frame : ... : | positive | |
40 * | incoming overflow argument 0 | | offsets | |
10958
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
41 * ---------+--------------------------------+--------------------------- |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
42 * | spill slot 0 | | negative ^ ^ |
10956 | 43 * : ... : v offsets | | |
10958
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
44 * | spill slot n | ----- total | |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
45 * +--------------------------------+ frame | |
10956 | 46 * current | alignment padding | size | |
47 * frame +--------------------------------+ ----- | | | |
10958
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
48 * | outgoing overflow argument n | ^ | frame |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
49 * : ... : | positive | size |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
50 * | outgoing overflow argument 0 | | offsets | | |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
51 * +--------------------------------+ | | | |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
52 * | return address | | | | |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
53 * +--------------------------------+ | | | |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
54 * | | | | | |
10956 | 55 * : callee save area : | | | |
10958
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
56 * | | | v v |
10956 | 57 * %sp--> +--------------------------------+--------------------------- |
58 * | |
59 * </pre> | |
60 * | |
61 * The spill slot area also includes stack allocated memory blocks (ALLOCA blocks). The size of such | |
62 * a block may be greater than the size of a normal spill slot or the word size. | |
63 * <p> | |
64 * A runtime can reserve space at the beginning of the overflow argument area. The calling | |
65 * convention can specify that the first overflow stack argument is not at offset 0, but at a | |
66 * specified offset. Use {@link CodeCacheProvider#getMinimumOutgoingSize()} to make sure that | |
67 * call-free methods also have this space reserved. Then the VM can use the memory at offset 0 | |
68 * relative to the stack pointer. | |
69 */ | |
70 public final class SPARCFrameMap extends FrameMap { | |
71 | |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
72 public SPARCFrameMap(CodeCacheProvider codeCache) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
73 super(codeCache); |
10958
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
74 // offset relative to sp + total frame size |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
75 initialSpillSize = 0; |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
76 spillSize = initialSpillSize; |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
77 } |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
78 |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
79 @Override |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
80 public int totalFrameSize() { |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
81 return frameSize(); |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
82 } |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
83 |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
84 @Override |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
85 public int currentFrameSize() { |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
86 return alignFrameSize(calleeSaveAreaSize() + returnAddressSize() + outgoingSize + spillSize); |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
87 } |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
88 |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
89 @Override |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
90 protected int alignFrameSize(int size) { |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
91 int x = size + (target.stackAlignment - 1); |
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
92 return (x / target.stackAlignment) * target.stackAlignment; |
10956 | 93 } |
94 | |
95 @Override | |
96 public int offsetToCalleeSaveArea() { | |
97 return 0; | |
98 } | |
99 | |
100 @Override | |
101 protected StackSlot allocateNewSpillSlot(PlatformKind kind, int additionalOffset) { | |
10958
e2c63a0b799c
moved move logic into architecture specific FrameMap
twisti
parents:
10956
diff
changeset
|
102 return StackSlot.get(kind, -spillSize + additionalOffset, true); |
10956 | 103 } |
104 } |