Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotVmSymbols.java @ 22487:a0e5714d5436
Remove Java implementation of HotSpotConstantPool Cache and ResolvedReferences and HotSpotSymbol.
author | twisti |
---|---|
date | Fri, 28 Aug 2015 12:42:06 -1000 |
parents | 179db500f6e5 |
children | d2035d841611 |
comparison
equal
deleted
inserted
replaced
22486:6292599feb75 | 22487:a0e5714d5436 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2014, 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. |
22 */ | 22 */ |
23 package jdk.internal.jvmci.hotspot; | 23 package jdk.internal.jvmci.hotspot; |
24 | 24 |
25 import static jdk.internal.jvmci.common.UnsafeAccess.*; | 25 import static jdk.internal.jvmci.common.UnsafeAccess.*; |
26 import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime.*; | 26 import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime.*; |
27 | |
28 import jdk.internal.jvmci.common.*; | |
29 import sun.misc.*; | 27 import sun.misc.*; |
30 | 28 |
31 /** | 29 /** |
32 * Class to access the C++ {@code vmSymbols} table. | 30 * Class to access the C++ {@code vmSymbols} table. |
33 */ | 31 */ |
43 public static String symbolAt(int index) { | 41 public static String symbolAt(int index) { |
44 HotSpotJVMCIRuntimeProvider runtime = runtime(); | 42 HotSpotJVMCIRuntimeProvider runtime = runtime(); |
45 HotSpotVMConfig config = runtime.getConfig(); | 43 HotSpotVMConfig config = runtime.getConfig(); |
46 assert config.vmSymbolsFirstSID <= index && index < config.vmSymbolsSIDLimit : "index " + index + " is out of bounds"; | 44 assert config.vmSymbolsFirstSID <= index && index < config.vmSymbolsSIDLimit : "index " + index + " is out of bounds"; |
47 assert config.symbolPointerSize == Unsafe.ADDRESS_SIZE : "the following address read is broken"; | 45 assert config.symbolPointerSize == Unsafe.ADDRESS_SIZE : "the following address read is broken"; |
48 final long metaspaceSymbol = unsafe.getAddress(config.vmSymbolsSymbols + index * config.symbolPointerSize); | 46 return runtime.getCompilerToVM().getSymbol(unsafe.getAddress(config.vmSymbolsSymbols + index * config.symbolPointerSize)); |
49 if (HotSpotConstantPool.Options.UseConstantPoolCacheJavaCode.getValue()) { | |
50 HotSpotSymbol symbol = new HotSpotSymbol(metaspaceSymbol); | |
51 String s = symbol.asString(); | |
52 // It shouldn't but just in case something went wrong... | |
53 if (s == null) { | |
54 throw JVMCIError.shouldNotReachHere("malformed UTF-8 string in constant pool"); | |
55 } | |
56 return s; | |
57 } else { | |
58 return runtime.getCompilerToVM().getSymbol(metaspaceSymbol); | |
59 } | |
60 } | 47 } |
61 } | 48 } |