Revision: 19772
Author: [email protected]
Date: Mon Mar 10 18:47:57 2014 UTC
Log: Special case the recording of constant pool entries in the slot
buffer.
This CL enables RelocInfo pointers which live in the constant pool to be
treated
as normal pointers by the slot buffer, avoiding the requirement of creating
fake
RelocInfo objects during UpdateSlots() in order to update these slots. This
is possible because constant pool entries are just pointers and don't
require
the RelocInfo machinary to be updated.
EmbeddedObject constant pool entries can be added untyped to the slot
buffer,
while code targets are still typed in order to correctly update the target
address based on the relocated code object.
Note: this is required in order to enable OOL constant pool support on Arm,
but
should be benifitial for the current inline constant pool used by Arm code.
[email protected]
Review URL: https://codereview.chromium.org/179813005
http://code.google.com/p/v8/source/detail?r=19772
Modified:
/branches/bleeding_edge/src/a64/assembler-a64-inl.h
/branches/bleeding_edge/src/a64/assembler-a64.cc
/branches/bleeding_edge/src/arm/assembler-arm-inl.h
/branches/bleeding_edge/src/arm/assembler-arm.cc
/branches/bleeding_edge/src/assembler.h
/branches/bleeding_edge/src/ia32/assembler-ia32-inl.h
/branches/bleeding_edge/src/ia32/assembler-ia32.cc
/branches/bleeding_edge/src/mark-compact.cc
/branches/bleeding_edge/src/mips/assembler-mips-inl.h
/branches/bleeding_edge/src/mips/assembler-mips.cc
/branches/bleeding_edge/src/x64/assembler-x64-inl.h
/branches/bleeding_edge/src/x64/assembler-x64.cc
=======================================
--- /branches/bleeding_edge/src/a64/assembler-a64-inl.h Mon Mar 10 16:25:15
2014 UTC
+++ /branches/bleeding_edge/src/a64/assembler-a64-inl.h Mon Mar 10 18:47:57
2014 UTC
@@ -651,6 +651,12 @@
|| rmode_ == EXTERNAL_REFERENCE);
return Assembler::target_pointer_address_at(pc_);
}
+
+
+Address RelocInfo::constant_pool_entry_address() {
+ ASSERT(IsInConstantPool());
+ return Assembler::target_pointer_address_at(pc_);
+}
Object* RelocInfo::target_object() {
=======================================
--- /branches/bleeding_edge/src/a64/assembler-a64.cc Tue Mar 4 15:54:12
2014 UTC
+++ /branches/bleeding_edge/src/a64/assembler-a64.cc Mon Mar 10 18:47:57
2014 UTC
@@ -158,6 +158,12 @@
// generate those for relocatable pointers.
return false;
}
+
+
+bool RelocInfo::IsInConstantPool() {
+ Instruction* instr = reinterpret_cast<Instruction*>(pc_);
+ return instr->IsLdrLiteralX();
+}
void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm-inl.h Mon Nov 25 14:07:05
2013 UTC
+++ /branches/bleeding_edge/src/arm/assembler-arm-inl.h Mon Mar 10 18:47:57
2014 UTC
@@ -111,6 +111,13 @@
|| rmode_ == EXTERNAL_REFERENCE);
return Assembler::target_pointer_address_at(pc_);
}
+
+
+Address RelocInfo::constant_pool_entry_address() {
+ ASSERT(IsInConstantPool());
+ ASSERT(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(pc_)));
+ return Assembler::target_pointer_address_at(pc_);
+}
int RelocInfo::target_address_size() {
=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm.cc Mon Dec 30 11:23:59
2013 UTC
+++ /branches/bleeding_edge/src/arm/assembler-arm.cc Mon Mar 10 18:47:57
2014 UTC
@@ -298,6 +298,11 @@
// generate those yet.
return false;
}
+
+
+bool RelocInfo::IsInConstantPool() {
+ return Assembler::IsLdrPcImmediateOffset(Memory::int32_at(pc_));
+}
void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
=======================================
--- /branches/bleeding_edge/src/assembler.h Mon Mar 10 10:39:17 2014 UTC
+++ /branches/bleeding_edge/src/assembler.h Mon Mar 10 18:47:57 2014 UTC
@@ -384,6 +384,10 @@
// instructions).
bool IsCodedSpecially();
+ // If true, the pointer this relocation info refers to is an entry in the
+ // constant pool, otherwise the pointer is embedded in the instruction
stream.
+ bool IsInConstantPool();
+
// Read/modify the code target in the branch/call instruction
// this relocation applies to;
// can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)
@@ -406,6 +410,10 @@
INLINE(Code* code_age_stub());
INLINE(void set_code_age_stub(Code* stub));
+ // Returns the address of the constant pool entry where the target
address
+ // is held. This should only be called if IsInConstantPool returns true.
+ INLINE(Address constant_pool_entry_address());
+
// Read the address of the word containing the target_address in an
// instruction stream. What this means exactly is
architecture-independent.
// The only architecture-independent user of this function is the
serializer.
@@ -413,6 +421,7 @@
// output before the next target. Architecture-independent code
shouldn't
// dereference the pointer it gets back from this.
INLINE(Address target_address_address());
+
// This indicates how much space a target takes up when deserializing a
code
// stream. For most architectures this is just the size of a pointer.
For
// an instruction like movw/movt where the target bits are mixed into the
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32-inl.h Tue Nov 5
10:14:48 2013 UTC
+++ /branches/bleeding_edge/src/ia32/assembler-ia32-inl.h Mon Mar 10
18:47:57 2014 UTC
@@ -95,6 +95,12 @@
|| rmode_ == EXTERNAL_REFERENCE);
return reinterpret_cast<Address>(pc_);
}
+
+
+Address RelocInfo::constant_pool_entry_address() {
+ UNREACHABLE();
+ return NULL;
+}
int RelocInfo::target_address_size() {
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.cc Wed Feb 19 13:51:49
2014 UTC
+++ /branches/bleeding_edge/src/ia32/assembler-ia32.cc Mon Mar 10 18:47:57
2014 UTC
@@ -158,6 +158,11 @@
// code object moves.
return (1 << rmode_) & kApplyMask;
}
+
+
+bool RelocInfo::IsInConstantPool() {
+ return false;
+}
void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Wed Mar 5 14:04:21 2014 UTC
+++ /branches/bleeding_edge/src/mark-compact.cc Mon Mar 10 18:47:57 2014 UTC
@@ -4370,14 +4370,33 @@
void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Object*
target) {
Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
+ RelocInfo::Mode rmode = rinfo->rmode();
if (target_page->IsEvacuationCandidate() &&
(rinfo->host() == NULL ||
!ShouldSkipEvacuationSlotRecording(rinfo->host()))) {
- if (!SlotsBuffer::AddTo(&slots_buffer_allocator_,
- target_page->slots_buffer_address(),
- SlotTypeForRMode(rinfo->rmode()),
- rinfo->pc(),
- SlotsBuffer::FAIL_ON_OVERFLOW)) {
+ bool success;
+ if (RelocInfo::IsEmbeddedObject(rmode) && rinfo->IsInConstantPool()) {
+ // This doesn't need to be typed since it is just a normal heap
pointer.
+ Object** target_pointer =
+ reinterpret_cast<Object**>(rinfo->constant_pool_entry_address());
+ success = SlotsBuffer::AddTo(&slots_buffer_allocator_,
+ target_page->slots_buffer_address(),
+ target_pointer,
+ SlotsBuffer::FAIL_ON_OVERFLOW);
+ } else if (RelocInfo::IsCodeTarget(rmode) &&
rinfo->IsInConstantPool()) {
+ success = SlotsBuffer::AddTo(&slots_buffer_allocator_,
+ target_page->slots_buffer_address(),
+ SlotsBuffer::CODE_ENTRY_SLOT,
+ rinfo->constant_pool_entry_address(),
+ SlotsBuffer::FAIL_ON_OVERFLOW);
+ } else {
+ success = SlotsBuffer::AddTo(&slots_buffer_allocator_,
+ target_page->slots_buffer_address(),
+ SlotTypeForRMode(rmode),
+ rinfo->pc(),
+ SlotsBuffer::FAIL_ON_OVERFLOW);
+ }
+ if (!success) {
EvictEvacuationCandidate(target_page);
}
}
=======================================
--- /branches/bleeding_edge/src/mips/assembler-mips-inl.h Fri Nov 22
18:13:52 2013 UTC
+++ /branches/bleeding_edge/src/mips/assembler-mips-inl.h Mon Mar 10
18:47:57 2014 UTC
@@ -154,6 +154,12 @@
return reinterpret_cast<Address>(
pc_ + Assembler::kInstructionsFor32BitConstant *
Assembler::kInstrSize);
}
+
+
+Address RelocInfo::constant_pool_entry_address() {
+ UNREACHABLE();
+ return NULL;
+}
int RelocInfo::target_address_size() {
=======================================
--- /branches/bleeding_edge/src/mips/assembler-mips.cc Thu Feb 20 21:03:26
2014 UTC
+++ /branches/bleeding_edge/src/mips/assembler-mips.cc Mon Mar 10 18:47:57
2014 UTC
@@ -211,6 +211,11 @@
// always the case inside code objects.
return true;
}
+
+
+bool RelocInfo::IsInConstantPool() {
+ return false;
+}
// Patch the code at the current address with the supplied instructions.
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64-inl.h Tue Nov 5 10:14:48
2013 UTC
+++ /branches/bleeding_edge/src/x64/assembler-x64-inl.h Mon Mar 10 18:47:57
2014 UTC
@@ -265,6 +265,12 @@
|| rmode_ == EXTERNAL_REFERENCE);
return reinterpret_cast<Address>(pc_);
}
+
+
+Address RelocInfo::constant_pool_entry_address() {
+ UNREACHABLE();
+ return NULL;
+}
int RelocInfo::target_address_size() {
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.cc Mon Mar 10 10:39:17
2014 UTC
+++ /branches/bleeding_edge/src/x64/assembler-x64.cc Mon Mar 10 18:47:57
2014 UTC
@@ -3211,6 +3211,12 @@
// by branch instructions.
return (1 << rmode_) & kApplyMask;
}
+
+
+bool RelocInfo::IsInConstantPool() {
+ return false;
+}
+
} } // namespace v8::internal
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.