From c8f8c11b70b49f77564de6c4dc85d4de385442cf Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Fri, 17 Jan 2020 00:24:20 +0000 Subject: [PATCH] Revert "[vm/fieldtable] Move current field values out of Field object into separate table." This reverts commit 85e396a1de20bd0c017707cc9680962652a9ed6f as it broke internal app running on android arm in release mode. Change-Id: Iaff0cf3c1ef859e35b4eaeb3ac8243ce3c6737b8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132168 Reviewed-by: Alexander Aprelev Commit-Queue: Alexander Aprelev --- .../service/get_retaining_path_rpc_test.dart | 34 +- ...et_user_level_retaining_path_rpc_test.dart | 6 +- .../service/inbound_references_test.dart | 2 + runtime/vm/clustered_snapshot.cc | 93 ++--- runtime/vm/clustered_snapshot.h | 6 - runtime/vm/compiler/aot/precompiler.cc | 46 --- runtime/vm/compiler/aot/precompiler.h | 3 - .../vm/compiler/backend/flow_graph_compiler.h | 7 - runtime/vm/compiler/backend/il.cc | 4 + runtime/vm/compiler/backend/il.h | 19 +- runtime/vm/compiler/backend/il_arm.cc | 59 ++- runtime/vm/compiler/backend/il_arm64.cc | 54 +-- runtime/vm/compiler/backend/il_ia32.cc | 55 ++- runtime/vm/compiler/backend/il_printer.cc | 2 +- runtime/vm/compiler/backend/il_x64.cc | 63 ++- .../compiler/backend/type_propagator_test.cc | 3 +- .../frontend/base_flow_graph_builder.cc | 4 +- .../frontend/base_flow_graph_builder.h | 2 +- .../frontend/bytecode_flow_graph_builder.cc | 3 +- .../frontend/kernel_binary_flowgraph.cc | 7 +- .../frontend/kernel_binary_flowgraph.h | 2 +- runtime/vm/compiler/frontend/kernel_to_il.cc | 14 +- runtime/vm/compiler/runtime_api.cc | 5 - runtime/vm/compiler/runtime_api.h | 6 - .../vm/compiler/runtime_offsets_extracted.h | 390 +++++++++--------- runtime/vm/compiler/runtime_offsets_list.h | 2 +- runtime/vm/field_table.cc | 106 ----- runtime/vm/field_table.h | 88 ---- runtime/vm/heap/pages.cc | 1 - runtime/vm/interpreter.cc | 22 +- runtime/vm/isolate.cc | 12 - runtime/vm/isolate.h | 6 - runtime/vm/isolate_reload_test.cc | 124 ------ runtime/vm/object.cc | 25 +- runtime/vm/object.h | 35 +- runtime/vm/object_reload.cc | 7 +- runtime/vm/raw_object.h | 12 +- runtime/vm/raw_object_fields.cc | 4 +- runtime/vm/thread.h | 9 - runtime/vm/vm_sources.gni | 2 - 40 files changed, 434 insertions(+), 910 deletions(-) delete mode 100644 runtime/vm/field_table.cc delete mode 100644 runtime/vm/field_table.h diff --git a/runtime/observatory/tests/service/get_retaining_path_rpc_test.dart b/runtime/observatory/tests/service/get_retaining_path_rpc_test.dart index fcb20a7035390..0421eab8fe841 100644 --- a/runtime/observatory/tests/service/get_retaining_path_rpc_test.dart +++ b/runtime/observatory/tests/service/get_retaining_path_rpc_test.dart @@ -48,9 +48,9 @@ var tests = [ 'limit': 100, }; var result = await isolate.invokeRpcNoUpgrade('getRetainingPath', params); - expect(result['gcRootType'], 'static fields table'); - expect(result['elements'].length, equals(1)); - expect(result['elements'][0]['value']['type'], equals('@Instance')); + expect(result['gcRootType'], 'user global'); + expect(result['elements'].length, equals(2)); + expect(result['elements'][1]['value']['name'], equals('globalObject')); }, // missing limit. @@ -81,10 +81,10 @@ var tests = [ }; var result = await isolate.invokeRpcNoUpgrade('getRetainingPath', params); expect(result['type'], equals('RetainingPath')); - expect(result['gcRootType'], 'static fields table'); - expect(result['elements'].length, equals(2)); - expect(result['elements'][0]['value']['type'], equals('@Instance')); + expect(result['gcRootType'], 'user global'); + expect(result['elements'].length, equals(3)); expect(result['elements'][1]['parentField'], equals('x')); + expect(result['elements'][2]['value']['name'], equals('globalObject')); }, (Isolate isolate) async { @@ -96,10 +96,10 @@ var tests = [ }; var result = await isolate.invokeRpcNoUpgrade('getRetainingPath', params); expect(result['type'], equals('RetainingPath')); - expect(result['gcRootType'], 'static fields table'); - expect(result['elements'].length, equals(2)); + expect(result['gcRootType'], 'user global'); + expect(result['elements'].length, equals(3)); expect(result['elements'][1]['parentField'], equals('y')); - expect(result['elements'][1]['value']['type'], equals('@Instance')); + expect(result['elements'][2]['value']['name'], equals('globalObject')); }, (Isolate isolate) async { @@ -111,10 +111,10 @@ var tests = [ }; var result = await isolate.invokeRpcNoUpgrade('getRetainingPath', params); expect(result['type'], equals('RetainingPath')); - expect(result['gcRootType'], 'static fields table'); - expect(result['elements'].length, equals(2)); + expect(result['gcRootType'], 'user global'); + expect(result['elements'].length, equals(3)); expect(result['elements'][1]['parentListIndex'], equals(12)); - expect(result['elements'][1]['value']['type'], equals('@Instance')); + expect(result['elements'][2]['value']['name'], equals('globalList')); }, (Isolate isolate) async { @@ -126,11 +126,11 @@ var tests = [ }; var result = await isolate.invokeRpcNoUpgrade('getRetainingPath', params); expect(result['type'], equals('RetainingPath')); - expect(result['gcRootType'], 'static fields table'); - expect(result['elements'].length, equals(2)); + expect(result['gcRootType'], 'user global'); + expect(result['elements'].length, equals(3)); expect( result['elements'][1]['parentMapKey']['valueAsString'], equals('key')); - expect(result['elements'][1]['value']['type'], equals('@Instance')); + expect(result['elements'][2]['value']['name'], equals('globalMap1')); }, (Isolate isolate) async { @@ -142,10 +142,10 @@ var tests = [ }; var result = await isolate.invokeRpcNoUpgrade('getRetainingPath', params); expect(result['type'], equals('RetainingPath')); - expect(result['elements'].length, equals(2)); + expect(result['elements'].length, equals(3)); expect(result['elements'][1]['parentMapKey']['class']['name'], equals('_TestClass')); - expect(result['elements'][1]['value']['type'], equals('@Instance')); + expect(result['elements'][2]['value']['name'], equals('globalMap2')); }, // object store diff --git a/runtime/observatory/tests/service/get_user_level_retaining_path_rpc_test.dart b/runtime/observatory/tests/service/get_user_level_retaining_path_rpc_test.dart index 698ab567b65f9..12f17655454c0 100644 --- a/runtime/observatory/tests/service/get_user_level_retaining_path_rpc_test.dart +++ b/runtime/observatory/tests/service/get_user_level_retaining_path_rpc_test.dart @@ -46,9 +46,10 @@ var tests = [ }; var result = await isolate.invokeRpcNoUpgrade('getRetainingPath', params); expect(result['type'], equals('RetainingPath')); - expect(result['elements'].length, equals(1)); + expect(result['elements'].length, equals(2)); expect( result['elements'][0]['value']['class']['name'], equals('_TestConst')); + expect(result['elements'][1]['value']['name'], equals('x')); }, // Expect a simple path through variable fn instead of long path filled @@ -61,8 +62,9 @@ var tests = [ }; var result = await isolate.invokeRpcNoUpgrade('getRetainingPath', params); expect(result['type'], equals('RetainingPath')); - expect(result['elements'].length, equals(1)); + expect(result['elements'].length, equals(2)); expect(result['elements'][0]['value']['class']['name'], equals('_Closure')); + expect(result['elements'][1]['value']['name'], equals('fn')); } ]; diff --git a/runtime/observatory/tests/service/inbound_references_test.dart b/runtime/observatory/tests/service/inbound_references_test.dart index fddc8ba7aaf82..6309f1f7b9b62 100644 --- a/runtime/observatory/tests/service/inbound_references_test.dart +++ b/runtime/observatory/tests/service/inbound_references_test.dart @@ -46,6 +46,8 @@ var tests = [ r['source'].clazz.name == 'Node'); hasReferenceSuchThat( (r) => r['parentListIndex'] == 1 && r['source'].isList); + hasReferenceSuchThat( + (r) => r['source'] is Field && r['source'].name == 'e'); } ]; diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc index 50410b495d6ec..f353a6f038442 100644 --- a/runtime/vm/clustered_snapshot.cc +++ b/runtime/vm/clustered_snapshot.cc @@ -913,11 +913,26 @@ class FieldSerializationCluster : public SerializationCluster { s->Push(field->ptr()->name_); s->Push(field->ptr()->owner_); s->Push(field->ptr()->type_); + // Write out the initial static value or field offset. + if (Field::StaticBit::decode(field->ptr()->kind_bits_)) { + if (kind == Snapshot::kFullAOT) { + // For precompiled static fields, the value was already reset and + // initializer_ now contains a Function. + s->Push(field->ptr()->value_.static_value_); + } else if (Field::ConstBit::decode(field->ptr()->kind_bits_)) { + // Do not reset const fields. + s->Push(field->ptr()->value_.static_value_); + } else { + // Otherwise, for static fields we write out the initial static value. + s->Push(field->ptr()->saved_initial_value_); + } + } else { + s->Push(field->ptr()->value_.offset_); + } // Write out the initializer function s->Push(field->ptr()->initializer_function_); - if (kind != Snapshot::kFullAOT) { - // Write out the saved initial values + // Write out the saved initial value s->Push(field->ptr()->saved_initial_value_); } if (kind != Snapshot::kFullAOT) { @@ -927,22 +942,6 @@ class FieldSerializationCluster : public SerializationCluster { if (kind == Snapshot::kFullJIT) { s->Push(field->ptr()->dependent_code_); } - // Write out either static value, initial value or field offset. - if (Field::StaticBit::decode(field->ptr()->kind_bits_)) { - if ( - // For precompiled static fields, the value was already reset and - // initializer_ now contains a Function. - kind == Snapshot::kFullAOT || - // Do not reset const fields. - Field::ConstBit::decode(field->ptr()->kind_bits_)) { - s->Push(s->field_table()->At(field->ptr()->offset_or_field_id_)); - } else { - // Otherwise, for static fields we write out the initial static value. - s->Push(field->ptr()->saved_initial_value_); - } - } else { - s->Push(Smi::New(field->ptr()->offset_or_field_id_)); - } } void WriteAlloc(Serializer* s) { @@ -965,6 +964,22 @@ class FieldSerializationCluster : public SerializationCluster { WriteField(field, name_); WriteField(field, owner_); WriteField(field, type_); + // Write out the initial static value or field offset. + if (Field::StaticBit::decode(field->ptr()->kind_bits_)) { + if (kind == Snapshot::kFullAOT) { + // For precompiled static fields, the value was already reset and + // initializer_ now contains a Function. + WriteField(field, value_.static_value_); + } else if (Field::ConstBit::decode(field->ptr()->kind_bits_)) { + // Do not reset const fields. + WriteField(field, value_.static_value_); + } else { + // Otherwise, for static fields we write out the initial static value. + WriteField(field, saved_initial_value_); + } + } else { + WriteField(field, value_.offset_); + } // Write out the initializer function and initial value if not in AOT. WriteField(field, initializer_function_); if (kind != Snapshot::kFullAOT) { @@ -989,27 +1004,6 @@ class FieldSerializationCluster : public SerializationCluster { #endif } s->Write(field->ptr()->kind_bits_); - - // Write out the initial static value or field offset. - if (Field::StaticBit::decode(field->ptr()->kind_bits_)) { - if ( - // For precompiled static fields, the value was already reset and - // initializer_ now contains a Function. - // WriteField(field, value_.static_value_); - kind == Snapshot::kFullAOT || - // Do not reset const fields. - Field::ConstBit::decode(field->ptr()->kind_bits_)) { - WriteFieldValue( - "static value", - s->field_table()->At(field->ptr()->offset_or_field_id_)); - } else { - // Otherwise, for static fields we write out the initial static value. - WriteFieldValue("static value", field->ptr()->saved_initial_value_); - } - s->WriteUnsigned(field->ptr()->offset_or_field_id_); - } else { - WriteFieldValue("offset", Smi::New(field->ptr()->offset_or_field_id_)); - } } } @@ -1051,17 +1045,6 @@ class FieldDeserializationCluster : public DeserializationCluster { #endif } field->ptr()->kind_bits_ = d->Read(); - - RawObject* value_or_offset = d->ReadRef(); - if (Field::StaticBit::decode(field->ptr()->kind_bits_)) { - intptr_t field_id = d->ReadUnsigned(); - d->field_table()->SetAt( - field_id, reinterpret_cast(value_or_offset)); - field->ptr()->offset_or_field_id_ = field_id; - } else { - field->ptr()->offset_or_field_id_ = - Smi::Value(Smi::RawCast(value_or_offset)); - } } } @@ -4361,7 +4344,6 @@ Serializer::Serializer(Thread* thread, num_base_objects_(0), num_written_objects_(0), next_ref_index_(1), - field_table_(thread->isolate()->field_table()), vm_(vm), profile_writer_(profile_writer) #if defined(SNAPSHOT_BACKTRACE) @@ -4816,7 +4798,6 @@ void Serializer::Serialize() { WriteUnsigned(num_objects); WriteUnsigned(num_clusters); WriteUnsigned(code_order_length); - WriteUnsigned(field_table_->NumFieldIds()); for (intptr_t cid = 1; cid < num_cids_; cid++) { SerializationCluster* cluster = clusters_by_cid_[cid]; @@ -5033,8 +5014,7 @@ Deserializer::Deserializer(Thread* thread, image_reader_(NULL), refs_(NULL), next_ref_index_(1), - clusters_(NULL), - field_table_(thread->isolate()->field_table()) { + clusters_(NULL) { if (Snapshot::IncludesCode(kind)) { ASSERT(instructions_buffer != NULL); ASSERT(data_buffer != NULL); @@ -5302,14 +5282,9 @@ void Deserializer::Prepare() { num_objects_ = ReadUnsigned(); num_clusters_ = ReadUnsigned(); code_order_length_ = ReadUnsigned(); - const intptr_t field_table_len = ReadUnsigned(); clusters_ = new DeserializationCluster*[num_clusters_]; refs_ = Array::New(num_objects_ + 1, Heap::kOld); - if (field_table_len > 0) { - field_table_->AllocateIndex(field_table_len - 1); - } - ASSERT(field_table_->NumFieldIds() == field_table_len); } void Deserializer::Deserialize() { diff --git a/runtime/vm/clustered_snapshot.h b/runtime/vm/clustered_snapshot.h index 7be84ef2d046e..d65569c6f0a51 100644 --- a/runtime/vm/clustered_snapshot.h +++ b/runtime/vm/clustered_snapshot.h @@ -216,9 +216,6 @@ class Serializer : public ThreadStackResource { void WriteVersionAndFeatures(bool is_vm_snapshot); void Serialize(); - - FieldTable* field_table() { return field_table_; } - WriteStream* stream() { return &stream_; } intptr_t bytes_written() { return stream_.bytes_written(); } @@ -375,7 +372,6 @@ class Serializer : public ThreadStackResource { intptr_t num_written_objects_; intptr_t next_ref_index_; SmiObjectIdMap smi_ids_; - FieldTable* field_table_; // True if writing VM snapshot, false for Isolate snapshot. bool vm_; @@ -560,7 +556,6 @@ class Deserializer : public ThreadStackResource { intptr_t next_index() const { return next_ref_index_; } Heap* heap() const { return heap_; } Snapshot::Kind kind() const { return kind_; } - FieldTable* field_table() const { return field_table_; } // The number of code objects which were relocated during AOT snapshot // writing. @@ -590,7 +585,6 @@ class Deserializer : public ThreadStackResource { RawArray* refs_; intptr_t next_ref_index_; DeserializationCluster** clusters_; - FieldTable* field_table_; }; #define ReadFromTo(obj, ...) d->ReadFromTo(obj, ##__VA_ARGS__); diff --git a/runtime/vm/compiler/aot/precompiler.cc b/runtime/vm/compiler/aot/precompiler.cc index 3abf7b362194a..e4f60dbc99c6f 100644 --- a/runtime/vm/compiler/aot/precompiler.cc +++ b/runtime/vm/compiler/aot/precompiler.cc @@ -166,7 +166,6 @@ Precompiler::Precompiler(Thread* thread) libraries_(GrowableObjectArray::Handle(I->object_store()->libraries())), pending_functions_( GrowableObjectArray::Handle(GrowableObjectArray::New())), - pending_static_fields_to_retain_(), sent_selectors_(), enqueued_functions_( HashTables::New(/*initial_capacity=*/1024)), @@ -531,13 +530,6 @@ void Precompiler::AddRoots() { } } -void Precompiler::AddRetainedStaticField(const Field& field) { - if (pending_static_fields_to_retain_.HasKey(&field)) { - return; - } - pending_static_fields_to_retain_.Insert(&Field::ZoneHandle(Z, field.raw())); -} - void Precompiler::Iterate() { Function& function = Function::Handle(Z); @@ -549,12 +541,6 @@ void Precompiler::Iterate() { ProcessFunction(function); } - FieldSet::Iterator it = pending_static_fields_to_retain_.GetIterator(); - for (const Field** field = it.Next(); field != nullptr; field = it.Next()) { - AddField(**field); - } - pending_static_fields_to_retain_.Clear(); - CheckForNewDynamicFunctions(); CollectCallbackFields(); } @@ -1565,12 +1551,6 @@ void Precompiler::DropFields() { if (FLAG_trace_precompiler) { THR_Print("Dropping field %s\n", field.ToCString()); } - - // This cleans up references to field current and initial values. - if (field.is_static()) { - field.SetStaticValue(Object::null_instance(), - /*save_initial_value=*/true); - } } } @@ -1814,25 +1794,9 @@ void Precompiler::DropMetadata() { Array& dependencies = Array::Handle(Z); Namespace& ns = Namespace::Handle(Z); const Field& null_field = Field::Handle(Z); - GrowableObjectArray& metadata = GrowableObjectArray::Handle(Z); - Field& metadata_field = Field::Handle(Z); for (intptr_t i = 0; i < libraries_.Length(); i++) { lib ^= libraries_.At(i); - metadata ^= lib.metadata(); - for (intptr_t j = 0; j < metadata.Length(); j++) { - metadata_field ^= metadata.At(j); - if (metadata_field.is_static()) { - // Although this field will become garbage after clearing the list - // below, we also need to clear its value from the field table. - // The value may be an instance of an otherwise dead class, and if - // it remains in the field table we can get an instance on the heap - // with a deleted class. - metadata_field.SetStaticValue(Object::null_instance(), - /*save_initial_value=*/true); - } - } - lib.set_metadata(null_growable_list); dependencies = lib.imports(); @@ -2491,16 +2455,6 @@ bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) { function_stats); } - for (intptr_t i = 0; i < graph_compiler.used_static_fields().length(); - i++) { - // We can't use precompiler_->AddField() directly here because they - // need to be added later as part of Iterate(). If they are added - // before that, initializer functions will get their code cleared by - // Precompiler::ClearAllCode(). - precompiler_->AddRetainedStaticField( - *graph_compiler.used_static_fields().At(i)); - } - // In bare instructions mode try adding all entries from the object // pool into the global object pool. This might fail if we have // nested code generation (i.e. we generated some stubs) whichs means diff --git a/runtime/vm/compiler/aot/precompiler.h b/runtime/vm/compiler/aot/precompiler.h index 97e15a1836598..093457dfe4c3a 100644 --- a/runtime/vm/compiler/aot/precompiler.h +++ b/runtime/vm/compiler/aot/precompiler.h @@ -214,8 +214,6 @@ class Precompiler : public ValueObject { static Precompiler* Instance() { return singleton_; } - void AddRetainedStaticField(const Field& field); - private: static Precompiler* singleton_; @@ -304,7 +302,6 @@ class Precompiler : public ValueObject { compiler::ObjectPoolBuilder global_object_pool_builder_; GrowableObjectArray& libraries_; const GrowableObjectArray& pending_functions_; - FieldSet pending_static_fields_to_retain_; SymbolSet sent_selectors_; FunctionSet enqueued_functions_; FieldSet fields_to_retain_; diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.h b/runtime/vm/compiler/backend/flow_graph_compiler.h index c38904d88b582..a936eddcb511d 100644 --- a/runtime/vm/compiler/backend/flow_graph_compiler.h +++ b/runtime/vm/compiler/backend/flow_graph_compiler.h @@ -478,10 +478,6 @@ class FlowGraphCompiler : public ValueObject { if (stats_ != NULL) stats_->SpecialEnd(tag); } - GrowableArray& used_static_fields() { - return used_static_fields_; - } - // Constructor is lighweight, major initialization work should occur here. // This makes it easier to measure time spent in the compiler. void InitCompiler(); @@ -1112,9 +1108,6 @@ class FlowGraphCompiler : public ValueObject { GrowableArray block_info_; GrowableArray deopt_infos_; GrowableArray slow_path_code_; - // Fields that were referenced by generated code. - // This list is needed by precompiler to ensure they are retained. - GrowableArray used_static_fields_; // Stores static call targets as well as stub targets. // TODO(srdjan): Evaluate if we should store allocation stub targets into a // separate table? diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 993e0f8ce40fd..b219564edb551 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -1069,6 +1069,10 @@ bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const { return StaticField().raw() == other_load->StaticField().raw(); } +const Field& LoadStaticFieldInstr::StaticField() const { + return Field::Cast(field_value()->BoundConstant()); +} + bool LoadStaticFieldInstr::IsFieldInitialized() const { const Field& field = StaticField(); return (field.StaticValue() != Object::sentinel().raw()) && diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h index 3d81babb0b7a4..93ef4eeaa7791 100644 --- a/runtime/vm/compiler/backend/il.h +++ b/runtime/vm/compiler/backend/il.h @@ -4990,17 +4990,22 @@ class GuardFieldTypeInstr : public GuardFieldInstr { DISALLOW_COPY_AND_ASSIGN(GuardFieldTypeInstr); }; -class LoadStaticFieldInstr : public TemplateDefinition<0, NoThrow> { +class LoadStaticFieldInstr : public TemplateDefinition<1, NoThrow> { public: - LoadStaticFieldInstr(const Field& field, TokenPosition token_pos) - : field_(field), token_pos_(token_pos) {} + LoadStaticFieldInstr(Value* field_value, TokenPosition token_pos) + : token_pos_(token_pos) { + ASSERT(field_value->BindsToConstant()); + SetInputAt(0, field_value); + } DECLARE_INSTRUCTION(LoadStaticField) virtual CompileType ComputeType() const; - const Field& StaticField() const { return field_; } + const Field& StaticField() const; bool IsFieldInitialized() const; + Value* field_value() const { return inputs_[0]; } + virtual bool ComputeCanDeoptimize() const { return false; } virtual bool AllowsCSE() const { @@ -5015,7 +5020,6 @@ class LoadStaticFieldInstr : public TemplateDefinition<0, NoThrow> { PRINT_OPERANDS_TO_SUPPORT private: - const Field& field_; const TokenPosition token_pos_; DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); @@ -6043,10 +6047,11 @@ class InitInstanceFieldInstr : public TemplateInstruction<1, Throws> { DISALLOW_COPY_AND_ASSIGN(InitInstanceFieldInstr); }; -class InitStaticFieldInstr : public TemplateInstruction<0, Throws> { +class InitStaticFieldInstr : public TemplateInstruction<1, Throws> { public: - InitStaticFieldInstr(const Field& field, intptr_t deopt_id) + InitStaticFieldInstr(Value* input, const Field& field, intptr_t deopt_id) : TemplateInstruction(deopt_id), field_(field) { + SetInputAt(0, input); CheckField(field); } diff --git a/runtime/vm/compiler/backend/il_arm.cc b/runtime/vm/compiler/backend/il_arm.cc index 055963c5c49a3..5d0b121398aeb 100644 --- a/runtime/vm/compiler/backend/il_arm.cc +++ b/runtime/vm/compiler/backend/il_arm.cc @@ -2770,12 +2770,12 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { - const intptr_t kNumInputs = 0; - const intptr_t kNumTemps = 1; + const intptr_t kNumInputs = 1; + const intptr_t kNumTemps = 0; LocationSummary* summary = new (zone) LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); + summary->set_in(0, Location::RequiresRegister()); summary->set_out(0, Location::RequiresRegister()); - summary->set_temp(0, Location::RequiresRegister()); return summary; } @@ -2785,19 +2785,10 @@ LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, // // This is safe only so long as LoadStaticFieldInstr cannot deoptimize. void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { + const Register field = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); - const Register temp = locs()->temp(0).reg(); - - compiler->used_static_fields().Add(&StaticField()); - - __ LoadFromOffset(kWord, temp, THR, - compiler::target::Thread::field_table_values_offset()); - // Hot-reload has to guarantee that static fields will never change their - // "id", so we can embed the offset directly in the unoptimized code. - // The hot-reload code seems to maintain this guarantee only for non-enum - // classes. - __ LoadFromOffset(kWord, result, temp, - compiler::target::FieldTable::OffsetOf(StaticField())); + __ LoadFieldFromOffset(kWord, result, field, + compiler::target::Field::static_value_offset()); } LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, @@ -2806,7 +2797,7 @@ LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, const intptr_t kNumTemps = 1; LocationSummary* locs = new (zone) LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); - locs->set_in(0, Location::RequiresRegister()); + locs->set_in(0, Location::RegisterLocation(kWriteBarrierValueReg)); locs->set_temp(0, Location::RequiresRegister()); return locs; } @@ -2815,13 +2806,21 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const Register temp = locs()->temp(0).reg(); - compiler->used_static_fields().Add(&field()); - - __ LoadFromOffset(kWord, temp, THR, - compiler::target::Thread::field_table_values_offset()); - // Note: static fields ids won't be changed by hot-reload. - __ StoreToOffset(kWord, value, temp, - compiler::target::FieldTable::OffsetOf(field())); + __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); + if (this->value()->NeedsWriteBarrier()) { + __ StoreIntoObject( + temp, + compiler::FieldAddress(temp, + compiler::target::Field::static_value_offset()), + value, CanValueBeSmi(), + /*lr_reserved=*/!compiler->intrinsic_mode()); + } else { + __ StoreIntoObjectNoBarrier( + temp, + compiler::FieldAddress(temp, + compiler::target::Field::static_value_offset()), + value); + } } LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, @@ -3333,24 +3332,22 @@ void InitInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { - const intptr_t kNumInputs = 0; + const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 1; LocationSummary* locs = new (zone) LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); + locs->set_in(0, Location::RegisterLocation(R0)); locs->set_temp(0, Location::RegisterLocation(R1)); return locs; } void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { + Register field = locs()->in(0).reg(); Register temp = locs()->temp(0).reg(); compiler::Label call_runtime, no_call; - __ LoadFromOffset(kWord, temp, THR, - compiler::target::Thread::field_table_values_offset()); - // Note: static fields ids won't be changed by hot-reload. - __ LoadFromOffset(kWord, temp, temp, - compiler::target::FieldTable::OffsetOf(field())); - + __ ldr(temp, compiler::FieldAddress( + field, compiler::target::Field::static_value_offset())); __ CompareObject(temp, Object::sentinel()); __ b(&call_runtime, EQ); @@ -3359,7 +3356,7 @@ void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&call_runtime); __ PushObject(Object::null_object()); // Make room for (unused) result. - __ PushObject(Field::ZoneHandle(field().Original())); + __ Push(field); compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kInitStaticFieldRuntimeEntry, 1, locs()); __ Drop(2); // Remove argument and result placeholder. diff --git a/runtime/vm/compiler/backend/il_arm64.cc b/runtime/vm/compiler/backend/il_arm64.cc index 7a56b468463f8..f2bffd079dc7b 100644 --- a/runtime/vm/compiler/backend/il_arm64.cc +++ b/runtime/vm/compiler/backend/il_arm64.cc @@ -2346,12 +2346,12 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { - const intptr_t kNumInputs = 0; - const intptr_t kNumTemps = 1; + const intptr_t kNumInputs = 1; + const intptr_t kNumTemps = 0; LocationSummary* summary = new (zone) LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); + summary->set_in(0, Location::RequiresRegister()); summary->set_out(0, Location::RequiresRegister()); - summary->set_temp(0, Location::RequiresRegister()); return summary; } @@ -2361,25 +2361,16 @@ LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, // // This is safe only so long as LoadStaticFieldInstr cannot deoptimize. void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { + const Register field = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); - const Register temp = locs()->temp(0).reg(); - - compiler->used_static_fields().Add(&StaticField()); - - __ LoadFromOffset(temp, THR, - compiler::target::Thread::field_table_values_offset()); - // Note: static fields ids won't be changed by hot-reload. - __ LoadFromOffset(result, temp, - compiler::target::FieldTable::OffsetOf(StaticField())); + __ LoadFieldFromOffset(result, field, Field::static_value_offset()); } LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { - const intptr_t kNumInputs = 1; - const intptr_t kNumTemps = 1; - LocationSummary* locs = new (zone) - LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); - locs->set_in(0, Location::RequiresRegister()); + LocationSummary* locs = + new (zone) LocationSummary(zone, 1, 1, LocationSummary::kNoCall); + locs->set_in(0, Location::RegisterLocation(kWriteBarrierValueReg)); locs->set_temp(0, Location::RequiresRegister()); return locs; } @@ -2388,13 +2379,15 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const Register value = locs()->in(0).reg(); const Register temp = locs()->temp(0).reg(); - compiler->used_static_fields().Add(&field()); - - __ LoadFromOffset(temp, THR, - compiler::target::Thread::field_table_values_offset()); - // Note: static fields ids won't be changed by hot-reload. - __ StoreToOffset(value, temp, - compiler::target::FieldTable::OffsetOf(field())); + __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); + if (this->value()->NeedsWriteBarrier()) { + __ StoreIntoObjectOffset(temp, Field::static_value_offset(), value, + CanValueBeSmi(), + /*lr_reserved=*/!compiler->intrinsic_mode()); + } else { + __ StoreIntoObjectOffsetNoBarrier(temp, Field::static_value_offset(), + value); + } } LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, @@ -2887,23 +2880,21 @@ void InitInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { - const intptr_t kNumInputs = 0; + const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 1; LocationSummary* locs = new (zone) LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); + locs->set_in(0, Location::RegisterLocation(R0)); locs->set_temp(0, Location::RegisterLocation(R1)); return locs; } void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { + Register field = locs()->in(0).reg(); Register temp = locs()->temp(0).reg(); compiler::Label call_runtime, no_call; - __ LoadFromOffset(temp, THR, - compiler::target::Thread::field_table_values_offset()); - // Note: static fields ids won't be changed by hot-reload. - __ LoadFromOffset(temp, temp, - compiler::target::FieldTable::OffsetOf(field())); + __ ldr(temp, compiler::FieldAddress(field, Field::static_value_offset())); __ CompareObject(temp, Object::sentinel()); __ b(&call_runtime, EQ); @@ -2911,8 +2902,7 @@ void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ b(&no_call, NE); __ Bind(&call_runtime); - __ Push(NULL_REG); - __ PushObject(Field::ZoneHandle(field().Original())); + __ PushPair(field, NULL_REG); compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kInitStaticFieldRuntimeEntry, 1, locs()); __ Drop(2); // Remove argument and result placeholder. diff --git a/runtime/vm/compiler/backend/il_ia32.cc b/runtime/vm/compiler/backend/il_ia32.cc index 10f1149a768a2..d85b2abe66f9f 100644 --- a/runtime/vm/compiler/backend/il_ia32.cc +++ b/runtime/vm/compiler/backend/il_ia32.cc @@ -2203,12 +2203,14 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { - const intptr_t kNumInputs = 0; - const intptr_t kNumTemps = 1; + const intptr_t kNumInputs = 1; + const intptr_t kNumTemps = 0; LocationSummary* summary = new (zone) LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); - summary->set_temp(0, Location::RequiresRegister()); - summary->set_out(0, Location::RequiresRegister()); + summary->set_in(0, Location::RequiresRegister()); + // By specifying same register as input, our simple register allocator can + // generate better code. + summary->set_out(0, Location::SameAsFirstInput()); return summary; } @@ -2218,18 +2220,9 @@ LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, // // This is safe only so long as LoadStaticFieldInstr cannot deoptimize. void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { + Register field = locs()->in(0).reg(); Register result = locs()->out(0).reg(); - Register temp = locs()->temp(0).reg(); - - compiler->used_static_fields().Add(&StaticField()); - - __ movl(temp, - compiler::Address( - THR, compiler::target::Thread::field_table_values_offset())); - // Note: static fields ids won't be changed by hot-reload. - __ movl(result, - compiler::Address( - temp, compiler::target::FieldTable::OffsetOf(StaticField()))); + __ movl(result, compiler::FieldAddress(field, Field::static_value_offset())); } LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, @@ -2246,15 +2239,16 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Register temp = locs()->temp(0).reg(); - compiler->used_static_fields().Add(&field()); - - __ movl(temp, - compiler::Address( - THR, compiler::target::Thread::field_table_values_offset())); - // Note: static fields ids won't be changed by hot-reload. - __ movl( - compiler::Address(temp, compiler::target::FieldTable::OffsetOf(field())), - value); + __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); + if (this->value()->NeedsWriteBarrier()) { + __ StoreIntoObject( + temp, compiler::FieldAddress(temp, Field::static_value_offset()), value, + CanValueBeSmi()); + } else { + __ StoreIntoObjectNoBarrier( + temp, compiler::FieldAddress(temp, Field::static_value_offset()), + value); + } } LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, @@ -2767,25 +2761,22 @@ void InitInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { - const intptr_t kNumInputs = 0; + const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 1; LocationSummary* locs = new (zone) LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); + locs->set_in(0, Location::RegisterLocation(EAX)); locs->set_temp(0, Location::RegisterLocation(ECX)); return locs; } void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { + Register field = locs()->in(0).reg(); Register temp = locs()->temp(0).reg(); compiler::Label call_runtime, no_call; - __ movl(temp, - compiler::Address( - THR, compiler::target::Thread::field_table_values_offset())); - // Note: static fields ids won't be changed by hot-reload. - __ movl(temp, compiler::Address( - temp, compiler::target::FieldTable::OffsetOf(field()))); + __ movl(temp, compiler::FieldAddress(field, Field::static_value_offset())); __ CompareObject(temp, Object::sentinel()); __ j(EQUAL, &call_runtime); @@ -2794,7 +2785,7 @@ void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&call_runtime); __ PushObject(Object::null_object()); // Make room for (unused) result. - __ PushObject(Field::ZoneHandle(field().Original())); + __ pushl(field); compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kInitStaticFieldRuntimeEntry, 1, locs()); __ Drop(2); // Remove argument and unused result. diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc index 78b937edf0802..bd8697aa0f945 100644 --- a/runtime/vm/compiler/backend/il_printer.cc +++ b/runtime/vm/compiler/backend/il_printer.cc @@ -637,7 +637,7 @@ void IfThenElseInstr::PrintOperandsTo(BufferFormatter* f) const { } void LoadStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { - f->Print("%s", String::Handle(StaticField().name()).ToCString()); + field_value()->PrintTo(f); } void StoreStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { diff --git a/runtime/vm/compiler/backend/il_x64.cc b/runtime/vm/compiler/backend/il_x64.cc index dd4800809610a..34df5b389d1dc 100644 --- a/runtime/vm/compiler/backend/il_x64.cc +++ b/runtime/vm/compiler/backend/il_x64.cc @@ -2338,13 +2338,13 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { - const intptr_t kNumInputs = 0; - const intptr_t kNumTemps = 1; - LocationSummary* locs = new (zone) + const intptr_t kNumInputs = 1; + const intptr_t kNumTemps = 0; + LocationSummary* summary = new (zone) LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); - locs->set_out(0, Location::RequiresRegister()); - locs->set_temp(0, Location::RequiresRegister()); - return locs; + summary->set_in(0, Location::RequiresRegister()); + summary->set_out(0, Location::RequiresRegister()); + return summary; } // When the parser is building an implicit static getter for optimization, @@ -2353,26 +2353,15 @@ LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, // // This is safe only so long as LoadStaticFieldInstr cannot deoptimize. void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { + Register field = locs()->in(0).reg(); Register result = locs()->out(0).reg(); - Register temp = locs()->temp(0).reg(); - - compiler->used_static_fields().Add(&StaticField()); - - __ movq(temp, - compiler::Address( - THR, compiler::target::Thread::field_table_values_offset())); - // Note: static fields ids won't be changed by hot-reload. - __ movq(result, - compiler::Address( - temp, compiler::target::FieldTable::OffsetOf(StaticField()))); + __ movq(result, compiler::FieldAddress(field, Field::static_value_offset())); } LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { - const intptr_t kNumInputs = 1; - const intptr_t kNumTemps = 1; - LocationSummary* locs = new (zone) - LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); + LocationSummary* locs = + new (zone) LocationSummary(zone, 1, 1, LocationSummary::kNoCall); locs->set_in(0, Location::RegisterLocation(kWriteBarrierValueReg)); locs->set_temp(0, Location::RequiresRegister()); return locs; @@ -2382,15 +2371,16 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register value = locs()->in(0).reg(); Register temp = locs()->temp(0).reg(); - compiler->used_static_fields().Add(&field()); - - __ movq(temp, - compiler::Address( - THR, compiler::target::Thread::field_table_values_offset())); - // Note: static fields ids won't be changed by hot-reload. - __ movq( - compiler::Address(temp, compiler::target::FieldTable::OffsetOf(field())), - value); + __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); + if (this->value()->NeedsWriteBarrier()) { + __ StoreIntoObject( + temp, compiler::FieldAddress(temp, Field::static_value_offset()), value, + CanValueBeSmi()); + } else { + __ StoreIntoObjectNoBarrier( + temp, compiler::FieldAddress(temp, Field::static_value_offset()), + value); + } } LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, @@ -2904,25 +2894,22 @@ void InitInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, bool opt) const { - const intptr_t kNumInputs = 0; + const intptr_t kNumInputs = 1; const intptr_t kNumTemps = 1; LocationSummary* locs = new (zone) LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); + locs->set_in(0, Location::RegisterLocation(RAX)); locs->set_temp(0, Location::RegisterLocation(RCX)); return locs; } void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { + Register field = locs()->in(0).reg(); Register temp = locs()->temp(0).reg(); compiler::Label call_runtime, no_call; - __ movq(temp, - compiler::Address( - THR, compiler::target::Thread::field_table_values_offset())); - // Note: static fields ids won't be changed by hot-reload. - __ movq(temp, compiler::Address( - temp, compiler::target::FieldTable::OffsetOf(field()))); + __ movq(temp, compiler::FieldAddress(field, Field::static_value_offset())); __ CompareObject(temp, Object::sentinel()); __ j(EQUAL, &call_runtime); @@ -2931,7 +2918,7 @@ void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&call_runtime); __ PushObject(Object::null_object()); // Make room for (unused) result. - __ PushObject(Field::ZoneHandle(field().Original())); + __ pushq(field); compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kInitStaticFieldRuntimeEntry, 1, locs()); __ Drop(2); // Remove argument and unused result. diff --git a/runtime/vm/compiler/backend/type_propagator_test.cc b/runtime/vm/compiler/backend/type_propagator_test.cc index 02a82c8ba021a..e0d37dcfe6a89 100644 --- a/runtime/vm/compiler/backend/type_propagator_test.cc +++ b/runtime/vm/compiler/backend/type_propagator_test.cc @@ -253,7 +253,8 @@ ISOLATE_UNIT_TEST_CASE(TypePropagator_Refinement) { EXPECT_PROPERTY(v2->Type(), it.IsNullableInt()); EXPECT_PROPERTY(v3->Type(), it.IsNullableInt()); - auto v4 = new LoadStaticFieldInstr(field, TokenPosition::kNoSource); + auto v4 = new LoadStaticFieldInstr( + new Value(H.flow_graph()->GetConstant(field)), TokenPosition::kNoSource); H.flow_graph()->InsertBefore(v2, v4, nullptr, FlowGraph::kValue); v2->ReplaceUsesWith(v4); v2->RemoveFromGraph(); diff --git a/runtime/vm/compiler/frontend/base_flow_graph_builder.cc b/runtime/vm/compiler/frontend/base_flow_graph_builder.cc index dd86588992980..c7b27641f7e19 100644 --- a/runtime/vm/compiler/frontend/base_flow_graph_builder.cc +++ b/runtime/vm/compiler/frontend/base_flow_graph_builder.cc @@ -523,9 +523,9 @@ Fragment BaseFlowGraphBuilder::StoreInstanceFieldGuarded( return instructions; } -Fragment BaseFlowGraphBuilder::LoadStaticField(const Field& field) { +Fragment BaseFlowGraphBuilder::LoadStaticField() { LoadStaticFieldInstr* load = - new (Z) LoadStaticFieldInstr(field, TokenPosition::kNoSource); + new (Z) LoadStaticFieldInstr(Pop(), TokenPosition::kNoSource); Push(load); return Fragment(load); } diff --git a/runtime/vm/compiler/frontend/base_flow_graph_builder.h b/runtime/vm/compiler/frontend/base_flow_graph_builder.h index 55af9c7985cbd..57fac7141ec6b 100644 --- a/runtime/vm/compiler/frontend/base_flow_graph_builder.h +++ b/runtime/vm/compiler/frontend/base_flow_graph_builder.h @@ -194,7 +194,7 @@ class BaseFlowGraphBuilder { Fragment StoreInstanceFieldGuarded(const Field& field, StoreInstanceFieldInstr::Kind kind = StoreInstanceFieldInstr::Kind::kOther); - Fragment LoadStaticField(const Field& field); + Fragment LoadStaticField(); Fragment RedefinitionWithType(const AbstractType& type); Fragment StoreStaticField(TokenPosition position, const Field& field); Fragment StoreIndexed(classid_t class_id); diff --git a/runtime/vm/compiler/frontend/bytecode_flow_graph_builder.cc b/runtime/vm/compiler/frontend/bytecode_flow_graph_builder.cc index 98a38efbcd09b..e9c0cecc5262b 100644 --- a/runtime/vm/compiler/frontend/bytecode_flow_graph_builder.cc +++ b/runtime/vm/compiler/frontend/bytecode_flow_graph_builder.cc @@ -1321,7 +1321,8 @@ void BytecodeFlowGraphBuilder::BuildLoadStatic() { code_ += B->Constant(value); return; } - code_ += B->LoadStaticField(field); + PushConstant(operand); + code_ += B->LoadStaticField(); } void BytecodeFlowGraphBuilder::BuildStoreIndexedTOS() { diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc index 765baf313c04a..e5f6346cc03d3 100644 --- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc +++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc @@ -1644,8 +1644,8 @@ Fragment StreamingFlowGraphBuilder::IntConstant(int64_t value) { return flow_graph_builder_->IntConstant(value); } -Fragment StreamingFlowGraphBuilder::LoadStaticField(const Field& field) { - return flow_graph_builder_->LoadStaticField(field); +Fragment StreamingFlowGraphBuilder::LoadStaticField() { + return flow_graph_builder_->LoadStaticField(); } Fragment StreamingFlowGraphBuilder::RedefinitionWithType( @@ -2711,7 +2711,8 @@ Fragment StreamingFlowGraphBuilder::BuildStaticGet(TokenPosition* p) { if (result_type.IsConstant()) { return Constant(result_type.constant_value); } - return LoadStaticField(field); + Fragment instructions = Constant(field); + return instructions + LoadStaticField(); } } } else { diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h index ec67dc003b7c4..3a209951ad74a 100644 --- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h +++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h @@ -163,7 +163,7 @@ class StreamingFlowGraphBuilder : public KernelReaderHelper { Fragment ThrowNoSuchMethodError(); Fragment Constant(const Object& value); Fragment IntConstant(int64_t value); - Fragment LoadStaticField(const Field& field); + Fragment LoadStaticField(); Fragment RedefinitionWithType(const AbstractType& type); Fragment CheckNull(TokenPosition position, LocalVariable* receiver, diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc index 66e0bc58100ac..77cccae758fac 100644 --- a/runtime/vm/compiler/frontend/kernel_to_il.cc +++ b/runtime/vm/compiler/frontend/kernel_to_il.cc @@ -445,7 +445,8 @@ Fragment FlowGraphBuilder::LoadLateField(const Field& field, // Check whether the field has been initialized already. if (is_static) { - instructions += LoadStaticField(field); + instructions += Constant(field); + instructions += LoadStaticField(); } else { instructions += LoadLocal(instance); instructions += LoadField(field); @@ -530,7 +531,8 @@ Fragment FlowGraphBuilder::StoreLateField(const Field& field, if (is_final) { // Check whether the field has been initialized already. if (is_static) { - instructions += LoadStaticField(field); + instructions += Constant(field); + instructions += LoadStaticField(); } else { instructions += LoadLocal(instance); instructions += LoadField(field); @@ -579,8 +581,8 @@ Fragment FlowGraphBuilder::InitInstanceField(const Field& field) { } Fragment FlowGraphBuilder::InitStaticField(const Field& field) { - InitStaticFieldInstr* init = - new (Z) InitStaticFieldInstr(MayCloneField(field), GetNextDeoptId()); + InitStaticFieldInstr* init = new (Z) + InitStaticFieldInstr(Pop(), MayCloneField(field), GetNextDeoptId()); return Fragment(init); } @@ -2676,8 +2678,10 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfFieldAccessor( body += LoadLateField(field, /* instance = */ nullptr); } else { ASSERT(field.has_nontrivial_initializer()); + body += Constant(field); body += InitStaticField(field); - body += LoadStaticField(field); + body += Constant(field); + body += LoadStaticField(); } if (field.needs_load_guard()) { #if defined(PRODUCT) diff --git a/runtime/vm/compiler/runtime_api.cc b/runtime/vm/compiler/runtime_api.cc index 63299eec0ecaf..67efe20fd9bc7 100644 --- a/runtime/vm/compiler/runtime_api.cc +++ b/runtime/vm/compiler/runtime_api.cc @@ -635,11 +635,6 @@ word Field::OffsetOf(const dart::Field& field) { return TranslateOffsetInWords(field.Offset()); } -word FieldTable::OffsetOf(const dart::Field& field) { - return TranslateOffsetInWords( - dart::FieldTable::FieldOffsetFor(field.field_id())); -} - } // namespace target } // namespace compiler } // namespace dart diff --git a/runtime/vm/compiler/runtime_api.h b/runtime/vm/compiler/runtime_api.h index c7d5b96329de8..772a2e25fc41b 100644 --- a/runtime/vm/compiler/runtime_api.h +++ b/runtime/vm/compiler/runtime_api.h @@ -657,7 +657,6 @@ class Thread : public AllStatic { static word top_offset(); static word end_offset(); static word isolate_offset(); - static word field_table_values_offset(); static word store_buffer_block_offset(); static word call_to_runtime_entry_point_offset(); static word null_error_shared_with_fpu_regs_entry_point_offset(); @@ -914,11 +913,6 @@ class TypeArguments : public AllStatic { static word type_at_offset(intptr_t i); }; -class FieldTable : public AllStatic { - public: - static word OffsetOf(const dart::Field& field); -}; - } // namespace target } // namespace compiler } // namespace dart diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h index a16384f22fcaf..45e2059d3c23c 100644 --- a/runtime/vm/compiler/runtime_offsets_extracted.h +++ b/runtime/vm/compiler/runtime_offsets_extracted.h @@ -103,13 +103,14 @@ static constexpr dart::compiler::target::word ExternalTwoByteString_external_data_offset = 12; static constexpr dart::compiler::target::word Float32x4_value_offset = 8; static constexpr dart::compiler::target::word Float64x2_value_offset = 8; -static constexpr dart::compiler::target::word Field_guarded_cid_offset = 44; +static constexpr dart::compiler::target::word Field_guarded_cid_offset = 48; static constexpr dart::compiler::target::word - Field_guarded_list_length_in_object_offset_offset = 52; + Field_guarded_list_length_in_object_offset_offset = 56; static constexpr dart::compiler::target::word Field_guarded_list_length_offset = - 24; -static constexpr dart::compiler::target::word Field_is_nullable_offset = 46; -static constexpr dart::compiler::target::word Field_kind_bits_offset = 60; + 28; +static constexpr dart::compiler::target::word Field_is_nullable_offset = 50; +static constexpr dart::compiler::target::word Field_static_value_offset = 16; +static constexpr dart::compiler::target::word Field_kind_bits_offset = 58; static constexpr dart::compiler::target::word Function_code_offset = 44; static constexpr dart::compiler::target::word Function_entry_point_offset[] = { 4, 8}; @@ -136,7 +137,7 @@ static constexpr dart::compiler::target::word Isolate_current_tag_offset = 20; static constexpr dart::compiler::target::word Isolate_default_tag_offset = 24; static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 28; static constexpr dart::compiler::target::word Isolate_object_store_offset = 36; -static constexpr dart::compiler::target::word Isolate_single_step_offset = 64; +static constexpr dart::compiler::target::word Isolate_single_step_offset = 60; static constexpr dart::compiler::target::word Isolate_user_tag_offset = 16; static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 16; static constexpr dart::compiler::target::word @@ -202,7 +203,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word Thread_allocate_mint_without_fpu_regs_stub_offset = 164; static constexpr dart::compiler::target::word Thread_async_stack_trace_offset = - 92; + 88; static constexpr dart::compiler::target::word Thread_auto_scope_native_wrapper_entry_point_offset = 288; static constexpr dart::compiler::target::word Thread_bool_false_offset = 112; @@ -225,7 +226,7 @@ static constexpr dart::compiler::target::word Thread_double_abs_address_offset = 308; static constexpr dart::compiler::target::word Thread_double_negate_address_offset = 304; -static constexpr dart::compiler::target::word Thread_end_offset = 68; +static constexpr dart::compiler::target::word Thread_end_offset = 64; static constexpr dart::compiler::target::word Thread_enter_safepoint_stub_offset = 204; static constexpr dart::compiler::target::word Thread_execution_state_offset = @@ -257,8 +258,6 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word Thread_invoke_dart_code_stub_offset = 132; static constexpr dart::compiler::target::word Thread_isolate_offset = 52; -static constexpr dart::compiler::target::word Thread_field_table_values_offset = - 56; static constexpr dart::compiler::target::word Thread_lazy_deopt_from_return_stub_offset = 188; static constexpr dart::compiler::target::word @@ -266,7 +265,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word Thread_lazy_specialize_type_test_stub_offset = 200; static constexpr dart::compiler::target::word - Thread_marking_stack_block_offset = 80; + Thread_marking_stack_block_offset = 76; static constexpr dart::compiler::target::word Thread_megamorphic_call_checked_entry_offset = 260; static constexpr dart::compiler::target::word @@ -315,14 +314,14 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 168; static constexpr dart::compiler::target::word Thread_store_buffer_block_offset = - 76; + 72; static constexpr dart::compiler::target::word - Thread_top_exit_frame_info_offset = 72; -static constexpr dart::compiler::target::word Thread_top_offset = 64; + Thread_top_exit_frame_info_offset = 68; +static constexpr dart::compiler::target::word Thread_top_offset = 60; static constexpr dart::compiler::target::word Thread_top_resource_offset = 24; static constexpr dart::compiler::target::word Thread_unboxed_int64_runtime_arg_offset = 96; -static constexpr dart::compiler::target::word Thread_vm_tag_offset = 88; +static constexpr dart::compiler::target::word Thread_vm_tag_offset = 84; static constexpr dart::compiler::target::word Thread_write_barrier_code_offset = 116; static constexpr dart::compiler::target::word @@ -480,13 +479,14 @@ static constexpr dart::compiler::target::word ExternalTwoByteString_external_data_offset = 16; static constexpr dart::compiler::target::word Float32x4_value_offset = 8; static constexpr dart::compiler::target::word Float64x2_value_offset = 8; -static constexpr dart::compiler::target::word Field_guarded_cid_offset = 80; +static constexpr dart::compiler::target::word Field_guarded_cid_offset = 88; static constexpr dart::compiler::target::word - Field_guarded_list_length_in_object_offset_offset = 88; + Field_guarded_list_length_in_object_offset_offset = 96; static constexpr dart::compiler::target::word Field_guarded_list_length_offset = - 48; -static constexpr dart::compiler::target::word Field_is_nullable_offset = 82; -static constexpr dart::compiler::target::word Field_kind_bits_offset = 104; + 56; +static constexpr dart::compiler::target::word Field_is_nullable_offset = 90; +static constexpr dart::compiler::target::word Field_static_value_offset = 32; +static constexpr dart::compiler::target::word Field_kind_bits_offset = 98; static constexpr dart::compiler::target::word Function_code_offset = 88; static constexpr dart::compiler::target::word Function_entry_point_offset[] = { 8, 16}; @@ -513,7 +513,7 @@ static constexpr dart::compiler::target::word Isolate_current_tag_offset = 40; static constexpr dart::compiler::target::word Isolate_default_tag_offset = 48; static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 56; static constexpr dart::compiler::target::word Isolate_object_store_offset = 72; -static constexpr dart::compiler::target::word Isolate_single_step_offset = 128; +static constexpr dart::compiler::target::word Isolate_single_step_offset = 120; static constexpr dart::compiler::target::word Isolate_user_tag_offset = 32; static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 32; static constexpr dart::compiler::target::word @@ -561,153 +561,151 @@ static constexpr dart::compiler::target::word String_hash_offset = 4; static constexpr dart::compiler::target::word String_length_offset = 8; static constexpr dart::compiler::target::word SubtypeTestCache_cache_offset = 8; static constexpr dart::compiler::target::word - Thread_AllocateArray_entry_point_offset = 648; + Thread_AllocateArray_entry_point_offset = 640; static constexpr dart::compiler::target::word Thread_active_exception_offset = - 1336; + 1328; static constexpr dart::compiler::target::word Thread_active_stacktrace_offset = - 1344; + 1336; static constexpr dart::compiler::target::word - Thread_array_write_barrier_code_offset = 232; + Thread_array_write_barrier_code_offset = 224; static constexpr dart::compiler::target::word - Thread_array_write_barrier_entry_point_offset = 432; + Thread_array_write_barrier_entry_point_offset = 424; static constexpr dart::compiler::target::word - Thread_allocate_mint_with_fpu_regs_entry_point_offset = 480; + Thread_allocate_mint_with_fpu_regs_entry_point_offset = 472; static constexpr dart::compiler::target::word - Thread_allocate_mint_with_fpu_regs_stub_offset = 312; + Thread_allocate_mint_with_fpu_regs_stub_offset = 304; static constexpr dart::compiler::target::word - Thread_allocate_mint_without_fpu_regs_entry_point_offset = 488; + Thread_allocate_mint_without_fpu_regs_entry_point_offset = 480; static constexpr dart::compiler::target::word - Thread_allocate_mint_without_fpu_regs_stub_offset = 320; + Thread_allocate_mint_without_fpu_regs_stub_offset = 312; static constexpr dart::compiler::target::word Thread_async_stack_trace_offset = - 184; + 176; static constexpr dart::compiler::target::word - Thread_auto_scope_native_wrapper_entry_point_offset = 568; -static constexpr dart::compiler::target::word Thread_bool_false_offset = 216; -static constexpr dart::compiler::target::word Thread_bool_true_offset = 208; + Thread_auto_scope_native_wrapper_entry_point_offset = 560; +static constexpr dart::compiler::target::word Thread_bool_false_offset = 208; +static constexpr dart::compiler::target::word Thread_bool_true_offset = 200; static constexpr dart::compiler::target::word - Thread_bootstrap_native_wrapper_entry_point_offset = 552; + Thread_bootstrap_native_wrapper_entry_point_offset = 544; static constexpr dart::compiler::target::word - Thread_call_to_runtime_entry_point_offset = 440; + Thread_call_to_runtime_entry_point_offset = 432; static constexpr dart::compiler::target::word - Thread_call_to_runtime_stub_offset = 272; -static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1408; + Thread_call_to_runtime_stub_offset = 264; +static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1400; static constexpr dart::compiler::target::word Thread_optimize_entry_offset = - 528; -static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 352; + 520; +static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 344; static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset = - 536; + 528; static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset = - 360; + 352; static constexpr dart::compiler::target::word Thread_double_abs_address_offset = - 608; + 600; static constexpr dart::compiler::target::word - Thread_double_negate_address_offset = 600; -static constexpr dart::compiler::target::word Thread_end_offset = 136; + Thread_double_negate_address_offset = 592; +static constexpr dart::compiler::target::word Thread_end_offset = 128; static constexpr dart::compiler::target::word - Thread_enter_safepoint_stub_offset = 400; + Thread_enter_safepoint_stub_offset = 392; static constexpr dart::compiler::target::word Thread_execution_state_offset = - 1376; + 1368; static constexpr dart::compiler::target::word - Thread_exit_safepoint_stub_offset = 408; + Thread_exit_safepoint_stub_offset = 400; static constexpr dart::compiler::target::word - Thread_call_native_through_safepoint_stub_offset = 416; + Thread_call_native_through_safepoint_stub_offset = 408; static constexpr dart::compiler::target::word - Thread_call_native_through_safepoint_entry_point_offset = 544; + Thread_call_native_through_safepoint_entry_point_offset = 536; static constexpr dart::compiler::target::word - Thread_fix_allocation_stub_code_offset = 248; + Thread_fix_allocation_stub_code_offset = 240; static constexpr dart::compiler::target::word - Thread_fix_callers_target_code_offset = 240; + Thread_fix_callers_target_code_offset = 232; static constexpr dart::compiler::target::word - Thread_float_absolute_address_offset = 632; + Thread_float_absolute_address_offset = 624; static constexpr dart::compiler::target::word - Thread_float_negate_address_offset = 624; + Thread_float_negate_address_offset = 616; static constexpr dart::compiler::target::word Thread_float_not_address_offset = - 616; + 608; static constexpr dart::compiler::target::word - Thread_float_zerow_address_offset = 640; + Thread_float_zerow_address_offset = 632; static constexpr dart::compiler::target::word Thread_global_object_pool_offset = - 1352; + 1344; static constexpr dart::compiler::target::word - Thread_interpret_call_entry_point_offset = 576; + Thread_interpret_call_entry_point_offset = 568; static constexpr dart::compiler::target::word - Thread_invoke_dart_code_from_bytecode_stub_offset = 264; + Thread_invoke_dart_code_from_bytecode_stub_offset = 256; static constexpr dart::compiler::target::word - Thread_invoke_dart_code_stub_offset = 256; + Thread_invoke_dart_code_stub_offset = 248; static constexpr dart::compiler::target::word Thread_isolate_offset = 104; -static constexpr dart::compiler::target::word Thread_field_table_values_offset = - 112; static constexpr dart::compiler::target::word - Thread_lazy_deopt_from_return_stub_offset = 368; + Thread_lazy_deopt_from_return_stub_offset = 360; static constexpr dart::compiler::target::word - Thread_lazy_deopt_from_throw_stub_offset = 376; + Thread_lazy_deopt_from_throw_stub_offset = 368; static constexpr dart::compiler::target::word - Thread_lazy_specialize_type_test_stub_offset = 392; + Thread_lazy_specialize_type_test_stub_offset = 384; static constexpr dart::compiler::target::word - Thread_marking_stack_block_offset = 160; + Thread_marking_stack_block_offset = 152; static constexpr dart::compiler::target::word - Thread_megamorphic_call_checked_entry_offset = 512; + Thread_megamorphic_call_checked_entry_offset = 504; static constexpr dart::compiler::target::word - Thread_monomorphic_miss_entry_offset = 520; + Thread_monomorphic_miss_entry_offset = 512; static constexpr dart::compiler::target::word - Thread_monomorphic_miss_stub_offset = 344; + Thread_monomorphic_miss_stub_offset = 336; static constexpr dart::compiler::target::word - Thread_no_scope_native_wrapper_entry_point_offset = 560; + Thread_no_scope_native_wrapper_entry_point_offset = 552; static constexpr dart::compiler::target::word - Thread_null_error_shared_with_fpu_regs_entry_point_offset = 456; + Thread_null_error_shared_with_fpu_regs_entry_point_offset = 448; static constexpr dart::compiler::target::word - Thread_null_error_shared_with_fpu_regs_stub_offset = 288; + Thread_null_error_shared_with_fpu_regs_stub_offset = 280; static constexpr dart::compiler::target::word - Thread_null_arg_error_shared_with_fpu_regs_entry_point_offset = 472; + Thread_null_arg_error_shared_with_fpu_regs_entry_point_offset = 464; static constexpr dart::compiler::target::word - Thread_null_arg_error_shared_with_fpu_regs_stub_offset = 304; + Thread_null_arg_error_shared_with_fpu_regs_stub_offset = 296; static constexpr dart::compiler::target::word - Thread_null_error_shared_without_fpu_regs_entry_point_offset = 448; + Thread_null_error_shared_without_fpu_regs_entry_point_offset = 440; static constexpr dart::compiler::target::word - Thread_null_error_shared_without_fpu_regs_stub_offset = 280; + Thread_null_error_shared_without_fpu_regs_stub_offset = 272; static constexpr dart::compiler::target::word - Thread_null_arg_error_shared_without_fpu_regs_entry_point_offset = 464; + Thread_null_arg_error_shared_without_fpu_regs_entry_point_offset = 456; static constexpr dart::compiler::target::word - Thread_null_arg_error_shared_without_fpu_regs_stub_offset = 296; -static constexpr dart::compiler::target::word Thread_object_null_offset = 200; + Thread_null_arg_error_shared_without_fpu_regs_stub_offset = 288; +static constexpr dart::compiler::target::word Thread_object_null_offset = 192; static constexpr dart::compiler::target::word - Thread_predefined_symbols_address_offset = 584; -static constexpr dart::compiler::target::word Thread_resume_pc_offset = 1360; + Thread_predefined_symbols_address_offset = 576; +static constexpr dart::compiler::target::word Thread_resume_pc_offset = 1352; static constexpr dart::compiler::target::word - Thread_saved_shadow_call_stack_offset = 1368; + Thread_saved_shadow_call_stack_offset = 1360; static constexpr dart::compiler::target::word Thread_safepoint_state_offset = - 1384; + 1376; static constexpr dart::compiler::target::word - Thread_slow_type_test_stub_offset = 384; + Thread_slow_type_test_stub_offset = 376; static constexpr dart::compiler::target::word Thread_stack_limit_offset = 72; static constexpr dart::compiler::target::word Thread_saved_stack_limit_offset = 80; static constexpr dart::compiler::target::word Thread_stack_overflow_flags_offset = 88; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 504; + Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 496; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 336; + Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 328; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 496; + Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 488; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 328; + Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 320; static constexpr dart::compiler::target::word Thread_store_buffer_block_offset = - 152; + 144; static constexpr dart::compiler::target::word - Thread_top_exit_frame_info_offset = 144; -static constexpr dart::compiler::target::word Thread_top_offset = 128; + Thread_top_exit_frame_info_offset = 136; +static constexpr dart::compiler::target::word Thread_top_offset = 120; static constexpr dart::compiler::target::word Thread_top_resource_offset = 48; static constexpr dart::compiler::target::word - Thread_unboxed_int64_runtime_arg_offset = 192; -static constexpr dart::compiler::target::word Thread_vm_tag_offset = 176; + Thread_unboxed_int64_runtime_arg_offset = 184; +static constexpr dart::compiler::target::word Thread_vm_tag_offset = 168; static constexpr dart::compiler::target::word Thread_write_barrier_code_offset = - 224; + 216; static constexpr dart::compiler::target::word - Thread_write_barrier_entry_point_offset = 424; + Thread_write_barrier_entry_point_offset = 416; static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset = 96; static constexpr dart::compiler::target::word Thread_callback_code_offset = - 1392; + 1384; static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word TwoByteString_data_offset = 16; @@ -746,8 +744,8 @@ static constexpr dart::compiler::target::word Code_entry_point_offset[] = { 8, 24, 16, 32}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { - 1248, 1256, 1264, 1272, -1, -1, 1280, 1288, - 1296, 1304, 1312, -1, 1320, 1328, -1, -1}; + 1240, 1248, 1256, 1264, -1, -1, 1272, 1280, + 1288, 1296, 1304, -1, 1312, 1320, -1, -1}; static constexpr dart::compiler::target::word Array_header_size = 24; static constexpr dart::compiler::target::word Context_header_size = 24; static constexpr dart::compiler::target::word Double_InstanceSize = 16; @@ -857,13 +855,14 @@ static constexpr dart::compiler::target::word ExternalTwoByteString_external_data_offset = 12; static constexpr dart::compiler::target::word Float32x4_value_offset = 8; static constexpr dart::compiler::target::word Float64x2_value_offset = 8; -static constexpr dart::compiler::target::word Field_guarded_cid_offset = 44; +static constexpr dart::compiler::target::word Field_guarded_cid_offset = 48; static constexpr dart::compiler::target::word - Field_guarded_list_length_in_object_offset_offset = 52; + Field_guarded_list_length_in_object_offset_offset = 56; static constexpr dart::compiler::target::word Field_guarded_list_length_offset = - 24; -static constexpr dart::compiler::target::word Field_is_nullable_offset = 46; -static constexpr dart::compiler::target::word Field_kind_bits_offset = 60; + 28; +static constexpr dart::compiler::target::word Field_is_nullable_offset = 50; +static constexpr dart::compiler::target::word Field_static_value_offset = 16; +static constexpr dart::compiler::target::word Field_kind_bits_offset = 58; static constexpr dart::compiler::target::word Function_code_offset = 44; static constexpr dart::compiler::target::word Function_entry_point_offset[] = { 4, 8}; @@ -890,7 +889,7 @@ static constexpr dart::compiler::target::word Isolate_current_tag_offset = 20; static constexpr dart::compiler::target::word Isolate_default_tag_offset = 24; static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 28; static constexpr dart::compiler::target::word Isolate_object_store_offset = 36; -static constexpr dart::compiler::target::word Isolate_single_step_offset = 64; +static constexpr dart::compiler::target::word Isolate_single_step_offset = 60; static constexpr dart::compiler::target::word Isolate_user_tag_offset = 16; static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 16; static constexpr dart::compiler::target::word @@ -956,7 +955,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word Thread_allocate_mint_without_fpu_regs_stub_offset = 164; static constexpr dart::compiler::target::word Thread_async_stack_trace_offset = - 92; + 88; static constexpr dart::compiler::target::word Thread_auto_scope_native_wrapper_entry_point_offset = 288; static constexpr dart::compiler::target::word Thread_bool_false_offset = 112; @@ -979,7 +978,7 @@ static constexpr dart::compiler::target::word Thread_double_abs_address_offset = 308; static constexpr dart::compiler::target::word Thread_double_negate_address_offset = 304; -static constexpr dart::compiler::target::word Thread_end_offset = 68; +static constexpr dart::compiler::target::word Thread_end_offset = 64; static constexpr dart::compiler::target::word Thread_enter_safepoint_stub_offset = 204; static constexpr dart::compiler::target::word Thread_execution_state_offset = @@ -1011,8 +1010,6 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word Thread_invoke_dart_code_stub_offset = 132; static constexpr dart::compiler::target::word Thread_isolate_offset = 52; -static constexpr dart::compiler::target::word Thread_field_table_values_offset = - 56; static constexpr dart::compiler::target::word Thread_lazy_deopt_from_return_stub_offset = 188; static constexpr dart::compiler::target::word @@ -1020,7 +1017,7 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word Thread_lazy_specialize_type_test_stub_offset = 200; static constexpr dart::compiler::target::word - Thread_marking_stack_block_offset = 80; + Thread_marking_stack_block_offset = 76; static constexpr dart::compiler::target::word Thread_megamorphic_call_checked_entry_offset = 260; static constexpr dart::compiler::target::word @@ -1069,14 +1066,14 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 168; static constexpr dart::compiler::target::word Thread_store_buffer_block_offset = - 76; + 72; static constexpr dart::compiler::target::word - Thread_top_exit_frame_info_offset = 72; -static constexpr dart::compiler::target::word Thread_top_offset = 64; + Thread_top_exit_frame_info_offset = 68; +static constexpr dart::compiler::target::word Thread_top_offset = 60; static constexpr dart::compiler::target::word Thread_top_resource_offset = 24; static constexpr dart::compiler::target::word Thread_unboxed_int64_runtime_arg_offset = 96; -static constexpr dart::compiler::target::word Thread_vm_tag_offset = 88; +static constexpr dart::compiler::target::word Thread_vm_tag_offset = 84; static constexpr dart::compiler::target::word Thread_write_barrier_code_offset = 116; static constexpr dart::compiler::target::word @@ -1230,13 +1227,14 @@ static constexpr dart::compiler::target::word ExternalTwoByteString_external_data_offset = 16; static constexpr dart::compiler::target::word Float32x4_value_offset = 8; static constexpr dart::compiler::target::word Float64x2_value_offset = 8; -static constexpr dart::compiler::target::word Field_guarded_cid_offset = 80; +static constexpr dart::compiler::target::word Field_guarded_cid_offset = 88; static constexpr dart::compiler::target::word - Field_guarded_list_length_in_object_offset_offset = 88; + Field_guarded_list_length_in_object_offset_offset = 96; static constexpr dart::compiler::target::word Field_guarded_list_length_offset = - 48; -static constexpr dart::compiler::target::word Field_is_nullable_offset = 82; -static constexpr dart::compiler::target::word Field_kind_bits_offset = 104; + 56; +static constexpr dart::compiler::target::word Field_is_nullable_offset = 90; +static constexpr dart::compiler::target::word Field_static_value_offset = 32; +static constexpr dart::compiler::target::word Field_kind_bits_offset = 98; static constexpr dart::compiler::target::word Function_code_offset = 88; static constexpr dart::compiler::target::word Function_entry_point_offset[] = { 8, 16}; @@ -1263,7 +1261,7 @@ static constexpr dart::compiler::target::word Isolate_current_tag_offset = 40; static constexpr dart::compiler::target::word Isolate_default_tag_offset = 48; static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 56; static constexpr dart::compiler::target::word Isolate_object_store_offset = 72; -static constexpr dart::compiler::target::word Isolate_single_step_offset = 128; +static constexpr dart::compiler::target::word Isolate_single_step_offset = 120; static constexpr dart::compiler::target::word Isolate_user_tag_offset = 32; static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 32; static constexpr dart::compiler::target::word @@ -1311,153 +1309,151 @@ static constexpr dart::compiler::target::word String_hash_offset = 4; static constexpr dart::compiler::target::word String_length_offset = 8; static constexpr dart::compiler::target::word SubtypeTestCache_cache_offset = 8; static constexpr dart::compiler::target::word - Thread_AllocateArray_entry_point_offset = 648; + Thread_AllocateArray_entry_point_offset = 640; static constexpr dart::compiler::target::word Thread_active_exception_offset = - 1416; + 1408; static constexpr dart::compiler::target::word Thread_active_stacktrace_offset = - 1424; + 1416; static constexpr dart::compiler::target::word - Thread_array_write_barrier_code_offset = 232; + Thread_array_write_barrier_code_offset = 224; static constexpr dart::compiler::target::word - Thread_array_write_barrier_entry_point_offset = 432; + Thread_array_write_barrier_entry_point_offset = 424; static constexpr dart::compiler::target::word - Thread_allocate_mint_with_fpu_regs_entry_point_offset = 480; + Thread_allocate_mint_with_fpu_regs_entry_point_offset = 472; static constexpr dart::compiler::target::word - Thread_allocate_mint_with_fpu_regs_stub_offset = 312; + Thread_allocate_mint_with_fpu_regs_stub_offset = 304; static constexpr dart::compiler::target::word - Thread_allocate_mint_without_fpu_regs_entry_point_offset = 488; + Thread_allocate_mint_without_fpu_regs_entry_point_offset = 480; static constexpr dart::compiler::target::word - Thread_allocate_mint_without_fpu_regs_stub_offset = 320; + Thread_allocate_mint_without_fpu_regs_stub_offset = 312; static constexpr dart::compiler::target::word Thread_async_stack_trace_offset = - 184; + 176; static constexpr dart::compiler::target::word - Thread_auto_scope_native_wrapper_entry_point_offset = 568; -static constexpr dart::compiler::target::word Thread_bool_false_offset = 216; -static constexpr dart::compiler::target::word Thread_bool_true_offset = 208; + Thread_auto_scope_native_wrapper_entry_point_offset = 560; +static constexpr dart::compiler::target::word Thread_bool_false_offset = 208; +static constexpr dart::compiler::target::word Thread_bool_true_offset = 200; static constexpr dart::compiler::target::word - Thread_bootstrap_native_wrapper_entry_point_offset = 552; + Thread_bootstrap_native_wrapper_entry_point_offset = 544; static constexpr dart::compiler::target::word - Thread_call_to_runtime_entry_point_offset = 440; + Thread_call_to_runtime_entry_point_offset = 432; static constexpr dart::compiler::target::word - Thread_call_to_runtime_stub_offset = 272; -static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1488; + Thread_call_to_runtime_stub_offset = 264; +static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1480; static constexpr dart::compiler::target::word Thread_optimize_entry_offset = - 528; -static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 352; + 520; +static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 344; static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset = - 536; + 528; static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset = - 360; + 352; static constexpr dart::compiler::target::word Thread_double_abs_address_offset = - 608; + 600; static constexpr dart::compiler::target::word - Thread_double_negate_address_offset = 600; -static constexpr dart::compiler::target::word Thread_end_offset = 136; + Thread_double_negate_address_offset = 592; +static constexpr dart::compiler::target::word Thread_end_offset = 128; static constexpr dart::compiler::target::word - Thread_enter_safepoint_stub_offset = 400; + Thread_enter_safepoint_stub_offset = 392; static constexpr dart::compiler::target::word Thread_execution_state_offset = - 1456; + 1448; static constexpr dart::compiler::target::word - Thread_exit_safepoint_stub_offset = 408; + Thread_exit_safepoint_stub_offset = 400; static constexpr dart::compiler::target::word - Thread_call_native_through_safepoint_stub_offset = 416; + Thread_call_native_through_safepoint_stub_offset = 408; static constexpr dart::compiler::target::word - Thread_call_native_through_safepoint_entry_point_offset = 544; + Thread_call_native_through_safepoint_entry_point_offset = 536; static constexpr dart::compiler::target::word - Thread_fix_allocation_stub_code_offset = 248; + Thread_fix_allocation_stub_code_offset = 240; static constexpr dart::compiler::target::word - Thread_fix_callers_target_code_offset = 240; + Thread_fix_callers_target_code_offset = 232; static constexpr dart::compiler::target::word - Thread_float_absolute_address_offset = 632; + Thread_float_absolute_address_offset = 624; static constexpr dart::compiler::target::word - Thread_float_negate_address_offset = 624; + Thread_float_negate_address_offset = 616; static constexpr dart::compiler::target::word Thread_float_not_address_offset = - 616; + 608; static constexpr dart::compiler::target::word - Thread_float_zerow_address_offset = 640; + Thread_float_zerow_address_offset = 632; static constexpr dart::compiler::target::word Thread_global_object_pool_offset = - 1432; + 1424; static constexpr dart::compiler::target::word - Thread_interpret_call_entry_point_offset = 576; + Thread_interpret_call_entry_point_offset = 568; static constexpr dart::compiler::target::word - Thread_invoke_dart_code_from_bytecode_stub_offset = 264; + Thread_invoke_dart_code_from_bytecode_stub_offset = 256; static constexpr dart::compiler::target::word - Thread_invoke_dart_code_stub_offset = 256; + Thread_invoke_dart_code_stub_offset = 248; static constexpr dart::compiler::target::word Thread_isolate_offset = 104; -static constexpr dart::compiler::target::word Thread_field_table_values_offset = - 112; static constexpr dart::compiler::target::word - Thread_lazy_deopt_from_return_stub_offset = 368; + Thread_lazy_deopt_from_return_stub_offset = 360; static constexpr dart::compiler::target::word - Thread_lazy_deopt_from_throw_stub_offset = 376; + Thread_lazy_deopt_from_throw_stub_offset = 368; static constexpr dart::compiler::target::word - Thread_lazy_specialize_type_test_stub_offset = 392; + Thread_lazy_specialize_type_test_stub_offset = 384; static constexpr dart::compiler::target::word - Thread_marking_stack_block_offset = 160; + Thread_marking_stack_block_offset = 152; static constexpr dart::compiler::target::word - Thread_megamorphic_call_checked_entry_offset = 512; + Thread_megamorphic_call_checked_entry_offset = 504; static constexpr dart::compiler::target::word - Thread_monomorphic_miss_entry_offset = 520; + Thread_monomorphic_miss_entry_offset = 512; static constexpr dart::compiler::target::word - Thread_monomorphic_miss_stub_offset = 344; + Thread_monomorphic_miss_stub_offset = 336; static constexpr dart::compiler::target::word - Thread_no_scope_native_wrapper_entry_point_offset = 560; + Thread_no_scope_native_wrapper_entry_point_offset = 552; static constexpr dart::compiler::target::word - Thread_null_error_shared_with_fpu_regs_entry_point_offset = 456; + Thread_null_error_shared_with_fpu_regs_entry_point_offset = 448; static constexpr dart::compiler::target::word - Thread_null_error_shared_with_fpu_regs_stub_offset = 288; + Thread_null_error_shared_with_fpu_regs_stub_offset = 280; static constexpr dart::compiler::target::word - Thread_null_arg_error_shared_with_fpu_regs_entry_point_offset = 472; + Thread_null_arg_error_shared_with_fpu_regs_entry_point_offset = 464; static constexpr dart::compiler::target::word - Thread_null_arg_error_shared_with_fpu_regs_stub_offset = 304; + Thread_null_arg_error_shared_with_fpu_regs_stub_offset = 296; static constexpr dart::compiler::target::word - Thread_null_error_shared_without_fpu_regs_entry_point_offset = 448; + Thread_null_error_shared_without_fpu_regs_entry_point_offset = 440; static constexpr dart::compiler::target::word - Thread_null_error_shared_without_fpu_regs_stub_offset = 280; + Thread_null_error_shared_without_fpu_regs_stub_offset = 272; static constexpr dart::compiler::target::word - Thread_null_arg_error_shared_without_fpu_regs_entry_point_offset = 464; + Thread_null_arg_error_shared_without_fpu_regs_entry_point_offset = 456; static constexpr dart::compiler::target::word - Thread_null_arg_error_shared_without_fpu_regs_stub_offset = 296; -static constexpr dart::compiler::target::word Thread_object_null_offset = 200; + Thread_null_arg_error_shared_without_fpu_regs_stub_offset = 288; +static constexpr dart::compiler::target::word Thread_object_null_offset = 192; static constexpr dart::compiler::target::word - Thread_predefined_symbols_address_offset = 584; -static constexpr dart::compiler::target::word Thread_resume_pc_offset = 1440; + Thread_predefined_symbols_address_offset = 576; +static constexpr dart::compiler::target::word Thread_resume_pc_offset = 1432; static constexpr dart::compiler::target::word - Thread_saved_shadow_call_stack_offset = 1448; + Thread_saved_shadow_call_stack_offset = 1440; static constexpr dart::compiler::target::word Thread_safepoint_state_offset = - 1464; + 1456; static constexpr dart::compiler::target::word - Thread_slow_type_test_stub_offset = 384; + Thread_slow_type_test_stub_offset = 376; static constexpr dart::compiler::target::word Thread_stack_limit_offset = 72; static constexpr dart::compiler::target::word Thread_saved_stack_limit_offset = 80; static constexpr dart::compiler::target::word Thread_stack_overflow_flags_offset = 88; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 504; + Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 496; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 336; + Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 328; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 496; + Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 488; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 328; + Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 320; static constexpr dart::compiler::target::word Thread_store_buffer_block_offset = - 152; + 144; static constexpr dart::compiler::target::word - Thread_top_exit_frame_info_offset = 144; -static constexpr dart::compiler::target::word Thread_top_offset = 128; + Thread_top_exit_frame_info_offset = 136; +static constexpr dart::compiler::target::word Thread_top_offset = 120; static constexpr dart::compiler::target::word Thread_top_resource_offset = 48; static constexpr dart::compiler::target::word - Thread_unboxed_int64_runtime_arg_offset = 192; -static constexpr dart::compiler::target::word Thread_vm_tag_offset = 176; + Thread_unboxed_int64_runtime_arg_offset = 184; +static constexpr dart::compiler::target::word Thread_vm_tag_offset = 168; static constexpr dart::compiler::target::word Thread_write_barrier_code_offset = - 224; + 216; static constexpr dart::compiler::target::word - Thread_write_barrier_entry_point_offset = 424; + Thread_write_barrier_entry_point_offset = 416; static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset = 96; static constexpr dart::compiler::target::word Thread_callback_code_offset = - 1472; + 1464; static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word TwoByteString_data_offset = 16; @@ -1496,9 +1492,9 @@ static constexpr dart::compiler::target::word Code_entry_point_offset[] = { 8, 24, 16, 32}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { - 1248, 1256, 1264, 1272, 1280, 1288, 1296, 1304, 1312, 1320, 1328, - 1336, 1344, 1352, 1360, -1, -1, -1, -1, 1368, 1376, 1384, - -1, 1392, 1400, 1408, -1, -1, -1, -1, -1, -1}; + 1240, 1248, 1256, 1264, 1272, 1280, 1288, 1296, 1304, 1312, 1320, + 1328, 1336, 1344, 1352, -1, -1, -1, -1, 1360, 1368, 1376, + -1, 1384, 1392, 1400, -1, -1, -1, -1, -1, -1}; static constexpr dart::compiler::target::word Array_header_size = 24; static constexpr dart::compiler::target::word Context_header_size = 24; static constexpr dart::compiler::target::word Double_InstanceSize = 16; diff --git a/runtime/vm/compiler/runtime_offsets_list.h b/runtime/vm/compiler/runtime_offsets_list.h index 3c243bb21f7b3..294b2e8607bc6 100644 --- a/runtime/vm/compiler/runtime_offsets_list.h +++ b/runtime/vm/compiler/runtime_offsets_list.h @@ -88,6 +88,7 @@ PRECOMP_NO_CHECK(FIELD(Field, guarded_list_length_in_object_offset_offset)) \ PRECOMP_NO_CHECK(FIELD(Field, guarded_list_length_offset)) \ PRECOMP_NO_CHECK(FIELD(Field, is_nullable_offset)) \ + FIELD(Field, static_value_offset) \ PRECOMP_NO_CHECK(FIELD(Field, kind_bits_offset)) \ FIELD(Function, code_offset) \ RANGE(Function, entry_point_offset, CodeEntryKind, CodeEntryKind::kNormal, \ @@ -180,7 +181,6 @@ FIELD(Thread, invoke_dart_code_from_bytecode_stub_offset) \ FIELD(Thread, invoke_dart_code_stub_offset) \ FIELD(Thread, isolate_offset) \ - FIELD(Thread, field_table_values_offset) \ FIELD(Thread, lazy_deopt_from_return_stub_offset) \ FIELD(Thread, lazy_deopt_from_throw_stub_offset) \ FIELD(Thread, lazy_specialize_type_test_stub_offset) \ diff --git a/runtime/vm/field_table.cc b/runtime/vm/field_table.cc deleted file mode 100644 index 5a248c144b988..0000000000000 --- a/runtime/vm/field_table.cc +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -#include "vm/field_table.h" - -#include "platform/atomic.h" -#include "vm/flags.h" -#include "vm/growable_array.h" -#include "vm/heap/heap.h" -#include "vm/object.h" -#include "vm/object_graph.h" -#include "vm/object_store.h" -#include "vm/raw_object.h" -#include "vm/visitor.h" - -namespace dart { - -FieldTable::~FieldTable() { - FreeOldTables(); - delete old_tables_; // Allocated in FieldTable::FieldTable() - free(table_); // Allocated in FieldTable::Grow() -} - -void FieldTable::FreeOldTables() { - while (old_tables_->length() > 0) { - free(old_tables_->RemoveLast()); - } -} - -intptr_t FieldTable::FieldOffsetFor(intptr_t field_id) { - return field_id * sizeof(RawInstance*); // NOLINT -} - -void FieldTable::Register(const Field& field) { - ASSERT(Thread::Current()->IsMutatorThread()); - if (free_head_ < 0) { - if (top_ == capacity_) { - const intptr_t new_capacity = capacity_ + kCapacityIncrement; - Grow(new_capacity); - } - - ASSERT(top_ < capacity_); - - field.set_field_id(top_); - table_[top_] = Object::sentinel().raw(); - - ++top_; - return; - } - - // Reuse existing free element. This is "slow path" that should only be - // triggered after hot reload. - intptr_t reused_free = free_head_; - free_head_ = Smi::Value(Smi::RawCast(table_[free_head_])); - field.set_field_id(reused_free); - table_[reused_free] = Object::sentinel().raw(); -} - -void FieldTable::Free(intptr_t field_id) { - table_[field_id] = Smi::New(free_head_); - free_head_ = field_id; -} - -void FieldTable::SetAt(intptr_t index, RawInstance* raw_instance) { - ASSERT(index < capacity_); - table_[index] = raw_instance; -} - -void FieldTable::AllocateIndex(intptr_t index) { - if (index >= capacity_) { - const intptr_t new_capacity = index + kCapacityIncrement; - Grow(new_capacity); - } - - ASSERT(table_[index] == nullptr); - if (index >= top_) { - top_ = index + 1; - } -} - -void FieldTable::Grow(intptr_t new_capacity) { - ASSERT(new_capacity > capacity_); - - auto new_table = static_cast( - malloc(new_capacity * sizeof(RawInstance*))); // NOLINT - memmove(new_table, table_, top_ * sizeof(RawInstance*)); - memset(new_table + top_, 0, (new_capacity - top_) * sizeof(RawInstance*)); - capacity_ = new_capacity; - old_tables_->Add(table_); - // Ensure that new_table_ is populated before it is published - // via store to table_. - std::atomic_thread_fence(std::memory_order_release); - table_ = new_table; - Thread::Current()->field_table_values_ = table_; -} - -void FieldTable::VisitObjectPointers(ObjectPointerVisitor* visitor) { - ASSERT(visitor != NULL); - visitor->set_gc_root_type("static fields table"); - visitor->VisitPointers(reinterpret_cast(&table_[0]), - reinterpret_cast(&table_[top_ - 1])); - visitor->clear_gc_root_type(); -} - -} // namespace dart diff --git a/runtime/vm/field_table.h b/runtime/vm/field_table.h deleted file mode 100644 index e89c733f2a3d4..0000000000000 --- a/runtime/vm/field_table.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -#ifndef RUNTIME_VM_FIELD_TABLE_H_ -#define RUNTIME_VM_FIELD_TABLE_H_ - -#include "platform/assert.h" -#include "platform/atomic.h" - -#include "vm/bitfield.h" -#include "vm/class_id.h" -#include "vm/globals.h" -#include "vm/growable_array.h" - -namespace dart { - -class Field; -class RawInstance; - -class FieldTable { - public: - FieldTable() - : top_(0), - capacity_(0), - free_head_(-1), - table_(nullptr), - old_tables_(new MallocGrowableArray()) {} - - ~FieldTable(); - - intptr_t NumFieldIds() const { return top_; } - intptr_t Capacity() const { return capacity_; } - - RawInstance** table() { return table_; } - - void FreeOldTables(); - - // Used by the generated code. - static intptr_t FieldOffsetFor(intptr_t field_id); - - bool IsValidIndex(intptr_t index) const { return index >= 0 && index < top_; } - - void Register(const Field& field); - void AllocateIndex(intptr_t index); - - // Static field elements are being freed only during isolate reload - // when initially created static field have to get remapped to point - // to an existing static field value. - void Free(intptr_t index); - - RawInstance* At(intptr_t index) const { - ASSERT(IsValidIndex(index)); - return table_[index]; - } - void SetAt(intptr_t index, RawInstance* raw_instance); - - void VisitObjectPointers(ObjectPointerVisitor* visitor); - - static const int kInitialCapacity = 512; - static const int kCapacityIncrement = 256; - - private: - friend class GCMarker; - friend class MarkingWeakVisitor; - friend class Scavenger; - friend class ScavengerWeakVisitor; - - void Grow(intptr_t new_capacity); - - intptr_t top_; - intptr_t capacity_; - // -1 if free list is empty, otherwise index of first empty element. Empty - // elements are organized into linked list - they contain index of next - // element, last element contains -1. - intptr_t free_head_; - - RawInstance** table_; - // When table_ grows and have to reallocated, keep the old one here - // so it will get freed when its are no longer in use. - MallocGrowableArray* old_tables_; - - DISALLOW_COPY_AND_ASSIGN(FieldTable); -}; - -} // namespace dart - -#endif // RUNTIME_VM_FIELD_TABLE_H_ diff --git a/runtime/vm/heap/pages.cc b/runtime/vm/heap/pages.cc index 6c5a066938d0d..bac1bdd61739b 100644 --- a/runtime/vm/heap/pages.cc +++ b/runtime/vm/heap/pages.cc @@ -1070,7 +1070,6 @@ void PageSpace::CollectGarbageAtSafepoint(bool compact, // Perform various cleanup that relies on no tasks interfering. isolate->class_table()->FreeOldTables(); - isolate->field_table()->FreeOldTables(); NoSafepointScope no_safepoints; diff --git a/runtime/vm/interpreter.cc b/runtime/vm/interpreter.cc index b1ce06c26217b..c0dbaeec7a831 100644 --- a/runtime/vm/interpreter.cc +++ b/runtime/vm/interpreter.cc @@ -2333,7 +2333,7 @@ RawObject* Interpreter::Call(RawFunction* function, BYTECODE(InitLateField, D); RawField* field = RAW_CAST(Field, LOAD_CONSTANT(rD + 1)); RawInstance* instance = reinterpret_cast(SP[0]); - intptr_t offset_in_words = field->ptr()->offset_or_field_id_; + intptr_t offset_in_words = Smi::Value(field->ptr()->value_.offset_); instance->StorePointer( reinterpret_cast(instance->ptr()) + offset_in_words, @@ -2362,16 +2362,14 @@ RawObject* Interpreter::Call(RawFunction* function, BYTECODE(StoreStaticTOS, D); RawField* field = reinterpret_cast(LOAD_CONSTANT(rD)); RawInstance* value = static_cast(*SP--); - intptr_t field_id = field->ptr()->offset_or_field_id_; - thread->field_table_values()[field_id] = value; + field->StorePointer(&field->ptr()->value_.static_value_, value, thread); DISPATCH(); } { BYTECODE(LoadStatic, D); RawField* field = reinterpret_cast(LOAD_CONSTANT(rD)); - intptr_t field_id = field->ptr()->offset_or_field_id_; - RawInstance* value = thread->field_table_values()[field_id]; + RawInstance* value = field->ptr()->value_.static_value_; ASSERT((value != Object::sentinel().raw()) && (value != Object::transition_sentinel().raw())); *++SP = value; @@ -2383,7 +2381,7 @@ RawObject* Interpreter::Call(RawFunction* function, RawField* field = RAW_CAST(Field, LOAD_CONSTANT(rD + 1)); RawInstance* instance = reinterpret_cast(SP[-1]); RawObject* value = reinterpret_cast(SP[0]); - intptr_t offset_in_words = field->ptr()->offset_or_field_id_; + intptr_t offset_in_words = Smi::Value(field->ptr()->value_.offset_); if (InterpreterHelpers::FieldNeedsGuardUpdate(field, value)) { SP[1] = 0; // Unused result of runtime call. @@ -3168,7 +3166,7 @@ RawObject* Interpreter::Call(RawFunction* function, // Field object is cached in function's data_. RawField* field = reinterpret_cast(function->ptr()->data_); - intptr_t offset_in_words = field->ptr()->offset_or_field_id_; + intptr_t offset_in_words = Smi::Value(field->ptr()->value_.offset_); const intptr_t kArgc = 1; RawInstance* instance = @@ -3188,7 +3186,7 @@ RawObject* Interpreter::Call(RawFunction* function, function = FrameFunction(FP); instance = reinterpret_cast(SP[2]); field = reinterpret_cast(SP[3]); - offset_in_words = field->ptr()->offset_or_field_id_; + offset_in_words = Smi::Value(field->ptr()->value_.offset_); value = reinterpret_cast(instance->ptr())[offset_in_words]; } @@ -3249,7 +3247,7 @@ RawObject* Interpreter::Call(RawFunction* function, // Field object is cached in function's data_. RawField* field = reinterpret_cast(function->ptr()->data_); - intptr_t offset_in_words = field->ptr()->offset_or_field_id_; + intptr_t offset_in_words = Smi::Value(field->ptr()->value_.offset_); const intptr_t kArgc = 2; RawInstance* instance = reinterpret_cast(FrameArguments(FP, kArgc)[0]); @@ -3329,8 +3327,7 @@ RawObject* Interpreter::Call(RawFunction* function, // Field object is cached in function's data_. RawField* field = reinterpret_cast(function->ptr()->data_); - intptr_t field_id = field->ptr()->offset_or_field_id_; - RawInstance* value = thread->field_table_values()[field_id]; + RawInstance* value = field->ptr()->value_.static_value_; if (value == Object::sentinel().raw() || value == Object::transition_sentinel().raw()) { SP[1] = 0; // Unused result of invoking the initializer. @@ -3343,8 +3340,7 @@ RawObject* Interpreter::Call(RawFunction* function, function = FrameFunction(FP); field = reinterpret_cast(function->ptr()->data_); // The field is initialized by the runtime call, but not returned. - intptr_t field_id = field->ptr()->offset_or_field_id_; - value = thread->field_table_values()[field_id]; + value = field->ptr()->value_.static_value_; } // Field was initialized. Return its value. diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc index 7bb5bf4c77bf7..da424ebace909 100644 --- a/runtime/vm/isolate.cc +++ b/runtime/vm/isolate.cc @@ -280,7 +280,6 @@ Thread* IsolateGroup::ScheduleThreadLocked(MonitorLocker* ml, // Set up other values and set the TLS value. thread->isolate_ = nullptr; thread->isolate_group_ = this; - thread->field_table_values_ = nullptr; thread->set_os_thread(os_thread); ASSERT(thread->execution_state() == Thread::kThreadInNative); thread->set_execution_state(Thread::kThreadInVM); @@ -528,10 +527,6 @@ void Isolate::ValidateClassTable() { } #endif // DEBUG -void Isolate::RegisterStaticField(const Field& field) { - field_table()->Register(field); -} - void Isolate::RehashConstants() { Thread* thread = Thread::Current(); StackZone stack_zone(thread); @@ -1229,7 +1224,6 @@ Isolate::Isolate(IsolateGroup* isolate_group, ic_miss_code_(Code::null()), shared_class_table_(new SharedClassTable()), class_table_(shared_class_table_.get()), - field_table_(new FieldTable()), store_buffer_(new StoreBuffer()), #if !defined(DART_PRECOMPILED_RUNTIME) native_callback_trampolines_(), @@ -1331,7 +1325,6 @@ Isolate::~Isolate() { delete heap_; ASSERT(marking_stack_ == nullptr); delete object_store_; - delete field_table_; delete api_state_; #if defined(USING_SIMULATOR) delete simulator_; @@ -2314,9 +2307,6 @@ void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, // Visit objects in the class table. class_table()->VisitObjectPointers(visitor); - // Visit objects in the field table. - field_table()->VisitObjectPointers(visitor); - // Visit the dart api state for all local and persistent handles. if (api_state() != nullptr) { api_state()->VisitObjectPointers(visitor); @@ -3287,7 +3277,6 @@ Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) { scheduled_mutator_thread_ = thread; } thread->isolate_ = this; - thread->field_table_values_ = field_table_->table(); ASSERT(heap() != nullptr); thread->heap_ = heap(); @@ -3323,7 +3312,6 @@ void Isolate::UnscheduleThread(Thread* thread, ASSERT(mutator_thread_ == scheduled_mutator_thread_); scheduled_mutator_thread_ = nullptr; } - thread->field_table_values_ = nullptr; group()->UnscheduleThreadLocked(&ml, thread, is_mutator, bypass_safepoint); } diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h index bab82c151d9ac..c8cf0251f79bc 100644 --- a/runtime/vm/isolate.h +++ b/runtime/vm/isolate.h @@ -21,7 +21,6 @@ #include "vm/constants_kbc.h" #include "vm/exceptions.h" #include "vm/ffi_callback_trampolines.h" -#include "vm/field_table.h" #include "vm/fixed_cache.h" #include "vm/growable_array.h" #include "vm/handles.h" @@ -445,8 +444,6 @@ class Isolate : public BaseIsolate, public IntrusiveDListEntry { #if defined(DEBUG) void ValidateClassTable(); #endif - // Register a newly introduced static field. - void RegisterStaticField(const Field& field); void RehashConstants(); #if defined(DEBUG) @@ -481,8 +478,6 @@ class Isolate : public BaseIsolate, public IntrusiveDListEntry { return OFFSET_OF(Isolate, class_table_); } - FieldTable* field_table() const { return field_table_; } - // Prefers old classes when we are in the middle of a reload. RawClass* GetClassForHeapWalkAt(intptr_t cid); intptr_t GetClassSizeForHeapWalkAt(intptr_t cid); @@ -1141,7 +1136,6 @@ class Isolate : public BaseIsolate, public IntrusiveDListEntry { std::unique_ptr shared_class_table_; ObjectStore* object_store_ = nullptr; ClassTable class_table_; - FieldTable* field_table_ = nullptr; bool single_step_ = false; // End accessed from generated code. diff --git a/runtime/vm/isolate_reload_test.cc b/runtime/vm/isolate_reload_test.cc index b69cee3e68b03..79325d844c974 100644 --- a/runtime/vm/isolate_reload_test.cc +++ b/runtime/vm/isolate_reload_test.cc @@ -3752,130 +3752,6 @@ TEST_CASE(IsolateReload_RunNewFieldInitializersWithGenerics) { SimpleInvokeStr(lib, "main")); } -TEST_CASE(IsolateReload_AddNewStaticField) { - const char* kScript = - "class C {\n" - "}\n" - "main() {\n" - " return 'Okay';\n" - "}\n"; - - Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); - EXPECT_VALID(lib); - EXPECT_STREQ("Okay", SimpleInvokeStr(lib, "main")); - - const char* kReloadScript = - "class C {\n" - " static var x = 42;\n" - "}\n" - "main() {\n" - " return '${C.x}';\n" - "}\n"; - - lib = TestCase::ReloadTestScript(kReloadScript); - EXPECT_VALID(lib); - EXPECT_STREQ("42", SimpleInvokeStr(lib, "main")); -} - -TEST_CASE(IsolateReload_StaticFieldInitialValueDoesnotChange) { - const char* kScript = - "class C {\n" - " static var x = 42;\n" - "}\n" - "main() {\n" - " return '${C.x}';\n" - "}\n"; - - Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); - EXPECT_VALID(lib); - EXPECT_STREQ("42", SimpleInvokeStr(lib, "main")); - - const char* kReloadScript = - "class C {\n" - " static var x = 13;\n" - "}\n" - "main() {\n" - " return '${C.x}';\n" - "}\n"; - - lib = TestCase::ReloadTestScript(kReloadScript); - EXPECT_VALID(lib); - // Newly loaded field maintained old static value - EXPECT_STREQ("42", SimpleInvokeStr(lib, "main")); -} - -class FindNoInstancesOfClass : public FindObjectVisitor { - public: - explicit FindNoInstancesOfClass(intptr_t cid) : cid_(cid) { -#if defined(DEBUG) - EXPECT_GT(Thread::Current()->no_safepoint_scope_depth(), 0); -#endif - } - virtual ~FindNoInstancesOfClass() {} - - virtual bool FindObject(RawObject* obj) const { - return obj->GetClassId() == cid_; - } - - private: - intptr_t cid_; -}; - -TEST_CASE(IsolateReload_DeleteStaticField) { - const char* kScript = - "class C {\n" - "}\n" - "class Foo {\n" - "static var x = C();\n" - "}\n" - "main() {\n" - " return Foo.x;\n" - "}\n"; - - Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); - EXPECT_VALID(lib); - intptr_t cid = 1118; - { - Dart_EnterScope(); - Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); - EXPECT_VALID(result); - { - TransitionNativeToVM transition(thread); - cid = Api::ClassId(result); - } - Dart_ExitScope(); - } - - const char* kReloadScript = - "class C {\n" - "}\n" - "class Foo {\n" - "}\n" - "main() {\n" - " return '${Foo()}';\n" - "}\n"; - - lib = TestCase::ReloadTestScript(kReloadScript); - EXPECT_VALID(lib); - Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); - EXPECT_VALID(result); - { - TransitionNativeToVM transition(thread); - GCTestHelper::CollectAllGarbage(); - - { - HeapIterationScope iteration(thread); - NoSafepointScope no_safepoint; - FindNoInstancesOfClass find_only(cid); - Isolate* isolate = Isolate::Current(); - Heap* heap = isolate->heap(); - // We still expect to find references to static field values - // because they are not deleted after hot reload. - EXPECT_NE(heap->FindObject(&find_only), Object::null()); - } - } -} - TEST_CASE(IsolateReload_ExistingFieldChangesType) { const char* kScript = R"( class Foo { diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 0232f49276c83..cb2a275a6c416 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -8883,9 +8883,6 @@ void Field::InitializeNew(const Field& result, result.set_static_type_exactness_state( StaticTypeExactnessState::NotTracking()); Isolate* isolate = Isolate::Current(); - if (is_static) { - isolate->RegisterStaticField(result); - } // Use field guards if they are enabled and the isolate has never reloaded. // TODO(johnmccutchan): The reload case assumes the worst case (everything is @@ -9157,11 +9154,9 @@ bool Field::IsConsistentWith(const Field& other) const { } bool Field::IsUninitialized() const { - Thread* thread = Thread::Current(); - const FieldTable* field_table = thread->isolate()->field_table(); - const RawInstance* raw_value = field_table->At(field_id()); - ASSERT(raw_value != Object::transition_sentinel().raw()); - return raw_value == Object::sentinel().raw(); + const Instance& value = Instance::Handle(raw_ptr()->value_.static_value_); + ASSERT(value.raw() != Object::transition_sentinel().raw()); + return value.raw() == Object::sentinel().raw(); } RawFunction* Field::EnsureInitializerFunction() const { @@ -9432,20 +9427,6 @@ static bool FindInstantiationOf(const Type& type, return false; // Not found. } -void Field::SetStaticValue(const Instance& value, - bool save_initial_value) const { - ASSERT(Thread::Current()->IsMutatorThread()); - ASSERT(is_static()); // Valid only for static dart fields. - Isolate* isolate = Isolate::Current(); - const intptr_t id = field_id(); - isolate->field_table()->SetAt(id, value.raw()); - if (save_initial_value) { -#if !defined(DART_PRECOMPILED_RUNTIME) - StorePointer(&raw_ptr()->saved_initial_value_, value.raw()); -#endif - } -} - static StaticTypeExactnessState TrivialTypeExactnessFor(const Class& cls) { const intptr_t type_arguments_offset = cls.type_arguments_field_offset(); ASSERT(type_arguments_offset != Class::kNoTypeArguments); diff --git a/runtime/vm/object.h b/runtime/vm/object.h index 10cdbf06b325c..e9a55ba33bfa2 100644 --- a/runtime/vm/object.h +++ b/runtime/vm/object.h @@ -3646,11 +3646,8 @@ class Field : public Object { inline void SetOffset(intptr_t offset_in_bytes) const; inline RawInstance* StaticValue() const; - void SetStaticValue(const Instance& value, - bool save_initial_value = false) const; - - intptr_t field_id() const { return raw_ptr()->offset_or_field_id_; } - inline void set_field_id(intptr_t field_id) const; + inline void SetStaticValue(const Instance& value, + bool save_initial_value = false) const; #ifndef DART_PRECOMPILED_RUNTIME RawInstance* saved_initial_value() const { @@ -3698,6 +3695,13 @@ class Field : public Object { // original is specified. RawField* Clone(const Field& original) const; + static intptr_t instance_field_offset() { + return OFFSET_OF(RawField, value_.offset_); + } + static intptr_t static_value_offset() { + return OFFSET_OF(RawField, value_.static_value_); + } + static intptr_t kind_bits_offset() { return OFFSET_OF(RawField, kind_bits_); } TokenPosition token_pos() const { return raw_ptr()->token_pos_; } @@ -4023,7 +4027,6 @@ class Field : public Object { friend class HeapProfiler; friend class RawField; friend class FieldSerializationCluster; - friend class FieldDeserializationCluster; }; class Script : public Object { @@ -10316,24 +10319,32 @@ bool Function::HasBytecode(RawFunction* function) { intptr_t Field::Offset() const { ASSERT(is_instance()); // Valid only for dart instance fields. - return (raw_ptr()->offset_or_field_id_ * kWordSize); + intptr_t value = Smi::Value(raw_ptr()->value_.offset_); + return (value * kWordSize); } void Field::SetOffset(intptr_t offset_in_bytes) const { ASSERT(is_instance()); // Valid only for dart instance fields. ASSERT(kWordSize != 0); - StoreNonPointer(&raw_ptr()->offset_or_field_id_, offset_in_bytes / kWordSize); + StorePointer(&raw_ptr()->value_.offset_, + Smi::New(offset_in_bytes / kWordSize)); } RawInstance* Field::StaticValue() const { ASSERT(is_static()); // Valid only for static dart fields. - return Isolate::Current()->field_table()->At(raw_ptr()->offset_or_field_id_); + return raw_ptr()->value_.static_value_; } -void Field::set_field_id(intptr_t field_id) const { - ASSERT(is_static()); +void Field::SetStaticValue(const Instance& value, + bool save_initial_value) const { ASSERT(Thread::Current()->IsMutatorThread()); - StoreNonPointer(&raw_ptr()->offset_or_field_id_, field_id); + ASSERT(is_static()); // Valid only for static dart fields. + StorePointer(&raw_ptr()->value_.static_value_, value.raw()); + if (save_initial_value) { +#if !defined(DART_PRECOMPILED_RUNTIME) + StorePointer(&raw_ptr()->saved_initial_value_, value.raw()); +#endif + } } #ifndef DART_PRECOMPILED_RUNTIME diff --git a/runtime/vm/object_reload.cc b/runtime/vm/object_reload.cc index afed7443858ac..70f903d461897 100644 --- a/runtime/vm/object_reload.cc +++ b/runtime/vm/object_reload.cc @@ -255,6 +255,7 @@ void Class::CopyStaticFieldValues(IsolateReloadContext* reload_context, Field& field = Field::Handle(); String& name = String::Handle(); + Instance& value = Instance::Handle(); for (intptr_t i = 0; i < field_list.Length(); i++) { field = Field::RawCast(field_list.At(i)); name = field.name(); @@ -268,10 +269,8 @@ void Class::CopyStaticFieldValues(IsolateReloadContext* reload_context, // We only copy values if requested and if the field is not a const // field. We let const fields be updated with a reload. if (update_values && !field.is_const()) { - // Make new field point to the old field value so that both - // old and new code see and update same value. - reload_context->isolate()->field_table()->Free(field.field_id()); - field.set_field_id(old_field.field_id()); + value = old_field.StaticValue(); + field.SetStaticValue(value); } reload_context->AddStaticFieldMapping(old_field, field); } else { diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h index 5cb5956a78d15..4bd351e28e606 100644 --- a/runtime/vm/raw_object.h +++ b/runtime/vm/raw_object.h @@ -1126,11 +1126,17 @@ class RawField : public RawObject { RawObject* owner_; // Class or patch class or mixin class // where this field is defined or original field. RawAbstractType* type_; + union { + RawInstance* static_value_; // Value for static fields. + RawSmi* offset_; // Offset in words for instance fields. + } value_; RawFunction* initializer_function_; // Static initializer function. // When generating APPJIT snapshots after running the application it is // necessary to save the initial value of static fields so that we can // restore the value back to the original initial value. - NOT_IN_PRECOMPILED(RawInstance* saved_initial_value_); // Saved initial value + NOT_IN_PRECOMPILED( + RawInstance* + saved_initial_value_); // Saved initial value - static fields. RawSmi* guarded_list_length_; RawArray* dependent_code_; RawObject** to_snapshot(Snapshot::Kind kind) { @@ -1177,10 +1183,6 @@ class RawField : public RawObject { // field. int8_t static_type_exactness_state_; - // - for instance fields: offset in words to the value in the class instance. - // - for static fields: index into field_table. - intptr_t offset_or_field_id_; - uint16_t kind_bits_; // static, final, const, has initializer.... friend class CidRewriteVisitor; diff --git a/runtime/vm/raw_object_fields.cc b/runtime/vm/raw_object_fields.cc index 8732309fc98b2..761adaa9bbca2 100644 --- a/runtime/vm/raw_object_fields.cc +++ b/runtime/vm/raw_object_fields.cc @@ -214,8 +214,8 @@ namespace dart { F(ICData, receivers_static_type_) \ F(Function, bytecode_) \ F(Function, unoptimized_code_) \ - F(Field, saved_initial_value_) \ - F(Field, type_test_cache_) + F(Field, type_test_cache_) \ + F(Field, saved_initial_value_) OffsetsTable::OffsetsTable(Zone* zone) : cached_offsets_(zone) { for (intptr_t i = 0; offsets_table[i].class_id != -1; ++i) { diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h index a4969ee292877..0adba981c0552 100644 --- a/runtime/vm/thread.h +++ b/runtime/vm/thread.h @@ -36,7 +36,6 @@ class Bytecode; class Error; class ExceptionHandlers; class Field; -class FieldTable; class Function; class GrowableObjectArray; class HandleScope; @@ -385,10 +384,6 @@ class Thread : public ThreadState { // The isolate group that this thread is operating on, or nullptr if none. IsolateGroup* isolate_group() const { return isolate_group_; } - static intptr_t field_table_values_offset() { - return OFFSET_OF(Thread, field_table_values_); - } - bool IsMutatorThread() const; bool CanCollectGarbage() const; @@ -863,7 +858,6 @@ class Thread : public ThreadState { uword stack_overflow_flags_; uword write_barrier_mask_; Isolate* isolate_; - RawInstance** field_table_values_; Heap* heap_; uword top_; uword end_; @@ -945,8 +939,6 @@ class Thread : public ThreadState { intptr_t ffi_marshalled_arguments_size_ = 0; uint64_t* ffi_marshalled_arguments_; - RawInstance** field_table_values() const { return field_table_values_; } - // Reusable handles support. #define REUSABLE_HANDLE_FIELDS(object) object* object##_handle_; REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_FIELDS) @@ -1013,7 +1005,6 @@ class Thread : public ThreadState { friend class ThreadRegistry; friend class CompilerState; friend class compiler::target::Thread; - friend class FieldTable; DISALLOW_COPY_AND_ASSIGN(Thread); }; diff --git a/runtime/vm/vm_sources.gni b/runtime/vm/vm_sources.gni index acc81abcaf27d..1a6c0de171959 100644 --- a/runtime/vm/vm_sources.gni +++ b/runtime/vm/vm_sources.gni @@ -101,8 +101,6 @@ vm_sources = [ "ffi_callback_trampolines.cc", "ffi_callback_trampolines.h", "finalizable_data.h", - "field_table.cc", - "field_table.h", "fixed_cache.h", "flag_list.h", "flags.cc",