8202769: jck test fails with C2: vm/jvmti/FollowReferences/fref001/fref00113/fref00113.html
authorpsandoz
Mon, 02 Jul 2018 10:09:01 -0700
changeset 50971 34872a21af82
parent 50970 d30b4459b71b
child 50973 833a291460b7
8202769: jck test fails with C2: vm/jvmti/FollowReferences/fref001/fref00113/fref00113.html Reviewed-by: kvn, coleenp
src/hotspot/share/ci/ciStreams.cpp
src/hotspot/share/oops/constantPool.cpp
src/hotspot/share/oops/constantPool.hpp
--- a/src/hotspot/share/ci/ciStreams.cpp	Thu Jun 28 10:51:02 2018 -0700
+++ b/src/hotspot/share/ci/ciStreams.cpp	Mon Jul 02 10:09:01 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -255,8 +255,7 @@
 // constant.
 constantTag ciBytecodeStream::get_constant_pool_tag(int index) const {
   VM_ENTRY_MARK;
-  BasicType bt = _method->get_Method()->constants()->basic_type_for_constant_at(index);
-  return constantTag::ofBasicType(bt);
+  return _method->get_Method()->constants()->constant_tag_at(index);
 }
 
 // ------------------------------------------------------------------
--- a/src/hotspot/share/oops/constantPool.cpp	Thu Jun 28 10:51:02 2018 -0700
+++ b/src/hotspot/share/oops/constantPool.cpp	Mon Jul 02 10:09:01 2018 -0700
@@ -807,6 +807,17 @@
   }
 }
 
+constantTag ConstantPool::constant_tag_at(int which) {
+  constantTag tag = tag_at(which);
+  if (tag.is_dynamic_constant() ||
+      tag.is_dynamic_constant_in_error()) {
+    // have to look at the signature for this one
+    Symbol* constant_type = uncached_signature_ref_at(which);
+    return constantTag::ofBasicType(FieldType::basic_type(constant_type));
+  }
+  return tag;
+}
+
 BasicType ConstantPool::basic_type_for_constant_at(int which) {
   constantTag tag = tag_at(which);
   if (tag.is_dynamic_constant() ||
--- a/src/hotspot/share/oops/constantPool.hpp	Thu Jun 28 10:51:02 2018 -0700
+++ b/src/hotspot/share/oops/constantPool.hpp	Mon Jul 02 10:09:01 2018 -0700
@@ -719,6 +719,9 @@
   enum { _no_index_sentinel = -1, _possible_index_sentinel = -2 };
  public:
 
+  // Get the tag for a constant, which may involve a constant dynamic
+  constantTag constant_tag_at(int which);
+  // Get the basic type for a constant, which may involve a constant dynamic
   BasicType basic_type_for_constant_at(int which);
 
   // Resolve late bound constants.