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

Unified Diff: runtime/vm/raw_object.h

Issue 2326483005: Shrink AOT snapshot size and memory usage. (Closed)
Patch Set: . Created 4 years, 3 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/raw_object.h
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index e249fdede7a89374b786a7bd893b409042746bd9..1e4f042131a08da8a92a13b7d4ae77efa55bbd21 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -832,6 +832,8 @@ class RawFunction : public RawObject {
static bool ShouldVisitCode(RawCode* raw_code);
static bool CheckUsageCounter(RawFunction* raw_fun);
+ uword entry_point_; // Accessed from generated code.
+
RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
RawString* name_;
RawObject* owner_; // Class or patch class or mixin class
@@ -847,23 +849,28 @@ class RawFunction : public RawObject {
RawObject** to_no_code() {
return reinterpret_cast<RawObject**>(&ptr()->ic_data_array_);
}
- RawCode* code_; // Currently active code.
- RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization.
+ RawCode* code_; // Currently active code. Accessed from generated code.
+ NOT_IN_PRECOMPILED(RawCode* unoptimized_code_); // Unoptimized code, keep it
+ // after optimization.
RawObject** to() {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return reinterpret_cast<RawObject**>(&ptr()->code_);
+#else
return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_);
+#endif
}
- uword entry_point_;
- TokenPosition token_pos_;
- TokenPosition end_token_pos_;
- int32_t usage_counter_; // Incremented while function is running.
+ NOT_IN_PRECOMPILED(TokenPosition token_pos_);
+ NOT_IN_PRECOMPILED(TokenPosition end_token_pos_);
+ NOT_IN_PRECOMPILED(int32_t usage_counter_); // Accessed from generated code
+ // (JIT only).
+ uint32_t kind_tag_; // See Function::KindTagBits.
int16_t num_fixed_parameters_;
int16_t num_optional_parameters_; // > 0: positional; < 0: named.
- int8_t deoptimization_counter_;
- int8_t was_compiled_;
- uint32_t kind_tag_; // See Function::KindTagBits.
- uint16_t optimized_instruction_count_;
- uint16_t optimized_call_site_count_;
+ NOT_IN_PRECOMPILED(uint16_t optimized_instruction_count_);
+ NOT_IN_PRECOMPILED(uint16_t optimized_call_site_count_);
+ NOT_IN_PRECOMPILED(int8_t deoptimization_counter_);
+ NOT_IN_PRECOMPILED(int8_t was_compiled_);
};
@@ -1113,15 +1120,14 @@ class RawCode : public RawObject {
RAW_HEAP_OBJECT_IMPLEMENTATION(Code);
- uword entry_point_;
- uword checked_entry_point_;
+ uword entry_point_; // Accessed from generated code.
+ uword checked_entry_point_; // Accessed from generated code (AOT only).
RawObject** from() {
- return reinterpret_cast<RawObject**>(&ptr()->active_instructions_);
+ return reinterpret_cast<RawObject**>(&ptr()->object_pool_);
}
- RawInstructions* active_instructions_;
- RawInstructions* instructions_;
- RawObjectPool* object_pool_;
+ RawObjectPool* object_pool_; // Accessed from generated code.
+ RawInstructions* instructions_; // Accessed from generated code.
// If owner_ is Function::null() the owner is a regular stub.
// If owner_ is a Class the owner is the allocation stub for that class.
// Else, owner_ is a regular Dart Function.
@@ -1129,21 +1135,27 @@ class RawCode : public RawObject {
RawExceptionHandlers* exception_handlers_;
RawPcDescriptors* pc_descriptors_;
RawArray* stackmaps_;
- RawArray* deopt_info_array_;
- RawArray* static_calls_target_table_; // (code-offset, function, code).
- RawLocalVarDescriptors* var_descriptors_;
- RawArray* inlined_metadata_;
- RawCodeSourceMap* code_source_map_;
- RawArray* comments_;
+ NOT_IN_PRECOMPILED(RawInstructions* active_instructions_);
+ NOT_IN_PRECOMPILED(RawArray* deopt_info_array_);
+ // (code-offset, function, code) triples.
+ NOT_IN_PRECOMPILED(RawArray* static_calls_target_table_);
+ NOT_IN_PRECOMPILED(RawLocalVarDescriptors* var_descriptors_);
+ NOT_IN_PRECOMPILED(RawArray* inlined_metadata_);
+ NOT_IN_PRECOMPILED(RawCodeSourceMap* code_source_map_);
+ NOT_IN_PRECOMPILED(RawArray* comments_);
// If return_address_metadata_ is a Smi, it is the offset to the prologue.
// Else, return_address_metadata_ is null.
- RawObject* return_address_metadata_;
+ NOT_IN_PRECOMPILED(RawObject* return_address_metadata_);
RawObject** to() {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return reinterpret_cast<RawObject**>(&ptr()->stackmaps_);
+#else
return reinterpret_cast<RawObject**>(&ptr()->return_address_metadata_);
+#endif
}
// Compilation timestamp.
- int64_t compile_timestamp_;
+ NOT_IN_PRECOMPILED(int64_t compile_timestamp_);
// state_bits_ is a bitfield with three fields:
// The optimized bit, the alive bit, and a count of the number of pointer
@@ -1152,7 +1164,7 @@ class RawCode : public RawObject {
int32_t state_bits_;
// PC offsets for code patching.
- int32_t lazy_deopt_pc_offset_;
+ NOT_IN_PRECOMPILED(int32_t lazy_deopt_pc_offset_);
// Variable length data follows here.
int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); }
@@ -1525,7 +1537,7 @@ class RawICData : public RawObject {
UNREACHABLE();
return NULL;
}
- int32_t deopt_id_; // Deoptimization id corresponding to this IC.
+ NOT_IN_PRECOMPILED(int32_t deopt_id_);
uint32_t state_bits_; // Number of arguments tested in IC, deopt reasons.
#if defined(TAG_IC_DATA)
intptr_t tag_; // Debugging, verifying that the icdata is assigned to the

Powered by Google App Engine
This is Rietveld 408576698