diff src/share/vm/shark/sharkBlock.cpp @ 7643:3ac7d10a6572

Merge with hsx25/hotspot.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 31 Jan 2013 15:42:25 +0100
parents 606eada1bf86
children de6a9e811145
line wrap: on
line diff
--- a/src/share/vm/shark/sharkBlock.cpp	Thu Jan 31 11:32:14 2013 +0100
+++ b/src/share/vm/shark/sharkBlock.cpp	Thu Jan 31 15:42:25 2013 +0100
@@ -1032,7 +1032,7 @@
     check_null(value);
     object = value->generic_value();
   }
-  if (is_get && field->is_constant()) {
+  if (is_get && field->is_constant() && field->is_static()) {
     SharkConstant *constant = SharkConstant::for_field(iter());
     if (constant->is_loaded())
       value = constant->value(builder());
@@ -1044,10 +1044,17 @@
     BasicType   basic_type = field->type()->basic_type();
     Type *stack_type = SharkType::to_stackType(basic_type);
     Type *field_type = SharkType::to_arrayType(basic_type);
-
+    Type *type = field_type;
+    if (field->is_volatile()) {
+      if (field_type == SharkType::jfloat_type()) {
+        type = SharkType::jint_type();
+      } else if (field_type == SharkType::jdouble_type()) {
+        type = SharkType::jlong_type();
+      }
+    }
     Value *addr = builder()->CreateAddressOfStructEntry(
       object, in_ByteSize(field->offset_in_bytes()),
-      PointerType::getUnqual(field_type),
+      PointerType::getUnqual(type),
       "addr");
 
     // Do the access
@@ -1055,6 +1062,7 @@
       Value* field_value;
       if (field->is_volatile()) {
         field_value = builder()->CreateAtomicLoad(addr);
+        field_value = builder()->CreateBitCast(field_value, field_type);
       } else {
         field_value = builder()->CreateLoad(addr);
       }
@@ -1074,6 +1082,7 @@
       }
 
       if (field->is_volatile()) {
+        field_value = builder()->CreateBitCast(field_value, type);
         builder()->CreateAtomicStore(field_value, addr);
       } else {
         builder()->CreateStore(field_value, addr);