Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSymbol.java @ 23336:90da61843aa4
Backout removal of HotSpotVMSymbols class.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Fri, 25 Mar 2016 12:40:19 +0100 |
parents | f8178417d018 |
children |
comparison
equal
deleted
inserted
replaced
23335:a2a044987816 | 23336:90da61843aa4 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package jdk.vm.ci.hotspot; | 23 package jdk.vm.ci.hotspot; |
24 | 24 |
25 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; | |
26 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; | |
27 | |
28 import jdk.vm.ci.meta.Constant; | 25 import jdk.vm.ci.meta.Constant; |
29 import sun.misc.Unsafe; | |
30 | 26 |
31 /** | 27 /** |
32 * Class to access the C++ {@code vmSymbols} table. | 28 * Class to access the C++ {@code vmSymbols} table. |
33 */ | 29 */ |
34 public final class HotSpotSymbol implements MetaspaceWrapperObject { | 30 public final class HotSpotSymbol implements MetaspaceWrapperObject { |
56 | 52 |
57 @Override | 53 @Override |
58 public String toString() { | 54 public String toString() { |
59 return "Symbol<" + symbol + ">"; | 55 return "Symbol<" + symbol + ">"; |
60 } | 56 } |
61 | |
62 /** | |
63 * Returns the symbol in the {@code vmSymbols} table at position {@code index} as {@link String} | |
64 * . | |
65 * | |
66 * @param index position in the symbol table | |
67 * @return the symbol at position id | |
68 */ | |
69 static String symbolAt(int index) { | |
70 HotSpotJVMCIRuntimeProvider runtime = runtime(); | |
71 HotSpotVMConfig config = runtime.getConfig(); | |
72 assert config.vmSymbolsFirstSID <= index && index < config.vmSymbolsSIDLimit : "index " + index + " is out of bounds"; | |
73 assert config.symbolPointerSize == Unsafe.ADDRESS_SIZE : "the following address read is broken"; | |
74 return runtime.getCompilerToVM().getSymbol(UNSAFE.getAddress(config.vmSymbolsSymbols + index * config.symbolPointerSize)); | |
75 } | |
76 } | 57 } |