Skip to content

Commit a64adce

Browse files
committed
simplify getter/setter names
1 parent 0be26f3 commit a64adce

7 files changed

Lines changed: 21 additions & 21 deletions

File tree

src/ir/type-updating.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ GlobalTypeRewriter::TypeMap GlobalTypeRewriter::rebuildTypes(
9090
i = 0;
9191
for (auto [type, _] : typeIndices) {
9292
typeBuilder[i].setOpen(type.isOpen());
93-
typeBuilder[i].setShareability(type.getShareability());
93+
typeBuilder[i].setShared(type.getShared());
9494
if (type.isSignature()) {
9595
auto sig = type.getSignature();
9696
TypeList newParams, newResults;

src/parser/contexts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ struct ParseTypeDefsCtx : TypeParserCtx<ParseTypeDefsCtx> {
11051105

11061106
void setOpen() { builder[index].setOpen(); }
11071107

1108-
void setShared() { builder[index].setShareability(Shared); }
1108+
void setShared() { builder[index].setShared(); }
11091109

11101110
Result<> addSubtype(HeapTypeT super) {
11111111
builder[index].subTypeOf(super);

src/wasm-type.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,9 @@ class HeapType {
381381
bool isString() const;
382382
bool isBottom() const;
383383
bool isOpen() const;
384-
bool isShared() const { return getShareability() == Shared; }
384+
bool isShared() const { return getShared() == Shared; }
385385

386-
Shareability getShareability() const;
386+
Shareability getShared() const;
387387

388388
Signature getSignature() const;
389389
Continuation getContinuation() const;
@@ -407,13 +407,13 @@ class HeapType {
407407
// Get the bottom heap type for this heap type's hierarchy.
408408
BasicHeapType getUnsharedBottom() const;
409409
BasicHeapType getBottom() const {
410-
return HeapType(getUnsharedBottom()).getBasic(getShareability());
410+
return HeapType(getUnsharedBottom()).getBasic(getShared());
411411
}
412412

413413
// Get the top heap type for this heap type's hierarchy.
414414
BasicHeapType getUnsharedTop() const;
415415
BasicHeapType getTop() const {
416-
return HeapType(getUnsharedTop()).getBasic(getShareability());
416+
return HeapType(getUnsharedTop()).getBasic(getShared());
417417
}
418418

419419
// Get the recursion group for this non-basic type.
@@ -658,7 +658,7 @@ struct TypeBuilder {
658658
void createRecGroup(size_t i, size_t length);
659659

660660
void setOpen(size_t i, bool open = true);
661-
void setShareability(size_t i, Shareability share);
661+
void setShared(size_t i, Shareability share = Shared);
662662

663663
enum class ErrorReason {
664664
// There is a cycle in the supertype relation.
@@ -731,8 +731,8 @@ struct TypeBuilder {
731731
builder.setOpen(index, open);
732732
return *this;
733733
}
734-
Entry& setShareability(Shareability share) {
735-
builder.setShareability(index, share);
734+
Entry& setShared(Shareability share = Unshared) {
735+
builder.setShared(index, share);
736736
return *this;
737737
}
738738
};

src/wasm/literal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2689,7 +2689,7 @@ Literal Literal::externalize() const {
26892689
return Literal(std::shared_ptr<GCData>{}, HeapType::noext);
26902690
}
26912691
auto heapType = type.getHeapType();
2692-
auto extType = HeapTypes::ext.getBasic(heapType.getShareability());
2692+
auto extType = HeapTypes::ext.getBasic(heapType.getShared());
26932693
if (heapType.isBasic()) {
26942694
switch (heapType.getBasic(Unshared)) {
26952695
case HeapType::i31: {

src/wasm/wasm-binary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,7 @@ void WasmBinaryReader::readTypes() {
24032403
form = getS32LEB();
24042404
}
24052405
if (form == BinaryConsts::Shared) {
2406-
builder[i].setShareability(Shared);
2406+
builder[i].setShared();
24072407
form = getS32LEB();
24082408
}
24092409
if (form == BinaryConsts::EncodedType::Func) {

src/wasm/wasm-type.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ std::optional<HeapType> getBasicHeapTypeLUB(HeapType::BasicHeapType a,
515515
// Bottom types already handled.
516516
WASM_UNREACHABLE("unexpected basic type");
517517
}
518-
auto share = HeapType(a).getShareability();
518+
auto share = HeapType(a).getShared();
519519
return {lubUnshared.getBasic(share)};
520520
}
521521

@@ -1270,7 +1270,7 @@ bool HeapType::isOpen() const {
12701270
}
12711271
}
12721272

1273-
Shareability HeapType::getShareability() const {
1273+
Shareability HeapType::getShared() const {
12741274
if (isBasic()) {
12751275
return (id & 1) != 0 ? Shared : Unshared;
12761276
} else {
@@ -1315,7 +1315,7 @@ std::optional<HeapType> HeapType::getSuperType() const {
13151315
return ret;
13161316
}
13171317

1318-
auto share = getShareability();
1318+
auto share = getShared();
13191319

13201320
// There may be a basic supertype.
13211321
if (isBasic()) {
@@ -2597,7 +2597,7 @@ void TypeBuilder::setOpen(size_t i, bool open) {
25972597
impl->entries[i].info->isOpen = open;
25982598
}
25992599

2600-
void TypeBuilder::setShareability(size_t i, Shareability share) {
2600+
void TypeBuilder::setShared(size_t i, Shareability share) {
26012601
assert(i < size() && "index out of bounds");
26022602
impl->entries[i].info->share = share;
26032603
}

test/gtest/type-builder.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ TEST_F(TypeTest, InvalidSharedSupertype) {
277277
TypeBuilder builder(2);
278278
builder[0] = Struct{};
279279
builder[1] = Struct{};
280-
builder[0].setShareability(Shared);
281-
builder[1].setShareability(Shared);
280+
builder[0].setShared();
281+
builder[1].setShared();
282282
builder[1].subTypeOf(builder[0]);
283283

284284
auto result = builder.build();
@@ -294,8 +294,8 @@ TEST_F(TypeTest, InvalidUnsharedSupertype) {
294294
TypeBuilder builder(2);
295295
builder[0] = Struct{};
296296
builder[1] = Struct{};
297-
builder[0].setShareability(Unshared);
298-
builder[1].setShareability(Shared);
297+
builder[0].setShared(Unshared);
298+
builder[1].setShared(Shared);
299299
builder[1].subTypeOf(builder[0]);
300300

301301
auto result = builder.build();
@@ -583,8 +583,8 @@ TEST_F(TypeTest, TestHeapTypeRelations) {
583583
TypeBuilder builder(2);
584584
builder[0] = Struct{};
585585
builder[1] = Signature();
586-
builder[0].setShareability(Shared);
587-
builder[1].setShareability(Shared);
586+
builder[0].setShared();
587+
builder[1].setShared();
588588
auto results = builder.build();
589589
ASSERT_TRUE(results);
590590
auto built = *results;

0 commit comments

Comments
 (0)