1.1 --- a/src/share/vm/shark/sharkBlock.cpp Mon Nov 26 17:25:11 2012 -0800 1.2 +++ b/src/share/vm/shark/sharkBlock.cpp Tue Nov 27 12:48:52 2012 -0800 1.3 @@ -170,10 +170,12 @@ 1.4 1.5 case Bytecodes::_ldc: 1.6 case Bytecodes::_ldc_w: 1.7 - case Bytecodes::_ldc2_w: 1.8 - push(SharkConstant::for_ldc(iter())->value(builder())); 1.9 + case Bytecodes::_ldc2_w: { 1.10 + SharkConstant* constant = SharkConstant::for_ldc(iter()); 1.11 + assert(constant->is_loaded(), "trap should handle unloaded classes"); 1.12 + push(constant->value(builder())); 1.13 break; 1.14 - 1.15 + } 1.16 case Bytecodes::_iload_0: 1.17 case Bytecodes::_lload_0: 1.18 case Bytecodes::_fload_0: 1.19 @@ -1000,9 +1002,9 @@ 1.20 builder()->SetInsertPoint(done); 1.21 PHINode *result; 1.22 if (is_long) 1.23 - result = builder()->CreatePHI(SharkType::jlong_type(), "result"); 1.24 + result = builder()->CreatePHI(SharkType::jlong_type(), 0, "result"); 1.25 else 1.26 - result = builder()->CreatePHI(SharkType::jint_type(), "result"); 1.27 + result = builder()->CreatePHI(SharkType::jint_type(), 0, "result"); 1.28 result->addIncoming(special_result, special_case); 1.29 result->addIncoming(general_result, general_case); 1.30 1.31 @@ -1036,12 +1038,12 @@ 1.32 value = constant->value(builder()); 1.33 } 1.34 if (!is_get || value == NULL) { 1.35 - if (!is_field) 1.36 - object = builder()->CreateInlineOop(field->holder()); 1.37 - 1.38 + if (!is_field) { 1.39 + object = builder()->CreateInlineOop(field->holder()->java_mirror()); 1.40 + } 1.41 BasicType basic_type = field->type()->basic_type(); 1.42 - const Type *stack_type = SharkType::to_stackType(basic_type); 1.43 - const Type *field_type = SharkType::to_arrayType(basic_type); 1.44 + Type *stack_type = SharkType::to_stackType(basic_type); 1.45 + Type *field_type = SharkType::to_arrayType(basic_type); 1.46 1.47 Value *addr = builder()->CreateAddressOfStructEntry( 1.48 object, in_ByteSize(field->offset_in_bytes()), 1.49 @@ -1050,8 +1052,12 @@ 1.50 1.51 // Do the access 1.52 if (is_get) { 1.53 - Value *field_value = builder()->CreateLoad(addr); 1.54 - 1.55 + Value* field_value; 1.56 + if (field->is_volatile()) { 1.57 + field_value = builder()->CreateAtomicLoad(addr); 1.58 + } else { 1.59 + field_value = builder()->CreateLoad(addr); 1.60 + } 1.61 if (field_type != stack_type) { 1.62 field_value = builder()->CreateIntCast( 1.63 field_value, stack_type, basic_type != T_CHAR); 1.64 @@ -1067,13 +1073,15 @@ 1.65 field_value, field_type, basic_type != T_CHAR); 1.66 } 1.67 1.68 - builder()->CreateStore(field_value, addr); 1.69 + if (field->is_volatile()) { 1.70 + builder()->CreateAtomicStore(field_value, addr); 1.71 + } else { 1.72 + builder()->CreateStore(field_value, addr); 1.73 + } 1.74 1.75 - if (!field->type()->is_primitive_type()) 1.76 + if (!field->type()->is_primitive_type()) { 1.77 builder()->CreateUpdateBarrierSet(oopDesc::bs(), addr); 1.78 - 1.79 - if (field->is_volatile()) 1.80 - builder()->CreateMemoryBarrier(SharkBuilder::BARRIER_STORELOAD); 1.81 + } 1.82 } 1.83 } 1.84 1.85 @@ -1105,7 +1113,7 @@ 1.86 builder()->CreateBr(done); 1.87 1.88 builder()->SetInsertPoint(done); 1.89 - PHINode *result = builder()->CreatePHI(SharkType::jint_type(), "result"); 1.90 + PHINode *result = builder()->CreatePHI(SharkType::jint_type(), 0, "result"); 1.91 result->addIncoming(LLVMValue::jint_constant(-1), lt); 1.92 result->addIncoming(LLVMValue::jint_constant(0), eq); 1.93 result->addIncoming(LLVMValue::jint_constant(1), gt); 1.94 @@ -1152,7 +1160,7 @@ 1.95 builder()->CreateBr(done); 1.96 1.97 builder()->SetInsertPoint(done); 1.98 - PHINode *result = builder()->CreatePHI(SharkType::jint_type(), "result"); 1.99 + PHINode *result = builder()->CreatePHI(SharkType::jint_type(), 0, "result"); 1.100 result->addIncoming(LLVMValue::jint_constant(-1), lt); 1.101 result->addIncoming(LLVMValue::jint_constant(0), eq); 1.102 result->addIncoming(LLVMValue::jint_constant(1), gt);