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 jdk.vm.ci.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 105 * {@linkplain #executeVarargs(Object...) invocation} will throw an 106 * {@link InvalidInstalledCodeException}. 107 */ 108 public void invalidate() { 109 throw new UnsupportedOperationException(); 110 } 111 112 /** 113 * Executes the installed code with a variable number of arguments. 114 * 115 * @param args the array of object arguments 116 * @return the value returned by the executed code 117 */ 118 @SuppressWarnings("unused") 119 public Object executeVarargs(Object... args) throws InvalidInstalledCodeException { 120 throw new UnsupportedOperationException(); 121 } 122 } | 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 jdk.vm.ci.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 address of entity representing this installed code. 33 */ 34 protected long address; 35 36 /** 37 * Raw address of entryPoint of this installed code. 38 */ 39 protected long entryPoint; 40 41 /** 42 * Counts how often the address field was reassigned. 43 */ 44 protected long version; 45 46 protected final String name; 47 48 public InstalledCode(String name) { 49 this.name = name; 50 } 51 52 /** 53 * @return the address of entity representing this installed code. 54 */ 55 public final long getAddress() { 56 return address; 57 } 58 59 /** 60 * @return the address of the normal entry point of the installed code. 61 */ 62 public final long getEntryPoint() { 63 return entryPoint; 64 } 65 66 /** 67 * @return the version number of this installed code 68 */ 69 public final long getVersion() { 70 return version; 71 } 72 73 /** 74 * Returns the name of this installed code. 75 */ 76 public String getName() { 77 return name; 78 } 79 80 /** 81 * Returns the start address of this installed code if it is {@linkplain #isValid() valid}, 0 82 * otherwise. 83 */ 84 public long getStart() { 85 return 0; 86 } 87 88 /** 89 * @return true if the code represented by this object is still valid for invocation, false 90 * otherwise (may happen due to deopt, etc.) 91 */ 92 public boolean isValid() { 93 return entryPoint != 0; 94 } 95 96 /** 97 * @return true if the code represented by this object still exists and might have live 98 * activations, false otherwise (may happen due to deopt, etc.) 99 */ 100 public boolean isAlive() { 101 return address != 0; 102 } 103 104 /** 105 * Returns a copy of this installed code if it is {@linkplain #isValid() valid}, null otherwise. 106 */ 107 public byte[] getCode() { 108 return null; 109 } 110 111 /** 112 * Invalidates this installed code such that any subsequent 113 * {@linkplain #executeVarargs(Object...) invocation} will throw an 114 * {@link InvalidInstalledCodeException} and all existing invocations will be deoptimized. 115 */ 116 public void invalidate() { 117 throw new UnsupportedOperationException(); 118 } 119 120 /** 121 * Executes the installed code with a variable number of arguments. 122 * 123 * @param args the array of object arguments 124 * @return the value returned by the executed code 125 */ 126 @SuppressWarnings("unused") 127 public Object executeVarargs(Object... args) throws InvalidInstalledCodeException { 128 throw new UnsupportedOperationException(); 129 } 130 } |