Mercurial > hg > truffle
comparison graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InstalledCode.java @ 21556:48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 27 May 2015 00:36:16 +0200 |
parents | graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java@c9744d2095e0 |
children |
comparison
equal
deleted
inserted
replaced
21555:d12eaef9af72 | 21556:48c1ebd24120 |
---|---|
1 /* | |
2 * Copyright (c) 2011, 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.jvmci.code; | |
24 | |
25 /** | |
26 * Represents a compiled instance of a method. It may have been invalidated or removed in the | |
27 * meantime. | |
28 */ | |
29 public class InstalledCode { | |
30 | |
31 /** | |
32 * Raw address of this code blob. | |
33 */ | |
34 private long address; | |
35 | |
36 /** | |
37 * Counts how often the address field was reassigned. | |
38 */ | |
39 private long version; | |
40 | |
41 protected final String name; | |
42 | |
43 public InstalledCode(String name) { | |
44 this.name = name; | |
45 } | |
46 | |
47 public final void setAddress(long address) { | |
48 this.address = address; | |
49 version++; | |
50 } | |
51 | |
52 /** | |
53 * @return the address of this code blob | |
54 */ | |
55 public final long getAddress() { | |
56 return address; | |
57 } | |
58 | |
59 /** | |
60 * @return the address of this code blob | |
61 */ | |
62 public final long getVersion() { | |
63 return version; | |
64 } | |
65 | |
66 /** | |
67 * Returns the name of this code blob. | |
68 */ | |
69 public String getName() { | |
70 return name; | |
71 } | |
72 | |
73 /** | |
74 * Returns the start address of this installed code if it is {@linkplain #isValid() valid}, 0 | |
75 * otherwise. | |
76 */ | |
77 public long getStart() { | |
78 return 0; | |
79 } | |
80 | |
81 /** | |
82 * Returns the number of instruction bytes for this code. | |
83 */ | |
84 public long getCodeSize() { | |
85 return 0; | |
86 } | |
87 | |
88 /** | |
89 * Returns a copy of this installed code if it is {@linkplain #isValid() valid}, null otherwise. | |
90 */ | |
91 public byte[] getCode() { | |
92 return null; | |
93 } | |
94 | |
95 /** | |
96 * @return true if the code represented by this object is still valid, false otherwise (may | |
97 * happen due to deopt, etc.) | |
98 */ | |
99 public boolean isValid() { | |
100 return address != 0; | |
101 } | |
102 | |
103 /** | |
104 * Invalidates this installed code such that any subsequent invocation will throw an | |
105 * {@link InvalidInstalledCodeException}. | |
106 */ | |
107 public void invalidate() { | |
108 throw new UnsupportedOperationException(); | |
109 } | |
110 | |
111 /** | |
112 * Executes the installed code with a variable number of arguments. | |
113 * | |
114 * @param args the array of object arguments | |
115 * @return the value returned by the executed code | |
116 */ | |
117 @SuppressWarnings("unused") | |
118 public Object executeVarargs(Object... args) throws InvalidInstalledCodeException { | |
119 throw new UnsupportedOperationException(); | |
120 } | |
121 } |