mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
warning fix
Signed-off-by: yangxiaoshuai2022 <yangxiaoshuai@huawei.com>
This commit is contained in:
parent
53b83f4e88
commit
108e4e4e9f
@ -137,6 +137,7 @@ CString procEachCodeInValue(const char *value, CString product)
|
||||
c += 2; // 2 : Skip 2 characters
|
||||
break;
|
||||
}
|
||||
[[fallthrough]];
|
||||
default:
|
||||
product = DefaultValueToQuotedString(*c, product);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ void TimSort::BinarySort(JSThread *thread, JSHandle<TaggedArray> &array,
|
||||
void TimSort::MergeCollapse()
|
||||
{
|
||||
while (pending_.size() > 1) {
|
||||
int n = pending_.size() - 2;
|
||||
int n = static_cast<int>(pending_.size() - 2);
|
||||
if ((n > 0 && pending_[n - 1].len <= pending_[n].len + pending_[n + 1].len) ||
|
||||
(n > 1 && pending_[n - 2].len <= pending_[n - 1].len + pending_[n].len)) { //2: means minus 2
|
||||
if (pending_[n - 1].len < pending_[n + 1].len) {
|
||||
@ -152,7 +152,7 @@ void TimSort::MergeCollapse()
|
||||
void TimSort::MergeForceCollapse()
|
||||
{
|
||||
while (pending_.size() > 1) {
|
||||
int n = pending_.size() - 2;
|
||||
int n = static_cast<int>(pending_.size() - 2);
|
||||
if (n > 0 && pending_[n - 1].len < pending_[n + 1].len) {
|
||||
--n;
|
||||
}
|
||||
@ -162,7 +162,7 @@ void TimSort::MergeForceCollapse()
|
||||
|
||||
void TimSort::MergeAt(int i)
|
||||
{
|
||||
const int stackSize = pending_.size();
|
||||
const int stackSize = static_cast<int>(pending_.size());
|
||||
ASSERT(stackSize >= 2); // 2: stackSize
|
||||
ASSERT(i >= 0);
|
||||
ASSERT(i == stackSize - 2 || i == stackSize - 3); // the 2nd-last and 3rd-last run.
|
||||
|
@ -65,7 +65,7 @@ class TimSort {
|
||||
{
|
||||
int minSize = std::max(requestedSize, 32);
|
||||
if (!tmp_.IsEmpty()) {
|
||||
int currentSize = tmp_->GetLength();
|
||||
int currentSize = static_cast<int>(tmp_->GetLength());
|
||||
if (currentSize >= minSize) {
|
||||
return tmp_;
|
||||
}
|
||||
|
@ -1368,7 +1368,7 @@ std::pair<int32_t, bool> ProcessDigitCapture(const JSHandle<EcmaString> &replace
|
||||
canBeCompress = false;
|
||||
}
|
||||
}
|
||||
return {peekIndex + advance, canBeCompress};
|
||||
return {static_cast<int32_t>(peekIndex) + advance, canBeCompress};
|
||||
}
|
||||
|
||||
// Handle $< case
|
||||
|
@ -1114,7 +1114,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
DISPATCH_OFFSET(offset);
|
||||
}
|
||||
HANDLE_OPCODE(JMP_IMM32) {
|
||||
int32_t offset = READ_INST_32_0();
|
||||
int32_t offset = static_cast<int32_t>(READ_INST_32_0());
|
||||
UPDATE_HOTNESS_COUNTER(offset);
|
||||
LOG_INST() << "jmp " << std::hex << offset;
|
||||
DISPATCH_OFFSET(offset);
|
||||
@ -1144,7 +1144,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
}
|
||||
}
|
||||
HANDLE_OPCODE(JEQZ_IMM32) {
|
||||
int32_t offset = READ_INST_32_0();
|
||||
int32_t offset = static_cast<int32_t>(READ_INST_32_0());
|
||||
LOG_INST() << "jeqz ->\t"
|
||||
<< "cond jmpz " << std::hex << static_cast<int32_t>(offset);
|
||||
if (GET_ACC().IsFalse() || (GET_ACC().IsInt() && GET_ACC().GetInt() == 0) ||
|
||||
@ -1180,7 +1180,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
}
|
||||
}
|
||||
HANDLE_OPCODE(JNEZ_IMM32) {
|
||||
int32_t offset = READ_INST_32_0();
|
||||
int32_t offset = static_cast<int32_t>(READ_INST_32_0());
|
||||
LOG_INST() << "jnez ->\t"
|
||||
<< "cond jmpz " << std::hex << static_cast<int32_t>(offset);
|
||||
if (GET_ACC().IsTrue() || (GET_ACC().IsInt() && GET_ACC().GetInt() != 0) ||
|
||||
@ -1205,7 +1205,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
DISPATCH(STA_V8);
|
||||
}
|
||||
HANDLE_OPCODE(LDAI_IMM32) {
|
||||
int32_t imm = READ_INST_32_0();
|
||||
int32_t imm = static_cast<int32_t>(READ_INST_32_0());
|
||||
LOG_INST() << "ldai " << std::hex << imm;
|
||||
SET_ACC(JSTaggedValue(imm));
|
||||
DISPATCH(LDAI_IMM32);
|
||||
|
@ -94,7 +94,7 @@ EcmaRuntimeCallInfo* EcmaInterpreter::ReBuildRuntimeCallInfo(JSThread *thread, E
|
||||
InterpretedEntryFrame *currentEntryState = InterpretedEntryFrame::GetFrameFromSp(currentSp);
|
||||
JSTaggedType *prevSp = currentEntryState->base.prev;
|
||||
|
||||
int actualArgc = info->GetArgsNumber();
|
||||
int actualArgc = static_cast<int>(info->GetArgsNumber());
|
||||
std::vector<JSTaggedType> args(actualArgc);
|
||||
for (int i = 0; i < actualArgc; i++) {
|
||||
args[i] = info->GetCallArgValue(actualArgc - i - 1).GetRawData();
|
||||
|
@ -671,8 +671,8 @@ std::optional<UCollationResult> TryFastCompareStrings([[maybe_unused]] const icu
|
||||
{
|
||||
processedUntilOut = 0;
|
||||
|
||||
const int length1 = EcmaStringAccessor(string1).GetLength();
|
||||
const int length2 = EcmaStringAccessor(string2).GetLength();
|
||||
const auto length1 = static_cast<int>(EcmaStringAccessor(string1).GetLength());
|
||||
const auto length2 = static_cast<int>(EcmaStringAccessor(string2).GetLength());
|
||||
int commonLength = std::min(length1, length2);
|
||||
|
||||
FastCompareStringsData fastCompareData;
|
||||
@ -711,7 +711,7 @@ icu::StringPiece ToICUStringPiece(const JSHandle<EcmaString>& string, int offset
|
||||
ASSERT(stringAcc.IsUtf8());
|
||||
ASSERT(!stringAcc.IsTreeString());
|
||||
return icu::StringPiece(reinterpret_cast<const char*>(EcmaStringAccessor::GetNonTreeUtf8Data(*string)) + offset,
|
||||
stringAcc.GetLength() - offset);
|
||||
static_cast<int>(stringAcc.GetLength()) - offset);
|
||||
}
|
||||
|
||||
// Convert to a UTF16 string and partially convert to ICUUnicodeString
|
||||
@ -719,13 +719,13 @@ icu::UnicodeString ToICUUnicodeString(const JSHandle<EcmaString> &string, int of
|
||||
{
|
||||
EcmaStringAccessor stringAcc(string);
|
||||
ASSERT(!stringAcc.IsTreeString());
|
||||
uint32_t strLength = stringAcc.GetLength();
|
||||
uint32_t partialLength = strLength - offset;
|
||||
int strLength = static_cast<int>(stringAcc.GetLength());
|
||||
int partialLength = strLength - offset;
|
||||
if (stringAcc.IsUtf8()) {
|
||||
constexpr uint32_t SHORT_STRING_LENGTH = 80;
|
||||
if (partialLength <= SHORT_STRING_LENGTH) {
|
||||
constexpr int shortStringLength = 80; // 80: short string length
|
||||
if (partialLength <= shortStringLength) {
|
||||
// short string on stack
|
||||
UChar shortStringBuffer[SHORT_STRING_LENGTH];
|
||||
UChar shortStringBuffer[shortStringLength];
|
||||
// utf8 is within ascii, std::copy_n from utf8 to utf16 is OK
|
||||
std::copy_n(EcmaStringAccessor::GetNonTreeUtf8Data(*string) + offset, partialLength, shortStringBuffer);
|
||||
return icu::UnicodeString(shortStringBuffer, partialLength);
|
||||
|
@ -2462,6 +2462,9 @@ void Heap::ReleaseEdenAllocator()
|
||||
{
|
||||
auto topAddress = activeSemiSpace_->GetAllocationTopAddress();
|
||||
auto endAddress = activeSemiSpace_->GetAllocationEndAddress();
|
||||
if (!topAddress || !endAddress) {
|
||||
return;
|
||||
}
|
||||
thread_->ReSetNewSpaceAllocationAddress(topAddress, endAddress);
|
||||
}
|
||||
|
||||
@ -2472,6 +2475,9 @@ void Heap::InstallEdenAllocator()
|
||||
}
|
||||
auto topAddress = edenSpace_->GetAllocationTopAddress();
|
||||
auto endAddress = edenSpace_->GetAllocationEndAddress();
|
||||
if (!topAddress || !endAddress) {
|
||||
return;
|
||||
}
|
||||
thread_->ReSetNewSpaceAllocationAddress(topAddress, endAddress);
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ void RegExpParser::ParseDisjunction(bool isBackward)
|
||||
buffer_.PutU8(ptr, RegExpOpCode::OP_SPARSE);
|
||||
buffer_.PutU16(ptr + 1, cnt);
|
||||
ptr += SPARSE_HEAD_OFFSET;
|
||||
for (int32_t i = chars.size() - 1; i >= 0; i--) {
|
||||
for (int32_t i = static_cast<int32_t>(chars.size() - 1); i >= 0; i--) {
|
||||
buffer_.PutU16(ptr, chars[i]);
|
||||
offsets[i] += opCharSize - opSplitSize * std::max(0, cnt - i -2);
|
||||
buffer_.PutU32(ptr + SPARSE_OFF_OFFSET, offsets[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user