Index: runtime/vm/stub_code_x64.cc |
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc |
index 322f0d82b456d059d9f9d3211b9060c463f6ff11..95874ca8b111a54cd24448d77a231aea04b7faa4 100644 |
--- a/runtime/vm/stub_code_x64.cc |
+++ b/runtime/vm/stub_code_x64.cc |
@@ -1034,21 +1034,23 @@ void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { |
// RDX: Address being stored |
Label reload; |
__ Bind(&reload); |
- __ movq(RAX, FieldAddress(RDX, Object::tags_offset())); |
- __ testq(RAX, Immediate(1 << RawObject::kRememberedBit)); |
+ __ movl(RAX, FieldAddress(RDX, Object::tags_offset())); |
+ __ testl(RAX, Immediate(1 << RawObject::kRememberedBit)); |
__ j(EQUAL, &add_to_buffer, Assembler::kNearJump); |
__ popq(RCX); |
__ popq(RAX); |
__ ret(); |
// Update the tags that this object has been remembered. |
+ // Note that we use 32 bit operations here to match the size of the |
+ // background sweeper which is also manipulating this 32 bit word. |
// RDX: Address being stored |
// RAX: Current tag value |
__ Bind(&add_to_buffer); |
- __ movq(RCX, RAX); |
- __ orq(RCX, Immediate(1 << RawObject::kRememberedBit)); |
+ __ movl(RCX, RAX); |
+ __ orl(RCX, Immediate(1 << RawObject::kRememberedBit)); |
// Compare the tag word with RAX, update to RCX if unchanged. |
- __ LockCmpxchgq(FieldAddress(RDX, Object::tags_offset()), RCX); |
+ __ LockCmpxchgl(FieldAddress(RDX, Object::tags_offset()), RCX); |
__ j(NOT_EQUAL, &reload); |
// Load the StoreBuffer block out of the thread. Then load top_ out of the |
@@ -1132,10 +1134,11 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler, |
// RBX: next object start. |
// RDX: new object type arguments (if is_cls_parameterized). |
// Set the tags. |
- uword tags = 0; |
+ uint32_t tags = 0; |
tags = RawObject::SizeTag::update(instance_size, tags); |
ASSERT(cls.id() != kIllegalCid); |
tags = RawObject::ClassIdTag::update(cls.id(), tags); |
+ // 64 bit store also zeros the identity hash field. |
__ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); |
__ addq(RAX, Immediate(kHeapObjectTag)); |