src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2018, 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. |
661 } |
661 } |
662 return compilerToVM().constantPoolRemapInstructionOperandFromCache(this, index); |
662 return compilerToVM().constantPoolRemapInstructionOperandFromCache(this, index); |
663 } |
663 } |
664 |
664 |
665 @Override |
665 @Override |
|
666 public void loadReferencedType(int cpi, int opcode) { |
|
667 loadReferencedType(cpi, opcode, true /* initialize */); |
|
668 } |
|
669 |
666 @SuppressWarnings("fallthrough") |
670 @SuppressWarnings("fallthrough") |
667 public void loadReferencedType(int cpi, int opcode) { |
671 public void loadReferencedType(int cpi, int opcode, boolean initialize) { |
668 int index; |
672 int index; |
669 switch (opcode) { |
673 switch (opcode) { |
670 case Bytecodes.CHECKCAST: |
674 case Bytecodes.CHECKCAST: |
671 case Bytecodes.INSTANCEOF: |
675 case Bytecodes.INSTANCEOF: |
672 case Bytecodes.NEW: |
676 case Bytecodes.NEW: |
716 // fall through |
720 // fall through |
717 case Class: |
721 case Class: |
718 case UnresolvedClass: |
722 case UnresolvedClass: |
719 case UnresolvedClassInError: |
723 case UnresolvedClassInError: |
720 final HotSpotResolvedObjectTypeImpl type = compilerToVM().resolveTypeInPool(this, index); |
724 final HotSpotResolvedObjectTypeImpl type = compilerToVM().resolveTypeInPool(this, index); |
721 Class<?> klass = type.mirror(); |
725 if (initialize) { |
722 if (!klass.isPrimitive() && !klass.isArray()) { |
726 Class<?> klass = type.mirror(); |
723 UNSAFE.ensureClassInitialized(klass); |
727 if (!klass.isPrimitive() && !klass.isArray()) { |
|
728 UNSAFE.ensureClassInitialized(klass); |
|
729 } |
724 } |
730 } |
725 if (tag == JVM_CONSTANT.MethodRef) { |
731 if (tag == JVM_CONSTANT.MethodRef) { |
726 if (Bytecodes.isInvokeHandleAlias(opcode) && isSignaturePolymorphicHolder(type)) { |
732 if (Bytecodes.isInvokeHandleAlias(opcode) && isSignaturePolymorphicHolder(type)) { |
727 final int methodRefCacheIndex = rawIndexToConstantPoolCacheIndex(cpi, opcode); |
733 final int methodRefCacheIndex = rawIndexToConstantPoolCacheIndex(cpi, opcode); |
728 assert checkTag(compilerToVM().constantPoolRemapInstructionOperandFromCache(this, methodRefCacheIndex), JVM_CONSTANT.MethodRef); |
734 assert checkTag(compilerToVM().constantPoolRemapInstructionOperandFromCache(this, methodRefCacheIndex), JVM_CONSTANT.MethodRef); |