Skip to content

Commit

Permalink
[vm,compiler] Cleanup UnboxedConstantInstr::constant_address_
Browse files Browse the repository at this point in the history
TEST=ci

Change-Id: Idfedcef88b1f9c32c32cd1a483300204972e8de6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401900
Commit-Queue: Alexander Markov <[email protected]>
Reviewed-by: Alexander Aprelev <[email protected]>
  • Loading branch information
alexmarkov authored and Commit Queue committed Dec 19, 2024
1 parent 5fd11d3 commit d3ecb22
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 37 deletions.
9 changes: 1 addition & 8 deletions runtime/vm/compiler/backend/il.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1175,14 +1175,7 @@ bool ConstantInstr::AttributesEqual(const Instruction& other) const {

UnboxedConstantInstr::UnboxedConstantInstr(const Object& value,
Representation representation)
: ConstantInstr(value),
representation_(representation),
constant_address_(0) {
if (representation_ == kUnboxedDouble) {
ASSERT(value.IsDouble());
constant_address_ = FindDoubleConstant(Double::Cast(value).value());
}
}
: ConstantInstr(value), representation_(representation) {}

// Returns true if the value represents a constant.
bool Value::BindsToConstant() const {
Expand Down
15 changes: 7 additions & 8 deletions runtime/vm/compiler/backend/il.h
Original file line number Diff line number Diff line change
Expand Up @@ -4409,20 +4409,19 @@ class UnboxedConstantInstr : public ConstantInstr {

virtual Representation representation() const { return representation_; }

// Either nullptr or the address of the unboxed constant.
uword constant_address() const { return constant_address_; }

DECLARE_INSTRUCTION(UnboxedConstant)
DECLARE_CUSTOM_SERIALIZATION(UnboxedConstantInstr)

DECLARE_ATTRIBUTES_NAMED(("value", "representation"),
(&value(), representation()))

private:
const Representation representation_;
uword
constant_address_; // Either nullptr or points to the untagged constant.
#define FIELD_LIST(F) F(const Representation, representation_)

DECLARE_INSTRUCTION_SERIALIZABLE_FIELDS(UnboxedConstantInstr,
ConstantInstr,
FIELD_LIST)
#undef FIELD_LIST

private:
DISALLOW_COPY_AND_ASSIGN(UnboxedConstantInstr);
};

Expand Down
6 changes: 1 addition & 5 deletions runtime/vm/compiler/backend/il_ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,7 @@ LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone,
ASSERT(!is_unboxed_int || RepresentationUtils::ValueSize(representation()) <=
compiler::target::kWordSize);
const intptr_t kNumInputs = 0;
const intptr_t kNumTemps =
(constant_address() == 0) && !is_unboxed_int ? 1 : 0;
const intptr_t kNumTemps = 0;
LocationSummary* locs = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
if (representation() == kUnboxedDouble) {
Expand All @@ -591,9 +590,6 @@ LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone,
ASSERT(is_unboxed_int);
locs->set_out(0, Location::RequiresRegister());
}
if (kNumTemps == 1) {
locs->set_temp(0, Location::RequiresRegister());
}
return locs;
}

Expand Down
16 changes: 0 additions & 16 deletions runtime/vm/compiler/backend/il_serializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2636,22 +2636,6 @@ uint64_t FlowGraphDeserializer::ReadTrait<uint64_t>::Read(
return static_cast<uint64_t>(d->stream()->Read<int64_t>());
}

void UnboxedConstantInstr::WriteTo(FlowGraphSerializer* s) {
ConstantInstr::WriteTo(s);
s->Write<Representation>(representation_);
// constant_address_ is not written - it is restored when reading.
}

UnboxedConstantInstr::UnboxedConstantInstr(FlowGraphDeserializer* d)
: ConstantInstr(d),
representation_(d->Read<Representation>()),
constant_address_(0) {
if (representation_ == kUnboxedDouble) {
ASSERT(value().IsDouble());
constant_address_ = FindDoubleConstant(Double::Cast(value()).value());
}
}

template <>
void FlowGraphSerializer::WriteTrait<Value*>::Write(FlowGraphSerializer* s,
Value* x) {
Expand Down

0 comments on commit d3ecb22

Please sign in to comment.