Bug 1698127 - wasm: Make sure parameter declaration names match parameter definition names. r=lth

The autofix algorithm for this rule appears to use the definition parameter
name when there is a mismatch. This seems reasonable to me from glancing at
the results.

Differential Revision: https://phabricator.services.mozilla.com/D108206
This commit is contained in:
Ryan Hunt 2021-03-18 21:27:38 +00:00
Родитель 122cc2c23d
Коммит 09c8e409d1
14 изменённых файлов: 40 добавлений и 41 удалений

Просмотреть файл

@ -1005,8 +1005,8 @@ static char lastAnalysisResult[1024];
namespace js {
namespace wasm {
void ReportSimdAnalysis(const char* v) {
strncpy(lastAnalysisResult, v, sizeof(lastAnalysisResult));
void ReportSimdAnalysis(const char* data) {
strncpy(lastAnalysisResult, data, sizeof(lastAnalysisResult));
lastAnalysisResult[sizeof(lastAnalysisResult) - 1] = 0;
}
} // namespace wasm

Просмотреть файл

@ -3334,7 +3334,7 @@ static bool CheckVariables(FunctionValidatorShared& f, ParseNode** stmtIter) {
}
template <typename Unit>
static bool CheckExpr(FunctionValidator<Unit>& f, ParseNode* op, Type* type);
static bool CheckExpr(FunctionValidator<Unit>& f, ParseNode* expr, Type* type);
template <typename Unit>
static bool CheckNumericLiteral(FunctionValidator<Unit>& f, ParseNode* num,

Просмотреть файл

@ -125,11 +125,11 @@ class TypedObject : public JSObject {
public:
// Creates a new struct typed object initialized to zero.
static TypedObject* createStruct(JSContext* cx, HandleRttValue typeObj,
static TypedObject* createStruct(JSContext* cx, HandleRttValue rtt,
gc::InitialHeap heap = gc::DefaultHeap);
// Creates a new array typed object initialized to zero of specified length.
static TypedObject* createArray(JSContext* cx, HandleRttValue typeObj,
static TypedObject* createArray(JSContext* cx, HandleRttValue rtt,
uint32_t length,
gc::InitialHeap heap = gc::DefaultHeap);
@ -166,7 +166,7 @@ class OutlineTypedObject : public TypedObject {
// Owned data pointer
uint8_t* data_;
static OutlineTypedObject* create(JSContext* cx, HandleRttValue type,
static OutlineTypedObject* create(JSContext* cx, HandleRttValue rtt,
size_t byteLength,
gc::InitialHeap heap = gc::DefaultHeap);
@ -194,7 +194,7 @@ class OutlineTypedObject : public TypedObject {
static gc::AllocKind allocKind();
static void obj_trace(JSTracer* trace, JSObject* object);
static void obj_trace(JSTracer* trc, JSObject* object);
static void obj_finalize(JSFreeOp* fop, JSObject* object);
};
@ -233,7 +233,7 @@ class InlineTypedObject : public TypedObject {
return inlineTypedMem();
}
static void obj_trace(JSTracer* trace, JSObject* object);
static void obj_trace(JSTracer* trc, JSObject* object);
static size_t obj_moved(JSObject* dst, JSObject* src);
static size_t offsetOfDataStart() {

Просмотреть файл

@ -3314,7 +3314,7 @@ class BaseCompiler final : public BaseCompilerInterface {
public:
BaseCompiler(const ModuleEnvironment& moduleEnv,
const CompilerEnvironment& compilerEnv,
const FuncCompileInput& input, const ValTypeVector& locals,
const FuncCompileInput& func, const ValTypeVector& locals,
const MachineState& trapExitLayout,
size_t trapExitLayoutNumWords, Decoder& decoder,
StkVector& stkSource, TempAllocator* alloc, MacroAssembler* masm,
@ -8412,7 +8412,7 @@ class BaseCompiler final : public BaseCompilerInterface {
False
};
[[nodiscard]] bool emitCallArgs(const ValTypeVector& args,
[[nodiscard]] bool emitCallArgs(const ValTypeVector& argTypes,
const StackResultsLoc& results,
FunctionCall* baselineCall,
CalleeOnStack calleeOnStack);

Просмотреть файл

@ -179,7 +179,7 @@ class ModuleSegment : public CodeSegment {
static UniqueModuleSegment create(Tier tier, const Bytes& unlinkedBytes,
const LinkData& linkData);
bool initialize(IsTier2 compileMode, const CodeTier& codeTier,
bool initialize(IsTier2 isTier2, const CodeTier& codeTier,
const LinkData& linkData, const Metadata& metadata,
const MetadataTier& metadataTier);
@ -797,7 +797,7 @@ class Code : public ShareableBase<Code> {
uint8_t* serialize(uint8_t* cursor, const LinkData& linkData) const;
static const uint8_t* deserialize(const uint8_t* cursor,
const LinkData& linkData,
Metadata& metadata, SharedCode* code);
Metadata& metadata, SharedCode* out);
};
void PatchDebugSymbolicAccesses(uint8_t* codeBase, jit::MacroAssembler& masm);

Просмотреть файл

@ -99,7 +99,7 @@ class DebugState {
bool hasBreakpointSite(uint32_t offset);
void destroyBreakpointSite(JSFreeOp* fop, Instance* instance,
uint32_t offset);
void clearBreakpointsIn(JSFreeOp* fp, WasmInstanceObject* instance,
void clearBreakpointsIn(JSFreeOp* fop, WasmInstanceObject* instance,
js::Debugger* dbg, JSObject* handler);
// When the Code is debug-enabled, single-stepping mode can be toggled on

Просмотреть файл

@ -186,10 +186,10 @@ class Instance {
static int32_t wait_i64(Instance* instance, uint32_t byteOffset,
int64_t value, int64_t timeout);
static int32_t wake(Instance* instance, uint32_t byteOffset, int32_t count);
static int32_t memCopy32(Instance* instance, uint32_t destByteOffset,
static int32_t memCopy32(Instance* instance, uint32_t dstByteOffset,
uint32_t srcByteOffset, uint32_t len,
uint8_t* memBase);
static int32_t memCopyShared32(Instance* instance, uint32_t destByteOffset,
static int32_t memCopyShared32(Instance* instance, uint32_t dstByteOffset,
uint32_t srcByteOffset, uint32_t len,
uint8_t* memBase);
static int32_t dataDrop(Instance* instance, uint32_t segIndex);

Просмотреть файл

@ -3359,7 +3359,7 @@ void WasmGlobalObject::finalize(JSFreeOp* fop, JSObject* obj) {
}
/* static */
WasmGlobalObject* WasmGlobalObject::create(JSContext* cx, HandleVal hval,
WasmGlobalObject* WasmGlobalObject::create(JSContext* cx, HandleVal value,
bool isMutable, HandleObject proto) {
AutoSetNewObjectMetadata metadata(cx);
RootedWasmGlobalObject obj(
@ -3371,7 +3371,7 @@ WasmGlobalObject* WasmGlobalObject::create(JSContext* cx, HandleVal hval,
MOZ_ASSERT(obj->isNewborn());
MOZ_ASSERT(obj->isTenured(), "assumed by global.set post barriers");
GCPtrVal* val = js_new<GCPtrVal>(Val(hval.get().type()));
GCPtrVal* val = js_new<GCPtrVal>(Val(value.get().type()));
if (!val) {
ReportOutOfMemory(cx);
return nullptr;
@ -3381,7 +3381,7 @@ WasmGlobalObject* WasmGlobalObject::create(JSContext* cx, HandleVal hval,
// It's simpler to initialize the cell after the object has been created,
// to avoid needing to root the cell before the object creation.
obj->val() = hval.get();
obj->val() = value.get();
MOZ_ASSERT(!obj->isNewborn());

Просмотреть файл

@ -393,7 +393,7 @@ class MOZ_STACK_CLASS OpIter : private Policy {
controlStack_.back().setPolymorphicBase();
}
inline bool checkIsSubtypeOf(ValType lhs, ValType rhs);
inline bool checkIsSubtypeOf(ValType actual, ValType expected);
inline bool checkIsSubtypeOf(ResultType params, ResultType results);
public:
@ -464,7 +464,7 @@ class MOZ_STACK_CLASS OpIter : private Policy {
[[nodiscard]] bool readBrIf(uint32_t* relativeDepth, ResultType* type,
ValueVector* values, Value* condition);
[[nodiscard]] bool readBrTable(Uint32Vector* depths, uint32_t* defaultDepth,
ResultType* defaultBranchValueType,
ResultType* defaultBranchType,
ValueVector* branchValues, Value* index);
#ifdef ENABLE_WASM_EXCEPTIONS
[[nodiscard]] bool readTry(ResultType* type);
@ -511,18 +511,18 @@ class MOZ_STACK_CLASS OpIter : private Policy {
[[nodiscard]] bool readRefAsNonNull(Value* input);
[[nodiscard]] bool readBrOnNull(uint32_t* relativeDepth, ResultType* type,
ValueVector* values, Value* condition);
[[nodiscard]] bool readCall(uint32_t* calleeIndex, ValueVector* argValues);
[[nodiscard]] bool readCall(uint32_t* funcTypeIndex, ValueVector* argValues);
[[nodiscard]] bool readCallIndirect(uint32_t* funcTypeIndex,
uint32_t* tableIndex, Value* callee,
ValueVector* argValues);
[[nodiscard]] bool readOldCallDirect(uint32_t numFuncImports,
uint32_t* funcIndex,
uint32_t* funcTypeIndex,
ValueVector* argValues);
[[nodiscard]] bool readOldCallIndirect(uint32_t* funcTypeIndex, Value* callee,
ValueVector* argValues);
[[nodiscard]] bool readWake(LinearMemoryAddress<Value>* addr, Value* count);
[[nodiscard]] bool readWait(LinearMemoryAddress<Value>* addr,
ValType resultType, uint32_t byteSize,
ValType valueType, uint32_t byteSize,
Value* value, Value* timeout);
[[nodiscard]] bool readFence();
[[nodiscard]] bool readAtomicLoad(LinearMemoryAddress<Value>* addr,
@ -597,7 +597,7 @@ class MOZ_STACK_CLASS OpIter : private Policy {
[[nodiscard]] bool readVectorShift(Value* baseValue, Value* shift);
[[nodiscard]] bool readVectorSelect(Value* v1, Value* v2, Value* controlMask);
[[nodiscard]] bool readVectorShuffle(Value* v1, Value* v2, V128* selectMask);
[[nodiscard]] bool readV128Const(V128* f64);
[[nodiscard]] bool readV128Const(V128* value);
[[nodiscard]] bool readLoadSplat(uint32_t byteSize,
LinearMemoryAddress<Value>* addr);
[[nodiscard]] bool readLoadExtend(LinearMemoryAddress<Value>* addr);
@ -1361,7 +1361,7 @@ inline bool OpIter<Policy>::readBrIf(uint32_t* relativeDepth, ResultType* type,
template <typename Policy>
inline bool OpIter<Policy>::checkBrTableEntry(uint32_t* relativeDepth,
ResultType prevType,
ResultType prevBranchType,
ResultType* type,
ValueVector* branchValues) {
if (!readVarU32(relativeDepth)) {
@ -1375,8 +1375,8 @@ inline bool OpIter<Policy>::checkBrTableEntry(uint32_t* relativeDepth,
*type = block->branchTargetType();
if (prevType != ResultType()) {
if (prevType.length() != type->length()) {
if (prevBranchType != ResultType()) {
if (prevBranchType.length() != type->length()) {
return fail("br_table targets must all have the same arity");
}

Просмотреть файл

@ -257,8 +257,7 @@ extern bool GenerateStubs(const ModuleEnvironment& env,
const FuncExportVector& exports, CompiledCode* code);
extern bool GenerateEntryStubs(jit::MacroAssembler& masm,
size_t funcExportIndex,
const FuncExport& funcExport,
size_t funcExportIndex, const FuncExport& fe,
const Maybe<jit::ImmPtr>& callee, bool isAsmJS,
CodeRangeVector* codeRanges);

Просмотреть файл

@ -58,9 +58,9 @@ class Table : public ShareableBase<Table> {
template <class>
friend struct js::MallocProvider;
Table(JSContext* cx, const TableDesc& td, HandleWasmTableObject maybeObject,
Table(JSContext* cx, const TableDesc& desc, HandleWasmTableObject maybeObject,
UniqueFuncRefArray functions);
Table(JSContext* cx, const TableDesc& td, HandleWasmTableObject maybeObject,
Table(JSContext* cx, const TableDesc& desc, HandleWasmTableObject maybeObject,
TableAnyRefVector&& objects);
void tracePrivate(JSTracer* trc);

Просмотреть файл

@ -521,9 +521,9 @@ WasmValueBox* WasmValueBox::create(JSContext* cx, HandleValue val) {
return obj;
}
bool wasm::BoxAnyRef(JSContext* cx, HandleValue val, MutableHandleAnyRef addr) {
bool wasm::BoxAnyRef(JSContext* cx, HandleValue val, MutableHandleAnyRef result) {
if (val.isNull()) {
addr.set(AnyRef::null());
result.set(AnyRef::null());
return true;
}
@ -531,13 +531,13 @@ bool wasm::BoxAnyRef(JSContext* cx, HandleValue val, MutableHandleAnyRef addr) {
JSObject* obj = &val.toObject();
MOZ_ASSERT(!obj->is<WasmValueBox>());
MOZ_ASSERT(obj->compartment() == cx->compartment());
addr.set(AnyRef::fromJSObject(obj));
result.set(AnyRef::fromJSObject(obj));
return true;
}
WasmValueBox* box = WasmValueBox::create(cx, val);
if (!box) return false;
addr.set(AnyRef::fromJSObject(box));
result.set(AnyRef::fromJSObject(box));
return true;
}

Просмотреть файл

@ -317,12 +317,12 @@ rewind:
return true;
}
bool Decoder::finishNameSubsection(uint32_t expected) {
bool Decoder::finishNameSubsection(uint32_t endOffset) {
uint32_t actual = currentOffset();
if (expected != actual) {
return failf("bad name subsection length (expected: %" PRIu32
if (endOffset != actual) {
return failf("bad name subsection length (endOffset: %" PRIu32
", actual: %" PRIu32 ")",
expected, actual);
endOffset, actual);
}
return true;

Просмотреть файл

@ -981,7 +981,7 @@ class Decoder {
// The local entries are part of function bodies and thus serialized by both
// wasm and asm.js and decoded as part of both validation and compilation.
[[nodiscard]] bool EncodeLocalEntries(Encoder& d, const ValTypeVector& locals);
[[nodiscard]] bool EncodeLocalEntries(Encoder& e, const ValTypeVector& locals);
// This performs no validation; the local entries must already have been
// validated by an earlier pass.
@ -1003,7 +1003,7 @@ class Decoder {
// handle this special case.
[[nodiscard]] bool StartsCodeSection(const uint8_t* begin, const uint8_t* end,
SectionRange* range);
SectionRange* codeSection);
// Calling DecodeModuleEnvironment decodes all sections up to the code section
// and performs full validation of all those sections. The client must then