Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f6acbcd

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
[vm/compiler] Make UnlinkedCall inherit common members from CallSiteDataLayout
Change-Id: I5bf162eeb93d6eac922e8a32df5f9ef9b9539110 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152849 Commit-Queue: Martin Kustermann <[email protected]> Reviewed-by: Alexander Aprelev <[email protected]> Reviewed-by: Ryan Macnak <[email protected]>
1 parent 8afe987 commit f6acbcd

File tree

6 files changed

+42
-53
lines changed

6 files changed

+42
-53
lines changed

runtime/vm/compiler/aot/precompiler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ void Precompiler::AddCalleesOfHelper(const Object& entry,
716716
if (temp_selector->raw() == Symbols::Call().raw()) {
717717
// Potential closure call.
718718
const Array& arguments_descriptor =
719-
Array::Handle(Z, call_site.args_descriptor());
719+
Array::Handle(Z, call_site.arguments_descriptor());
720720
AddClosureCall(arguments_descriptor);
721721
}
722722
} else if (entry.IsMegamorphicCache()) {

runtime/vm/object.cc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14348,14 +14348,6 @@ SingleTargetCachePtr SingleTargetCache::New() {
1434814348
return result.raw();
1434914349
}
1435014350

14351-
void UnlinkedCall::set_target_name(const String& value) const {
14352-
StorePointer(&raw_ptr()->target_name_, value.raw());
14353-
}
14354-
14355-
void UnlinkedCall::set_args_descriptor(const Array& value) const {
14356-
StorePointer(&raw_ptr()->args_descriptor_, value.raw());
14357-
}
14358-
1435914351
void UnlinkedCall::set_can_patch_to_monomorphic(bool value) const {
1436014352
StoreNonPointer(&raw_ptr()->can_patch_to_monomorphic_, value);
1436114353
}
@@ -14366,7 +14358,7 @@ intptr_t UnlinkedCall::Hashcode() const {
1436614358

1436714359
bool UnlinkedCall::Equals(const UnlinkedCall& other) const {
1436814360
return (target_name() == other.target_name()) &&
14369-
(args_descriptor() == other.args_descriptor()) &&
14361+
(arguments_descriptor() == other.arguments_descriptor()) &&
1437014362
(can_patch_to_monomorphic() == other.can_patch_to_monomorphic());
1437114363
}
1437214364

@@ -15311,7 +15303,7 @@ UnlinkedCallPtr ICData::AsUnlinkedCall() const {
1531115303
ASSERT(!is_tracking_exactness());
1531215304
const UnlinkedCall& result = UnlinkedCall::Handle(UnlinkedCall::New());
1531315305
result.set_target_name(String::Handle(target_name()));
15314-
result.set_args_descriptor(Array::Handle(arguments_descriptor()));
15306+
result.set_arguments_descriptor(Array::Handle(arguments_descriptor()));
1531515307
result.set_can_patch_to_monomorphic(!FLAG_precompiled_mode ||
1531615308
receiver_cannot_be_smi());
1531715309
return result.raw();

runtime/vm/object.h

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,36 +1919,9 @@ class MonomorphicSmiableCall : public Object {
19191919
friend class Class;
19201920
};
19211921

1922-
class UnlinkedCall : public Object {
1923-
public:
1924-
StringPtr target_name() const { return raw_ptr()->target_name_; }
1925-
void set_target_name(const String& target_name) const;
1926-
ArrayPtr args_descriptor() const { return raw_ptr()->args_descriptor_; }
1927-
void set_args_descriptor(const Array& args_descriptor) const;
1928-
1929-
bool can_patch_to_monomorphic() const {
1930-
return raw_ptr()->can_patch_to_monomorphic_;
1931-
}
1932-
void set_can_patch_to_monomorphic(bool value) const;
1933-
1934-
static intptr_t InstanceSize() {
1935-
return RoundedAllocationSize(sizeof(UnlinkedCallLayout));
1936-
}
1937-
1938-
intptr_t Hashcode() const;
1939-
bool Equals(const UnlinkedCall& other) const;
1940-
1941-
static UnlinkedCallPtr New();
1942-
1943-
private:
1944-
FINAL_HEAP_OBJECT_IMPLEMENTATION(UnlinkedCall, Object);
1945-
friend class Class;
1946-
};
1947-
19481922
class CallSiteData : public Object {
19491923
public:
19501924
StringPtr target_name() const { return raw_ptr()->target_name_; }
1951-
19521925
ArrayPtr arguments_descriptor() const { return raw_ptr()->args_descriptor_; }
19531926

19541927
static intptr_t target_name_offset() {
@@ -1961,7 +1934,6 @@ class CallSiteData : public Object {
19611934

19621935
private:
19631936
void set_target_name(const String& value) const;
1964-
19651937
void set_arguments_descriptor(const Array& value) const;
19661938

19671939
HEAP_OBJECT_IMPLEMENTATION(CallSiteData, Object)
@@ -1970,6 +1942,30 @@ class CallSiteData : public Object {
19701942
friend class MegamorphicCache;
19711943
};
19721944

1945+
class UnlinkedCall : public CallSiteData {
1946+
public:
1947+
bool can_patch_to_monomorphic() const {
1948+
return raw_ptr()->can_patch_to_monomorphic_;
1949+
}
1950+
1951+
static intptr_t InstanceSize() {
1952+
return RoundedAllocationSize(sizeof(UnlinkedCallLayout));
1953+
}
1954+
1955+
intptr_t Hashcode() const;
1956+
bool Equals(const UnlinkedCall& other) const;
1957+
1958+
static UnlinkedCallPtr New();
1959+
1960+
private:
1961+
friend class ICData; // For set_*() methods.
1962+
1963+
void set_can_patch_to_monomorphic(bool value) const;
1964+
1965+
FINAL_HEAP_OBJECT_IMPLEMENTATION(UnlinkedCall, CallSiteData);
1966+
friend class Class;
1967+
};
1968+
19731969
// Object holding information about an IC: test classes and their
19741970
// corresponding targets. The owner of the ICData can be either the function
19751971
// or the original ICData object. In case of background compilation we

runtime/vm/object_service.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,8 @@ void UnlinkedCall::PrintJSONImpl(JSONStream* stream, bool ref) const {
810810
if (ref) {
811811
return;
812812
}
813-
jsobj.AddProperty("_argumentsDescriptor", Array::Handle(args_descriptor()));
813+
jsobj.AddProperty("_argumentsDescriptor",
814+
Array::Handle(arguments_descriptor()));
814815
}
815816

816817
void MonomorphicSmiableCall::PrintJSONImpl(JSONStream* stream, bool ref) const {

runtime/vm/raw_object.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,16 +1979,6 @@ class SingleTargetCacheLayout : public ObjectLayout {
19791979
classid_t upper_limit_;
19801980
};
19811981

1982-
class UnlinkedCallLayout : public ObjectLayout {
1983-
RAW_HEAP_OBJECT_IMPLEMENTATION(UnlinkedCall);
1984-
VISIT_FROM(ObjectPtr, target_name_);
1985-
StringPtr target_name_;
1986-
ArrayPtr args_descriptor_;
1987-
VISIT_TO(ObjectPtr, args_descriptor_);
1988-
bool can_patch_to_monomorphic_;
1989-
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
1990-
};
1991-
19921982
class MonomorphicSmiableCallLayout : public ObjectLayout {
19931983
RAW_HEAP_OBJECT_IMPLEMENTATION(MonomorphicSmiableCall);
19941984
VISIT_FROM(ObjectPtr, target_);
@@ -2010,6 +2000,15 @@ class CallSiteDataLayout : public ObjectLayout {
20102000
RAW_HEAP_OBJECT_IMPLEMENTATION(CallSiteData)
20112001
};
20122002

2003+
class UnlinkedCallLayout : public CallSiteDataLayout {
2004+
RAW_HEAP_OBJECT_IMPLEMENTATION(UnlinkedCall);
2005+
VISIT_FROM(ObjectPtr, target_name_);
2006+
VISIT_TO(ObjectPtr, args_descriptor_);
2007+
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
2008+
2009+
bool can_patch_to_monomorphic_;
2010+
};
2011+
20132012
class ICDataLayout : public CallSiteDataLayout {
20142013
RAW_HEAP_OBJECT_IMPLEMENTATION(ICData);
20152014
VISIT_FROM(ObjectPtr, target_name_);

runtime/vm/runtime_entry.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,8 @@ class SwitchableCallHandler {
16161616
void SwitchableCallHandler::DoUnlinkedCall(const UnlinkedCall& unlinked,
16171617
const Function& target_function) {
16181618
const String& name = String::Handle(zone_, unlinked.target_name());
1619-
const Array& descriptor = Array::Handle(zone_, unlinked.args_descriptor());
1619+
const Array& descriptor =
1620+
Array::Handle(zone_, unlinked.arguments_descriptor());
16201621
const ICData& ic_data =
16211622
ICData::Handle(zone_, ICData::New(caller_function_, name, descriptor,
16221623
DeoptId::kNone, 1, /* args_tested */
@@ -1975,7 +1976,7 @@ FunctionPtr SwitchableCallHandler::ResolveTargetFunction(const Object& data) {
19751976
#endif // defined(DART_PRECOMPILED_RUNTIME)
19761977

19771978
name_ = unlinked_call.target_name();
1978-
args_descriptor_ = unlinked_call.args_descriptor();
1979+
args_descriptor_ = unlinked_call.arguments_descriptor();
19791980
break;
19801981
}
19811982
case kMonomorphicSmiableCallCid:
@@ -1987,7 +1988,7 @@ FunctionPtr SwitchableCallHandler::ResolveTargetFunction(const Object& data) {
19871988
const auto& unlinked_call = UnlinkedCall::Handle(
19881989
zone_, LoadUnlinkedCall(zone_, isolate_, caller_frame_->pc()));
19891990
name_ = unlinked_call.target_name();
1990-
args_descriptor_ = unlinked_call.args_descriptor();
1991+
args_descriptor_ = unlinked_call.arguments_descriptor();
19911992
break;
19921993
}
19931994
#else

0 commit comments

Comments
 (0)