comparison graal/Compiler/src/com/sun/c1x/globalstub/GlobalStub.java @ 2507:9ec15d6914ca

Pull over of compiler from maxine repository.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 27 Apr 2011 11:43:22 +0200
parents
children
comparison
equal deleted inserted replaced
2506:4a3bf8a5bf41 2507:9ec15d6914ca
1 /*
2 * Copyright (c) 2009, 2010, 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.sun.c1x.globalstub;
24
25 import static com.sun.cri.ci.CiKind.*;
26
27 import com.sun.cri.ci.*;
28
29 /**
30 * A global stub is a shared routine that performs an operation on behalf of compiled code.
31 * Typically the routine is too large to inline, is infrequent, or requires runtime support.
32 * Global stubs are called with a callee-save convention; the global stub must save any
33 * registers it may destroy and then restore them upon return. This allows the register
34 * allocator to ignore calls to global stubs. Parameters to global stubs are
35 * passed on the stack in order to preserve registers for the rest of the code.
36 *
37 * @author Thomas Wuerthinger
38 * @author Ben L. Titzer
39 */
40 public class GlobalStub {
41
42 public enum Id {
43
44 fneg(Float, Float),
45 dneg(Double, Double),
46 f2i(Int, Float),
47 f2l(Long, Float),
48 d2i(Int, Double),
49 d2l(Long, Double);
50
51 public final CiKind resultKind;
52 public final CiKind[] arguments;
53
54 private Id(CiKind resultKind, CiKind... args) {
55 this.resultKind = resultKind;
56 this.arguments = args;
57 }
58 }
59
60 public final Id id;
61 public final CiKind resultKind;
62 public final Object stubObject;
63 public final int argsSize;
64 public final int[] argOffsets;
65 public final int resultOffset;
66
67 public GlobalStub(Id id, CiKind resultKind, Object stubObject, int argsSize, int[] argOffsets, int resultOffset) {
68 this.id = id;
69 this.resultKind = resultKind;
70 this.stubObject = stubObject;
71 this.argsSize = argsSize;
72 this.argOffsets = argOffsets;
73 this.resultOffset = resultOffset;
74 }
75
76 }