Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Unified Diff: runtime/vm/assembler.h

Issue 1147303002: Support untagged object pool entries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rebased Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/assembler.h
diff --git a/runtime/vm/assembler.h b/runtime/vm/assembler.h
index d8249ba4377fb4dc2645bd26d8c37a9ecfc8dde5..33f405108bebdc18eba33b3db24a4b110ad1605f 100644
--- a/runtime/vm/assembler.h
+++ b/runtime/vm/assembler.h
@@ -49,7 +49,9 @@ class ExternalLabel : public ValueObject {
// into executable memory.
class AssemblerFixup : public ZoneAllocated {
public:
- virtual void Process(const MemoryRegion& region, intptr_t position) = 0;
+ virtual void Process(const MemoryRegion& region,
+ intptr_t position,
+ Assembler* assembler) = 0;
virtual bool IsPointerOffset() const = 0;
@@ -74,7 +76,7 @@ class AssemblerFixup : public ZoneAllocated {
// Assembler buffers are used to emit binary code. They grow on demand.
class AssemblerBuffer : public ValueObject {
public:
- AssemblerBuffer();
+ explicit AssemblerBuffer(Assembler* assembler);
~AssemblerBuffer();
// Basic support for emitting, loading, and storing.
@@ -180,6 +182,7 @@ class AssemblerBuffer : public ValueObject {
uword cursor_;
uword limit_;
AssemblerFixup* fixup_;
+ Assembler* assembler_;
ZoneGrowableArray<intptr_t>* pointer_offsets_;
#if defined(DEBUG)
bool fixups_processed_;
@@ -258,36 +261,86 @@ class ObjIndexPair {
};
+class UntaggedIndexPair {
+ public:
+ // Typedefs needed for the DirectChainedHashMap template.
+ typedef uword Key;
+ typedef intptr_t Value;
+ typedef UntaggedIndexPair Pair;
+
+ static const intptr_t kNoIndex = -1;
+
+ UntaggedIndexPair() : key_(), value_(kNoIndex) { }
+
+ UntaggedIndexPair(Key key, Value value) : key_(key), value_(value) { }
+
+ static Key KeyOf(Pair kv) { return kv.key_; }
+
+ static Value ValueOf(Pair kv) { return kv.value_; }
+
+ static intptr_t Hashcode(Key key) {
+ return static_cast<intptr_t>(key);
+ }
+
+ static inline bool IsKeyEqual(Pair kv, Key key) {
+ return kv.key_ == key;
+ }
+
+ private:
+ Key key_;
+ Value value_;
+};
+
+
enum Patchability {
kPatchable,
kNotPatchable,
};
-class ObjectPool : public ValueObject {
+class ObjectPoolHelper : public ValueObject {
public:
- ObjectPool() : object_pool_(GrowableObjectArray::Handle()) { }
-
- intptr_t AddObject(const Object& obj, Patchability patchable);
+ intptr_t AddObject(const Object& obj);
+ intptr_t AddImmediate(uword imm);
intptr_t AddExternalLabel(const ExternalLabel* label,
Patchability patchable);
- intptr_t FindObject(const Object& obj, Patchability patchable);
+ intptr_t AddFixedObject(const Object& obj);
+ intptr_t AddFixedExternalLabel(const ExternalLabel* label);
+
+ intptr_t FindObject(const Object& obj);
+ intptr_t FindImmediate(uword imm);
intptr_t FindExternalLabel(const ExternalLabel* label,
Patchability patchable);
- const GrowableObjectArray& data() const { return object_pool_; }
+
+ RawObjectPool* MakeObjectPool();
+
+ intptr_t UntaggedEntryStart() { return tagged_entries_.length(); }
private:
- // Objects and jump targets.
- GrowableObjectArray& object_pool_;
+ intptr_t AddUntagged(uword value, Patchability patchable);
+ intptr_t FindUntagged(uword value, Patchability patchable);
+
+ GrowableArray<ObjectPool::Entry> fixed_entries_;
+
+ GrowableArray<const Object*> tagged_entries_;
+ DirectChainedHashMap<ObjIndexPair> object_index_table_;
+
+ GrowableArray<uword> untagged_entries_;
+ DirectChainedHashMap<UntaggedIndexPair> untagged_index_table_;
+};
+
- // Patchability of pool entries.
- GrowableArray<Patchability> patchable_pool_entries_;
+class ObjectPoolIndexFixup : public AssemblerFixup {
+ public:
+ virtual void Process(const MemoryRegion& region,
+ intptr_t position,
+ Assembler* assembler);
- // Hashmap for fast lookup in object pool.
- DirectChainedHashMap<ObjIndexPair> object_pool_index_table_;
+ virtual bool IsPointerOffset() const { return false; }
};
+
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698