changeset 1907:d8dac70fb1fa

2009-06-19 Gary Benson <gbenson@redhat.com> * ports/hotspot/src/share/vm/shark/sharkConstant.cpp (SharkConstant::for_ldc): Set type for object constants. (SharkConstant::SharkConstant): Updated.
author Gary Benson <gbenson@redhat.com>
date Fri, 19 Jun 2009 08:48:56 -0400
parents 3d97a22bbdab
children b1923df0d722
files ChangeLog ports/hotspot/src/share/vm/shark/sharkConstant.cpp
diffstat 2 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jun 19 06:03:31 2009 -0400
+++ b/ChangeLog	Fri Jun 19 08:48:56 2009 -0400
@@ -1,3 +1,9 @@
+2009-06-19  Gary Benson  <gbenson@redhat.com>
+
+	* ports/hotspot/src/share/vm/shark/sharkConstant.cpp
+	(SharkConstant::for_ldc): Set type for object constants.
+	(SharkConstant::SharkConstant): Updated.
+
 2009-06-19  Gary Benson  <gbenson@redhat.com>
 
 	* ports/hotspot/src/share/vm/shark/sharkCompiler.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkConstant.cpp	Fri Jun 19 06:03:31 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkConstant.cpp	Fri Jun 19 08:48:56 2009 -0400
@@ -30,7 +30,16 @@
 
 SharkConstant* SharkConstant::for_ldc(ciBytecodeStream *iter)
 {
-  return new SharkConstant(iter->get_constant(), NULL);
+  ciConstant constant = iter->get_constant();
+  ciType *type = NULL;
+  if (constant.basic_type() == T_OBJECT) {
+    ciEnv *env = ciEnv::current();
+    if (constant.as_object()->is_klass())
+      type = env->Class_klass();
+    else
+      type = env->String_klass();
+  }
+  return new SharkConstant(constant, type);
 }
 
 SharkConstant* SharkConstant::for_field(ciBytecodeStream *iter)
@@ -97,6 +106,7 @@
   // have yet to be created.  We need to spot the unloaded
   // objects (which differ between ldc* and get*, thanks!)
   ciObject *object = constant.as_object();
+  assert(type != NULL, "shouldn't be");
   if (object->is_klass()) {
     // The constant returned for a klass is the ciKlass
     // for the entry, but we want the java_mirror.
@@ -114,7 +124,7 @@
 
   _value       = NULL;
   _object      = object;
-  _type        = type ? type : ciType::make(T_OBJECT);
+  _type        = type;
   _is_loaded   = true;
   _is_nonzero  = true;
   _is_two_word = false;