fix codex warning

Signed-off-by: hjzhangcm <zhanghaijun20@huawei.com>
This commit is contained in:
hjzhangcm 2022-07-28 11:15:41 +08:00
parent 1ef734da89
commit 76b6ee0329
8 changed files with 15 additions and 14 deletions

View File

@ -96,10 +96,10 @@ size_t ArgumentAccessor::GetFunctionArgIndex(const size_t currentVreg, const boo
void ArgumentAccessor::FillArgsGateType(const TypeRecorder *typeRecorder) void ArgumentAccessor::FillArgsGateType(const TypeRecorder *typeRecorder)
{ {
ASSERT(method_ != nullptr); ASSERT(method_ != nullptr);
const int32_t numOfArgs = method_->GetNumArgs(); const uint32_t numOfArgs = method_->GetNumArgs();
const int32_t offsetArgs = method_->GetNumVregs(); const uint32_t offsetArgs = method_->GetNumVregs();
GateAccessor gateAcc(circuit_); GateAccessor gateAcc(circuit_);
for (int32_t argIndex = 0; argIndex < numOfArgs; argIndex++) { for (uint32_t argIndex = 0; argIndex < numOfArgs; argIndex++) {
auto argType = typeRecorder->GetArgType(argIndex); auto argType = typeRecorder->GetArgType(argIndex);
if (!argType.IsAnyType()) { if (!argType.IsAnyType()) {
auto gate = GetArgGate(offsetArgs + argIndex); auto gate = GetArgGate(offsetArgs + argIndex);

View File

@ -85,7 +85,7 @@ private:
std::string fileName_ = ""; std::string fileName_ = "";
SamplesRecord *generator_ = nullptr; SamplesRecord *generator_ = nullptr;
pthread_t tid_ = 0; pthread_t tid_ = 0;
EcmaVM *vm_; EcmaVM *vm_ = nullptr;
}; };
} // namespace panda::ecmascript } // namespace panda::ecmascript
#endif // ECMASCRIPT_CPU_PROFILE_H #endif // ECMASCRIPT_CPU_PROFILE_H

View File

@ -192,7 +192,7 @@ double MemController::CalculateAverageSpeed(const base::GCRingBuffer<BytesAndDur
return 0; return 0;
} }
double speed = bytes / durations; double speed = bytes / durations;
const int maxSpeed = 1_GB; const int maxSpeed = static_cast<int>(1_GB);
const int minSpeed = 1; const int minSpeed = 1;
if (speed >= maxSpeed) { if (speed >= maxSpeed) {
return maxSpeed; return maxSpeed;

View File

@ -203,11 +203,11 @@ JSTaggedValue TaggedHashArray::SetVal(JSThread *thread, JSHandle<TaggedHashArray
return JSTaggedValue::True(); return JSTaggedValue::True();
} else if (node->IsRBTreeNode()) { } else if (node->IsRBTreeNode()) {
JSHandle<RBTreeNode> root = JSHandle<RBTreeNode>::Cast(node); JSHandle<RBTreeNode> root = JSHandle<RBTreeNode>::Cast(node);
int curCount = root->GetCount(); uint32_t curCount = root->GetCount();
JSHandle<RBTreeNode> changeNode = RBTreeNode::Set(thread, root, hash, key, value); JSHandle<RBTreeNode> changeNode = RBTreeNode::Set(thread, root, hash, key, value);
changeNode->SetIsRed(thread, JSTaggedValue(false)); changeNode->SetIsRed(thread, JSTaggedValue(false));
table->Set(thread, index, changeNode); table->Set(thread, index, changeNode);
int updateCount = changeNode->GetCount(); uint32_t updateCount = changeNode->GetCount();
if (curCount == updateCount) { if (curCount == updateCount) {
return JSTaggedValue::Undefined(); return JSTaggedValue::Undefined();
} }

View File

@ -213,7 +213,7 @@ JSHandle<RBTreeNode> RBTreeNode::Set(JSThread *thread, JSHandle<RBTreeNode> tree
} }
// 1 : root count // 1 : root count
int count = Count(treeNode->GetLeft()) + Count(treeNode->GetRight()) + 1; uint32_t count = Count(treeNode->GetLeft()) + Count(treeNode->GetRight()) + 1;
treeNode->SetCount(count); treeNode->SetCount(count);
return treeNode; return treeNode;
@ -284,7 +284,7 @@ JSTaggedValue RBTreeNode::Balance(JSThread *thread, RBTreeNode *treeNode)
treeNode->FlipColors(thread); treeNode->FlipColors(thread);
} }
// 1 : root count // 1 : root count
int count = Count(treeNode->GetLeft()) + Count(treeNode->GetRight()) + 1; uint32_t count = Count(treeNode->GetLeft()) + Count(treeNode->GetRight()) + 1;
treeNode->SetCount(count); treeNode->SetCount(count);
return JSTaggedValue(treeNode); return JSTaggedValue(treeNode);

View File

@ -66,7 +66,8 @@ public:
int32_t hash = ECMAObject::Cast(key.GetTaggedObject())->GetHash(); int32_t hash = ECMAObject::Cast(key.GetTaggedObject())->GetHash();
if (hash == 0) { if (hash == 0) {
uint64_t keyValue = key.GetRawData(); uint64_t keyValue = key.GetRawData();
hash = GetHash32(reinterpret_cast<uint8_t *>(&keyValue), sizeof(keyValue) / sizeof(uint8_t)); hash = static_cast<int32_t>(GetHash32(reinterpret_cast<uint8_t *>(&keyValue),
sizeof(keyValue) / sizeof(uint8_t)));
ECMAObject::Cast(key.GetTaggedObject())->SetHash(hash); ECMAObject::Cast(key.GetTaggedObject())->SetHash(hash);
} }
return hash; return hash;

View File

@ -35,7 +35,7 @@ public:
// Get chunk's size // Get chunk's size
int GetSize() override int GetSize() override
{ {
const static int fileChunkSize = 10_KB; const static int fileChunkSize = static_cast<int>(10_KB);
return fileChunkSize; return fileChunkSize;
} }
@ -66,7 +66,7 @@ public:
// Get chunk's size // Get chunk's size
int GetSize() override int GetSize() override
{ {
const static int fileChunkSize = 10_KB; const static int fileChunkSize = static_cast<int>(10_KB);
return fileChunkSize; return fileChunkSize;
} }

View File

@ -59,8 +59,8 @@ public:
explicit GlobalTSTypeRef(int moduleId, int localId, TSTypeKind typeKind) : type_(0) explicit GlobalTSTypeRef(int moduleId, int localId, TSTypeKind typeKind) : type_(0)
{ {
SetKind(static_cast<int>(typeKind)); SetKind(static_cast<int>(typeKind));
SetLocalId(localId); SetLocalId(static_cast<uint8_t>(localId));
SetModuleId(moduleId); SetModuleId(static_cast<uint8_t>(moduleId));
} }
~GlobalTSTypeRef() = default; ~GlobalTSTypeRef() = default;