Index: runtime/vm/stub_code_x64.cc |
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc |
index cbda5c38f6fd8a561f22b4a9a48b5dab92efa4ec..c032e673491c6be052f1aea438e6fa6429d146d6 100644 |
--- a/runtime/vm/stub_code_x64.cc |
+++ b/runtime/vm/stub_code_x64.cc |
@@ -1033,21 +1033,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 |
@@ -1131,10 +1133,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)); |