< prev index next >

src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 80,110 **** private static long readRawValue(Constant baseConstant, long displacement, int bits) { Object base = asObject(baseConstant); if (base != null) { switch (bits) { ! case 8: return UNSAFE.getByte(base, displacement); ! case 16: return UNSAFE.getShort(base, displacement); ! case 32: return UNSAFE.getInt(base, displacement); ! case 64: return UNSAFE.getLong(base, displacement); default: throw new JVMCIError("%d", bits); } } else { long pointer = asRawPointer(baseConstant); switch (bits) { ! case 8: return UNSAFE.getByte(pointer + displacement); ! case 16: return UNSAFE.getShort(pointer + displacement); ! case 32: return UNSAFE.getInt(pointer + displacement); ! case 64: return UNSAFE.getLong(pointer + displacement); default: throw new JVMCIError("%d", bits); } } --- 80,110 ---- private static long readRawValue(Constant baseConstant, long displacement, int bits) { Object base = asObject(baseConstant); if (base != null) { switch (bits) { ! case Byte.SIZE: return UNSAFE.getByte(base, displacement); ! case Short.SIZE: return UNSAFE.getShort(base, displacement); ! case Integer.SIZE: return UNSAFE.getInt(base, displacement); ! case Long.SIZE: return UNSAFE.getLong(base, displacement); default: throw new JVMCIError("%d", bits); } } else { long pointer = asRawPointer(baseConstant); switch (bits) { ! case Byte.SIZE: return UNSAFE.getByte(pointer + displacement); ! case Short.SIZE: return UNSAFE.getShort(pointer + displacement); ! case Integer.SIZE: return UNSAFE.getInt(pointer + displacement); ! case Long.SIZE: return UNSAFE.getLong(pointer + displacement); default: throw new JVMCIError("%d", bits); } }
*** 149,159 **** public JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant baseConstant, long displacement) { if (kind == JavaKind.Object) { Object o = readRawObject(baseConstant, displacement, runtime.getConfig().useCompressedOops); return HotSpotObjectConstantImpl.forObject(o); } else { ! return readPrimitiveConstant(kind, baseConstant, displacement, kind.getByteCount() * 8); } } @Override public JavaConstant readPrimitiveConstant(JavaKind kind, Constant baseConstant, long initialDisplacement, int bits) { --- 149,160 ---- public JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant baseConstant, long displacement) { if (kind == JavaKind.Object) { Object o = readRawObject(baseConstant, displacement, runtime.getConfig().useCompressedOops); return HotSpotObjectConstantImpl.forObject(o); } else { ! int bits = kind.getByteCount() * Byte.SIZE; ! return readPrimitiveConstant(kind, baseConstant, displacement, bits); } } @Override public JavaConstant readPrimitiveConstant(JavaKind kind, Constant baseConstant, long initialDisplacement, int bits) {
*** 227,232 **** --- 228,245 ---- assert (base instanceof HotSpotObjectConstantImpl); Object baseObject = ((HotSpotObjectConstantImpl) base).object(); HotSpotResolvedJavaMethodImpl method = runtime.getCompilerToVM().getResolvedJavaMethod(baseObject, displacement); return HotSpotMetaspaceConstantImpl.forMetaspaceObject(method, false); } + + @Override + public Constant readSymbolConstant(Constant base, long displacement) { + int bits = runtime.getConfig().symbolPointerSize * Byte.SIZE; + long pointer = readRawValue(base, displacement, bits); + if (pointer == 0) { + return JavaConstant.NULL_POINTER; + } else { + String symbol = runtime.getCompilerToVM().getSymbol(pointer); + return new HotSpotSymbol(symbol, pointer).asConstant(); + } + } }
< prev index next >