修改告警

Signed-off-by: hwx1163501 <hanjing35@huawei.com>
issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I9IYYO
This commit is contained in:
hwx1163501 2024-04-24 09:56:45 +08:00
parent 6918621f70
commit 0d2e13ca0d
23 changed files with 44 additions and 39 deletions

View File

@ -906,7 +906,7 @@ JSHandle<JSObject> TypedArrayHelper::TypedArraySpeciesCreate(JSThread *thread, c
if (isCtrUnchanged && isCtrBylen) {
JSType type = obj->GetJSHClass()->GetObjectType();
DataViewType arrayType = GetType(type);
uint32_t length = buffHandle->GetInt();
uint32_t length = static_cast<uint32_t>(buffHandle->GetInt());
// 3. Let result be ? AllocateTypedArray(constructorName, defaultConstructor, length, arrayType).
if constexpr (typedArrayKind == TypedArrayKind::NON_SHARED) {
JSHandle<JSTaggedValue> constructorName = GetConstructorNameFromType(thread, arrayType);

View File

@ -302,12 +302,12 @@ JSTaggedValue BuiltinsArrayBuffer::CloneArrayBuffer(JSThread *thread, const JSHa
if (srcBuffer->IsByteArray()) {
JSHandle<ByteArray> byteArrayBuf(srcBuffer);
srcLen = byteArrayBuf->GetArrayLength();
int32_t byteLen = byteArrayBuf->GetByteLength();
int32_t byteLen = static_cast<int32_t>(byteArrayBuf->GetByteLength());
// 5. Assert: srcByteOffset ≤ srcLength.
ASSERT(srcByteOffset <= srcLen);
// 6. Let cloneLength be (srcLength srcByteOffset) * byteLen.
cloneLen = static_cast<int32_t>(srcLen - srcByteOffset) * byteLen;
srcByteOffset *= byteLen;
srcByteOffset *= static_cast<uint32_t>(byteLen);
} else {
JSHandle<JSArrayBuffer> arrBuf(srcBuffer);
srcLen = arrBuf->GetArrayBufferByteLength();

View File

@ -348,7 +348,7 @@ JSTaggedValue BuiltinsAtomics::AtomicReadModifyWriteCase(JSThread *thread, JSTag
return HandleWithUint32(thread, size, block, indexedPosition, argv, op, tag);
}
case DataViewType::INT32: {
int32_t tag = JSTaggedValue::ToUint32(thread, value);
int32_t tag = static_cast<int32_t>(JSTaggedValue::ToUint32(thread, value));
pointer = BuiltinsArrayBuffer::GetDataPointFromBuffer(arrBufHadle.GetTaggedValue());
block = reinterpret_cast<uint8_t *>(pointer);
return HandleWithInt32(thread, size, block, indexedPosition, argv, op, tag);

View File

@ -52,7 +52,7 @@ static size_t MakeArgListWithHole(JSThread *thread, TaggedArray *argv, int lengt
size_t newlength = static_cast<size_t>(length);
size_t arryLength = argv->GetLength();
if (newlength > arryLength) {
length = arryLength;
length = static_cast<int>(arryLength);
}
for (size_t index = 0; index < newlength; ++index) {
JSTaggedValue value = argv->Get(thread, index);

View File

@ -282,7 +282,7 @@ JSTaggedValue BuiltinsRegExp::RegExpTestFast(JSThread *thread, JSHandle<JSTagged
JSTaggedValue endIndex = globalTable->GetEndIndex();
uint32_t newLastIndex = lastIndex;
if (ifUpdateLastIndex) {
newLastIndex = endIndex.GetInt();
newLastIndex = static_cast<uint32_t>(endIndex.GetInt());
SetLastIndex(thread, regexp, endIndex, true);
}
if (useCache) {
@ -1084,7 +1084,7 @@ JSTaggedValue BuiltinsRegExp::ReplaceInternal(JSThread *thread,
// 14. Let accumulatedResult be the empty String value.
bool isUtf8 = EcmaStringAccessor(srcString).IsUtf8();
uint32_t resultStrLength = 0;
uint32_t resultArrayLength = (resultsIndex + 1) * 2;
uint32_t resultArrayLength = (static_cast<uint32_t>(resultsIndex) + 1) * 2;
JSHandle<TaggedArray> resultArray = factory->NewTaggedArray(resultArrayLength);
std::vector<uint64_t> resultLengthArray(resultArrayLength);
// 15. Let nextSourcePosition be 0.
@ -2029,7 +2029,7 @@ JSTaggedValue BuiltinsRegExp::RegExpBuiltinExec(JSThread *thread, const JSHandle
bool global = GetOringinalFlag(thread, regexp, RegExpParser::FLAG_GLOBAL);
bool sticky = GetOringinalFlag(thread, regexp, RegExpParser::FLAG_STICKY);
if (global || sticky) {
newLastIndex = globalTable->GetEndIndex().GetInt();
newLastIndex = static_cast<uint32_t>(globalTable->GetEndIndex().GetInt());
}
RegExpExecResultCache::AddResultInCache(thread, cacheTable, regexp, inputStr,
JSHandle<JSTaggedValue>(results), RegExpExecResultCache::EXEC_TYPE,

View File

@ -314,12 +314,12 @@ JSTaggedValue BuiltinsSendableArrayBuffer::CloneArrayBuffer(JSThread *thread,
if (srcBuffer->IsByteArray()) {
JSHandle<ByteArray> byteArrayBuf(srcBuffer);
srcLen = byteArrayBuf->GetArrayLength();
int32_t byteLen = byteArrayBuf->GetByteLength();
int32_t byteLen = static_cast<int32_t>(byteArrayBuf->GetByteLength());
// 5. Assert: srcByteOffset ≤ srcLength.
ASSERT(srcByteOffset <= srcLen);
// 6. Let cloneLength be (srcLength srcByteOffset) * byteLen.
cloneLen = static_cast<int32_t>(srcLen - srcByteOffset) * byteLen;
srcByteOffset *= byteLen;
srcByteOffset *= static_cast<uint32_t>(byteLen);
} else {
JSHandle<JSSendableArrayBuffer> arrBuf(srcBuffer);
srcLen = arrBuf->GetArrayBufferByteLength();

View File

@ -2226,7 +2226,7 @@ JSTaggedValue BuiltinsSharedArray::ExtendTo(EcmaRuntimeCallInfo *argv)
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
}
JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
for (uint32_t k = length; k < newLength; k++) {
for (uint32_t k = static_cast<uint32_t>(length); k < newLength; k++) {
key.Update(JSTaggedValue(k));
JSObject::CreateDataPropertyOrThrow(thread, thisObjHandle, key, initValue, SCheckMode::SKIP);
}

View File

@ -402,7 +402,7 @@ JSTaggedValue BuiltinsString::EndsWith(EcmaRuntimeCallInfo *argv)
JSTaggedNumber posVal = JSTaggedValue::ToInteger(thread, posTag);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (posVal.GetNumber() == BuiltinsNumber::POSITIVE_INFINITY) {
pos = thisLen;
pos = static_cast<int32_t>(thisLen);
} else {
pos = posVal.ToInt32();
}

View File

@ -2114,7 +2114,7 @@ bool AArch64CGFunc::LmbcSmallAggForRet(const BaseNode &bNode, const Operand *src
RegOperand &res1 = GetOrCreatePhysicalRegisterOperand(R0, loadSize, kRegTyInt);
SelectCopy(res1, pTy, mem, pTy);
}
if (tySize > static_cast<int32>(k8ByteSize)) {
if (tySize > k8ByteSize) {
int32 newOffset = offset + static_cast<int32>(k8ByteSize);
MemOperand &newMem = CreateMemOpnd(regno, newOffset, size * kBitsPerByte);
RegOperand &res2 = GetOrCreatePhysicalRegisterOperand(R1, loadSize, kRegTyInt);

View File

@ -300,7 +300,8 @@ uint32 AArch64Schedule::ComputeEstart(uint32 cycle)
++schedNum;
}
}
CHECK_FATAL((node->GetPreds().size() - schedNum) == node->GetValidPredsSize(), "validPredsSize error.");
CHECK_FATAL((node->GetPreds().size() - static_cast<uint32>(schedNum)) ==
node->GetValidPredsSize(), "validPredsSize error.");
}
}

View File

@ -888,7 +888,8 @@ int32 X64CGFunc::GetBaseOffset(const SymbolAlloc &symbolAlloc)
memLayout->SizeOfArgsRegisterPassed());
} else if (sgKind == kMsArgsRegPassed) {
/* ArgsReg = baseOffset - ReseverdSlot - ArgsReg */
return baseOffset - GetFunction().GetFrameReseverdSlot() - memLayout->SizeOfArgsRegisterPassed();
return baseOffset - static_cast<int32_t>(GetFunction().GetFrameReseverdSlot()) -
static_cast<int32_t>(memLayout->SizeOfArgsRegisterPassed());
} else if (sgKind == kMsArgsStkPassed) {
return baseOffset + sizeofFplr;
} else {

View File

@ -191,9 +191,10 @@ Mem X64Emitter::TransferMem(Operand *opnd, uint32 funcUniqueId)
if (symbolName.size() > 2 && symbolName[2] == '.') {
string delimiter = "__";
size_t pos = symbolName.find(delimiter);
uint32 itsFuncUniqueId =
pos > 3 ? stoi(symbolName.substr(3, pos)) : 0; /* 3: index starts after ".L." */
uint32 labelIdx = stoi(symbolName.substr(pos + 2, symbolName.length())); /* 2: delimiter.length() */
/* 3: index starts after ".L." */
uint32 itsFuncUniqueId = pos > 3 ? static_cast<uint32>(stoi(symbolName.substr(3, pos))) : 0;
/* 2: delimiter.length() */
uint32 labelIdx = static_cast<uint32_t>(stoi(symbolName.substr(pos + 2, symbolName.length())));
symIdx = CalculateLabelSymIdx(itsFuncUniqueId, labelIdx);
} else {
symIdx = symbol->GetNameStrIdx().get();
@ -1767,7 +1768,8 @@ uint64 X64Emitter::EmitArray(MIRConst &mirConst, CG &cg, bool belongsToDataSec)
DEBUG_ASSERT(false, "should not run here");
}
}
int64 iNum = (arrayType.GetSizeArrayItem(0) > 0) ? (static_cast<int64>(arrayType.GetSizeArrayItem(0))) - uNum : 0;
int64 iNum = (static_cast<int64>(arrayType.GetSizeArrayItem(0)) > 0) ?
(static_cast<int64>(arrayType.GetSizeArrayItem(0))) - static_cast<int64>(uNum) : 0;
if (iNum > 0) {
if (uNum > 0) {
uint64 unInSizeInByte =

View File

@ -34,8 +34,8 @@ void X64GenProEpilog::GenerateCalleeSavedRegs(bool isPush)
}
/* CalleeSave(0) = -(FrameSize + CalleeReg - ArgsStk) */
X64MemLayout *memLayout = static_cast<X64MemLayout *>(cgFunc.GetMemlayout());
int64 offset = -(memLayout->StackFrameSize() + static_cast<X64CGFunc &>(cgFunc).SizeOfCalleeSaved() -
memLayout->SizeOfArgsToStackPass());
int64 offset = -static_cast<int64>((memLayout->StackFrameSize() +
static_cast<X64CGFunc &>(cgFunc).SizeOfCalleeSaved() - memLayout->SizeOfArgsToStackPass()));
RegOperand &baseReg = cgFunc.GetOpndBuilder()->CreatePReg(x64::RBP, k64BitSize, kRegTyInt);
std::vector<std::pair<uint16, int32>> calleeRegAndOffsetVec;
for (const auto &reg : calleeSavedRegs) {

View File

@ -156,11 +156,11 @@ bool LexicalEnvSpecializationPass::SearchStLexVar(GateRef gate, GateRef ldLexVar
bool LexicalEnvSpecializationPass::CheckStLexVar(GateRef gate, GateRef ldldLexVar)
{
int32_t ldLevel = acc_.TryGetValue(acc_.GetValueIn(ldldLexVar, 0));
int32_t ldSlot = acc_.TryGetValue(acc_.GetValueIn(ldldLexVar, 1)); // 1: slot
int32_t ldLevel = static_cast<int32_t>(acc_.TryGetValue(acc_.GetValueIn(ldldLexVar, 0)));
int32_t ldSlot = static_cast<int32_t>(acc_.TryGetValue(acc_.GetValueIn(ldldLexVar, 1))); // 1: slot
int32_t stLevel = acc_.TryGetValue(acc_.GetValueIn(gate, 0));
int32_t stSlot = acc_.TryGetValue(acc_.GetValueIn(gate, 1)); // 1: slot
int32_t stLevel = static_cast<int32_t>(acc_.TryGetValue(acc_.GetValueIn(gate, 0)));
int32_t stSlot = static_cast<int32_t>(acc_.TryGetValue(acc_.GetValueIn(gate, 1))); // 1: slot
if (stSlot != ldSlot) {
return false;
}

View File

@ -72,7 +72,7 @@ void PostSchedule::GenerateExtraBB(ControlFlowGraph &cfg)
bool PostSchedule::VisitHeapAlloc(GateRef gate, ControlFlowGraph &cfg, size_t bbIdx, size_t instIdx)
{
int64_t flag = acc_.TryGetValue(gate);
int64_t flag = static_cast<int64_t>(acc_.TryGetValue(gate));
ASSERT(flag == RegionSpaceFlag::IN_YOUNG_SPACE ||
flag == RegionSpaceFlag::IN_SHARED_OLD_SPACE);
std::vector<GateRef> currentBBGates;

View File

@ -333,7 +333,7 @@ void TypedBytecodeLowering::Lower(GateRef gate)
int32_t TypedBytecodeLowering::GetEcmaOpCodeListIndex(EcmaOpcode ecmaOpCode)
{
std::vector<EcmaOpcode> opcodeList = GetEcmaCodeListForRange();
int32_t index = opcodeList.size();
int32_t index = static_cast<int32_t>(opcodeList.size());
int32_t size = static_cast<int32_t>(opcodeList.size());
for (int32_t i = 0; i < size; i++) {
if (opcodeList[i] == ecmaOpCode) {
@ -506,7 +506,7 @@ void TypedBytecodeLowering::LowerTypedLdObjByName(GateRef gate)
PropertyLookupResult plr = tacc.GetAccessInfo(0).Plr();
GateRef plrGate = builder_.Int32(plr.GetData());
GateRef constpoool = argAcc_.GetFrameArgsIn(gate, FrameArgIdx::CONST_POOL);
size_t holderHClassIndex = tacc.GetAccessInfo(0).HClassIndex();
size_t holderHClassIndex = static_cast<size_t>(tacc.GetAccessInfo(0).HClassIndex());
if (LIKELY(!plr.IsAccessor())) {
result = builder_.MonoLoadPropertyOnProto(receiver, plrGate, constpoool, holderHClassIndex);
} else {
@ -685,7 +685,7 @@ void TypedBytecodeLowering::LowerTypedStObjByName(GateRef gate)
PropertyLookupResult plr = tacc.GetAccessInfo(0).Plr();
GateRef plrGate = builder_.Int32(plr.GetData());
GateRef constpool = argAcc_.GetFrameArgsIn(gate, FrameArgIdx::CONST_POOL);
size_t holderHClassIndex = tacc.GetAccessInfo(0).HClassIndex();
size_t holderHClassIndex = static_cast<size_t>(tacc.GetAccessInfo(0).HClassIndex());
GateRef value = tacc.GetValue();
if (tacc.IsHolderEqNewHolder(0)) {
builder_.MonoStorePropertyLookUpProto(tacc.GetReceiver(), plrGate, constpool, holderHClassIndex, value);

View File

@ -32,7 +32,7 @@ public:
int GetGlobalConstId() const
{
int id = GlobalConstBits::Decode(index_);
int id = static_cast<int>(GlobalConstBits::Decode(index_));
return id - 1;
}
@ -48,7 +48,7 @@ public:
int GetGlobalEnvId() const
{
int id = GlobalEnvBits::Decode(index_);
int id = static_cast<int>(GlobalEnvBits::Decode(index_));
return id - 1;
}
@ -64,7 +64,7 @@ public:
int GetBuiltinEntriesId() const
{
int id = BuiltinEntriesBits::Decode(index_);
int id = static_cast<int>(BuiltinEntriesBits::Decode(index_));
return id - 1;
}

View File

@ -403,7 +403,7 @@ public:
}
}
if (key == "jsHeap") {
heapSize_ = stoi(value) * 1_MB;
heapSize_ = static_cast<size_t>(stoi(value)) * 1_MB;
}
}
}

View File

@ -980,7 +980,7 @@ void SendableClassDefiner::DefineSendableInstanceHClass(JSThread *thread, const
} else {
JSHandle<NameDictionary> baseDict(thread, baseIHClass->GetLayout());
auto baseLength = baseDict->EntriesCount();
auto newLength = fieldNum + baseLength;
auto newLength = fieldNum + static_cast<uint32_t>(baseLength);
JSHandle<NameDictionary> dict =
NameDictionary::CreateInSharedHeap(thread, NameDictionary::ComputeHashTableSize(newLength));
baseDict->Rehash(thread, *dict);

View File

@ -805,7 +805,8 @@ void Heap::CollectGarbage(TriggerGCType gcType, GCReason reason)
if (GetEcmaVM()->IsEnableBaselineJit() || GetEcmaVM()->IsEnableFastJit()) {
// check machine code space if enough
int remainSize = config_.GetDefaultMachineCodeSpaceSize() - GetMachineCodeSpace()->GetHeapObjectSize();
int remainSize = static_cast<int>(config_.GetDefaultMachineCodeSpaceSize()) -
static_cast<int>(GetMachineCodeSpace()->GetHeapObjectSize());
Jit::GetInstance()->CheckMechineCodeSpaceMemory(GetEcmaVM()->GetJSThread(), remainSize);
}
}

View File

@ -80,7 +80,7 @@ JSHandle<TaggedArray> SendableClassModule::CloneModuleEnvironment(JSThread *thre
}
JSHandle<TaggedArray> currentEnvironment(moduleEnvironment);
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
int enumKeys = currentEnvironment->GetLength();
int enumKeys = static_cast<int>(currentEnvironment->GetLength());
JSHandle<TaggedArray> sendableEnvironment = factory->NewSDictionaryArray(enumKeys);
for (int idx = 0; idx < enumKeys; idx++) {
JSTaggedValue key = currentEnvironment->Get(idx);

View File

@ -1228,7 +1228,7 @@ void PGOProfiler::DumpNewObjRange(ApEntityId abcId, const CString &recordName, E
ctorMethodId = slotValue.GetInt();
} else if (slotValue.IsMethod()) {
Method *calleeMethod = Method::Cast(slotValue);
ctorMethodId = calleeMethod->GetMethodId().GetOffset();
ctorMethodId = static_cast<int>(calleeMethod->GetMethodId().GetOffset());
} else {
return;
}

View File

@ -203,8 +203,8 @@ void RuntimeStubs::CopyTypedArrayBuffer(JSTypedArray *srcArray, JSTypedArray *ta
DISALLOW_GARBAGE_COLLECTION;
JSTaggedValue srcBuffer = srcArray->GetViewedArrayBufferOrByteArray();
JSTaggedValue targetBuffer = targetArray->GetViewedArrayBufferOrByteArray();
uint32_t srcByteIndex = srcStartPos * elementSize + srcArray->GetByteOffset();
uint32_t targetByteIndex = tarStartPos * elementSize + targetArray->GetByteOffset();
uint32_t srcByteIndex = static_cast<uint32_t>(srcStartPos * elementSize) + srcArray->GetByteOffset();
uint32_t targetByteIndex = static_cast<uint32_t>(tarStartPos * elementSize) + targetArray->GetByteOffset();
uint8_t *srcBuf = (uint8_t *)builtins::BuiltinsArrayBuffer::GetDataPointFromBuffer(srcBuffer, srcByteIndex);
uint8_t *targetBuf = (uint8_t *)builtins::BuiltinsArrayBuffer::GetDataPointFromBuffer(targetBuffer,
targetByteIndex);