diff --git a/static_core/compiler/optimizer/code_generator/target/aarch32/target.h b/static_core/compiler/optimizer/code_generator/target/aarch32/target.h index e0ecfbc41cb249e86d2a74825593004482dfd528..9368a7a351f41c51f30df6bb19089cba89bc1ada 100644 --- a/static_core/compiler/optimizer/code_generator/target/aarch32/target.h +++ b/static_core/compiler/optimizer/code_generator/target/aarch32/target.h @@ -40,8 +40,8 @@ const std::array AARCH32_TMP_REG = { vixl::aarch32::r8.GetCode(), vixl::aarch32::r9.GetCode(), vixl::aarch32::r12.GetCode()}; // Temporary vector registers used -const std::array AARCH32_TMP_VREG = {vixl::aarch32::s14.GetCode(), - vixl::aarch32::s15.GetCode()}; +const std::array AARCH32_TMP_VREG = {vixl::aarch32::s30.GetCode(), + vixl::aarch32::s31.GetCode()}; static inline constexpr const uint8_t UNDEF_REG = std::numeric_limits::max(); diff --git a/static_core/compiler/optimizer/ir/instructions.yaml b/static_core/compiler/optimizer/ir/instructions.yaml index 52c4465e93449a469bb74388c626095623411542..d066a8041c16325e39788f69f8331c6b952d8da8 100644 --- a/static_core/compiler/optimizer/ir/instructions.yaml +++ b/static_core/compiler/optimizer/ir/instructions.yaml @@ -1344,7 +1344,7 @@ arch_info: regs_count: 16 temp_regs: [8, 9, 12] fp_regs_count: 32 - fp_temp_regs: [14, 15] + fp_temp_regs: [30, 31] - name: x86_64 regs_count: 16 diff --git a/static_core/compiler/tests/aarch32/callconv32_test.cpp b/static_core/compiler/tests/aarch32/callconv32_test.cpp index a66ada15fda077d2c22f26397206a827335f7969..ba738e742ca02f966540d947d8a0956e43218df7 100644 --- a/static_core/compiler/tests/aarch32/callconv32_test.cpp +++ b/static_core/compiler/tests/aarch32/callconv32_test.cpp @@ -345,4 +345,28 @@ TEST_F(Callconv32Test, NativeParams) BigCheckMixHfloatSfloatSlots(); } + +class Callconv32ParamTypedTest : public Callconv32Test, public testing::WithParamInterface {}; + +TEST_P(Callconv32ParamTypedTest, NativeParamsAndTmpRegs) +{ + // no tmp registers in param registers + auto param_info = GetCallconv()->GetParameterInfo(0); + const auto &target = GetEncoder()->GetTarget(); + auto getTempRegsMaskByType = [&target](Reg ®) { + return reg.IsFloat() ? target.GetTempVRegsMask() : target.GetTempRegsMask(); + }; + + while (true) { + auto ret = param_info->GetNativeParam(GetParam()); + if (!std::holds_alternative(ret)) { + break; + } + auto ® = std::get(ret); + EXPECT_FALSE(getTempRegsMaskByType(reg).Test(reg.GetId())); + } +} + +INSTANTIATE_TEST_SUITE_P(AllTypes, Callconv32ParamTypedTest, + testing::Values(INT8_TYPE, INT16_TYPE, INT32_TYPE, INT64_TYPE, FLOAT32_TYPE, FLOAT64_TYPE)); } // namespace ark::compiler diff --git a/static_core/compiler/tests/aarch64/callconv64_test.cpp b/static_core/compiler/tests/aarch64/callconv64_test.cpp index 2b18237546fbe39b7b130e50cc57a0b05bfa425a..58e6346386a11a1bd5803740d8eefc7fc696b6e5 100644 --- a/static_core/compiler/tests/aarch64/callconv64_test.cpp +++ b/static_core/compiler/tests/aarch64/callconv64_test.cpp @@ -169,4 +169,29 @@ TEST_F(Callconv64Test, NativeFloatParams) } } } + +class Callconv64ParamTypedTest : public Callconv64Test, public testing::WithParamInterface {}; + +TEST_P(Callconv64ParamTypedTest, NativeParamsAndTmpRegs) +{ + // no tmp registers in param registers + auto param_info = GetCallconv()->GetParameterInfo(0); + const auto &target = GetEncoder()->GetTarget(); + auto getTempRegsMaskByType = [&target](Reg ®) { + return reg.IsFloat() ? target.GetTempVRegsMask() : target.GetTempRegsMask(); + }; + + while (true) { + auto ret = param_info->GetNativeParam(GetParam()); + if (!std::holds_alternative(ret)) { + break; + } + auto ® = std::get(ret); + EXPECT_FALSE(getTempRegsMaskByType(reg).Test(reg.GetId())); + } +} + +INSTANTIATE_TEST_SUITE_P(AllTypes, Callconv64ParamTypedTest, + testing::Values(INT8_TYPE, INT16_TYPE, INT32_TYPE, INT64_TYPE, FLOAT32_TYPE, FLOAT64_TYPE)); + } // namespace ark::compiler diff --git a/static_core/compiler/tests/amd64/callconv64_test.cpp b/static_core/compiler/tests/amd64/callconv64_test.cpp index 5a5a8b6126385de0e9f177eca23001a6fdb9add8..80cc68cf148301579ca0708f358ee1ca76b406e8 100644 --- a/static_core/compiler/tests/amd64/callconv64_test.cpp +++ b/static_core/compiler/tests/amd64/callconv64_test.cpp @@ -172,6 +172,30 @@ TEST_F(Callconv64Test, NativeParamsEight) } } } + +class Callconv64ParamTypedTest : public Callconv64Test, public testing::WithParamInterface {}; + +TEST_P(Callconv64ParamTypedTest, NativeParamsAndTmpRegs) +{ + // no tmp registers in param registers + auto param_info = GetCallconv()->GetParameterInfo(0); + const auto &target = GetEncoder()->GetTarget(); + auto getTempRegsMaskByType = [&target](Reg ®) { + return reg.IsFloat() ? target.GetTempVRegsMask() : target.GetTempRegsMask(); + }; + + while (true) { + auto ret = param_info->GetNativeParam(GetParam()); + if (!std::holds_alternative(ret)) { + break; + } + auto ® = std::get(ret); + EXPECT_FALSE(getTempRegsMaskByType(reg).Test(reg.GetId())); + } +} + +INSTANTIATE_TEST_SUITE_P(AllTypes, Callconv64ParamTypedTest, + testing::Values(INT8_TYPE, INT16_TYPE, INT32_TYPE, INT64_TYPE, FLOAT32_TYPE, FLOAT64_TYPE)); // NOLINTEND(readability-magic-numbers) } // namespace ark::compiler diff --git a/static_core/plugins/ets/runtime/ets_libbase_runtime.yaml b/static_core/plugins/ets/runtime/ets_libbase_runtime.yaml index aedf2b472d14bb0610aee5a2a35c2289a5eacd40..6e4635664a6f9db703dea2db1473312b278e906a 100644 --- a/static_core/plugins/ets/runtime/ets_libbase_runtime.yaml +++ b/static_core/plugins/ets/runtime/ets_libbase_runtime.yaml @@ -680,18 +680,18 @@ intrinsics: impl: ark::ets::intrinsics::LoadLibraryWithPermissionCheck ################### -# Escompat.JSON # +# std.core.JSON # ################### - - name: EscompatJSONStringifyFast + - name: StdCoreJSONStringifyFast space: ets - class_name: escompat.JSON + class_name: std.core.JSON method_name: stringifyFast static: true signature: ret: std.core.String args: [ std.core.Object ] - impl: ark::ets::intrinsics::EscompatJSONStringifyFast + impl: ark::ets::intrinsics::StdCoreJSONStringifyFast ################### # std.core.String # @@ -1436,57 +1436,57 @@ intrinsics: impl: ark::ets::intrinsics::StdMathRandom ################# -# escompat.JSON # +# std.core.JSON # ################# - - name: EscompatJSONGetJSONStringifyIgnoreByIdx + - name: StdCoreJSONGetJSONStringifyIgnoreByIdx space: ets - class_name: escompat.JSONAPI + class_name: std.core.JSONAPI method_name: getJSONStringifyIgnoreByIdx static: true signature: ret: u1 args: [ std.core.Class, i64 ] - impl: ark::ets::intrinsics::EscompatJSONGetJSONStringifyIgnoreByIdx + impl: ark::ets::intrinsics::StdCoreJSONGetJSONStringifyIgnoreByIdx - - name: EscompatJSONGetJSONStringifyIgnoreByName + - name: StdCoreJSONGetJSONStringifyIgnoreByName space: ets - class_name: escompat.JSONAPI + class_name: std.core.JSONAPI method_name: getJSONStringifyIgnoreByName static: true signature: ret: u1 args: [ std.core.Class, std.core.String ] - impl: ark::ets::intrinsics::EscompatJSONGetJSONStringifyIgnoreByName + impl: ark::ets::intrinsics::StdCoreJSONGetJSONStringifyIgnoreByName - - name: EscompatJSONGetJSONParseIgnoreFromAnnotation + - name: StdCoreJSONGetJSONParseIgnoreFromAnnotation space: ets - class_name: escompat.JSONAPI + class_name: std.core.JSONAPI method_name: getJSONParseIgnoreFromAnnotation static: true signature: ret: u1 args: [ std.core.Class, i64 ] - impl: ark::ets::intrinsics::EscompatJSONGetJSONParseIgnoreFromAnnotation + impl: ark::ets::intrinsics::StdCoreJSONGetJSONParseIgnoreFromAnnotation - - name: EscompatJSONGetJSONRenameByIdx + - name: StdCoreJSONGetJSONRenameByIdx space: ets - class_name: escompat.JSONAPI + class_name: std.core.JSONAPI method_name: getJSONRenameByIdx static: true signature: ret: std.core.String args: [ std.core.Class, i64 ] - impl: ark::ets::intrinsics::EscompatJSONGetJSONRenameByIdx + impl: ark::ets::intrinsics::StdCoreJSONGetJSONRenameByIdx - - name: EscompatJSONGetJSONRenameByName + - name: StdCoreJSONGetJSONRenameByName space: ets - class_name: escompat.JSONAPI + class_name: std.core.JSONAPI method_name: getJSONRenameByName static: true signature: ret: std.core.String args: [ std.core.Class, std.core.String ] - impl: ark::ets::intrinsics::EscompatJSONGetJSONRenameByName + impl: ark::ets::intrinsics::StdCoreJSONGetJSONRenameByName ################# @@ -4048,6 +4048,17 @@ intrinsics: - i32\[ impl: ark::ets::intrinsics::EtsEscompatBigInt64ArrayOfInt + - name: BigInt64ArrayOfBigInt + space: ets + class_name: escompat.BigInt64Array + method_name: ofBigInt + static: false + signature: + ret: void + args: + - std.core.Object[] + impl: ark::ets::intrinsics::EtsEscompatBigInt64ArrayOfBigInt + - name: BigInt64ArrayOfLong space: ets class_name: escompat.BigInt64Array @@ -4268,6 +4279,17 @@ intrinsics: - i64\[ impl: ark::ets::intrinsics::EtsEscompatBigUint64ArrayOfLong + - name: BigUint64ArrayOfBigInt + space: ets + class_name: escompat.BigUint64Array + method_name: ofBigInt + static: false + signature: + ret: void + args: + - std.core.Object[] + impl: ark::ets::intrinsics::EtsEscompatBigUint64ArrayOfBigInt + - name: Uint8ClampedArrayToUint8Clamped space: ets class_name: escompat.Uint8ClampedArray diff --git a/static_core/plugins/ets/runtime/ets_panda_file_items.h b/static_core/plugins/ets/runtime/ets_panda_file_items.h index abbda9808ceebede77aa42331eff52d3d7e4aeff..90e66d584d756ae8d8dfc92688161a0e6ca7cf20 100644 --- a/static_core/plugins/ets/runtime/ets_panda_file_items.h +++ b/static_core/plugins/ets/runtime/ets_panda_file_items.h @@ -213,7 +213,7 @@ static constexpr std::string_view INTEROP_DYNAMIC_FUNCTION = "Lstd/i static constexpr std::string_view ARRAY = "Lescompat/Array;"; static constexpr std::string_view ARRAY_AS_LIST_INT = "Lstd/containers/containers/ArrayAsListInt;"; static constexpr std::string_view REG_EXP_EXEC_ARRAY = "Lescompat/RegExpExecArray;"; -static constexpr std::string_view JSON_REPLACER = "Lescompat/JsonReplacer;"; +static constexpr std::string_view JSON_REPLACER = "Lstd/core/JsonReplacer;"; // ANI annotation classes static constexpr std::string_view ANI_UNSAFE_QUICK = "Lstd/annotations/ani/unsafe/Quick;"; @@ -253,9 +253,9 @@ static constexpr std::string_view BIG_INT64_ARRAY = "Lescom static constexpr std::string_view BIG_UINT64_ARRAY = "Lescompat/BigUint64Array;"; // Json Annotations -static constexpr std::string_view JSON_STRINGIFY_IGNORE = "Lescompat/JSONStringifyIgnore;"; -static constexpr std::string_view JSON_PARSE_IGNORE = "Lescompat/JSONParseIgnore;"; -static constexpr std::string_view JSON_RENAME = "Lescompat/JSONRename;"; +static constexpr std::string_view JSON_STRINGIFY_IGNORE = "Lstd/core/JSONStringifyIgnore;"; +static constexpr std::string_view JSON_PARSE_IGNORE = "Lstd/core/JSONParseIgnore;"; +static constexpr std::string_view JSON_RENAME = "Lstd/core/JSONRename;"; // Annotation for optional parameters static constexpr std::string_view OPTIONAL_PARAMETERS_ANNOTATION = diff --git a/static_core/plugins/ets/runtime/ets_vm.cpp b/static_core/plugins/ets/runtime/ets_vm.cpp index 7e8b0b6cc7f1c492faad229694e9bc164e51fbbc..005f8d9d7897713b6d29cba74cad33705c56b43d 100644 --- a/static_core/plugins/ets/runtime/ets_vm.cpp +++ b/static_core/plugins/ets/runtime/ets_vm.cpp @@ -789,8 +789,8 @@ void PandaEtsVM::UpdateVmRefs(const GCRootUpdater &gcRootUpdater) } } -void PandaEtsVM::RegisterFinalizerForObject(EtsCoroutine *coro, const EtsHandle &object, - void (*finalizer)(void *), void *finalizerArg) +EtsFinalizableWeakRef *PandaEtsVM::RegisterFinalizerForObject(EtsCoroutine *coro, const EtsHandle &object, + void (*finalizer)(void *), void *finalizerArg) { ASSERT_MANAGED_CODE(); auto *weakRef = EtsFinalizableWeakRef::Create(coro); @@ -801,6 +801,16 @@ void PandaEtsVM::RegisterFinalizerForObject(EtsCoroutine *coro, const EtsHandle< os::memory::LockHolder lh(finalizableWeakRefListLock_); ASSERT(weakRefList != nullptr); weakRefList->Push(coro, weakRef); + return weakRef; +} + +bool PandaEtsVM::UnregisterFinalizerForObject(EtsCoroutine *coro, EtsFinalizableWeakRef *weakRef) +{ + auto *coreList = GetGlobalObjectStorage()->Get(finalizableWeakRefList_); + auto *weakRefList = EtsFinalizableWeakRefList::FromCoreType(coreList); + os::memory::LockHolder lh(finalizableWeakRefListLock_); + ASSERT(weakRefList != nullptr); + return weakRefList->Unlink(coro, weakRef); } void PandaEtsVM::CleanFinalizableReferenceList() diff --git a/static_core/plugins/ets/runtime/ets_vm.h b/static_core/plugins/ets/runtime/ets_vm.h index c2fe8a2330584e1807dca093c7a43b3513b2c40e..c402b6b0610ff0b4cd1c094dd2a06ca5b0f85ba7 100644 --- a/static_core/plugins/ets/runtime/ets_vm.h +++ b/static_core/plugins/ets/runtime/ets_vm.h @@ -338,8 +338,10 @@ public: return MEMBER_OFFSET(PandaEtsVM, doubleToStringCache_); } - void RegisterFinalizerForObject(EtsCoroutine *coro, const EtsHandle &object, void (*finalizer)(void *), - void *finalizerArg); + EtsFinalizableWeakRef *RegisterFinalizerForObject(EtsCoroutine *coro, const EtsHandle &object, + void (*finalizer)(void *), void *finalizerArg); + + bool UnregisterFinalizerForObject(EtsCoroutine *coro, EtsFinalizableWeakRef *object); void CleanFinalizableReferenceList(); diff --git a/static_core/plugins/ets/runtime/interop_js/intrinsics/std_js_jsruntime.yaml b/static_core/plugins/ets/runtime/interop_js/intrinsics/std_js_jsruntime.yaml index 55c75c3d92fb542b2182c6f37ad060a6d29579d7..6a6ddd80380c0fc20840a857dc61c34ca6ff511a 100644 --- a/static_core/plugins/ets/runtime/interop_js/intrinsics/std_js_jsruntime.yaml +++ b/static_core/plugins/ets/runtime/interop_js/intrinsics/std_js_jsruntime.yaml @@ -667,7 +667,7 @@ intrinsics: - name: JSONStringify space: ets - class_name: escompat.JSON + class_name: std.core.JSON method_name: stringifyJSValue static: true signature: diff --git a/static_core/plugins/ets/runtime/intrinsics/escompat_JSON.cpp b/static_core/plugins/ets/runtime/intrinsics/escompat_JSON.cpp index 7c0c38d9bdb6d6a9d154c3b64901d337ec3274d2..eabea878c99e4d9f2cd5f412eccae791b3307f64 100644 --- a/static_core/plugins/ets/runtime/intrinsics/escompat_JSON.cpp +++ b/static_core/plugins/ets/runtime/intrinsics/escompat_JSON.cpp @@ -26,7 +26,7 @@ static EtsField *GetInstanceFieldByName(EtsClass *cls, EtsString *name) return instanceField; } -EtsBoolean EscompatJSONGetJSONStringifyIgnoreByIdx(EtsClass *cls, EtsLong idx) +EtsBoolean StdCoreJSONGetJSONStringifyIgnoreByIdx(EtsClass *cls, EtsLong idx) { EtsField *field = cls->GetFieldByIndex(idx); bool ret = false; @@ -46,7 +46,7 @@ EtsBoolean EscompatJSONGetJSONStringifyIgnoreByIdx(EtsClass *cls, EtsLong idx) return static_cast(ret); } -EtsBoolean EscompatJSONGetJSONStringifyIgnoreByName(EtsClass *cls, EtsString *name) +EtsBoolean StdCoreJSONGetJSONStringifyIgnoreByName(EtsClass *cls, EtsString *name) { EtsField *field = GetInstanceFieldByName(cls, name); bool ret = false; @@ -66,7 +66,7 @@ EtsBoolean EscompatJSONGetJSONStringifyIgnoreByName(EtsClass *cls, EtsString *na return static_cast(ret); } -EtsBoolean EscompatJSONGetJSONParseIgnoreFromAnnotation(EtsClass *cls, EtsLong idx) +EtsBoolean StdCoreJSONGetJSONParseIgnoreFromAnnotation(EtsClass *cls, EtsLong idx) { EtsField *field = cls->GetFieldByIndex(idx); bool ret = false; @@ -86,7 +86,7 @@ EtsBoolean EscompatJSONGetJSONParseIgnoreFromAnnotation(EtsClass *cls, EtsLong i return static_cast(ret); } -EtsString *EscompatJSONGetJSONRenameByIdx(EtsClass *cls, EtsLong idx) +EtsString *StdCoreJSONGetJSONRenameByIdx(EtsClass *cls, EtsLong idx) { auto *thread = ManagedThread::GetCurrent(); [[maybe_unused]] HandleScope scope(thread); @@ -113,7 +113,7 @@ EtsString *EscompatJSONGetJSONRenameByIdx(EtsClass *cls, EtsLong idx) return retStrHandle.GetPtr(); } -EtsString *EscompatJSONGetJSONRenameByName(EtsClass *cls, EtsString *name) +EtsString *StdCoreJSONGetJSONRenameByName(EtsClass *cls, EtsString *name) { auto *thread = ManagedThread::GetCurrent(); [[maybe_unused]] HandleScope scope(thread); @@ -140,7 +140,7 @@ EtsString *EscompatJSONGetJSONRenameByName(EtsClass *cls, EtsString *name) return retStrHandle.GetPtr(); } -extern "C" EtsString *EscompatJSONStringifyFast(EtsObject *value) +extern "C" EtsString *StdCoreJSONStringifyFast(EtsObject *value) { auto coro = EtsCoroutine::GetCurrent(); ASSERT(coro->HasPendingException() == false); diff --git a/static_core/plugins/ets/runtime/intrinsics/escompat_TypedArrays.cpp b/static_core/plugins/ets/runtime/intrinsics/escompat_TypedArrays.cpp index 2b89ffdf359ac6824e4d943a2b2b8dc09400a638..6b69999d62268a0171904d78fe646af27c2c3d7d 100644 --- a/static_core/plugins/ets/runtime/intrinsics/escompat_TypedArrays.cpp +++ b/static_core/plugins/ets/runtime/intrinsics/escompat_TypedArrays.cpp @@ -223,6 +223,26 @@ namespace { namespace unbox { +constexpr uint64_t LONG_SHIFT = 32U; +constexpr uint64_t LONG_MASK = (uint64_t {1} << LONG_SHIFT) - uint64_t {1U}; + +[[nodiscard]] EtsLong GetLong(const EtsBigInt *bigint) +{ + const auto *bytes = bigint->GetBytes(); + ASSERT(bytes != nullptr); + auto buff = EtsLong {0}; + const auto len = std::min(uint32_t {2U}, static_cast(bytes->GetLength())); + for (uint32_t i = 0; i < len; ++i) { + buff += static_cast((static_cast(bytes->Get(i)) & LONG_MASK) << i * LONG_SHIFT); + } + return bigint->GetSign() * buff; +} + +[[nodiscard]] EtsUlong GetULong(const EtsBigInt *bigint) +{ + return static_cast(GetLong(bigint)); +} + template bool CheckCastedClass(Cond cond, const EtsClass *expectedClass, const EtsClass *objectClass) { @@ -339,26 +359,6 @@ public: } private: - static constexpr uint64_t LONG_SHIFT = 32U; - static constexpr uint64_t LONG_MASK = (uint64_t {1} << LONG_SHIFT) - uint64_t {1U}; - - [[nodiscard]] static EtsLong GetLong(const EtsBigInt *bigint) - { - const auto *bytes = bigint->GetBytes(); - ASSERT(bytes != nullptr); - auto buff = EtsLong {0}; - const auto len = std::min(uint32_t {2U}, static_cast(bytes->GetLength())); - for (uint32_t i = 0; i < len; ++i) { - buff += static_cast((static_cast(bytes->Get(i)) & LONG_MASK) << i * LONG_SHIFT); - } - return bigint->GetSign() * buff; - } - - [[nodiscard]] static EtsUlong GetULong(const EtsBigInt *bigint) - { - return static_cast(GetLong(bigint)); - } - const EtsBigInt *Cast(EtsObject *object) const { if (CheckCastedClass([](const EtsClass *klass) { return klass->IsBigInt(); }, escompatBigIntClass_, @@ -2176,6 +2176,29 @@ extern "C" void EtsEscompatBigInt64ArrayOfInt(ark::ets::EtsEscompatBigInt64Array EtsEscompatArrayOfImpl(thisArray, srcAddress); } +template +void EtsEscompatArrayOfBigIntImpl(T *thisArray, EtsTypedObjectArray *src, ToLong toLong) +{ + auto *arrayPtr = GetNativeData(thisArray); + if (UNLIKELY(arrayPtr == nullptr)) { + return; + } + + using ElementType = typename T::ElementType; + auto *dst = reinterpret_cast(ToUintPtr(arrayPtr) + static_cast(thisArray->GetByteOffset())); + ASSERT(thisArray->GetLengthInt() >= 0 && static_cast(thisArray->GetLengthInt()) >= src->GetLength()); + std::generate_n(dst, src->GetLength(), [idx = 0, src, toLong]() mutable { return toLong(src->Get(idx++)); }); +} + +extern "C" void EtsEscompatBigInt64ArrayOfBigInt(ark::ets::EtsEscompatBigInt64Array *thisArray, ark::ObjectHeader *src) +{ + // The method fills the typed array from a FixedArray and in contrast to + // EtsEscompatBigInt64ArraySetValuesFromArray, which fills a typed array from escompat.Array, we can be + // sure that `src` is an instance of the EtsTypedObjectArray class. + EtsEscompatArrayOfBigIntImpl(thisArray, EtsTypedObjectArray::FromCoreType(src), + [](EtsBigInt *bigint) { return unbox::GetLong(bigint); }); +} + extern "C" void EtsEscompatBigInt64ArrayOfLong(ark::ets::EtsEscompatBigInt64Array *thisArray, EtsCharArray *src) { auto *srcAddress = reinterpret_cast(ToUintPtr(src->GetCoreType()->GetData())); @@ -2297,4 +2320,14 @@ extern "C" void EtsEscompatBigUint64ArrayOfLong(ark::ets::EtsEscompatBigUInt64Ar auto *srcAddress = reinterpret_cast(ToUintPtr(src->GetCoreType()->GetData())); EtsEscompatArrayOfImpl(thisArray, srcAddress); } + +extern "C" void EtsEscompatBigUint64ArrayOfBigInt(ark::ets::EtsEscompatBigUInt64Array *thisArray, + ark::ObjectHeader *src) +{ + // The method fills the typed array from a FixedArray and in contrast to + // EtsEscompatBigUint64ArraySetValuesFromArray, which fills a typed array from escompat.Array, we can be + // sure that `src` is an instance of the EtsTypedObjectArray class. + EtsEscompatArrayOfBigIntImpl(thisArray, EtsTypedObjectArray::FromCoreType(src), + [](EtsBigInt *bigint) { return unbox::GetULong(bigint); }); +} } // namespace ark::ets::intrinsics diff --git a/static_core/plugins/ets/runtime/types/ets_finalizable_weak_ref_list.h b/static_core/plugins/ets/runtime/types/ets_finalizable_weak_ref_list.h index b77dd9bbf599ca62d397ccbfbe85fac5644dadd2..109d24e1a659cc41e467b0b77a07e0f931c7dd64 100644 --- a/static_core/plugins/ets/runtime/types/ets_finalizable_weak_ref_list.h +++ b/static_core/plugins/ets/runtime/types/ets_finalizable_weak_ref_list.h @@ -38,11 +38,14 @@ public: SetHead(coro, weakRef); } - void Unlink(EtsCoroutine *coro, Node *weakRef) + bool Unlink(EtsCoroutine *coro, Node *weakRef) { ASSERT(weakRef != nullptr); auto *prev = weakRef->GetPrev(); auto *next = weakRef->GetNext(); + if (prev == nullptr && next == nullptr && weakRef != GetHead()) { + return false; + } if (prev != nullptr) { prev->SetNext(coro, next); } @@ -54,6 +57,7 @@ public: } weakRef->SetPrev(coro, nullptr); weakRef->SetNext(coro, nullptr); + return true; } void UnlinkClearedReferences(EtsCoroutine *coro) diff --git a/static_core/plugins/ets/sdk/arkts/@arkts.math.Decimal.ets b/static_core/plugins/ets/sdk/arkts/@arkts.math.Decimal.ets index b31ead78fc1e0f7808c805f24ee704a47577e0b9..e518f6081ddac388545b75f1641a0f4c662b8403 100644 --- a/static_core/plugins/ets/sdk/arkts/@arkts.math.Decimal.ets +++ b/static_core/plugins/ets/sdk/arkts/@arkts.math.Decimal.ets @@ -85,13 +85,10 @@ export interface DecimalConfig { } export class Decimal { - //NOTE(ekaterinazaytseva): unable to replace internal - used in friend class Utils - internal digits: Array | null = new Array(); - //NOTE(ekaterinazaytseva): unable to replace internal - used in friend class Utils - internal exponent: double; + public digits: Array | null = new Array(); + public exponent: double; private sign: double; - //NOTE(ekaterinazaytseva): unable to replace internal - used in friend class Utils - internal toStringTag: string = '[object Decimal]'; + public readonly toStringTag: string = '[object Decimal]'; private static quadrant: int = 0; public static maxE: double = EXP_LIMIT; diff --git a/static_core/plugins/ets/stdlib/escompat/Array.ets b/static_core/plugins/ets/stdlib/escompat/Array.ets index aef109230b0f76baaa20b6f1ff1b49925f15e241..86ef2d9696d9b7f435d9c2633790d1d6e18b3384 100644 --- a/static_core/plugins/ets/stdlib/escompat/Array.ets +++ b/static_core/plugins/ets/stdlib/escompat/Array.ets @@ -91,8 +91,7 @@ export class Array implements ReadonlyArray, Iterable { public override native $_get(idx: int): T; - //NOTE(ekaterinazaytseva): unable to replace internal - using from friend class ArrayValuesIterator_T provide accsess problems - internal final native $_get_unsafe(idx: int): T + private final native $_get_unsafe(idx: int): T public native $_set(idx: int, val: T): void; @@ -115,8 +114,7 @@ export class Array implements ReadonlyArray, Iterable { this.actualLength = buf.length } - //NOTE(ekaterinazaytseva): unable to replace internal - using default c-tor from non-inherited classes provide accsess problems - internal constructor() { + public constructor() { this.buffer = new Any[4] this.actualLength = 0 } @@ -1844,7 +1842,7 @@ class ArrayValuesIterator_T implements IterableIterator { this.isDone = true return new IteratorResult() } - return new IteratorResult(this.parent.$_get_unsafe(this.idx++)) + return new IteratorResult(this.parent[this.idx++]) } override $_iterator(): IterableIterator { @@ -1871,7 +1869,7 @@ class ArrayEntriesIterator_T implements IterableIterator<[number, T]> { return new IteratorResult<[number, T]>() } const i = this.idx++; - const vl: [number, T] = [i.toDouble(), this.parent.$_get_unsafe(i)] + const vl: [number, T] = [i.toDouble(), this.parent[i]] return new IteratorResult<[number, T]>(vl); } diff --git a/static_core/plugins/ets/stdlib/escompat/ArrayBuffer.ets b/static_core/plugins/ets/stdlib/escompat/ArrayBuffer.ets index f4bcea23746b666d3ce2fc19db1deaeab71d0795..0aef75b3031088594d2437c233d8ab31b972ceb4 100644 --- a/static_core/plugins/ets/stdlib/escompat/ArrayBuffer.ets +++ b/static_core/plugins/ets/stdlib/escompat/ArrayBuffer.ets @@ -412,150 +412,149 @@ export class ArrayBuffer extends Buffer */ public static native stringify(buffer: ArrayBuffer, encoding: string, start: int, end: int): string; - //NOTE(ekaterinazaytseva): unable to replace internal - used in frined class Atomics - internal native atomicAddI8(index: int, byteOffset: int, value: byte): double; + public native atomicAddI8(index: int, byteOffset: int, value: byte): double; - internal native atomicAndI8(index: int, byteOffset: int, value: byte): double; + public native atomicAndI8(index: int, byteOffset: int, value: byte): double; - internal native atomicCompareExchangeI8(index: int, byteOffset: int, expectedValue: byte, replacementValue: byte): double; + public native atomicCompareExchangeI8(index: int, byteOffset: int, expectedValue: byte, replacementValue: byte): double; - internal native atomicExchangeI8(index: int, byteOffset: int, value: byte): double; + public native atomicExchangeI8(index: int, byteOffset: int, value: byte): double; - internal native atomicLoadI8(index: int, byteOffset: int): double; + public native atomicLoadI8(index: int, byteOffset: int): double; - internal native atomicOrI8(index: int, byteOffset: int, value: byte): double; + public native atomicOrI8(index: int, byteOffset: int, value: byte): double; - internal native atomicStoreI8(index: int, byteOffset: int, value: byte): double; + public native atomicStoreI8(index: int, byteOffset: int, value: byte): double; - internal native atomicSubI8(index: int, byteOffset: int, value: byte): double; + public native atomicSubI8(index: int, byteOffset: int, value: byte): double; - internal native atomicXorI8(index: int, byteOffset: int, value: byte): double; + public native atomicXorI8(index: int, byteOffset: int, value: byte): double; - internal native atomicAddI16(index: int, byteOffset: int, value: short): double; + public native atomicAddI16(index: int, byteOffset: int, value: short): double; - internal native atomicAndI16(index: int, byteOffset: int, value: short): double; + public native atomicAndI16(index: int, byteOffset: int, value: short): double; - internal native atomicCompareExchangeI16(index: int, byteOffset: int, expectedValue: short, replacementValue: short): double; + public native atomicCompareExchangeI16(index: int, byteOffset: int, expectedValue: short, replacementValue: short): double; - internal native atomicExchangeI16(index: int, byteOffset: int, value: short): double; + public native atomicExchangeI16(index: int, byteOffset: int, value: short): double; - internal native atomicLoadI16(index: int, byteOffset: int): double; + public native atomicLoadI16(index: int, byteOffset: int): double; - internal native atomicOrI16(index: int, byteOffset: int, value: short): double; + public native atomicOrI16(index: int, byteOffset: int, value: short): double; - internal native atomicStoreI16(index: int, byteOffset: int, value: short): double; + public native atomicStoreI16(index: int, byteOffset: int, value: short): double; - internal native atomicSubI16(index: int, byteOffset: int, value: short): double; + public native atomicSubI16(index: int, byteOffset: int, value: short): double; - internal native atomicXorI16(index: int, byteOffset: int, value: short): double; + public native atomicXorI16(index: int, byteOffset: int, value: short): double; - internal native atomicAddI32(index: int, byteOffset: int, value: int): double; + public native atomicAddI32(index: int, byteOffset: int, value: int): double; - internal native atomicAndI32(index: int, byteOffset: int, value: int): double; + public native atomicAndI32(index: int, byteOffset: int, value: int): double; - internal native atomicCompareExchangeI32(index: int, byteOffset: int, expectedValue: int, replacementValue: int): double; + public native atomicCompareExchangeI32(index: int, byteOffset: int, expectedValue: int, replacementValue: int): double; - internal native atomicExchangeI32(index: int, byteOffset: int, value: int): double; + public native atomicExchangeI32(index: int, byteOffset: int, value: int): double; - internal native atomicLoadI32(index: int, byteOffset: int): double; + public native atomicLoadI32(index: int, byteOffset: int): double; - internal native atomicOrI32(index: int, byteOffset: int, value: int): double; + public native atomicOrI32(index: int, byteOffset: int, value: int): double; - internal native atomicStoreI32(index: int, byteOffset: int, value: int): double; + public native atomicStoreI32(index: int, byteOffset: int, value: int): double; - internal native atomicSubI32(index: int, byteOffset: int, value: int): double; + public native atomicSubI32(index: int, byteOffset: int, value: int): double; - internal native atomicXorI32(index: int, byteOffset: int, value: int): double; + public native atomicXorI32(index: int, byteOffset: int, value: int): double; - internal native atomicAddI64(index: int, byteOffset: int, value: long): double; + public native atomicAddI64(index: int, byteOffset: int, value: long): double; - internal native atomicAndI64(index: int, byteOffset: int, value: long): double; + public native atomicAndI64(index: int, byteOffset: int, value: long): double; - internal native atomicCompareExchangeI64(index: int, byteOffset: int, expectedValue: long, replacementValue: long): double; + public native atomicCompareExchangeI64(index: int, byteOffset: int, expectedValue: long, replacementValue: long): double; - internal native atomicExchangeI64(index: int, byteOffset: int, value: long): double; + public native atomicExchangeI64(index: int, byteOffset: int, value: long): double; - internal native atomicLoadI64(index: int, byteOffset: int): double; + public native atomicLoadI64(index: int, byteOffset: int): double; - internal native atomicOrI64(index: int, byteOffset: int, value: long): double; + public native atomicOrI64(index: int, byteOffset: int, value: long): double; - internal native atomicStoreI64(index: int, byteOffset: int, value: long): double; + public native atomicStoreI64(index: int, byteOffset: int, value: long): double; - internal native atomicSubI64(index: int, byteOffset: int, value: long): double; + public native atomicSubI64(index: int, byteOffset: int, value: long): double; - internal native atomicXorI64(index: int, byteOffset: int, value: long): double; + public native atomicXorI64(index: int, byteOffset: int, value: long): double; - internal native atomicAddU8(index: int, byteOffset: int, value: byte): double; + public native atomicAddU8(index: int, byteOffset: int, value: byte): double; - internal native atomicAndU8(index: int, byteOffset: int, value: byte): double; + public native atomicAndU8(index: int, byteOffset: int, value: byte): double; - internal native atomicCompareExchangeU8(index: int, byteOffset: int, expectedValue: byte, replacementValue: byte): double; + public native atomicCompareExchangeU8(index: int, byteOffset: int, expectedValue: byte, replacementValue: byte): double; - internal native atomicExchangeU8(index: int, byteOffset: int, value: byte): double; + public native atomicExchangeU8(index: int, byteOffset: int, value: byte): double; - internal native atomicLoadU8(index: int, byteOffset: int): double; + public native atomicLoadU8(index: int, byteOffset: int): double; - internal native atomicOrU8(index: int, byteOffset: int, value: byte): double; + public native atomicOrU8(index: int, byteOffset: int, value: byte): double; - internal native atomicStoreU8(index: int, byteOffset: int, value: byte): double; + public native atomicStoreU8(index: int, byteOffset: int, value: byte): double; - internal native atomicSubU8(index: int, byteOffset: int, value: byte): double; + public native atomicSubU8(index: int, byteOffset: int, value: byte): double; - internal native atomicXorU8(index: int, byteOffset: int, value: byte): double; + public native atomicXorU8(index: int, byteOffset: int, value: byte): double; - internal native atomicAddU16(index: int, byteOffset: int, value: short): double; + public native atomicAddU16(index: int, byteOffset: int, value: short): double; - internal native atomicAndU16(index: int, byteOffset: int, value: short): double; + public native atomicAndU16(index: int, byteOffset: int, value: short): double; - internal native atomicCompareExchangeU16(index: int, byteOffset: int, expectedValue: short, replacementValue: short): double; + public native atomicCompareExchangeU16(index: int, byteOffset: int, expectedValue: short, replacementValue: short): double; - internal native atomicExchangeU16(index: int, byteOffset: int, value: short): double; + public native atomicExchangeU16(index: int, byteOffset: int, value: short): double; - internal native atomicLoadU16(index: int, byteOffset: int): double; + public native atomicLoadU16(index: int, byteOffset: int): double; - internal native atomicOrU16(index: int, byteOffset: int, value: short): double; + public native atomicOrU16(index: int, byteOffset: int, value: short): double; - internal native atomicStoreU16(index: int, byteOffset: int, value: short): double; + public native atomicStoreU16(index: int, byteOffset: int, value: short): double; - internal native atomicSubU16(index: int, byteOffset: int, value: short): double; + public native atomicSubU16(index: int, byteOffset: int, value: short): double; - internal native atomicXorU16(index: int, byteOffset: int, value: short): double; + public native atomicXorU16(index: int, byteOffset: int, value: short): double; - internal native atomicAddU32(index: int, byteOffset: int, value: int): double; + public native atomicAddU32(index: int, byteOffset: int, value: int): double; - internal native atomicAndU32(index: int, byteOffset: int, value: int): double; + public native atomicAndU32(index: int, byteOffset: int, value: int): double; - internal native atomicCompareExchangeU32(index: int, byteOffset: int, expectedValue: int, replacementValue: int): double; + public native atomicCompareExchangeU32(index: int, byteOffset: int, expectedValue: int, replacementValue: int): double; - internal native atomicExchangeU32(index: int, byteOffset: int, value: int): double; + public native atomicExchangeU32(index: int, byteOffset: int, value: int): double; - internal native atomicLoadU32(index: int, byteOffset: int): double; + public native atomicLoadU32(index: int, byteOffset: int): double; - internal native atomicOrU32(index: int, byteOffset: int, value: int): double; + public native atomicOrU32(index: int, byteOffset: int, value: int): double; - internal native atomicStoreU32(index: int, byteOffset: int, value: int): double; + public native atomicStoreU32(index: int, byteOffset: int, value: int): double; - internal native atomicSubU32(index: int, byteOffset: int, value: int): double; + public native atomicSubU32(index: int, byteOffset: int, value: int): double; - internal native atomicXorU32(index: int, byteOffset: int, value: int): double; + public native atomicXorU32(index: int, byteOffset: int, value: int): double; - internal native atomicAddU64(index: int, byteOffset: int, value: long): double; + public native atomicAddU64(index: int, byteOffset: int, value: long): double; - internal native atomicAndU64(index: int, byteOffset: int, value: long): double; + public native atomicAndU64(index: int, byteOffset: int, value: long): double; - internal native atomicCompareExchangeU64(index: int, byteOffset: int, expectedValue: long, replacementValue: long): double; + public native atomicCompareExchangeU64(index: int, byteOffset: int, expectedValue: long, replacementValue: long): double; - internal native atomicExchangeU64(index: int, byteOffset: int, value: long): double; + public native atomicExchangeU64(index: int, byteOffset: int, value: long): double; - internal native atomicLoadU64(index: int, byteOffset: int): double; + public native atomicLoadU64(index: int, byteOffset: int): double; - internal native atomicOrU64(index: int, byteOffset: int, value: long): double; + public native atomicOrU64(index: int, byteOffset: int, value: long): double; - internal native atomicStoreU64(index: int, byteOffset: int, value: long): double; + public native atomicStoreU64(index: int, byteOffset: int, value: long): double; - internal native atomicSubU64(index: int, byteOffset: int, value: long): double; + public native atomicSubU64(index: int, byteOffset: int, value: long): double; - internal native atomicXorU64(index: int, byteOffset: int, value: long): double; + public native atomicXorU64(index: int, byteOffset: int, value: long): double; } export type ArrayBufferLike = ArrayBuffer diff --git a/static_core/plugins/ets/stdlib/escompat/BigInt.ets b/static_core/plugins/ets/stdlib/escompat/BigInt.ets index afc69b3b61f4c5a8f2dfba884411d6802e6854c2..c62fb347359e05bc15e3c2cc1c9a92e2c1026775 100644 --- a/static_core/plugins/ets/stdlib/escompat/BigInt.ets +++ b/static_core/plugins/ets/stdlib/escompat/BigInt.ets @@ -152,8 +152,7 @@ export final class BigInt { this.sign = this.bytes.length == 0 ? 0 : sign } - //NOTE(ekaterinazaytseva): unable to replace internal - used in typedArrays - internal static fromULong(val: long): BigInt { + public static fromULong(val: long): BigInt { let ret = val == 0 ? new BigInt([], 0) : new BigInt(BigInt.fromLongHelper(val, 64, 1), 1) return ret } @@ -302,8 +301,7 @@ export final class BigInt { return (this.negative() ? "-" : "").concat((fastToStringHandler != undefined) ? fastToStringHandler!(this) : this.toStringAsGenericRadix(radix)) } - //NOTE(ekaterinazaytseva): unable to replace internal - used as public in initializerBlock - internal toStringAsBinary(): string { + public toStringAsBinary(): string { let reversedInts = BigInt.reverse(this.bytes) let intToBinaryString = (value: Long) => { return value.toString(2) } let result = new StringBuilder(intToBinaryString((reversedInts[0]!).toLong())) @@ -313,8 +311,7 @@ export final class BigInt { return result.toString() } - //NOTE(ekaterinazaytseva): unable to replace internal - used as public in initializerBlock - internal toStringAsDecimal(): string { + public toStringAsDecimal(): string { let digits = this.bytesToDigits(this.bytes) let result = new StringBuilder for (let i = 0; i < digits.length; i++) { @@ -341,8 +338,7 @@ export final class BigInt { return result.toString() } - //NOTE(ekaterinazaytseva): unable to replace internal - used as public in initializerBlock - internal toStringAsPowerOfTwoRadix(radix: int): string { + public toStringAsPowerOfTwoRadix(radix: int): string { let chunkSize: Number = Math.log2(radix) if (!chunkSize.isInteger() || radix < 2) { throw new Error("BigInt::toStringAsPowerOfTwoRadix(): invalid radix: " + radix) diff --git a/static_core/plugins/ets/stdlib/escompat/Map.ets b/static_core/plugins/ets/stdlib/escompat/Map.ets index 14a99df6d001ad57d4fa794e8da4917d6a150e6a..fa3e4f2a20fca1082ab987b225859218d42d74b8 100644 --- a/static_core/plugins/ets/stdlib/escompat/Map.ets +++ b/static_core/plugins/ets/stdlib/escompat/Map.ets @@ -311,7 +311,7 @@ export class Map implements ReadonlyMap { const buck = this.getOrCreateBucket(key) const buckSize = buck.length for (let i = 0; i < buckSize; i++) { - const entry = buck.$_get_unsafe(i) + const entry = buck[i] if (Runtime.sameValueZero(entry.key, key)) { entry.val = val return this diff --git a/static_core/plugins/ets/stdlib/escompat/RegExp.ets b/static_core/plugins/ets/stdlib/escompat/RegExp.ets index 3b20eb4ba505b05a1a87aff0d30eb1d15570c95f..dce4301a010df3bc7e3c80ee25f12347f13bd578 100644 --- a/static_core/plugins/ets/stdlib/escompat/RegExp.ets +++ b/static_core/plugins/ets/stdlib/escompat/RegExp.ets @@ -31,6 +31,7 @@ export class RegExpResultArray extends Array { protected input_: String = "" private endIndex: number = 0 + private wasProcessed: boolean = false // NOTE(shumilov-petr): Make nullable when #14813 will be fixed protected indices_: Array> = [] @@ -78,8 +79,11 @@ export class RegExpResultArray extends Array { else if (index == 9) RegExp.$9_ = value } - // NOTE(ekaterinzaytseva): unable to replace internal - crash in analyzer - internal postExecProcessing(res: RegExpResultArray, input: String, index: number, hasIndices: boolean): void { + public postExecProcessing(res: RegExpResultArray, input: String, index: number, hasIndices: boolean): void { + // NOTE(ekaterinazaytseva): temp solution - will be fixed in #20259 + if (this.wasProcessed) { + return + } if (!res.isCorrect) { return } @@ -97,6 +101,7 @@ export class RegExpResultArray extends Array { RegExp.input_ = input RegExp.leftContext_ = input.substring(0, index) RegExp.rightContext_ = input.substring(index + res.result[0]!.length) + this.wasProcessed = true } /** @@ -694,8 +699,7 @@ export class RegExp extends Object { private native matchImpl(pattern: String, flags: String, str: String, patternLength: int, strLength: int, lastIndex: int, hasSlashU: boolean): RegExpMatchArray; - // NOTE(ekaterinazaytseva): used as public - internal exec(str: String, index: int): RegExpExecArray | null { + public exec(str: String, index: int): RegExpExecArray | null { const hasSlashU = str.contains("\\u", 0) || this.pattern_.contains("\\u", 0) const res = this.execImpl(this.pattern_, this.flags_, str, this.pattern_.length, str.length, index, hasSlashU) if (res.isCorrect) { @@ -722,8 +726,7 @@ export class RegExp extends Object { return this.exec(str, this.lastIndex) } - // NOTE(ekaterinzaytseva): unable to replace internal - used as public - internal matchInternal(str: String, index: int): RegExpMatchArray | null { + private matchInternal(str: String, index: int): RegExpMatchArray | null { const hasSlashU = str.contains("\\u", 0) || this.pattern_.contains("\\u", 0) const res = this.matchImpl(this.pattern_, this.flags_, str, this.pattern_.length, str.length, index, hasSlashU) if (res.isCorrect) { @@ -735,8 +738,7 @@ export class RegExp extends Object { } } - // NOTE(ekaterinazaytseva): unable to replace internal - used in friend class - internal matchInternal(str: String): RegExpMatchArray | null { + public matchInternal(str: String): RegExpMatchArray | null { return this.matchInternal(str, this.lastIndex) } diff --git a/static_core/plugins/ets/stdlib/escompat/TypedArrays.ets b/static_core/plugins/ets/stdlib/escompat/TypedArrays.ets index ad82424461e4effa832572647fd1f721e778fd95..bfd8e93dcba8bc2165be4759a1db6c1517a81efe 100644 --- a/static_core/plugins/ets/stdlib/escompat/TypedArrays.ets +++ b/static_core/plugins/ets/stdlib/escompat/TypedArrays.ets @@ -662,6 +662,19 @@ export final class Int8Array implements Iterable, ArrayLike { return result } + /** + * Creates an array from an object of FixedArray. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new Int8Array + */ + public static fromFixedArrayint(arr: FixedArray): Int8Array { + let result = new Int8Array(arr.length) + result.ofInt(arr) + return result + } + private native final set(array: Array): void; /** @@ -674,7 +687,7 @@ export final class Int8Array implements Iterable, ArrayLike { public static fromArrayint(arr: Array): Int8Array { let result = new Int8Array(arr.length) result.set(arr) - return result; + return result } /** @@ -757,7 +770,8 @@ export final class Int8Array implements Iterable, ArrayLike { public static overload from { fromSetint, fromInt8Array ,fromUint8Array, - fromArrayint, fromArrayLikeNumber, fromArrayLike, fromIterable + fromFixedArrayint, fromArrayint, fromArrayLikeNumber, + fromArrayLike, fromIterable }; /** @@ -2163,6 +2177,19 @@ export final class Int16Array implements Iterable, ArrayLike { return result } + /** + * Creates an array from an object of FixedArray. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new Int16Array + */ + public static fromFixedArrayint(arr: FixedArray): Int16Array { + let result = new Int16Array(arr.length) + result.ofInt(arr) + return result + } + private native final set(array: Array): void; /** @@ -2175,7 +2202,7 @@ export final class Int16Array implements Iterable, ArrayLike { public static fromArrayint(arr: Array): Int16Array { let result = new Int16Array(arr.length) result.set(arr) - return result; + return result } /** @@ -2258,7 +2285,8 @@ export final class Int16Array implements Iterable, ArrayLike { public static overload from { fromSetint, fromInt16Array ,fromUint16Array, - fromArrayint, fromArrayLikeNumber, fromArrayLike, fromIterable + fromFixedArrayint, fromArrayint, fromArrayLikeNumber, + fromArrayLike, fromIterable }; /** @@ -3641,6 +3669,19 @@ export final class Int32Array implements Iterable, ArrayLike { return result } + /** + * Creates an array from an object of FixedArray. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new Int32Array + */ + public static fromFixedArrayint(arr: FixedArray): Int32Array { + let result = new Int32Array(arr.length) + result.ofInt(arr) + return result + } + private native final set(array: Array): void; /** @@ -3653,7 +3694,7 @@ export final class Int32Array implements Iterable, ArrayLike { public static fromArrayint(arr: Array): Int32Array { let result = new Int32Array(arr.length) result.set(arr) - return result; + return result } /** @@ -3736,7 +3777,8 @@ export final class Int32Array implements Iterable, ArrayLike { public static overload from { fromSetint, fromInt32Array, - fromArrayint, fromArrayLikeNumber, fromArrayLike, fromIterable + fromFixedArrayint, fromArrayint, fromArrayLikeNumber, + fromArrayLike, fromIterable }; /** @@ -5073,15 +5115,14 @@ export final class BigInt64Array implements Iterable, ArrayLike */ public static of(...items: FixedArray): BigInt64Array { let res = new BigInt64Array(items.length.toInt()) - for (let i: int = 0; i < items.length; i++) { - res.setUnsafe(i, items[i].getLong()) - } + res.ofBigInt(items) return res } private final native ofInt(items: FixedArray): void private final native ofNumber(items: FixedArray): void private final native ofLong(items: FixedArray): void + private final native ofBigInt(items: FixedArray): void /** * Returns a new array from a set of elements. @@ -5139,6 +5180,19 @@ export final class BigInt64Array implements Iterable, ArrayLike return result } + /** + * Creates an array from an object of FixedArray. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new BigInt64Array + */ + public static fromFixedArrayBigInt(arr: FixedArray): BigInt64Array { + let result = new BigInt64Array(arr.length) + result.ofBigInt(arr) + return result + } + private native final set(array: Array): void; /** @@ -5151,7 +5205,7 @@ export final class BigInt64Array implements Iterable, ArrayLike public static fromArrayBigInt(arr: Array): BigInt64Array { let result = new BigInt64Array(arr.length) result.set(arr) - return result; + return result } /** @@ -5233,7 +5287,8 @@ export final class BigInt64Array implements Iterable, ArrayLike public static overload from { fromSetBigInt, fromBigInt64Array, - fromArrayBigInt, fromArrayLikeNumber, fromArrayLike, fromIterable + fromFixedArrayBigInt, fromArrayBigInt, fromArrayLikeNumber, + fromArrayLike, fromIterable }; /** @@ -6606,6 +6661,19 @@ export final class Float32Array implements Iterable, ArrayLike { return result } + /** + * Creates an array from an object of FixedArray. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new Float32Array + */ + public static fromFixedArraynumber(arr: FixedArray): Float32Array { + let result = new Float32Array(arr.length) + result.ofNumber(arr) + return result + } + private native final set(array: Array): void; /** @@ -6618,7 +6686,7 @@ export final class Float32Array implements Iterable, ArrayLike { public static fromArraynumber(arr: Array): Float32Array { let result = new Float32Array(arr.length) result.set(arr) - return result; + return result } /** @@ -6700,7 +6768,8 @@ export final class Float32Array implements Iterable, ArrayLike { public static overload from { fromSetnumber, fromFloat32Array, - fromArraynumber, fromArrayLikeNumber, fromArrayLike, fromIterable + fromFixedArraynumber, fromArraynumber, fromArrayLikeNumber, + fromArrayLike, fromIterable }; private final native containsNaN(fromIndex: int): boolean; @@ -8013,6 +8082,19 @@ export final class Float64Array implements Iterable, ArrayLike { return result } + /** + * Creates an array from an object of FixedArray. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new Float64Array + */ + public static fromFixedArraynumber(arr: FixedArray): Float64Array { + let result = new Float64Array(arr.length) + result.ofNumber(arr) + return result + } + private native final set(array: Array): void; /** @@ -8025,7 +8107,7 @@ export final class Float64Array implements Iterable, ArrayLike { public static fromArraynumber(arr: Array): Float64Array { let result = new Float64Array(arr.length) result.set(arr) - return result; + return result } /** @@ -8107,7 +8189,8 @@ export final class Float64Array implements Iterable, ArrayLike { public static overload from { fromSetnumber, fromFloat64Array, - fromArraynumber, fromArrayLikeNumber, fromArrayLike, fromIterable + fromFixedArraynumber, fromArraynumber, fromArrayLikeNumber, + fromArrayLike, fromIterable }; private final native containsNaN(fromIndex: int): boolean; diff --git a/static_core/plugins/ets/stdlib/escompat/TypedUArrays.ets b/static_core/plugins/ets/stdlib/escompat/TypedUArrays.ets index e797811ef82da30072b2341682c96074e5d45078..ea01a9cd4f3499cbd12813d969316e599f7ac4c2 100644 --- a/static_core/plugins/ets/stdlib/escompat/TypedUArrays.ets +++ b/static_core/plugins/ets/stdlib/escompat/TypedUArrays.ets @@ -654,6 +654,19 @@ export final class Uint8ClampedArray implements Iterable, ArrayLike. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new Uint8ClampedArray + */ + public static fromFixedArrayint(arr: FixedArray): Uint8ClampedArray { + let result = new Uint8ClampedArray(arr.length) + result.ofInt(arr) + return result + } + private native final set(array: Array): void; /** @@ -666,7 +679,7 @@ export final class Uint8ClampedArray implements Iterable, ArrayLike): Uint8ClampedArray { let result = new Uint8ClampedArray(arr.length) result.set(arr) - return result; + return result } /** @@ -746,7 +759,8 @@ export final class Uint8ClampedArray implements Iterable, ArrayLike, ArrayLike { return result } + /** + * Creates an array from an object of FixedArray. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new Uint8Array + */ + public static fromFixedArrayint(arr: FixedArray): Uint8Array { + let result = new Uint8Array(arr.length) + result.ofInt(arr) + return result + } + private native final set(array: Array): void; /** @@ -2173,7 +2200,7 @@ export final class Uint8Array implements Iterable, ArrayLike { public static fromArrayint(arr: Array): Uint8Array { let result = new Uint8Array(arr.length) result.set(arr) - return result; + return result } /** @@ -2253,7 +2280,8 @@ export final class Uint8Array implements Iterable, ArrayLike { public static overload from { fromSetint, fromUint8Array ,fromInt8Array - ,fromArrayint, fromArrayLikenumber, fromArrayLike, fromIterable + ,fromFixedArrayint, fromArrayint, fromArrayLikenumber, + fromArrayLike, fromIterable }; /** @@ -3652,6 +3680,19 @@ export final class Uint16Array implements Iterable, ArrayLike { return result } + /** + * Creates an array from an object of FixedArray. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new Uint16Array + */ + public static fromFixedArrayint(arr: FixedArray): Uint16Array { + let result = new Uint16Array(arr.length) + result.ofInt(arr) + return result + } + private native final set(array: Array): void; /** @@ -3664,7 +3705,7 @@ export final class Uint16Array implements Iterable, ArrayLike { public static fromArrayint(arr: Array): Uint16Array { let result = new Uint16Array(arr.length) result.set(arr) - return result; + return result } /** @@ -3744,7 +3785,8 @@ export final class Uint16Array implements Iterable, ArrayLike { public static overload from { fromSetint, fromUint16Array ,fromInt16Array - ,fromArrayint, fromArrayLikenumber, fromArrayLike, fromIterable + ,fromFixedArrayint, fromArrayint, fromArrayLikenumber, + fromArrayLike, fromIterable }; /** @@ -5177,6 +5219,19 @@ export final class Uint32Array implements Iterable, ArrayLike { return result } + /** + * Creates an array from an object of FixedArray. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new Uint32Array + */ + public static fromFixedArrayint(arr: FixedArray): Uint32Array { + let result = new Uint32Array(arr.length) + result.ofInt(arr) + return result + } + private native final set(array: Array): void; /** @@ -5189,7 +5244,7 @@ export final class Uint32Array implements Iterable, ArrayLike { public static fromArrayint(arr: Array): Uint32Array { let result = new Uint32Array(arr.length) result.set(arr) - return result; + return result } /** @@ -5269,7 +5324,8 @@ export final class Uint32Array implements Iterable, ArrayLike { public static overload from { fromSetint, fromUint32Array ,fromInt32Array - ,fromArrayint, fromArrayLikenumber, fromArrayLike, fromIterable + ,fromFixedArrayint, fromArrayint, fromArrayLikenumber, + fromArrayLike, fromIterable }; /** @@ -6626,15 +6682,14 @@ export final class BigUint64Array implements Iterable, ArrayLike */ public static of(...items: FixedArray): BigUint64Array { let res = new BigUint64Array(items.length.toInt()) - for (let i: int = 0; i < items.length; i++) { - res.setUnsafeClamp(i, items[i].getULong()) - } + res.ofBigInt(items) return res } private final native ofInt(items: FixedArray): void private final native ofNumber(items: FixedArray): void private final native ofLong(items: FixedArray): void + private final native ofBigInt(items: FixedArray): void /** * Returns a new array from a set of elements. @@ -6692,6 +6747,19 @@ export final class BigUint64Array implements Iterable, ArrayLike return result } + /** + * Creates an array from an object of FixedArray. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new BigUint64Array + */ + public static fromFixedArrayBigInt(arr: FixedArray): BigUint64Array { + let result = new BigUint64Array(arr.length) + result.ofBigInt(arr) + return result + } + private native final set(array: Array): void; /** @@ -6704,7 +6772,7 @@ export final class BigUint64Array implements Iterable, ArrayLike public static fromArrayBigInt(arr: Array): BigUint64Array { let result = new BigUint64Array(arr.length) result.set(arr) - return result; + return result } /** @@ -6784,7 +6852,8 @@ export final class BigUint64Array implements Iterable, ArrayLike public static overload from { fromSetBigInt, fromBigUint64Array - ,fromArrayBigInt, fromArrayLikeBigInt, fromArrayLike, fromIterable + ,fromFixedArrayBigInt, fromArrayBigInt, fromArrayLikeBigInt, + fromArrayLike, fromIterable }; /** diff --git a/static_core/plugins/ets/stdlib/escompat/_initializerBlock_.ets b/static_core/plugins/ets/stdlib/escompat/_initializerBlock_.ets index 7b1ded4b077de37a3d6a5a93019fdf570ba69551..5a8ee90f25731f5dc55e98d5e1e3912c0dccebf0 100644 --- a/static_core/plugins/ets/stdlib/escompat/_initializerBlock_.ets +++ b/static_core/plugins/ets/stdlib/escompat/_initializerBlock_.ets @@ -17,7 +17,6 @@ package escompat; // Note: This file initialize all the `const` property that non-immediately initialized(spec-issue 217). static { FROM_BUFFER = new FromBuffer() - BigIntType = Type.of(new BigInt()); hexChars = [c'0', c'1', c'2', c'3', c'4', c'5', c'6', c'7', c'8', c'9', c'A', c'B', c'C', c'D', c'E', c'F']; uriArray = fillInURINotComponent(); uriSpecialChars = createAndFillInURISpecial(); diff --git a/static_core/plugins/ets/stdlib/std/containers/ConcurrentHashMap.ets b/static_core/plugins/ets/stdlib/std/containers/ConcurrentHashMap.ets index e7e36f9b803f4cf3dd85cea23e538450df9d0316..63db66707c416230f0a8e28bd96d7230c1a74069 100644 --- a/static_core/plugins/ets/stdlib/std/containers/ConcurrentHashMap.ets +++ b/static_core/plugins/ets/stdlib/std/containers/ConcurrentHashMap.ets @@ -242,7 +242,7 @@ export namespace containers { if (i >= bucket.length || i < 0) { return null; } - return bucket.$_get_unsafe(i); + return bucket[i]; } finally { ConcurrencyHelpers.mutexUnlock(mutex); } diff --git a/static_core/plugins/ets/stdlib/std/core/Class.ets b/static_core/plugins/ets/stdlib/std/core/Class.ets index 6287fb1f3c0a2b14fd226f3ae26da7b88587b0c8..b590eca0d57b28fd883c06661f14d4eb6727efaa 100644 --- a/static_core/plugins/ets/stdlib/std/core/Class.ets +++ b/static_core/plugins/ets/stdlib/std/core/Class.ets @@ -69,8 +69,7 @@ export final class Class { /** * Get internal string descriptor */ - // NOTE(ekaterinazaytseva): unable to replace internal - used in RuntimeLinker.ets as public - internal native getDescriptor(): string + public native getDescriptor(): string public native isEnum(): boolean diff --git a/static_core/plugins/ets/stdlib/std/core/Console.ets b/static_core/plugins/ets/stdlib/std/core/Console.ets index 0eb5663e1a6b430331aedf1a535f605283d06f79..a2af6f571bcb8c36ad3c195e60d23d12d04f0cd4 100644 --- a/static_core/plugins/ets/stdlib/std/core/Console.ets +++ b/static_core/plugins/ets/stdlib/std/core/Console.ets @@ -102,8 +102,7 @@ export final class Console { * Internal constructor for Console class * @internal */ - // NOTE(ekaterinzaytseva): unable to replace internal - used as public - internal constructor() { + private constructor() { this.timers = new Map this.counters = new Map this.lvl2Buf = new Map @@ -115,6 +114,15 @@ export final class Console { this.lvl2Buf.set(LogLevel.PRINTLN, new StringBuilder) } + private static instance?: Console + + public static getInstance(): Console { + if (Console.instance == undefined) { + Console.instance = new Console() + } + return Console.instance!; + } + private native printString(s: String, lvl: int): void; private addToBuffer(s: String, level: LogLevel): void { diff --git a/static_core/plugins/ets/stdlib/std/core/Type.ets b/static_core/plugins/ets/stdlib/std/core/Type.ets index 702d45a177a67ac4ba5e8361bce007f1eec813b2..446881b00b7b12cbf5a676ea1454b03f845e22ce 100644 --- a/static_core/plugins/ets/stdlib/std/core/Type.ets +++ b/static_core/plugins/ets/stdlib/std/core/Type.ets @@ -220,8 +220,7 @@ export abstract class Type extends Object { * * @returns instance of appropriate type or undefined if resolving is failed */ - // NOTE(ekaterinazaytseva): unable to replace internal - used in TypeCreator.ets as public - internal static resolve(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker): Type | undefined { + public static resolve(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker): Type | undefined { let kind = (TypeAPI.getTypeKind(td, contextLinker) & TypeKindMask).toByte() switch (kind) { case TypeKind.NONE: @@ -502,7 +501,7 @@ export abstract class Type extends Object { this.contextLinker = contextLinker } - internal getTypeDesc(): RuntimeTypeDescriptor { + public getTypeDesc(): RuntimeTypeDescriptor { return this.td } @@ -538,7 +537,7 @@ export abstract class Type extends Object { return false } - internal abstract convertObject(obj: Any): Any; + public abstract convertObject(obj: Any): Any; private isNumericType(): boolean { return (this) instanceof ByteType @@ -675,7 +674,7 @@ export final class NullType extends Type { return other instanceof NullType } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { if (obj != null) { throw new Error("invalid conversion") } @@ -746,7 +745,7 @@ export final class UndefinedType extends Type { return other instanceof UndefinedType } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { throw new Error("todo(kprokopenko): add when undefined becomes available") } } @@ -821,7 +820,7 @@ export final class VoidType extends Type { return other instanceof VoidType } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { if (!this.assignableFrom(Type.of(obj))) { throw new Error("invalid conversion") } @@ -905,7 +904,7 @@ export final class CharType extends Type { return other instanceof CharType } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (!this.equals(objType)) { throw new Error("invalid type for conversion") @@ -989,7 +988,7 @@ export final class BooleanType extends Type { return other instanceof BooleanType } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (!this.equals(objType)) { throw new Error("invalid type for conversion") @@ -1073,7 +1072,7 @@ export final class ByteType extends Type { return other instanceof ByteType } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (this.equals(objType)) { return obj @@ -1168,7 +1167,7 @@ export final class ShortType extends Type { return other instanceof ShortType } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (this.equals(objType)) { return obj @@ -1263,7 +1262,7 @@ export final class IntType extends Type { return other instanceof IntType } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (this.equals(objType)) { return obj @@ -1358,7 +1357,7 @@ export final class LongType extends Type { return other instanceof LongType } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (this.equals(objType)) { return obj @@ -1453,7 +1452,7 @@ export final class FloatType extends Type { return other instanceof FloatType } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (this.equals(objType)) { return obj @@ -1548,7 +1547,7 @@ export final class DoubleType extends Type { return other instanceof DoubleType } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (this.equals(objType)) { return obj @@ -1567,7 +1566,7 @@ export final class ClassType extends Type { private readonly cls: Class private readonly attrs: int - internal constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { + public constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { super(td, contextLinker) this.cls = TypeAPI.getClass(td, contextLinker)! this.attrs = TypeAPI.getClassAttributes(this.cls) @@ -1984,7 +1983,7 @@ export final class ClassType extends Type { return false } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (!this.assignableFrom(objType)) { throw new Error("invalid conversion") @@ -1999,7 +1998,7 @@ export final class ClassType extends Type { export final class InterfaceType extends Type { private cls: Class - internal constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { + public constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { super(td, contextLinker) this.cls = TypeAPI.getClass(td, contextLinker)! } @@ -2161,14 +2160,14 @@ export final class InterfaceType extends Type { throw new Error("Not implemented") } - internal hasSuperInterface(expected: InterfaceType): boolean { + public hasSuperInterface(expected: InterfaceType): boolean { if (this.equals(expected)) { return true } return TypeAPI.isInheritedFrom(this.cls, expected.cls) } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (!this.assignableFrom(objType)) { throw new Error("invalid conversion") @@ -2212,12 +2211,12 @@ export final class ArrayType extends Type { return other instanceof ArrayType && (other as ArrayType).getElementType().subTypeOf(this.getElementType()) } - internal static getInstance(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker): ArrayType { + public static getInstance(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker): ArrayType { const arrayClass = TypeAPI.getClass(td, contextLinker)! return ArrayType.getInstance(arrayClass) } - internal static getInstance(arrayClass: Class, elemTD?: RuntimeTypeDescriptor): ArrayType { + public static getInstance(arrayClass: Class, elemTD?: RuntimeTypeDescriptor): ArrayType { elemTD = elemTD ?? TypeAPI.getArrayElementType(arrayClass) const contextLinker = arrayClass.getLinker() let ek = (TypeAPI.getTypeKind(elemTD, contextLinker) & TypeKindMask).toByte() @@ -2334,7 +2333,7 @@ export final class ArrayType extends Type { return TypeAPI.makeArrayInstance(this.elemTD, this.getContextLinker(), length) } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (this.equals(objType)) { return obj @@ -2347,7 +2346,7 @@ export final class ArrayType extends Type { } export final class TupleType extends Type { - internal constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { + public constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { super(td, contextLinker) } @@ -2375,7 +2374,7 @@ export final class TupleType extends Type { throw new Error("Not implemented") } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { throw new Error("todo(kprokopenko): add when tuple becomes available") } } @@ -2511,7 +2510,7 @@ export abstract class FunctionType extends Type { export final class LambdaType extends FunctionType { - internal constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { + public constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { super(td, contextLinker) } @@ -2581,7 +2580,7 @@ export final class LambdaType extends FunctionType { } } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (this.equals(objType)) { return obj @@ -2594,7 +2593,7 @@ export final class LambdaType extends FunctionType { } export final class MethodType extends FunctionType { - internal constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { + public constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { super(td, contextLinker) } @@ -2642,7 +2641,7 @@ export final class MethodType extends FunctionType { return this.getReceiverTypeDescriptor() !== undefined } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { throw new Error("Only LambdaType can be converted") } @@ -2655,7 +2654,7 @@ export final class MethodType extends FunctionType { export final class StringType extends Type { public static readonly REF: StringType = new StringType() - internal constructor() { + public constructor() { super(TypeAPI.convertTypeDescriptor("std.core.String"), getBootRuntimeLinker()) } @@ -2717,7 +2716,7 @@ export final class StringType extends Type { return other instanceof StringType } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (!this.equals(objType)) { throw new Error("invalid conversion") @@ -2730,7 +2729,7 @@ export final class StringType extends Type { * Represents enum type */ export final class EnumType extends Type { - internal constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { + public constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { super(td, contextLinker) } @@ -2829,7 +2828,7 @@ export final class EnumType extends Type { throw new Error("not implemented") } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { throw new Error("todo(kprokopenko): enum conversion") } } @@ -2838,7 +2837,7 @@ export final class EnumType extends Type { * Represents union type */ export final class UnionType extends Type { - internal constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { + public constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) { super(td, contextLinker) } @@ -2945,7 +2944,7 @@ export final class UnionType extends Type { throw new Error("not implemented") } - internal override convertObject(obj: Any): Any { + public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (this.equals(objType)) { return obj diff --git a/static_core/plugins/ets/stdlib/std/core/TypeCreator.ets b/static_core/plugins/ets/stdlib/std/core/TypeCreator.ets index 93d96311250d46affaea2a9a0f52c99e935087c6..c607a08906f4b6b793271f45f1b8e0f20356aaa5 100644 --- a/static_core/plugins/ets/stdlib/std/core/TypeCreator.ets +++ b/static_core/plugins/ets/stdlib/std/core/TypeCreator.ets @@ -42,8 +42,7 @@ type CollectTypesCB = (tc: TypeOrCreator) => void * Base for all type creators, supports creation of {@link Type} */ export abstract class TypeCreator { - // NOTE(ekaterinazaytseva): unable to replace internal - used as public in FreezableCreator - internal typ?: Type // not undefined if already created + protected typ?: Type // not undefined if already created protected ctxItemPtr: long = 0 // resides in ctx, no need to free /** @@ -69,26 +68,22 @@ export abstract class TypeCreator { * Traverses all types on which this `TypeCreator` depends * @param collector callback to be called with every type */ - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal abstract collectTypes(collector: CollectTypesCB): void + public abstract collectTypes(collector: CollectTypesCB): void /** * Must declare up to the point where future type descriptor is determinated * @param ctx current context */ - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal abstract declare(ctx: TypeCreatorCtx): void + public abstract declare(ctx: TypeCreatorCtx): void /** * Defines rest of the body, called after {@link declare} * @param ctx current context */ - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal abstract define(ctx: TypeCreatorCtx): void + public abstract define(ctx: TypeCreatorCtx): void /** Makes class sealed in stdlib */ - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal constructor() {} + public constructor() {} /** * Functions that verifies that this can be modified @@ -101,8 +96,7 @@ export abstract class TypeCreator { * @returns type descriptor that created type will habe * @note will be called only after {@link define} */ - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal getTypeDescriptor(): RuntimeTypeDescriptor { + public getTypeDescriptor(): RuntimeTypeDescriptor { if (this.typ != undefined) { return this.typ!.getTypeDesc() } @@ -438,7 +432,7 @@ export final class ClassTypeCreator extends TypeCreator { return this; } - internal override collectTypes(collector: CollectTypesCB): void { + public override collectTypes(collector: CollectTypesCB): void { collector(this.base) for (let i = 0; i < this.ifaces.length; i++) { collector(this.ifaces.$_get(i)) @@ -455,14 +449,14 @@ export final class ClassTypeCreator extends TypeCreator { } } - internal override declare(ctx: TypeCreatorCtx): void { + public override declare(ctx: TypeCreatorCtx): void { if (this.ctxItemPtr !== 0) { throw new AssertionError("this.ctxItemPtr is not 0") } this.ctxItemPtr = ctx.checkCtxItemPtr(TypeCreatorCtx.classCreate(ctx.ctxPtr, this.name, this.attrs.get())) } - internal override define(ctx: TypeCreatorCtx): void { + public override define(ctx: TypeCreatorCtx): void { const classPtr = this.ctxItemPtr ctx.checkError(TypeCreatorCtx.classSetBase(classPtr, this.base.getTypeDescriptor())) for (let i = 0; i < this.ifaces.length; i++) { @@ -594,7 +588,7 @@ export final class InterfaceTypeCreator extends TypeCreator { return this; } - internal override collectTypes(collector: CollectTypesCB): void { + public override collectTypes(collector: CollectTypesCB): void { for (let i = 0; i < this.bases.length; i++) { collector(this.bases.$_get(i)) } @@ -607,7 +601,7 @@ export final class InterfaceTypeCreator extends TypeCreator { } } - internal override define(ctx: TypeCreatorCtx): void { + public override define(ctx: TypeCreatorCtx): void { const classPtr = this.ctxItemPtr for (let i = 0; i < this.bases.length; i++) { ctx.checkError(TypeCreatorCtx.interfaceAddBase(classPtr, this.bases.$_get(i).getTypeDescriptor())) @@ -618,7 +612,7 @@ export final class InterfaceTypeCreator extends TypeCreator { } } - internal override declare(ctx: TypeCreatorCtx): void { + public override declare(ctx: TypeCreatorCtx): void { if (this.ctxItemPtr !== 0) { throw new AssertionError("this.ctxItemPtr is not 0") } @@ -634,8 +628,8 @@ export final class InterfaceTypeCreator extends TypeCreator { * Creator for {@link LambdaType} */ export final class LambdaTypeCreator extends TypeCreator { - internal params: Array = new Array(); - internal result: TypeOrCreator = TypeOrCreator.from(VoidType.REF); + public params: Array = new Array(); + public result: TypeOrCreator = TypeOrCreator.from(VoidType.REF); private attrs: HasAttributes private targetLinker: RuntimeLinker @@ -691,7 +685,7 @@ export final class LambdaTypeCreator extends TypeCreator { * @param typ type of result * @returns this */ - internal addResult(typ: TypeOrCreator): LambdaTypeCreator { + public addResult(typ: TypeOrCreator): LambdaTypeCreator { this.checkNotCreated() this.result = typ return this; @@ -716,14 +710,14 @@ export final class LambdaTypeCreator extends TypeCreator { return this; } - internal override collectTypes(collector: CollectTypesCB): void { + public override collectTypes(collector: CollectTypesCB): void { collector(this.result) for (let i = 0; i < this.params.length; i++) { collector(this.params.$_get(i).typ) } } - internal override declare(ctx: TypeCreatorCtx): void { + public override declare(ctx: TypeCreatorCtx): void { if (this.ctxItemPtr !== 0) { throw new AssertionError("this.ctxItemPtr is not 0") } @@ -737,7 +731,7 @@ export final class LambdaTypeCreator extends TypeCreator { ctx.checkError(TypeCreatorCtx.lambdaTypeAdd(ftPtr)) } - internal override define(ctx: TypeCreatorCtx): void { + public override define(ctx: TypeCreatorCtx): void { } protected override getTargetLinker(): RuntimeLinker { @@ -763,16 +757,26 @@ function checkNotFrozen(freezable: Freezable): void { } } -final class FreezableCreator implements Freezable { - private creator: TypeCreator +final class FreezableCreator extends TypeCreator implements Freezable { constructor(creator: TypeCreator) { - this.creator = creator + super() + this.typ = creator.typ } override isFrozen(): boolean { - return this.creator.typ != undefined + return this.typ != undefined + } + + protected override getTargetLinker(): RuntimeLinker { + return getNearestNonBootRuntimeLinker()! } + + public override collectTypes(collector: CollectTypesCB): void {} + + public override declare(ctx: TypeCreatorCtx): void {} + + public override define(ctx: TypeCreatorCtx): void {} } /** @@ -875,14 +879,8 @@ class HasAccessMod { * Creator for {@link Field}. Must be used as a part of {@link TypeCreator}. */ export final class FieldCreator { - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal name: string - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal typ: TypeOrCreator -// // // <<<<<<< HEAD -// internal frozen: FreezableImpl = new FreezableImpl() -// internal attrs: HasAttributes -// internal accessMod: HasAccessMod + public name: string + public typ: TypeOrCreator /** * @param name new field name @@ -896,8 +894,7 @@ export final class FieldCreator { } private frozen: FreezableImpl = new FreezableImpl() - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal attrs: HasAttributes + public attrs: HasAttributes private accessMod: HasAccessMod /** @@ -941,11 +938,10 @@ export final class FieldCreator { * Creator for {@link Parameter}. Must be used as a part of {@link MethodCreator}. */ export final class ParameterCreator { - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal typ: TypeOrCreator - internal name?: string - internal frozen: FreezableImpl = new FreezableImpl() - internal attrs: HasAttributes + public typ: TypeOrCreator + public name?: string + public frozen: FreezableImpl = new FreezableImpl() + public attrs: HasAttributes /** * @param parameter type @@ -973,7 +969,7 @@ export final class ParameterCreator { /** * @param parameter type */ - internal constructor(typ: TypeOrCreator) { + public constructor(typ: TypeOrCreator) { this.typ = typ this.attrs = new HasAttributes(this.frozen, AllowedAttributes.PARAMETER) } @@ -1020,13 +1016,12 @@ export final class ParameterCreator { * Creator for {@link Method}. Must be used as a part of {@link ClassTypeCreator} or {@link InterfaceTypeCreatpr}. */ export final class MethodCreator { - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal name: string - internal params: Array = new Array(); - internal result: TypeOrCreator = TypeOrCreator.from(VoidType.REF); + public name: string + public params: Array = new Array(); + public result: TypeOrCreator = TypeOrCreator.from(VoidType.REF); private body?: CallableBody - internal frozen: FreezableImpl = new FreezableImpl() - internal attrs: HasAttributes + public frozen: FreezableImpl = new FreezableImpl() + public attrs: HasAttributes private accessMod: HasAccessMod /** @@ -1083,8 +1078,7 @@ export final class MethodCreator { * @param typ type of result * @returns this */ - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal addResult(typ: TypeOrCreator): MethodCreator { + public addResult(typ: TypeOrCreator): MethodCreator { checkNotFrozen(this.frozen) this.result = typ return this; @@ -1166,8 +1160,7 @@ export final class MethodCreator { /** * adds method to interface or class */ - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal addToCtxItemPtr(ctx: TypeCreatorCtx, classOrIfacePtr: long): void { + public addToCtxItemPtr(ctx: TypeCreatorCtx, classOrIfacePtr: long): void { const fptr = ctx.checkCtxItemPtr(TypeCreatorCtx.methodCreate(classOrIfacePtr, this.name, this.attrs.get())) ctx.checkError(TypeCreatorCtx.methodAddAccessMod(fptr, this.accessMod.get())) for (let a = 0; a < this.params.length; a++) { diff --git a/static_core/plugins/ets/stdlib/std/core/Value.ets b/static_core/plugins/ets/stdlib/std/core/Value.ets index 2ebf1cea1b80806d3d8f9cddc0786c09112ab4f3..62fc8500b4d3148726b35121b4aaf1fdd0e93ce7 100644 --- a/static_core/plugins/ets/stdlib/std/core/Value.ets +++ b/static_core/plugins/ets/stdlib/std/core/Value.ets @@ -286,8 +286,7 @@ export final class ClassValue extends reflect.Value { return this.data } - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal constructor(typ: ClassType, data: Object) { + public constructor(typ: ClassType, data: Object) { this.typ = typ this.data = data } @@ -587,7 +586,7 @@ export final class ArrayValue extends reflect.Value { return this.data } - internal constructor(typ: ArrayType, data: Object) { + public constructor(typ: ArrayType, data: Object) { this.typ = typ this.data = data } @@ -725,7 +724,7 @@ export final class LambdaValue extends reflect.Value { return this.data } - internal constructor(typ: LambdaType, data: Object) { + public constructor(typ: LambdaType, data: Object) { this.typ = typ this.data = data } @@ -767,7 +766,7 @@ export final class BooleanValue extends reflect.Value { return this.data } - internal constructor(typ: BooleanType, data: boolean) { + public constructor(typ: BooleanType, data: boolean) { this.typ = typ this.data = data } @@ -804,7 +803,7 @@ export final class ByteValue extends reflect.Value { return this.data } - internal constructor(typ: ByteType, data: byte) { + public constructor(typ: ByteType, data: byte) { this.typ = typ this.data = data } @@ -841,7 +840,7 @@ export final class ShortValue extends reflect.Value { return this.data } - internal constructor(typ: ShortType, data: short) { + public constructor(typ: ShortType, data: short) { this.typ = typ this.data = data } @@ -878,7 +877,7 @@ export final class CharValue extends reflect.Value { return this.data } - internal constructor(typ: CharType, data: char) { + public constructor(typ: CharType, data: char) { this.typ = typ this.data = data } @@ -915,7 +914,7 @@ export final class IntValue extends reflect.Value { return this.data } - internal constructor(typ: IntType, data: int) { + public constructor(typ: IntType, data: int) { this.typ = typ this.data = data } @@ -952,7 +951,7 @@ export final class FloatValue extends reflect.Value { return this.data } - internal constructor(typ: FloatType, data: float) { + public constructor(typ: FloatType, data: float) { this.typ = typ this.data = data } @@ -989,7 +988,7 @@ export final class DoubleValue extends reflect.Value { return this.data } - internal constructor(typ: DoubleType, data: double) { + public constructor(typ: DoubleType, data: double) { this.typ = typ this.data = data } @@ -1026,7 +1025,7 @@ export final class LongValue extends reflect.Value { return this.data } - internal constructor(typ: LongType, data: long) { + public constructor(typ: LongType, data: long) { this.typ = typ this.data = data } @@ -1059,7 +1058,7 @@ export final class StringValue extends reflect.Value { return this.data } - internal constructor(typ: StringType, data: String) { + public constructor(typ: StringType, data: String) { this.typ = typ this.data = data } @@ -1091,7 +1090,7 @@ export final class NullValue extends reflect.Value { return null } - internal constructor() {} + public constructor() {} public override toPrint(depth: int): string { return NullType.REF.toString() @@ -1120,7 +1119,7 @@ export final class UndefinedValue extends reflect.Value { return undefined } - internal constructor() {} + public constructor() {} public override toPrint(depth: int): string { return UndefinedType.REF.toString() @@ -1149,7 +1148,7 @@ export final class VoidValue extends reflect.Value { return Void.void_instance } - internal constructor() {} + public constructor() {} public override toPrint(depth: int): string { return VoidType.REF.toString() diff --git a/static_core/plugins/ets/stdlib/std/core/_initializerBlock_.ets b/static_core/plugins/ets/stdlib/std/core/_initializerBlock_.ets index 2a46f54938dbd7a1101ff8e2acab87f114033a3c..25fdeab5e9989dd42f93b503d2bca450697d9112 100644 --- a/static_core/plugins/ets/stdlib/std/core/_initializerBlock_.ets +++ b/static_core/plugins/ets/stdlib/std/core/_initializerBlock_.ets @@ -18,8 +18,8 @@ package std.core; static { // 5 lower bits stores kind's id TypeKindMask = ((1 << 6) - 1).toByte(); - + BigIntType = Type.of(new BigInt()); ObjectType = Type.of(new Object()) as ClassType; - console = new Console(); + console = Console.getInstance(); coroutine = new Coroutine(); } diff --git a/static_core/plugins/ets/stdlib/escompat/json.ets b/static_core/plugins/ets/stdlib/std/core/json.ets similarity index 99% rename from static_core/plugins/ets/stdlib/escompat/json.ets rename to static_core/plugins/ets/stdlib/std/core/json.ets index b1b37e04791a292cb3608699940ea606ea6e2664..b9ffec2f44eb36484002c1c6311a6a8ef1fc23cc 100644 --- a/static_core/plugins/ets/stdlib/escompat/json.ets +++ b/static_core/plugins/ets/stdlib/std/core/json.ets @@ -13,11 +13,9 @@ * limitations under the License. */ -package escompat +package std.core +// import { jsonx } from "std/core" -import { jsonx } from "std/core" - -// initialized in _initializerBlock_.ets const BigIntType: Type; export interface JsonReplacer { diff --git a/static_core/plugins/ets/stdlib/std/interop/ESValue.ets b/static_core/plugins/ets/stdlib/std/interop/ESValue.ets index a769f61e638618b42ce3d9d212b0fb81fa9ba7cf..0a1773df69495a7f9ee94ffddd841ae029b15d56 100644 --- a/static_core/plugins/ets/stdlib/std/interop/ESValue.ets +++ b/static_core/plugins/ets/stdlib/std/interop/ESValue.ets @@ -368,8 +368,7 @@ export final class ESValue { return new ESValue(JSRuntime.invoke(ESValue.Undefined.ev, this.ev, ...argsAny)); } - // NOTE(ekaterinazaytseva): unable to replace internal - used as public - internal invokeWithRecv(recv: ESValue, ...args: FixedArray): ESValue { + public invokeWithRecv(recv: ESValue, ...args: FixedArray): ESValue { let argsAny: FixedArray = new Any[args.length]; for (let i = 0; i < args.length; i++) { if (args[i] instanceof ESValue) { diff --git a/static_core/plugins/ets/templates/stdlib/Array_builtin.erb b/static_core/plugins/ets/templates/stdlib/Array_builtin.erb index cfcac9a48495fd974bd1cf7327b6f6a9149ca087..c30a5e23b17226a7d86802e515bd70d6dd87c7a7 100644 --- a/static_core/plugins/ets/templates/stdlib/Array_builtin.erb +++ b/static_core/plugins/ets/templates/stdlib/Array_builtin.erb @@ -62,6 +62,7 @@ class BuiltinArrayKeysIterator implements IterableIterator { % ctx.access_private = 'function' % ctx.override = '' % ctx.get_unsafe = Proc.new { |t, i| "#{t}[#{i}]" } +% ctx.get = Proc.new { |t, i| "#{t}[#{i}]" } % ctx.set_unsafe = Proc.new { |t, i, v| "#{t}[#{i}] = #{v}" } % ctx.arr_method_call = Proc.new { |t, f, *args| "#{f}(#{args.prepend(t).join(', ')})" } % primitive_types = ['boolean', 'byte', 'short', 'int', 'long', 'float', 'double', 'char'] diff --git a/static_core/plugins/ets/templates/stdlib/Array_common_top_scope.erb b/static_core/plugins/ets/templates/stdlib/Array_common_top_scope.erb index 723f7ed6a24abf0a6d5554660c48f9af37e0ef95..00ea5f7e810432a14b08dcbfc1b2507e7506660b 100644 --- a/static_core/plugins/ets/templates/stdlib/Array_common_top_scope.erb +++ b/static_core/plugins/ets/templates/stdlib/Array_common_top_scope.erb @@ -27,7 +27,7 @@ class ArrayValuesIterator_<%= ctx.el_type %><%= ctx.this_iterator_generic || ctx this.isDone = true return new IteratorResult<<%= ctx.el_type %>>() } - return new IteratorResult<<%= ctx.el_type %>>(<%= ctx.get_unsafe.('this.parent', 'this.idx++') %>) + return new IteratorResult<<%= ctx.el_type %>>(<%= ctx.get.('this.parent', 'this.idx++') %>) } override $_iterator(): IterableIterator<<%= ctx.el_type %>> { @@ -54,7 +54,7 @@ class ArrayEntriesIterator_<%= ctx.el_type %><%= ctx.this_iterator_generic || ct return new IteratorResult<[number, <%= ctx.el_type %>]>() } const i = this.idx++; - const vl: [number, <%= ctx.el_type %>] = [i.toDouble(), <%= ctx.get_unsafe.('this.parent', 'i') %>] + const vl: [number, <%= ctx.el_type %>] = [i.toDouble(), <%= ctx.get.('this.parent', 'i') %>] return new IteratorResult<[number, <%= ctx.el_type %>]>(vl); } diff --git a/static_core/plugins/ets/templates/stdlib/Array_escompat.erb b/static_core/plugins/ets/templates/stdlib/Array_escompat.erb index 31be6ff0001f6c3bfba1b3bf7d28c379ddae633b..d3ec78f0595e935e3f4a08dbef40cbb5cc646335 100644 --- a/static_core/plugins/ets/templates/stdlib/Array_escompat.erb +++ b/static_core/plugins/ets/templates/stdlib/Array_escompat.erb @@ -70,8 +70,7 @@ export class Array implements ReadonlyArray, Iterable { public override native $_get(idx: int): T; - //NOTE(ekaterinazaytseva): unable to replace internal - using from friend class ArrayValuesIterator_T provide accsess problems - internal final native $_get_unsafe(idx: int): T + private final native $_get_unsafe(idx: int): T public native $_set(idx: int, val: T): void; @@ -94,8 +93,7 @@ export class Array implements ReadonlyArray, Iterable { this.actualLength = buf.length } - //NOTE(ekaterinazaytseva): unable to replace internal - using default c-tor from non-inherited classes provide accsess problems - internal constructor() { + public constructor() { this.buffer = new Any[4] this.actualLength = 0 } @@ -981,6 +979,7 @@ export class Array implements ReadonlyArray, Iterable { % ctx.override = 'override' % ctx.override_expected_here = '' # hide 'override' when it cannot be implemented % ctx.get_unsafe = Proc.new { |t, i| "#{t}.$_get_unsafe(#{i})" } +% ctx.get = Proc.new { |t, i| "#{t}[#{i}]" } % ctx.set_unsafe = Proc.new { |t, i, v| "#{t}.$_set_unsafe(#{i}, #{v})" } % ctx.el_type = 'T' % ctx.el_type_boxed = 'T' diff --git a/static_core/plugins/ets/templates/stdlib/typedArray.ets.j2 b/static_core/plugins/ets/templates/stdlib/typedArray.ets.j2 index 75d75a966cc1b026d46ce27717d141c3158920f9..c43bda5616d5933a78c6d0961491b227c419f775 100644 --- a/static_core/plugins/ets/templates/stdlib/typedArray.ets.j2 +++ b/static_core/plugins/ets/templates/stdlib/typedArray.ets.j2 @@ -737,9 +737,7 @@ export final class {{N}}Array implements Iterable<{{subsetTypeValues}}>, ArrayLi {%- elif argType == 'float' %} res.ofFloat(items) {%- elif argType == 'bigint' %} - for (let i: int = 0; i < items.length; i++) { - res.setUnsafe(i, items[i].getLong()) - } + res.ofBigInt(items) {%- else %} res.ofNumber(items) {%- endif %} @@ -757,6 +755,7 @@ export final class {{N}}Array implements Iterable<{{subsetTypeValues}}>, ArrayLi private final native ofShort(items: FixedArray): void {%- elif N == 'BigInt64' %} private final native ofLong(items: FixedArray): void + private final native ofBigInt(items: FixedArray): void {%- elif N == 'Float32' %} private final native ofFloat(items: FixedArray): void {%- endif %} @@ -836,6 +835,25 @@ export final class {{N}}Array implements Iterable<{{subsetTypeValues}}>, ArrayLi } {%- endif %} + /** + * Creates an array from an object of FixedArray<{{updatedElementCompat}}>. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new {{N}}Array + */ + public static fromFixedArray{{updatedElementCompat}}(arr: FixedArray<{{updatedElementCompat}}>): {{N}}Array { + let result = new {{N}}Array(arr.length) + {%- if updatedElementCompat == 'number' %} + result.ofNumber(arr) + {%- elif updatedElementCompat == 'BigInt' %} + result.ofBigInt(arr) + {%- else %} + result.ofInt(arr) + {%- endif %} + return result + } + private native final set(array: Array<{{updatedElementCompat}}>): void; /** @@ -848,7 +866,7 @@ export final class {{N}}Array implements Iterable<{{subsetTypeValues}}>, ArrayLi public static fromArray{{updatedElementCompat}}(arr: Array<{{updatedElementCompat}}>): {{N}}Array { let result = new {{N}}Array(arr.length) result.set(arr) - return result; + return result } /** @@ -946,7 +964,8 @@ export final class {{N}}Array implements Iterable<{{subsetTypeValues}}>, ArrayLi public static overload from { fromSet{{updatedElementCompat}}, from{{N}}Array{%- if U|length %} ,from{{U}}Array{%- endif %}, - fromArray{{updatedElementCompat}}, fromArrayLikeNumber, fromArrayLike, fromIterable + fromFixedArray{{updatedElementCompat}}, fromArray{{updatedElementCompat}}, fromArrayLikeNumber, + fromArrayLike, fromIterable }; {%- if (N == 'Float32') or (N == 'Float64') %} diff --git a/static_core/plugins/ets/templates/stdlib/typedUArray.ets.j2 b/static_core/plugins/ets/templates/stdlib/typedUArray.ets.j2 index 4ba79a75d7f8ad2a20d18cd89d368aadaaea6159..ec3401c68df9c798892c3b189f00af361b065417 100644 --- a/static_core/plugins/ets/templates/stdlib/typedUArray.ets.j2 +++ b/static_core/plugins/ets/templates/stdlib/typedUArray.ets.j2 @@ -685,9 +685,7 @@ export final class {{element['name']}}Array implements Iterable<{{element['subse {%- elif argType == 'long' %} res.ofLong(items) {%- elif argType == 'bigint' %} - for (let i: int = 0; i < items.length; i++) { - res.setUnsafeClamp(i, items[i].getULong()) - } + res.ofBigInt(items) {%- else %} {%- if element.get('name') == 'BigUint64' %} for (let i: int = 0; i < items.length; i++) { @@ -712,6 +710,7 @@ export final class {{element['name']}}Array implements Iterable<{{element['subse private final native ofLong(items: FixedArray): void {%- elif element.get('name') == 'BigUint64' %} private final native ofLong(items: FixedArray): void + private final native ofBigInt(items: FixedArray): void {%- endif %} /** @@ -829,6 +828,23 @@ export final class {{element['name']}}Array implements Iterable<{{element['subse } {%- endif %} + /** + * Creates an array from an object of FixedArray<{{updatedSubsetType}}>. + * + * @param arr An instance of the FixedArray type to convert to an array. + * + * @returns new {{element['name']}}Array + */ + public static fromFixedArray{{updatedSubsetType}}(arr: FixedArray<{{updatedSubsetType}}>): {{element['name']}}Array { + let result = new {{element['name']}}Array(arr.length) + {%- if updatedSubsetType == 'BigInt' %} + result.ofBigInt(arr) + {%- else %} + result.ofInt(arr) + {%- endif %} + return result + } + private native final set(array: Array<{{updatedSubsetType}}>): void; /** @@ -841,7 +857,7 @@ export final class {{element['name']}}Array implements Iterable<{{element['subse public static fromArray{{updatedSubsetType}}(arr: Array<{{updatedSubsetType}}>): {{element['name']}}Array { let result = new {{element['name']}}Array(arr.length) result.set(arr) - return result; + return result } /** @@ -940,7 +956,8 @@ export final class {{element['name']}}Array implements Iterable<{{element['subse public static overload from { fromSet{{updatedSubsetType}}, from{{element['name']}}Array {%- if element['signed'] is defined and element['signed']|length %} ,from{{element['signed']}}Array{%- endif %} - ,fromArray{{updatedSubsetType}}, fromArrayLike{{element['subsetType']}}, fromArrayLike, fromIterable + ,fromFixedArray{{updatedSubsetType}}, fromArray{{updatedSubsetType}}, fromArrayLike{{element['subsetType']}}, + fromArrayLike, fromIterable }; /** diff --git a/static_core/plugins/ets/tests/ani/tests/bridges/CMakeLists.txt b/static_core/plugins/ets/tests/ani/tests/bridges/CMakeLists.txt index 9d0df36d5b9cb96ae48b75809d898b83983166e4..b40f1539c67c62cd8509ec51c779dd399cf961d8 100644 --- a/static_core/plugins/ets/tests/ani/tests/bridges/CMakeLists.txt +++ b/static_core/plugins/ets/tests/ani/tests/bridges/CMakeLists.txt @@ -72,11 +72,6 @@ set(PANDA_RUN_PREFIX add_custom_target(ani_tests_bridges_tests COMMENT "Common target to run ANI bridges tests") function(add_tests pref suff) - # NOTE(mgroshev): #29597 - if(${pref} STREQUAL "types_double") - set(RT_OPTION "--compiler-inlining=false") - endif() - set(test_name ${pref}_${suff}) panda_add_library(${test_name} SHARED ${CMAKE_CURRENT_BINARY_DIR}/tests/${test_name}/${test_name}.cpp) add_dependencies(${test_name} ani_tests_bridges_generate_test_files) diff --git a/static_core/plugins/ets/tests/ani/tests/class_ops/class_find_field_test.ets b/static_core/plugins/ets/tests/ani/tests/class_ops/class_find_field_test.ets index 3de61efde2e96f6bb17855a352a5a630eb0e66b4..4c5e0666585650473c3e96a82e8b02275582f495 100644 --- a/static_core/plugins/ets/tests/ani/tests/class_ops/class_find_field_test.ets +++ b/static_core/plugins/ets/tests/ani/tests/class_ops/class_find_field_test.ets @@ -45,7 +45,7 @@ class Sphere extends Circle {} class Space { objects: [Circle, Sphere, Vector, ExtendedPoint, Point]; - internal dimension: int; + private dimension: int; constructor(objects: [Circle, Sphere, Vector, ExtendedPoint, Point]) { this.objects = objects } diff --git a/static_core/plugins/ets/tests/checked/escompat_array_from.ets b/static_core/plugins/ets/tests/checked/escompat_array_from.ets index ba70a97004482453279c6704b30b8257a8e3d5ee..78a29d0811397e7a6f0616054babf7e620d93f48 100644 --- a/static_core/plugins/ets/tests/checked/escompat_array_from.ets +++ b/static_core/plugins/ets/tests/checked/escompat_array_from.ets @@ -44,7 +44,7 @@ let bigFromUint8ClampedArray: Uint8ClampedArray = new Uint8ClampedArray(longSize class ArrayLikeImplTest implements ArrayLike { private buffer: Any[] - internal actualLength: int + protected actualLength: int override $_get(index: int): T { if ((index < 0) || (index >= this.actualLength)) { diff --git a/static_core/plugins/ets/tests/ets-common-tests/atomics/concurrent_wait_store_notify.ets b/static_core/plugins/ets/tests/ets-common-tests/atomics/concurrent_wait_store_notify.ets index fe248522b65d8caa096ef6ec228481a1aa22df71..a2c355f2b84222cca7cc6b3775df1ec6ec60871b 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/atomics/concurrent_wait_store_notify.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/atomics/concurrent_wait_store_notify.ets @@ -24,7 +24,7 @@ let arr: Int32Array = new Int32Array; let bytearr: Int8Array = new Int8Array; function testMain() { - let c = new Console() + let c = Console.getInstance() buf = new ArrayBuffer(4); arr = new Int32Array(buf, 0, 1); @@ -38,7 +38,7 @@ function testMain() { } function writer(): Int { - let c = new Console() + let c = Console.getInstance() wait() Atomics.store(bytearr, 0, 5 as byte) diff --git a/static_core/plugins/ets/tests/ets-common-tests/atomics/nonconcurrent_wait_i32_not_equal.ets b/static_core/plugins/ets/tests/ets-common-tests/atomics/nonconcurrent_wait_i32_not_equal.ets index e0bf16e9d1ae0d6e8a06dd7ab759221386b82139..f1601ea4395c903fdc9ec50199c5f67042b702db 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/atomics/nonconcurrent_wait_i32_not_equal.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/atomics/nonconcurrent_wait_i32_not_equal.ets @@ -18,7 +18,7 @@ function test(byteToChange: int) { let arr = new Int32Array(buf, 0, 1); let bytearr = new Int8Array(buf, 0, 4); - (new Console()).println('Testing for byte: ' + byteToChange) + (Console.getInstance()).println('Testing for byte: ' + byteToChange) Atomics.store(bytearr, byteToChange, 1); let x = Atomics.wait(arr, 0, 0) arktest.assertEQ(x, 'not-equal') diff --git a/static_core/plugins/ets/tests/ets-common-tests/atomics/nonconcurrent_wait_i64_not_equal.ets b/static_core/plugins/ets/tests/ets-common-tests/atomics/nonconcurrent_wait_i64_not_equal.ets index b43f125f8b28682ff1c5e1c51ac56d12ea9776ff..8173d1ec49034a8d57356059dfc6d3fa26f4ffe6 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/atomics/nonconcurrent_wait_i64_not_equal.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/atomics/nonconcurrent_wait_i64_not_equal.ets @@ -18,7 +18,7 @@ function test(byteToChange: int) { let arr = new Int32Array(buf, 0, 1); let bytearr = new Int8Array(buf, 0, 4); - (new Console()).println('Testing for byte: ' + byteToChange) + (Console.getInstance()).println('Testing for byte: ' + byteToChange) Atomics.store(bytearr, byteToChange, 1); let x = Atomics.wait(arr, 0, 0) arktest.assertEQ(x, 'not-equal') diff --git a/static_core/plugins/ets/tests/ets-common-tests/atomics/nonconcurrent_waitasync_store_notify.ets b/static_core/plugins/ets/tests/ets-common-tests/atomics/nonconcurrent_waitasync_store_notify.ets index 545e061d3ce4de0ca50469b3a834b98ec2a1a80b..f1ccfe3c9f479ff90ef23bcaf14524f84dbf76c1 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/atomics/nonconcurrent_waitasync_store_notify.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/atomics/nonconcurrent_waitasync_store_notify.ets @@ -17,7 +17,7 @@ let buf: ArrayBuffer; let arr: Int32Array; async function testMain() { - let c = new Console() + let c = Console.getInstance() buf = new ArrayBuffer(4); arr = new Int32Array(buf, 0, 1); diff --git a/static_core/plugins/ets/tests/ets-common-tests/atomics/skipped_cyclic_barrier.ets b/static_core/plugins/ets/tests/ets-common-tests/atomics/skipped_cyclic_barrier.ets index a599f0ca31c82c18dec8c730722c7d7efadd64b7..84a98364f37b429d0aed25fb06a9ca666460fb2c 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/atomics/skipped_cyclic_barrier.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/atomics/skipped_cyclic_barrier.ets @@ -34,7 +34,7 @@ function testMain() { } function task(): Int { - let c = new Console() // workaround, issue: #12996 + let c = Console.getInstance() // workaround, issue: #12996 heavyComputation() c.println("task completed, waiting") diff --git a/static_core/plugins/ets/tests/ets-common-tests/atomics/skipped_rendezvous_channel.ets b/static_core/plugins/ets/tests/ets-common-tests/atomics/skipped_rendezvous_channel.ets index 52a0481658063aa6314fa3d97bd2bd73c7936fcb..3c28e44f09c9242607044102621549f4ca87fc33 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/atomics/skipped_rendezvous_channel.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/atomics/skipped_rendezvous_channel.ets @@ -28,7 +28,7 @@ function testMain() { } function producer(): Int { - let c = new Console() // workaround, issue: #12996 + let c = Console.getInstance() // workaround, issue: #12996 for (let i = 1; i < 10; i++) { c.println('sending ' + i) @@ -39,7 +39,7 @@ function producer(): Int { } function consumer(): Int { - let c = new Console() // workaround, issue: #12996 + let c = Console.getInstance() // workaround, issue: #12996 for (let i = 1; i < 10; i++) { c.println('receiving') diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/typed_arrays_from.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/typed_arrays_from.ets index acf45aaf1d18b60a598174fb6486397f30226a14..db25a5d31ad445243fd2bd7acfcf83e81520f728 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/typed_arrays_from.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/typed_arrays_from.ets @@ -23,8 +23,10 @@ function testIU8FromArrayWrongType() { function testIU8FromIterableNumber() { checkNumberArray(Int8Array.of(), Int8Array.from(new Set())); checkNumberArray(Uint8Array.of(), Uint8Array.from(new Set())); + checkNumberArray(Uint8ClampedArray.of(), Uint8ClampedArray.from(new Set())); checkNumberArray(Int8Array.of(), Int8Array.from(new Set())); checkNumberArray(Uint8Array.of(), Uint8Array.from(new Set())); + checkNumberArray(Uint8ClampedArray.of(), Uint8ClampedArray.from(new Set())); const len: int = 127; let iexpected: Int8Array = new Int8Array(len); @@ -58,16 +60,28 @@ function testIU8FromIterableNumber() { } function testIU8FromArrayLikeNumber() { + let empty: FixedArray = []; checkNumberArray(Int8Array.of(), Int8Array.from(new Array())); + checkNumberArray(Int8Array.of(), Int8Array.from([])); + checkNumberArray(Int8Array.of(), Int8Array.from(empty)); checkNumberArray(Int8Array.of(), Int8Array.from(Int8Array.of())); checkNumberArray(Int8Array.of(), Int8Array.from(Uint8Array.of())); checkNumberArray(Int8Array.of(), Int8Array.from(Int32Array.of())); checkNumberArray(Int8Array.of(), Int8Array.from(Uint32Array.of())); checkNumberArray(Uint8Array.of(), Uint8Array.from(new Array())); + checkNumberArray(Uint8Array.of(), Uint8Array.from([])); + checkNumberArray(Uint8Array.of(), Uint8Array.from(empty)); checkNumberArray(Uint8Array.of(), Uint8Array.from(Uint8Array.of())); checkNumberArray(Uint8Array.of(), Uint8Array.from(Int8Array.of())); checkNumberArray(Uint8Array.of(), Uint8Array.from(Uint32Array.of())); checkNumberArray(Uint8Array.of(), Uint8Array.from(Int32Array.of())); + checkNumberArray(Uint8ClampedArray.of(), Uint8ClampedArray.from(new Array())); + checkNumberArray(Uint8ClampedArray.of(), Uint8ClampedArray.from([])); + checkNumberArray(Uint8ClampedArray.of(), Uint8ClampedArray.from(empty)); + checkNumberArray(Uint8ClampedArray.of(), Uint8ClampedArray.from(Uint8Array.of())); + checkNumberArray(Uint8ClampedArray.of(), Uint8ClampedArray.from(Int8Array.of())); + checkNumberArray(Uint8ClampedArray.of(), Uint8ClampedArray.from(Uint32Array.of())); + checkNumberArray(Uint8ClampedArray.of(), Uint8ClampedArray.from(Int32Array.of())); const len: int = 127; let iexpected: Int8Array = new Int8Array(len); @@ -81,35 +95,65 @@ function testIU8FromArrayLikeNumber() { uexpected[i] = u8arr[i] = u16arr[i] = Int.toDouble(i + 1); } - let data = prepareTestData(len, 1.0); + let data = prepareTestData(len, 1); let arr = data[1]; + let fixarr = data[2]; checkNumberArray(iexpected, Int8Array.from(arr)); + checkNumberArray(iexpected, Int8Array.from(fixarr)); checkNumberArray(iexpected, Int8Array.from(i8arr)); checkNumberArray(iexpected, Int8Array.from(u8arr)); checkNumberArray(iexpected, Int8Array.from(i16arr)); checkNumberArray(iexpected, Int8Array.from(u16arr)); checkNumberArray(uexpected, Uint8Array.from(arr)); + checkNumberArray(uexpected, Uint8Array.from(fixarr)); checkNumberArray(uexpected, Uint8Array.from(i8arr)); checkNumberArray(uexpected, Uint8Array.from(u8arr)); checkNumberArray(uexpected, Uint8Array.from(i16arr)); checkNumberArray(uexpected, Uint8Array.from(u16arr)); + let source: FixedArray = [0, 1, -1, 65535, -65535, 2147483647, -2147483648]; checkNumberArray(Int8Array.of(0, 1, -1, -1, 1, -1, 0), Int8Array.from(Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648))); + checkNumberArray(Int8Array.of(0, 1, -1, -1, 1, -1, 0), + Int8Array.from([0, 1, -1, 65535, -65535, 2147483647, -2147483648])); + checkNumberArray(Int8Array.of(0, 1, -1, -1, 1, -1, 0), Int8Array.from(source)); checkNumberArray(Uint8Array.of(0, 1, 255, 255, 1, 255, 0), Uint8Array.from(Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648))); + checkNumberArray(Uint8Array.of(0, 1, 255, 255, 1, 255, 0), + Uint8Array.from([0, 1, -1, 65535, -65535, 2147483647, -2147483648])); + checkNumberArray(Uint8Array.of(0, 1, 255, 255, 1, 255, 0), Uint8Array.from(source)); checkNumberArray(Uint8ClampedArray.of(0, 1, 0, 255, 0, 255, 0), Uint8ClampedArray.from(Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648))); + checkNumberArray(Uint8ClampedArray.of(0, 1, 0, 255, 0, 255, 0), + Uint8ClampedArray.from([0, 1, -1, 65535, -65535, 2147483647, -2147483648])); + checkNumberArray(Uint8ClampedArray.of(0, 1, 0, 255, 0, 255, 0), Uint8ClampedArray.from(source)); + let source2: FixedArray = [1, -1, -126, -127, -128, -129, -256, -257, 0, 12, 255, 126, 127, 128, + 254, 256, 257, 10000]; checkNumberArray(Int8Array.of(1, -1, -126, -127, -128, 127, 0, -1, 0, 12, -1, 126, 127, -128, -2, 0, 1, 16), Int8Array.from(Array.of(1, -1, -126, -127, -128, -129, -256, -257, 0, 12, 255, 126, 127, 128, 254, 256, 257, 10000))); + checkNumberArray(Int8Array.of(1, -1, -126, -127, -128, 127, 0, -1, 0, 12, -1, 126, 127, -128, -2, 0, 1, 16), + Int8Array.from([1, -1, -126, -127, -128, -129, -256, -257, 0, 12, 255, 126, 127, 128, + 254, 256, 257, 10000])); + checkNumberArray(Int8Array.of(1, -1, -126, -127, -128, 127, 0, -1, 0, 12, -1, 126, 127, -128, -2, 0, 1, 16), + Int8Array.from(source2)); checkNumberArray(Uint8Array.of(1, 255, 130, 129, 128, 127, 0, 255, 0, 12, 255, 126, 127, 128, 254, 0, 1, 16), Uint8Array.from(Array.of(1, -1, -126, -127, -128, -129, -256, -257, 0, 12, 255, 126, 127, 128, 254, 256, 257, 10000))); + checkNumberArray(Uint8Array.of(1, 255, 130, 129, 128, 127, 0, 255, 0, 12, 255, 126, 127, 128, 254, 0, 1, 16), + Uint8Array.from([1, -1, -126, -127, -128, -129, -256, -257, 0, 12, 255, 126, 127, 128, + 254, 256, 257, 10000])); + checkNumberArray(Uint8Array.of(1, 255, 130, 129, 128, 127, 0, 255, 0, 12, 255, 126, 127, 128, 254, 0, 1, 16), + Uint8Array.from(source2)); checkNumberArray(Uint8ClampedArray.of(1, 0, 0, 0, 0, 0, 0, 0, 0, 12, 255, 126, 127, 128, 254, 255, 255, 255), Uint8ClampedArray.from(Array.of(1, -1, -126, -127, -128, -129, -256, -257, 0, 12, 255, 126, 127, 128, 254, 256, 257, 10000))); + checkNumberArray(Uint8ClampedArray.of(1, 0, 0, 0, 0, 0, 0, 0, 0, 12, 255, 126, 127, 128, 254, 255, 255, 255), + Uint8ClampedArray.from([1, -1, -126, -127, -128, -129, -256, -257, 0, 12, 255, 126, + 127, 128, 254, 256, 257, 10000])); + checkNumberArray(Uint8ClampedArray.of(1, 0, 0, 0, 0, 0, 0, 0, 0, 12, 255, 126, 127, 128, 254, 255, 255, 255), + Uint8ClampedArray.from(source2)); Uint8Array.from(Int8Array.of(1, -1, -126, -127, -128, -129, -256, -257, 0, 12, 255, 126, 127, 128, 254, 256, 257, 10000)); } @@ -125,7 +169,7 @@ function testIU16FromIterableNumber() { uexpected[i] = Int.toDouble(i + 128); } - let data = prepareTestData(len, 128.0); + let data = prepareTestData(len, 128); let set = data[0]; checkNumberArray(iexpected, Int16Array.from(set)); checkNumberArray(uexpected, Uint16Array.from(set)); @@ -146,7 +190,10 @@ function testIU16FromIterableNumber() { } function testIU16FromArrayLikeNumber() { + let empty: FixedArray = []; checkNumberArray(Int16Array.of(), Int16Array.from(new Array())); + checkNumberArray(Int16Array.of(), Int16Array.from([])); + checkNumberArray(Int16Array.of(), Int16Array.from(empty)); checkNumberArray(Int16Array.of(), Int16Array.from(Int8Array.of())); checkNumberArray(Int16Array.of(), Int16Array.from(Uint8Array.of())); checkNumberArray(Int16Array.of(), Int16Array.from(Int16Array.of())); @@ -154,6 +201,8 @@ function testIU16FromArrayLikeNumber() { checkNumberArray(Int16Array.of(), Int16Array.from(Int32Array.of())); checkNumberArray(Int16Array.of(), Int16Array.from(Uint32Array.of())); checkNumberArray(Uint16Array.of(), Uint16Array.from(new Array())); + checkNumberArray(Uint16Array.of(), Uint16Array.from([])); + checkNumberArray(Uint16Array.of(), Uint16Array.from(empty)); checkNumberArray(Uint16Array.of(), Uint16Array.from(Int8Array.of())); checkNumberArray(Uint16Array.of(), Uint16Array.from(Uint8Array.of())); checkNumberArray(Uint16Array.of(), Uint16Array.from(Uint16Array.of())); @@ -176,9 +225,11 @@ function testIU16FromArrayLikeNumber() { uexpected[i] = u8arr[i] = u16arr[i] = u32arr[i] = Int.toDouble(i + 1); } - let data = prepareTestData(len, 1.0); + let data = prepareTestData(len, 1); let arr = data[1]; + let fixarr = data[2]; checkNumberArray(iexpected, Int16Array.from(arr)); + checkNumberArray(iexpected, Int16Array.from(fixarr)); checkNumberArray(iexpected, Int16Array.from(i8arr)); checkNumberArray(iexpected, Int16Array.from(u8arr)); checkNumberArray(iexpected, Int16Array.from(i16arr)); @@ -186,6 +237,7 @@ function testIU16FromArrayLikeNumber() { checkNumberArray(iexpected, Int16Array.from(i32arr)); checkNumberArray(iexpected, Int16Array.from(u32arr)); checkNumberArray(uexpected, Uint16Array.from(arr)); + checkNumberArray(uexpected, Uint16Array.from(fixarr)); checkNumberArray(uexpected, Uint16Array.from(i8arr)); checkNumberArray(uexpected, Uint16Array.from(u8arr)); checkNumberArray(uexpected, Uint16Array.from(i16arr)); @@ -198,32 +250,56 @@ function testIU16FromArrayLikeNumber() { uexpected[i] = u16arr[i] = u32arr[i] = Int.toDouble(i + 128); } - data = prepareTestData(len, 128.0); + data = prepareTestData(len, 128); arr = data[1]; + fixarr = data[2]; checkNumberArray(iexpected, Int16Array.from(arr)); + checkNumberArray(iexpected, Int16Array.from(fixarr)); checkNumberArray(iexpected, Int16Array.from(i16arr)); checkNumberArray(iexpected, Int16Array.from(u16arr)); checkNumberArray(iexpected, Int16Array.from(i32arr)); checkNumberArray(iexpected, Int16Array.from(u32arr)); checkNumberArray(uexpected, Uint16Array.from(arr)); + checkNumberArray(uexpected, Uint16Array.from(fixarr)); checkNumberArray(uexpected, Uint16Array.from(i16arr)); checkNumberArray(uexpected, Uint16Array.from(u16arr)); checkNumberArray(uexpected, Uint16Array.from(i32arr)); checkNumberArray(uexpected, Uint16Array.from(u32arr)); + let source: FixedArray = [0, 1, -1, 65535, -65535, 2147483647, -2147483648]; checkNumberArray(Int16Array.of(0, 1, -1, -1, 1, -1, 0), - Int16Array.from(new Set(Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648)))); + Int16Array.from(Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648))); + checkNumberArray(Int16Array.of(0, 1, -1, -1, 1, -1, 0), + Int16Array.from([0, 1, -1, 65535, -65535, 2147483647, -2147483648])); + checkNumberArray(Int16Array.of(0, 1, -1, -1, 1, -1, 0), Int16Array.from(source)); checkNumberArray(Uint16Array.of(0, 1, 65535, 65535, 1, 65535, 0), - Uint16Array.from(new Set(Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648)))); + Uint16Array.from(Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648))); + checkNumberArray(Uint16Array.of(0, 1, 65535, 65535, 1, 65535, 0), + Uint16Array.from([0, 1, -1, 65535, -65535, 2147483647, -2147483648])); + checkNumberArray(Uint16Array.of(0, 1, 65535, 65535, 1, 65535, 0), Uint16Array.from(source)); + let source2: FixedArray = [-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, + 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648]; checkNumberArray(Int16Array.of(-1, -32766, -32767, -32768, 32767, 1, 0, -1, 0, 12, 255, 32766, 32765, -32768, -32767, -2, -1, 0, -31072, -1, 0), - Int16Array.from(new Set(Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, - 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648)))); + Int16Array.from(Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, + 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648))); + checkNumberArray(Int16Array.of(-1, -32766, -32767, -32768, 32767, 1, 0, -1, 0, 12, 255, 32766, 32765, -32768, + -32767, -2, -1, 0, -31072, -1, 0), + Int16Array.from([-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, + 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648])); + checkNumberArray(Int16Array.of(-1, -32766, -32767, -32768, 32767, 1, 0, -1, 0, 12, 255, 32766, 32765, -32768, + -32767, -2, -1, 0, -31072, -1, 0), Int16Array.from(source2)); checkNumberArray(Uint16Array.of(65535, 32770, 32769, 32768, 32767, 1, 0, 65535, 0, 12, 255, 32766, 32765, 32768, 32769, 65534, 65535, 0, 34464, 65535, 0), - Uint16Array.from(new Set(Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, - 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648)))); + Uint16Array.from(Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, + 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648))); + checkNumberArray(Uint16Array.of(65535, 32770, 32769, 32768, 32767, 1, 0, 65535, 0, 12, 255, 32766, 32765, 32768, + 32769, 65534, 65535, 0, 34464, 65535, 0), + Uint16Array.from([-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, + 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648])); + checkNumberArray(Uint16Array.of(65535, 32770, 32769, 32768, 32767, 1, 0, 65535, 0, 12, 255, 32766, 32765, 32768, + 32769, 65534, 65535, 0, 34464, 65535, 0), Uint16Array.from(source2)); checkNumberArray(Int16Array.of(-1, -32766, -32767, -32768, 32767, 1, 0, -1, 0, 12, 255, 32766, 32765, -32768, -32767, -2, -1, 0, -31072), Int16Array.from(Uint16Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, 255, 32766, @@ -246,7 +322,7 @@ function testIU32FromIterableNumber() { uexpected[i] = Int.toDouble(i + 16536); } - let data = prepareTestData(len, 16536.0); + let data = prepareTestData(len, 16536); let set = data[0]; checkNumberArray(iexpected, Int32Array.from(set)); checkNumberArray(uexpected, Uint32Array.from(set)); @@ -268,12 +344,17 @@ function testIU32FromIterableNumber() { } function testIU32FromArrayLikeNumber() { + let empty: FixedArray = []; checkNumberArray(Int32Array.of(), Int32Array.from(new Array())); + checkNumberArray(Int32Array.of(), Int32Array.from([])); + checkNumberArray(Int32Array.of(), Int32Array.from(empty)); checkNumberArray(Int32Array.of(), Int32Array.from(Int8Array.of())); checkNumberArray(Int32Array.of(), Int32Array.from(Uint8Array.of())); checkNumberArray(Int32Array.of(), Int32Array.from(Int32Array.of())); checkNumberArray(Int32Array.of(), Int32Array.from(Uint32Array.of())); checkNumberArray(Uint32Array.of(), Uint32Array.from(new Array())); + checkNumberArray(Uint32Array.of(), Uint32Array.from([])); + checkNumberArray(Uint32Array.of(), Uint32Array.from(empty)); checkNumberArray(Uint32Array.of(), Uint32Array.from(Uint8Array.of())); checkNumberArray(Uint32Array.of(), Uint32Array.from(Int8Array.of())); checkNumberArray(Uint32Array.of(), Uint32Array.from(Uint32Array.of())); @@ -291,14 +372,17 @@ function testIU32FromArrayLikeNumber() { uexpected[i] = u8arr[i] = u32arr[i] = Int.toDouble(i + 1); } - let data = prepareTestData(len, 1.0); + let data = prepareTestData(len, 1); let arr = data[1]; + let fixarr = data[2]; checkNumberArray(iexpected, Int32Array.from(arr)); + checkNumberArray(iexpected, Int32Array.from(fixarr)); checkNumberArray(iexpected, Int32Array.from(i8arr)); checkNumberArray(iexpected, Int32Array.from(i32arr)); checkNumberArray(iexpected, Int32Array.from(u8arr)); checkNumberArray(iexpected, Int32Array.from(u32arr)); checkNumberArray(uexpected, Uint32Array.from(arr)); + checkNumberArray(uexpected, Uint32Array.from(fixarr)); checkNumberArray(uexpected, Uint32Array.from(u8arr)); checkNumberArray(uexpected, Uint32Array.from(u32arr)); checkNumberArray(uexpected, Uint32Array.from(i8arr)); @@ -309,29 +393,56 @@ function testIU32FromArrayLikeNumber() { uexpected[i] = u32arr[i] = Int.toDouble(i + 16536); } - data = prepareTestData(len, 16536.0); + data = prepareTestData(len, 16536); arr = data[1]; + fixarr = data[2]; checkNumberArray(iexpected, Int32Array.from(arr)); + checkNumberArray(iexpected, Int32Array.from(fixarr)); checkNumberArray(iexpected, Int32Array.from(i32arr)); checkNumberArray(iexpected, Int32Array.from(u32arr)); checkNumberArray(uexpected, Uint32Array.from(arr)); + checkNumberArray(uexpected, Uint32Array.from(fixarr)); checkNumberArray(uexpected, Uint32Array.from(u32arr)); checkNumberArray(uexpected, Uint32Array.from(i32arr)); + let source: FixedArray = [0, 1, -1, 65535, -65535, 2147483647, -2147483648]; checkNumberArray(Int32Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648), Int32Array.from(Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648))); + checkNumberArray(Int32Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648), + Int32Array.from([0, 1, -1, 65535, -65535, 2147483647, -2147483648])); + checkNumberArray(Int32Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648), Int32Array.from(source)); checkNumberArray(Uint32Array.of(0.0, 1.0, 4294967295.0, 65535.0, 4294901761.0, 2147483647.0, 2147483648.0), Uint32Array.from(Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648))); + checkNumberArray(Uint32Array.of(0.0, 1.0, 4294967295.0, 65535.0, 4294901761.0, 2147483647.0, 2147483648.0), + Uint32Array.from([0, 1, -1, 65535, -65535, 2147483647, -2147483648])); + checkNumberArray(Uint32Array.of(0.0, 1.0, 4294967295.0, 65535.0, 4294901761.0, 2147483647.0, 2147483648.0), + Uint32Array.from(source)); + let source2: FixedArray = [-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, + 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648]; checkNumberArray(Int32Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648), Int32Array.from(Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648))); + checkNumberArray(Int32Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, 255, 32766, 32765, + 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648), + Int32Array.from([-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, + 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648])); + checkNumberArray(Int32Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, 255, 32766, 32765, + 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648), Int32Array.from(source2)); checkNumberArray(Uint32Array.of(4294967295.0, 4294934530.0, 4294934529.0, 4294934528.0, 4294934527.0, 4294901761.0, 4294901760.0, 4294901759.0, 0.0, 12.0, 255.0, 32766.0, 32765.0, 32768.0, 32769.0, 65534.0, 65535.0, 65536.0, 100000.0, 2147483647.0, 2147483648.0), Uint32Array.from(Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648))); + checkNumberArray(Uint32Array.of(4294967295.0, 4294934530.0, 4294934529.0, 4294934528.0, 4294934527.0, 4294901761.0, + 4294901760.0, 4294901759.0, 0.0, 12.0, 255.0, 32766.0, 32765.0, 32768.0, 32769.0, 65534.0, 65535.0, + 65536.0, 100000.0, 2147483647.0, 2147483648.0), + Uint32Array.from([-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, + 255, 32766, 32765, 32768, 32769, 65534, 65535, 65536, 100000, 2147483647, -2147483648])); + checkNumberArray(Uint32Array.of(4294967295.0, 4294934530.0, 4294934529.0, 4294934528.0, 4294934527.0, 4294901761.0, + 4294901760.0, 4294901759.0, 0.0, 12.0, 255.0, 32766.0, 32765.0, 32768.0, 32769.0, 65534.0, 65535.0, + 65536.0, 100000.0, 2147483647.0, 2147483648.0), Uint32Array.from(source2)); checkNumberArray(Int32Array.of(2147483647.0, 2147483647.0, 2147483647.0, 2147483647.0, 2.0, 1.0, 0.0, 2147483647.0, 0.0, 12.0, 255.0, 2147483646.0, 2147483647.0, 2147483647.0, 2147483647.0, 2147483647.0, 2147483647.0, 0.0), @@ -368,7 +479,10 @@ function testF32FromIterableNumber() { } function testF32FromArrayLikeNumber() { + let empty: FixedArray = []; checkNumberArray(Float32Array.of(), Float32Array.from(new Array())); + checkNumberArray(Float32Array.of(), Float32Array.from([])); + checkNumberArray(Float32Array.of(), Float32Array.from(empty)); checkNumberArray(Float32Array.of(), Float32Array.from(Float64Array.of())); checkNumberArray(Float32Array.of(), Float32Array.from(Float32Array.of())); @@ -382,19 +496,41 @@ function testF32FromArrayLikeNumber() { let data = prepareTestData(len, 1.0); let arr = data[1]; + let fixarr = data[2]; checkNumberArray(expected, Float32Array.from(arr)); + checkNumberArray(expected, Float32Array.from(fixarr)); checkNumberArray(expected, Float32Array.from(f64arr)); checkNumberArray(expected, Float32Array.from(f32arr)); + let source: FixedArray = [1.0, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105, + -3.31899e+38, 3.31899e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -3.402823466385289e+38, 3.402823466385289e+38, + -3.4028235677973359e+38, 3.4028235677973359e+38, -3.4028235677973362e+38, 3.4028235677973362e+38, + -3.4028235677973362e+38 - 1.0e+23, 3.4028235677973362e+38 + 1.0e+23]; checkNumberArray(Float32Array.of(1, NaN, Infinity, 0.00001f, Infinity, -Infinity, -Infinity, -0.6e+16f, Infinity, -3.31899e+38, 3.31899e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -Infinity, Infinity), - Float32Array.from(Array.of(1.0, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105, - -3.31899e+38, 3.31899e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -3.402823466385289e+38, 3.402823466385289e+38, - -3.4028235677973359e+38, 3.4028235677973359e+38, -3.4028235677973362e+38, 3.4028235677973362e+38, - -3.4028235677973362e+38 - 1.0e+23, 3.4028235677973362e+38 + 1.0e+23))); + Float32Array.from(Array.of(1.0, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105, + -3.31899e+38, 3.31899e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -3.402823466385289e+38, 3.402823466385289e+38, + -3.4028235677973359e+38, 3.4028235677973359e+38, -3.4028235677973362e+38, 3.4028235677973362e+38, + -3.4028235677973362e+38 - 1.0e+23, 3.4028235677973362e+38 + 1.0e+23))); + checkNumberArray(Float32Array.of(1, NaN, Infinity, 0.00001f, Infinity, -Infinity, -Infinity, -0.6e+16f, Infinity, + -3.31899e+38, 3.31899e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, + -3.4028234663852886e+38, 3.4028234663852886e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -Infinity, Infinity), + Float32Array.from([1.0, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105, + -3.31899e+38, 3.31899e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -3.402823466385289e+38, 3.402823466385289e+38, + -3.4028235677973359e+38, 3.4028235677973359e+38, -3.4028235677973362e+38, 3.4028235677973362e+38, + -3.4028235677973362e+38 - 1.0e+23, 3.4028235677973362e+38 + 1.0e+23])); + checkNumberArray(Float32Array.of(1, NaN, Infinity, 0.00001f, Infinity, -Infinity, -Infinity, -0.6e+16f, Infinity, + -3.31899e+38, 3.31899e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, + -3.4028234663852886e+38, 3.4028234663852886e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -Infinity, Infinity), + Float32Array.from(source)); + + let shortsource: FixedArray = [1, 65535, -65535, NaN, Infinity]; checkNumberArray(Float32Array.of(1, 65535, -65535, NaN, Infinity), Float32Array.from(Array.of(1, 65535, -65535, NaN, Infinity))); + checkNumberArray(Float32Array.of(1, 65535, -65535, NaN, Infinity), + Float32Array.from([1, 65535, -65535, NaN, Infinity])); + checkNumberArray(Float32Array.of(1, 65535, -65535, NaN, Infinity), Float32Array.from(shortsource)); } function testF64FromIterableNumber() { @@ -412,7 +548,10 @@ function testF64FromIterableNumber() { } function testF64FromArrayLikeNumber() { + let empty: FixedArray = []; checkNumberArray(Float64Array.of(), Float64Array.from(new Array())); + checkNumberArray(Float64Array.of(), Float64Array.from([])); + checkNumberArray(Float64Array.of(), Float64Array.from(empty)); checkNumberArray(Float64Array.of(), Float64Array.from(Float64Array.of())); checkNumberArray(Float64Array.of(), Float64Array.from(Float32Array.of())); @@ -426,14 +565,25 @@ function testF64FromArrayLikeNumber() { let data = prepareTestData(len, 1.0); let arr = data[1]; + let fixarr = data[2]; checkNumberArray(expected, Float64Array.from(arr)); + checkNumberArray(expected, Float64Array.from(fixarr)); checkNumberArray(expected, Float64Array.from(f64arr)); checkNumberArray(expected, Float64Array.from(f32arr)); + let source: FixedArray = [1.0, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105]; checkNumberArray(Float64Array.of(1, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105), Float64Array.from(Array.of(1.0, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105))); + checkNumberArray(Float64Array.of(1, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105), + Float64Array.from([1.0, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105])); + checkNumberArray(Float64Array.of(1, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105), + Float64Array.from(source)); + let shortsource: FixedArray = [1, 65535, -65535, NaN, Infinity]; checkNumberArray(Float64Array.of(1, 65535, -65535, NaN, Infinity), Float64Array.from(Array.of(1, 65535, -65535, NaN, Infinity))); + checkNumberArray(Float64Array.of(1, 65535, -65535, NaN, Infinity), + Float64Array.from([1, 65535, -65535, NaN, Infinity])); + checkNumberArray(Float64Array.of(1, 65535, -65535, NaN, Infinity), Float64Array.from(shortsource)); } function testIU64FromArrayLikeNumber() { @@ -467,7 +617,7 @@ function __noinline__Float32ArrayFromCheckException(obj: Object, factType: strin }); } -function __noinline__BigInt64ArrayFromCheckException(obj: Object, factType: string): void +function __noinline__BigInt64ArrayFromArrayCheckException(obj: Object, factType: string): void { let arr: Array = obj as Array; arktest.expectThrow(() => { BigInt64Array.from(arr); }, (e: Error) => { @@ -475,31 +625,53 @@ function __noinline__BigInt64ArrayFromCheckException(obj: Object, factType: stri }); } +function __noinline__BigInt64ArrayFromFixedArrayCheckException(obj: Object, factType: string): void +{ + arktest.expectThrow(() => { let arr: FixedArray = obj as FixedArray }, (e: Error) => { + return e instanceof ClassCastError && e.message == factType + ' cannot be cast to [Lescompat/BigInt;'; + }); +} + function testIU64FromArrayWrongType() { let strings: Array = Array.of(new string("hi"), new string("hello"), new string("new")); - __noinline__BigInt64ArrayFromCheckException(strings, 'std.core.LineString'); + __noinline__BigInt64ArrayFromArrayCheckException(strings, 'std.core.LineString'); let ints: Object = Array.of(1, 2, 3); - __noinline__BigInt64ArrayFromCheckException(ints, 'std.core.Int'); + __noinline__BigInt64ArrayFromArrayCheckException(ints, 'std.core.Int'); + let fixstrings: FixedArray = [new string("hi"), new string("hello"), new string("new")]; + __noinline__BigInt64ArrayFromFixedArrayCheckException(fixstrings, '[Lstd/core/String;'); } function testIU64FromArrayBigInt() { + let empty: FixedArray = []; checkBigIntArray(BigInt64Array.of(), BigInt64Array.from(new Array())); + checkBigIntArray(BigInt64Array.of(), BigInt64Array.from([])); + checkBigIntArray(BigInt64Array.of(), BigInt64Array.from(empty)); const length: int = 128; - let arr: Array = new Array(); + let arr: Array = new Array(length); + let fixarr: FixedArray = new bigint[length]; let iexpected: BigInt64Array = new BigInt64Array(length); for (let i = 0; i < length; i++) { const v = new BigInt(i); - arr.push(v); + arr[i] = v; + fixarr[i] = v; iexpected[i] = v; } checkBigIntArray(iexpected, BigInt64Array.from(arr)); + checkBigIntArray(iexpected, BigInt64Array.from(fixarr)); let arr2: Array = Array.of(1n, BigInt(1.e+5), BigInt(1.7e+308), BigInt(-1.7e+308), BigInt(-0.6e+16), BigInt(0.4e+105), 9007199254740991n * 9007199254740991n, -9007199254740991n * 9007199254740991n, -9007199254740991n * 9007199254740991n * 9007199254740991n * 9007199254740991n * 9007199254740991n); + + let fixarr2: FixedArray = [1n, BigInt(1.e+5), BigInt(1.7e+308), BigInt(-1.7e+308), BigInt(-0.6e+16), + BigInt(0.4e+105), 9007199254740991n * 9007199254740991n, -9007199254740991n * 9007199254740991n, + -9007199254740991n * 9007199254740991n * 9007199254740991n * 9007199254740991n * 9007199254740991n]; checkBigIntArray(BigInt64Array.of(1n, BigInt(1.e+5), 0n, 0n, BigInt(-0.6e+16), 0n, -18014398509481983n, 18014398509481983n, -45035996273704959n), BigInt64Array.from(arr2)); + checkBigIntArray(BigInt64Array.of(1n, BigInt(1.e+5), 0n, 0n, BigInt(-0.6e+16), 0n, -18014398509481983n, + 18014398509481983n, -45035996273704959n), + BigInt64Array.from(fixarr2)); // Currently, we have no method to build a BigUint64Array from an Array let uexpected: BigUint64Array = new BigUint64Array(arr2.length); for (let i = 0; i < arr2.length; i++) { @@ -536,28 +708,32 @@ function testIU64FromIterableBigInt() { checkBigIntArray(iexpected, BigInt64Array.from(u64Arr)); } -function prepareTestData(length: int, from: number): [Set, Array] { +function prepareTestData(length: int, from: number): [Set, Array, FixedArray] { let set: Set = new Set(); - let arr: Array = new Array(); + let arr: Array = new Array(length); + let fixarr: FixedArray = new number[length]; let v: number = from; for (let i = 0; i < length; i++) { - arr.push(v); + arr[i] = v; + fixarr[i] = v; set.add(v); v++; } - return [set, arr]; + return [set, arr, fixarr]; } -function prepareTestData(length: int, from: int): [Set, Array] { +function prepareTestData(length: int, from: int): [Set, Array, FixedArray] { let set: Set = new Set(); - let arr: Array = new Array(); + let arr: Array = new Array(length); + let fixarr: FixedArray = new int[length]; let v: int = from; for (let i = 0; i < length; i++) { - arr.push(v); + arr[i] = v; + fixarr[i] = v; set.add(v); v++; } - return [set, arr]; + return [set, arr, fixarr]; } function checkNumberArray(expected: ArrayLike, data: ArrayLike): void { diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/typed_arrays_of.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/typed_arrays_of.ets new file mode 100644 index 0000000000000000000000000000000000000000..b1cc49b9e9d4f6e926d90ee87d69855c28ac7136 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/typed_arrays_of.ets @@ -0,0 +1,299 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function testIU8OfInt() { + checkIntArray(new int[0], Int8Array.of()); + checkIntArray(new int[0], Uint8Array.of()); + checkIntArray(new int[0], Uint8ClampedArray.of()); + + let arr = prepareTestData(127, 1); + checkIntArray(arr, Int8Array.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127)); + checkIntArray(arr, Uint8Array.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127)); + checkIntArray(arr, Uint8ClampedArray.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127)); + + checkIntArray([0, 1, -1, -1, 1, -1, 0], Int8Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648)); + checkIntArray([0, 1, 255, 255, 1, 255, 0], Uint8Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648)); + checkIntArray([0, 1, 0, 255, 0, 255, 0], Uint8ClampedArray.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648)); + + checkIntArray([1, -1, -126, -127, -128, 127, 0, -1, 0, 12, -1, 126, 127, -128, -2, 0, 1, 16], + Int8Array.of(1, -1, -126, -127, -128, -129, -256, -257, 0, 12, 255, 126, 127, 128, 254, 256, 257, 10000)); + checkIntArray([1, 255, 130, 129, 128, 127, 0, 255, 0, 12, 255, 126, 127, 128, 254, 0, 1, 16], + Uint8Array.of(1, -1, -126, -127, -128, -129, -256, -257, 0, 12, 255, 126, 127, 128, 254, 256, 257, 10000)); + checkIntArray([1, 0, 0, 0, 0, 0, 0, 0, 0, 12, 255, 126, 127, 128, 254, 255, 255, 255], + Uint8ClampedArray.of(1, -1, -126, -127, -128, -129, -256, -257, 0, 12, 255, 126, 127, 128, 254, 256, 257, 10000)); +} + +function testIU16OfInt() { + checkIntArray(new int[0], Int16Array.of()); + checkIntArray(new int[0], Uint16Array.of()); + + let arr = prepareTestData(127, 1); + checkIntArray(arr, Int16Array.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127)); + checkIntArray(arr, Uint16Array.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127)); + + arr = prepareTestData(127, 128); + checkIntArray(arr, Int16Array.of(128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254)); + checkIntArray(arr, Uint16Array.of(128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254)); + + checkIntArray([0, 1, -1, -1, 1, -1, 0], Int16Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648)); + checkIntArray([0, 1, 65535, 65535, 1, 65535, 0], Uint16Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648)); + + checkIntArray([-1, -32766, -32767, -32768, 32767, 1, 0, -1, 0, 12, 255, 32766, 32765, -32768, -32767, -2, -1, 0, -31072, -1, 0], + Int16Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, 255, 32766, 32765, 32768, 32769, + 65534, 65535, 65536, 100000, 2147483647, -2147483648)); + checkIntArray([65535, 32770, 32769, 32768, 32767, 1, 0, 65535, 0, 12, 255, 32766, 32765, 32768, 32769, 65534, 65535, + 0, 34464, 65535, 0], + Uint16Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, 255, 32766, 32765, 32768, 32769, + 65534, 65535, 65536, 100000, 2147483647, -2147483648)); +} + +function testIU32OfInt() { + checkIntArray(new int[0], Int32Array.of()); + checkIntArray(new int[0], Uint32Array.of()); + + let arr = prepareTestData(127, 1); + checkIntArray(arr, Int32Array.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127)); + checkIntArray(arr, Uint32Array.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127)); + + arr = prepareTestData(127, 16536); + checkIntArray(arr, Int32Array.of(16536, 16537, 16538, 16539, 16540, 16541, 16542, 16543, 16544, 16545, 16546, 16547, + 16548, 16549, 16550, 16551, 16552, 16553, 16554, 16555, 16556, 16557, 16558, 16559, 16560, 16561, 16562, 16563, + 16564, 16565, 16566, 16567, 16568, 16569, 16570, 16571, 16572, 16573, 16574, 16575, 16576, 16577, 16578, 16579, + 16580, 16581, 16582, 16583, 16584, 16585, 16586, 16587, 16588, 16589, 16590, 16591, 16592, 16593, 16594, 16595, + 16596, 16597, 16598, 16599, 16600, 16601, 16602, 16603, 16604, 16605, 16606, 16607, 16608, 16609, 16610, 16611, + 16612, 16613, 16614, 16615, 16616, 16617, 16618, 16619, 16620, 16621, 16622, 16623, 16624, 16625, 16626, 16627, + 16628, 16629, 16630, 16631, 16632, 16633, 16634, 16635, 16636, 16637, 16638, 16639, 16640, 16641, 16642, 16643, + 16644, 16645, 16646, 16647, 16648, 16649, 16650, 16651, 16652, 16653, 16654, 16655, 16656, 16657, 16658, 16659, + 16660, 16661, 16662)); + checkIntArray(arr, Uint32Array.of(16536, 16537, 16538, 16539, 16540, 16541, 16542, 16543, 16544, 16545, 16546, 16547, + 16548, 16549, 16550, 16551, 16552, 16553, 16554, 16555, 16556, 16557, 16558, 16559, 16560, 16561, 16562, 16563, + 16564, 16565, 16566, 16567, 16568, 16569, 16570, 16571, 16572, 16573, 16574, 16575, 16576, 16577, 16578, 16579, + 16580, 16581, 16582, 16583, 16584, 16585, 16586, 16587, 16588, 16589, 16590, 16591, 16592, 16593, 16594, 16595, + 16596, 16597, 16598, 16599, 16600, 16601, 16602, 16603, 16604, 16605, 16606, 16607, 16608, 16609, 16610, 16611, + 16612, 16613, 16614, 16615, 16616, 16617, 16618, 16619, 16620, 16621, 16622, 16623, 16624, 16625, 16626, 16627, + 16628, 16629, 16630, 16631, 16632, 16633, 16634, 16635, 16636, 16637, 16638, 16639, 16640, 16641, 16642, 16643, + 16644, 16645, 16646, 16647, 16648, 16649, 16650, 16651, 16652, 16653, 16654, 16655, 16656, 16657, 16658, 16659, + 16660, 16661, 16662)); + + checkIntArray([0, 1, -1, 65535, -65535, 2147483647, -2147483648], + Int32Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648)); + checkNumberArray([0.0, 1.0, 4294967295.0, 65535.0, 4294901761.0, 2147483647.0, 2147483648.0], + Uint32Array.of(0, 1, -1, 65535, -65535, 2147483647, -2147483648)); + + checkIntArray([-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, 255, 32766, 32765, 32768, 32769, + 65534, 65535, 65536, 100000, 2147483647, -2147483648], + Int32Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, 255, 32766, 32765, 32768, 32769, + 65534, 65535, 65536, 100000, 2147483647, -2147483648)); + checkNumberArray([4294967295.0, 4294934530.0, 4294934529.0, 4294934528.0, 4294934527.0, 4294901761.0, + 4294901760.0, 4294901759.0, 0.0, 12.0, 255.0, 32766.0, 32765.0, 32768.0, 32769.0, 65534.0, 65535.0, + 65536.0, 100000.0, 2147483647.0, 2147483648.0], + Uint32Array.of(-1, -32766, -32767, -32768, -32769, -65535, -65536, -65537, 0, 12, 255, 32766, 32765, 32768, 32769, + 65534, 65535, 65536, 100000, 2147483647, -2147483648)); +} + +function testIU32OfNumber() { + checkNumberArray([0.0, 1.0, 1.0, -1.0, 65535.0, -65535.0, 2147483647.0, -2147483648.0], + Int32Array.of(0.1, 1.5, 1.9, -1.0, 65535.0, -65535.0, 2147483647.0, -2147483648.0)); + checkNumberArray([0.0, 1.0, 1.0, 4294967295.0, 65535.0, 4294901761.0, 2147483647.0, 2147483648.0], + Uint32Array.of(0.1, 1.5, 1.9, 4294967295.0, 65535.0, 4294901761.0, 2147483647.0, 2147483648.0)); + + checkNumberArray([-1.0, -32766.0, -32767.0, -32768.0, -32769.0, -65535.0, -65536.0, -65537.0, 0.0, 12.0, 255.0, + 32766.0, 32765.0, 32768.0, 32769.0, 65534.0, 65535.0, 65536.0, 100000.0, 2147483647.0, -2147483648.0], + Int32Array.of(-1.001, -32766.999, -32767.0, -32768.0, -32769.0, -65535.0, -65536.0, -65537.0, 0.0, 12.0, 255.0, + 32766.0, 32765.0, 32768.0, 32769.0, 65534.0, 65535.0, 65536.0, 100000.0, 2147483647.0, -2147483648.0)); + checkNumberArray([4294967295.0, 4294934530.0, 4294934529.0, 4294934528.0, 4294934527.0, 4294901761.0, 4294901760.0, + 4294901759.0, 0.0, 12.0, 255.0, 32766.0, 32765.0, 32768.0, 32769.0, 65534.0, 65535.0, 65536.0, 100000.0, + 2147483647.0, 2147483648.0], + Uint32Array.of(-1.0, -32766.0, -32767.0, -32768.0, -32769.0, -65535.0, -65536.0, -65537.0, 0.0, 12.0, 255.0, + 32766.0, 32765.0, 32768.0, 32769.0, 65534.0, 65535.0, 65536.0, 100000.0, 2147483647.0, -2147483648.0)); + + checkNumberArray([4294967295.0, 4294934530.0, 4294934529.0, 4294934528.0, 4294934527.0, 4294901761.0, + 4294901760.0, 4294901759.0, 0.0, 12.0, 255.0, 32766.0, 32765.0, 32768.0, 32769.0, 65534.0, 65535.0, + 65536.0, 100000.0, 2147483647.0, 2147483648.0], + Uint32Array.of(4294967295.1, 4294934530.5, 4294934529.9, 4294934528.0, 4294934527.0, 4294901761.0, + 4294901760.0, 4294901759.0, 0.0, 12.0, 255.0, 32766.0, 32765.0, 32768.0, 32769.0, 65534.0, 65535.0, + 65536.0, 100000.0, 2147483647.0, 2147483648.0)); +} + +function testF32OfNumber() { + checkNumberArray(new number[0], Float32Array.of()); + + let arr = prepareTestData(127, 1.0); + checkNumberArray(arr, Float32Array.of(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, + 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, + 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, + 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0, 71.0, 72.0, + 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0, 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0, 91.0, + 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0, 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, + 109.0, 110.0, 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0, 121.0, 122.0, 123.0, 124.0, + 125.0, 126.0, 127.0)); + + checkNumberArray([1, 65535, -65535, NaN, Infinity], Float32Array.of(1, 65535, -65535, NaN, Infinity)); + + checkNumberArray([1, NaN, Infinity, 0.00001f, Infinity, -Infinity, -Infinity, -0.6e+16f, Infinity, -3.31899e+38f, + 3.31899e+38f, -3.40282346e+38f, 3.40282346e+38f, -3.40282346e+38f, 3.40282346e+38f, -3.40282346e+38f, + 3.40282346e+38f, -3.40282346e+38f, 3.40282346e+38f, -Infinity, Infinity], + Float32Array.of(1.0, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105, + -3.31899e+38, 3.31899e+38, -3.4028234663852886e+38, 3.4028234663852886e+38, -3.402823466385289e+38, + 3.402823466385289e+38, -3.4028235677973359e+38, 3.4028235677973359e+38, -3.4028235677973362e+38, + 3.4028235677973362e+38, -3.4028235677973362e+38 - 1.0e+23, 3.4028235677973362e+38 + 1.0e+23)); +} + +function testF64OfNumber() { + checkNumberArray(new number[0], Float64Array.of()); + + let arr = prepareTestData(127, 1.0); + checkNumberArray(arr, Float64Array.of(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, + 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, + 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, + 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0, 71.0, 72.0, + 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0, 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0, 91.0, + 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0, 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, + 109.0, 110.0, 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0, 121.0, 122.0, 123.0, 124.0, + 125.0, 126.0, 127.0)); + + checkNumberArray([1, 65535, -65535, NaN, Infinity], Float64Array.of(1, 65535, -65535, NaN, Infinity)); + checkNumberArray([1, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105], + Float64Array.of(1, NaN, Infinity, 0.00001, 1.7e+308, -Infinity, -1.7e+308, -0.6e+16, 0.4e+105)); +} + +function testIU64OfBigInt() { + checkBigIntArray(new bigint[0], BigInt64Array.of()); + + const length: int = 127; + let arr: FixedArray = new bigint[length]; + for (let i = 0; i < length; i++) { + const v = new BigInt(i + 1); + arr[i] = v; + } + checkBigIntArray(arr, BigInt64Array.of(1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n, 10n, 11n, 12n, 13n, 14n, 15n, 16n, 17n, + 18n, 19n, 20n, 21n, 22n, 23n, 24n, 25n, 26n, 27n, 28n, 29n, 30n, 31n, 32n, 33n, 34n, 35n, 36n, 37n, 38n, 39n, + 40n, 41n, 42n, 43n, 44n, 45n, 46n, 47n, 48n, 49n, 50n, 51n, 52n, 53n, 54n, 55n, 56n, 57n, 58n, 59n, 60n, 61n, + 62n, 63n, 64n, 65n, 66n, 67n, 68n, 69n, 70n, 71n, 72n, 73n, 74n, 75n, 76n, 77n, 78n, 79n, 80n, 81n, 82n, 83n, + 84n, 85n, 86n, 87n, 88n, 89n, 90n, 91n, 92n, 93n, 94n, 95n, 96n, 97n, 98n, 99n, 100n, 101n, 102n, 103n, 104n, + 105n, 106n, 107n, 108n, 109n, 110n, 111n, 112n, 113n, 114n, 115n, 116n, 117n, 118n, 119n, 120n, 121n, 122n, 123n, + 124n, 125n, 126n, 127n)); + checkBigIntArray(arr, BigUint64Array.of(1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n, 10n, 11n, 12n, 13n, 14n, 15n, 16n, 17n, + 18n, 19n, 20n, 21n, 22n, 23n, 24n, 25n, 26n, 27n, 28n, 29n, 30n, 31n, 32n, 33n, 34n, 35n, 36n, 37n, 38n, 39n, + 40n, 41n, 42n, 43n, 44n, 45n, 46n, 47n, 48n, 49n, 50n, 51n, 52n, 53n, 54n, 55n, 56n, 57n, 58n, 59n, 60n, 61n, + 62n, 63n, 64n, 65n, 66n, 67n, 68n, 69n, 70n, 71n, 72n, 73n, 74n, 75n, 76n, 77n, 78n, 79n, 80n, 81n, 82n, 83n, + 84n, 85n, 86n, 87n, 88n, 89n, 90n, 91n, 92n, 93n, 94n, 95n, 96n, 97n, 98n, 99n, 100n, 101n, 102n, 103n, 104n, + 105n, 106n, 107n, 108n, 109n, 110n, 111n, 112n, 113n, 114n, 115n, 116n, 117n, 118n, 119n, 120n, 121n, 122n, 123n, + 124n, 125n, 126n, 127n)); + + checkBigIntArray([1n, BigInt(1.e+5), 0n, 0n, BigInt(-0.6e+16), 0n, -18014398509481983n, 18014398509481983n, + -45035996273704959n], + BigInt64Array.of(1n, BigInt(1.e+5), 0n, 0n, BigInt(-0.6e+16), 0n, -18014398509481983n, 18014398509481983n, + -45035996273704959n)); + checkBigIntArray([1n, BigInt(1.e+5), 0n, 0n, 18440744073709551616n, 0n, 18428729675200069633n, 18014398509481983n, + 18401708077435846657n], + BigUint64Array.of(1n, BigInt(1.e+5), 0n, 0n, BigInt(-0.6e+16), 0n, -18014398509481983n, 18014398509481983n, + -45035996273704959n)); + checkBigIntArray([1n, 100000n, 0n, 0n, 18440744073709551616n, 0n, 18428729675200069633n, 18014398509481983n, + 18401708077435846657n], + BigUint64Array.of(1n, 100000n, 0n, 0n, 18440744073709551616n, 0n, 18428729675200069633n, 18014398509481983n, + 18401708077435846657n)); +} + +function prepareTestData(length: int, from: number): FixedArray { + let fixarr: FixedArray = new number[length]; + let v: number = from; + for (let i = 0; i < length; i++) { + fixarr[i] = v++; + } + return fixarr; +} + +function prepareTestData(length: int, from: int): FixedArray { + let fixarr: FixedArray = new int[length]; + let v: int = from; + for (let i = 0; i < length; i++) { + fixarr[i] = v++; + } + return fixarr; +} + +function checkNumberArray(expected: FixedArray, data: ArrayLike): void { + arktest.assertEQ(data.length, expected.length, 'Unexpected array length'); + for (let i: int = 0; i < expected.length; i++) { + arktest.assertTrue((isNaN(data[i]) && isNaN(expected[i])) || (data[i] == expected[i]), + 'Unexpected element with index ' + i + ': expected ' + expected[i] + ' but was ' + data[i]); + } +} + +function checkIntArray(expected: FixedArray, data: ArrayLike): void { + arktest.assertEQ(data.length, expected.length, 'Unexpected array length'); + for (let i: int = 0; i < expected.length; i++) { + arktest.assertTrue(data[i] == expected[i], + 'Unexpected element with index ' + i + ': expected ' + expected[i] + ' but was ' + data[i]); + } +} + +function checkBigIntArray(expected: FixedArray, data: ArrayLike): void { + arktest.assertEQ(data.length, expected.length, 'Unexpected array length'); + for (let i: int = 0; i < expected.length; i++) { + arktest.assertEQ(data[i], expected[i], 'Unexpected element with index ' + i); + } +} + +function main(): int { + let testSuite = new arktest.ArkTestsuite('typedArrays.of'); + testSuite.addTest('BigInt64,BigUint64 Arrays: of test', testIU64OfBigInt); + testSuite.addTest('Int8,Uint8 Arrays: of test', testIU8OfInt); + testSuite.addTest('Int16,Uint16 Arrays: of test', testIU16OfInt); + testSuite.addTest('Int32,Uint32 Arrays: of test', testIU32OfInt); + testSuite.addTest('Int32,Uint32 Arrays: of test', testIU32OfNumber); + testSuite.addTest('Float32 Arrays: of test', testF32OfNumber); + testSuite.addTest('Float64 Arrays: of test', testF64OfNumber); + return testSuite.run(); +} diff --git a/static_core/plugins/ets/tests/ets_func_tests/algorithms/SampleAppTest.ets b/static_core/plugins/ets/tests/ets_func_tests/algorithms/SampleAppTest.ets index efc244e2ffed5b2542b74dc590c69eb6b6282e9d..6c429c687514a0cee6e591ad2d0024990aeae867 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/algorithms/SampleAppTest.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/algorithms/SampleAppTest.ets @@ -20,8 +20,8 @@ */ class Point { - internal x: double; - internal y: double; + public x: double; + public y: double; constructor() { this.x = Double.NaN; this.y = Double.NaN; diff --git a/static_core/plugins/ets/tests/ets_func_tests/escompat/JsonParseTest.ets b/static_core/plugins/ets/tests/ets_func_tests/std/core/JsonParseTest.ets similarity index 100% rename from static_core/plugins/ets/tests/ets_func_tests/escompat/JsonParseTest.ets rename to static_core/plugins/ets/tests/ets_func_tests/std/core/JsonParseTest.ets diff --git a/static_core/plugins/ets/tests/ets_func_tests/escompat/JsonReplacerTest.ets b/static_core/plugins/ets/tests/ets_func_tests/std/core/JsonReplacerTest.ets similarity index 100% rename from static_core/plugins/ets/tests/ets_func_tests/escompat/JsonReplacerTest.ets rename to static_core/plugins/ets/tests/ets_func_tests/std/core/JsonReplacerTest.ets diff --git a/static_core/plugins/ets/tests/ets_func_tests/escompat/JsonStringifyRegExpExecArrayTest.ets b/static_core/plugins/ets/tests/ets_func_tests/std/core/JsonStringifyRegExpExecArrayTest.ets similarity index 100% rename from static_core/plugins/ets/tests/ets_func_tests/escompat/JsonStringifyRegExpExecArrayTest.ets rename to static_core/plugins/ets/tests/ets_func_tests/std/core/JsonStringifyRegExpExecArrayTest.ets diff --git a/static_core/plugins/ets/tests/ets_func_tests/escompat/JsonTest.ets b/static_core/plugins/ets/tests/ets_func_tests/std/core/JsonTest.ets similarity index 100% rename from static_core/plugins/ets/tests/ets_func_tests/escompat/JsonTest.ets rename to static_core/plugins/ets/tests/ets_func_tests/std/core/JsonTest.ets diff --git a/static_core/plugins/ets/tests/ets_func_tests/std/core/json/JsonStringifyParseBigIntTest.ets b/static_core/plugins/ets/tests/ets_func_tests/std/core/json/JsonStringifyParseBigIntTest.ets index f920fbd90f727cef87f78708c2d737c67f1b8c1b..c5839e8a8b4a5c0a799240d45cbb91145168cb48 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/std/core/json/JsonStringifyParseBigIntTest.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/std/core/json/JsonStringifyParseBigIntTest.ets @@ -14,6 +14,8 @@ */ import { jsonx } from "std/core" +//const BigIntType = Type.of(new BigInt()); +//const BigIntType: Type; function main() { testStringifyParseBigInt() @@ -40,37 +42,38 @@ class SuperUser extends UserWithFields { users: FixedArray = [] } +const str1 = "{\"id\":10,\"g\":true,\"name\":\"Name\",\"users\":[{\"id\":12,\"g\":true,\"name\":\"Name1\"},{\"id\":13,\"g\":false,\"name\":\"Name2\"}]}" + +function doTest(mode: jsonx.BigIntMode, filter?: (k: string, v: Any) => Any) { + const classType = Type.of(new SuperUser() as Object) + return JSON.parse(str1, filter, classType, {bigIntMode: mode} as jsonx.ParseOptions) as SuperUser +} + function testStringifyParseBigInt(): void { - let classType = Type.of(new SuperUser() as Object) - let str = "{\"id\":10,\"g\":true,\"name\":\"Name\",\"users\":[{\"id\":12,\"g\":true,\"name\":\"Name1\"},{\"id\":13,\"g\":false,\"name\":\"Name2\"}]}"; - let x = JSON.stringify(JSON.parse(str, undefined, classType, {bigIntMode: jsonx.BigIntMode.ALWAYS_PARSE_AS_BIGINT} as jsonx.ParseOptions) as SuperUser) - arktest.assertEQ(x, str) + doTest(jsonx.BigIntMode.ALWAYS_PARSE_AS_BIGINT) + // let x = JSON.stringify(doTest(jsonx.BigIntMode.ALWAYS_PARSE_AS_BIGINT)) + // arktest.assertEQ(x, str1) } function testStringifyParseOptOne(): void { - let classType = Type.of(new SuperUser() as Object) - let str = "{\"id\":10,\"g\":true,\"name\":\"Name\",\"users\":[{\"id\":12,\"g\":true,\"name\":\"Name1\"},{\"id\":13,\"g\":false,\"name\":\"Name2\"}]}"; - arktest.expectThrow(() => {JSON.parse(str, undefined, classType, {bigIntMode: jsonx.BigIntMode.PARSE_AS_BIGINT} as jsonx.ParseOptions)}) + arktest.expectThrow(() => { doTest(jsonx.BigIntMode.PARSE_AS_BIGINT) }) } function testStringifyParseOptZero(): void { - let classType = Type.of(new SuperUser() as Object) - let str = "{\"id\":10,\"g\":true,\"name\":\"Name\",\"users\":[{\"id\":12,\"g\":true,\"name\":\"Name1\"},{\"id\":13,\"g\":false,\"name\":\"Name2\"}]}"; - arktest.expectThrow(() => {JSON.parse(str, undefined, classType, {bigIntMode: jsonx.BigIntMode.DEFAULT} as jsonx.ParseOptions)}) + arktest.expectThrow(() => { doTest(jsonx.BigIntMode.DEFAULT) }) } function testStringifyParseBigIntWithReviver(): void { - let classType = Type.of(new SuperUser() as Object) let reviver = (k: string, v: Any) => { if (k === "id") { return new BigInt(1) } return v } - let str = "{\"id\":10,\"g\":true,\"name\":\"Name\",\"users\":[{\"id\":12,\"g\":true,\"name\":\"Name1\"},{\"id\":13,\"g\":false,\"name\":\"Name2\"}]}"; let expected_str = "{\"id\":1,\"g\":true,\"name\":\"Name\",\"users\":[{\"id\":1,\"g\":true,\"name\":\"Name1\"},{\"id\":1,\"g\":false,\"name\":\"Name2\"}]}"; - let x = JSON.stringify(JSON.parse(str, reviver, classType, {bigIntMode: jsonx.BigIntMode.ALWAYS_PARSE_AS_BIGINT} as jsonx.ParseOptions) as SuperUser) - arktest.assertEQ(x, expected_str) + doTest(jsonx.BigIntMode.ALWAYS_PARSE_AS_BIGINT, reviver) + // let x = JSON.stringify(doTest(jsonx.BigIntMode.ALWAYS_PARSE_AS_BIGINT, reviver)) + // arktest.assertEQ(x, expected_str) } @@ -80,23 +83,24 @@ class NumbersTest extends User { bul: Boolean|undefined = false } -function testParseNoBigInt() { + +const str2 = "{\"val\":123444444421,\"str\":\"true\",\"bul\":false}" +function doTest2(mode: jsonx.BigIntMode) { let classType = Type.of(new NumbersTest()) - let str = "{\"val\":123444444421,\"str\":\"true\",\"bul\":false}" - let x = JSON.stringify(JSON.parse(str, undefined, classType, {bigIntMode: jsonx.BigIntMode.DEFAULT} as jsonx.ParseOptions) as NumbersTest) - arktest.assertEQ(x, str) + return JSON.stringify(JSON.parse(str2, undefined, classType, {bigIntMode: mode} as jsonx.ParseOptions) as NumbersTest) +} + +function testParseNoBigInt() { + let x = doTest2(jsonx.BigIntMode.DEFAULT) + arktest.assertEQ(x, str2) } function testParseNoBigIntParseAsBigint() { - let classType = Type.of(new NumbersTest()) - let str = "{\"val\":123444444421,\"str\":\"true\",\"bul\":false}" - let x = JSON.stringify(JSON.parse(str, undefined, classType, {bigIntMode: jsonx.BigIntMode.PARSE_AS_BIGINT} as jsonx.ParseOptions) as NumbersTest) - arktest.assertEQ(x, str) + let x = doTest2(jsonx.BigIntMode.PARSE_AS_BIGINT) + arktest.assertEQ(x, str2) } function testParseNoBigIntAlwaysParseAsBigint() { - let classType = Type.of(new NumbersTest()) - let str = "{\"val\":123444444421,\"str\":\"true\",\"bul\":false}" - arktest.expectThrow(() => {JSON.parse(str, undefined, classType, {bigIntMode: jsonx.BigIntMode.ALWAYS_PARSE_AS_BIGINT} as jsonx.ParseOptions) as NumbersTest}) + arktest.expectThrow(() => { doTest2(jsonx.BigIntMode.ALWAYS_PARSE_AS_BIGINT) }) } diff --git a/static_core/plugins/ets/tests/ets_func_tests/escompat/JsonStringifyTest.ets b/static_core/plugins/ets/tests/ets_func_tests/std/core/json/JsonStringifyTest1.ets similarity index 100% rename from static_core/plugins/ets/tests/ets_func_tests/escompat/JsonStringifyTest.ets rename to static_core/plugins/ets/tests/ets_func_tests/std/core/json/JsonStringifyTest1.ets diff --git a/static_core/plugins/ets/tests/runtime/types/ets_finalizable_weak_ref_test.cpp b/static_core/plugins/ets/tests/runtime/types/ets_finalizable_weak_ref_test.cpp index 7a39dfeacef0a529ecb46f44f4bda0f6d8222ba8..e2f7422d23a6bc2b340bce6fe54beab22a1656e0 100644 --- a/static_core/plugins/ets/tests/runtime/types/ets_finalizable_weak_ref_test.cpp +++ b/static_core/plugins/ets/tests/runtime/types/ets_finalizable_weak_ref_test.cpp @@ -172,9 +172,15 @@ TEST_F(EtsFinalizableWeakRefTest, RegisterFinalizerTest) std::array, EVENT_COUNT> arrayHandles; for (auto &handle : arrayHandles) { handle = EtsHandle(coro, EtsObjectArray::Create(objectClass, ARRAY_SIZE)->AsObject()); - vm_->RegisterFinalizerForObject(coro, handle, TestEvent::Finalize, &event); + ASSERT_NE(vm_->RegisterFinalizerForObject(coro, handle, TestEvent::Finalize, &event), nullptr); } + auto handle = EtsHandle(coro, EtsObject::Create(objectClass)); + auto finWeakRef = vm_->RegisterFinalizerForObject( + coro, handle, [](void *) { ASSERT_TRUE(false); }, nullptr); + ASSERT_NE(finWeakRef, nullptr); + ASSERT_EQ(vm_->UnregisterFinalizerForObject(coro, finWeakRef), true); + // Trigger GC TriggerGC(); @@ -191,4 +197,19 @@ TEST_F(EtsFinalizableWeakRefTest, RegisterFinalizerTest) ASSERT(event.IsHappened()); } +TEST_F(EtsFinalizableWeakRefTest, UnregisterFinalizerTwiceTest) +{ + auto *coro = EtsCoroutine::GetCurrent(); + ScopedManagedCodeThread managedScope(coro); + EtsHandleScope handleScope(coro); + + auto *objectClass = vm_->GetClassLinker()->GetClassRoot(EtsClassRoot::OBJECT); + auto handle = EtsHandle(coro, EtsObject::Create(objectClass)); + auto finWeakRef = vm_->RegisterFinalizerForObject( + coro, handle, [](void *) {}, nullptr); + ASSERT_NE(finWeakRef, nullptr); + ASSERT_EQ(vm_->UnregisterFinalizerForObject(coro, finWeakRef), true); + ASSERT_EQ(vm_->UnregisterFinalizerForObject(coro, finWeakRef), false); +} + } // namespace ark::ets::test diff --git a/static_core/plugins/ets/tests/test-lists/declgenets2ts/ets-func-tests/declgen-ets2ts-func-tests-ignored.txt b/static_core/plugins/ets/tests/test-lists/declgenets2ts/ets-func-tests/declgen-ets2ts-func-tests-ignored.txt index 79f4173a5979aac945ac250b6e5b6f37f78c0d41..cc749dd5d0992e9a8e2e419f837b174fd1b9fd4b 100644 --- a/static_core/plugins/ets/tests/test-lists/declgenets2ts/ets-func-tests/declgen-ets2ts-func-tests-ignored.txt +++ b/static_core/plugins/ets/tests/test-lists/declgenets2ts/ets-func-tests/declgen-ets2ts-func-tests-ignored.txt @@ -27,7 +27,7 @@ spec/17.Experimental_Features/17.9.Default_and_Static_Interface_Methods/17.9.1.D spec/17.Experimental_Features/17.9.Default_and_Static_Interface_Methods/17.9.1.Default_Method_Declarations/default_method_0006.ets std/core/TypeCreatePrimitiveNameTest.ets escompat/ArrayProxyTest.ets -escompat/JsonParseTest.ets +std/core/JsonParseTest.ets escompat/ProcessTest.ets escompat/ProxyTest.ets escompat/WeakMapGCTest.ets @@ -214,7 +214,7 @@ std/core/std_core_typedarrays__Int16Array.ets std/core/std_core_typedarrays__Int32Array.ets std/core/std_core_typedarrays__Int8Array.ets escompat/ReadonlyArrayProxyTest.ets -escompat/JsonReplacerTest.ets +std/core/JsonReplacerTest.ets regression/23623.ets regression/23735.ets std/core/DeepCopyTest.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded-DI.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded-DI.txt index a30fd053b59da9e5490bdae5252fbf0ae5aa66ab..f1ff9e893dbba250aae52c64ca2736d0c1bd1987 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded-DI.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded-DI.txt @@ -1,5 +1,5 @@ -escompat/JsonReplacerTest.ets -escompat/JsonTest.ets +std/core/JsonReplacerTest.ets +std/core/JsonTest.ets regression/function_params_optional_union.ets spec/03.types/References_Types/3.8.12.Nullish_Types/issue13991.ets spec/03.types/References_Types/3.8.12.Nullish_Types/issue14113.ets @@ -92,7 +92,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -101,6 +101,6 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets \ No newline at end of file diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded-JIT-REPEATS.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded-JIT-REPEATS.txt index 594a939c2e7884452f8f082956224b0763d8e978..1a4e362b3db803855cf25c9f4b7523a316f41ad4 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded-JIT-REPEATS.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded-JIT-REPEATS.txt @@ -125,7 +125,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -134,4 +134,4 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets \ No newline at end of file +std/core/json/JsonStringifyTest1.ets \ No newline at end of file diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded-TSAN.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded-TSAN.txt index 4de33f51e96e742226f7a8c680135215c46b26b9..a0ba9f0daed54964b803c15e504822eb68778b66 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded-TSAN.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded-TSAN.txt @@ -65,7 +65,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -74,5 +74,5 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded.txt index 1266d268b584cd4b2bfdf2f5202fe8efaf588048..bc3f75b2b703c50a9dc94e0dfbd58d48ab560af9 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded.txt @@ -7,7 +7,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -16,7 +16,7 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets # extended escompat/ArrayProxyTest.ets escompat/ArrayTest7.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-CPP-OL2-FULLASTV.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-CPP-OL2-FULLASTV.txt index 4aed32745a4ade58b2cc38d1b03b34dae95cdc92..10962597252b491c7a35ddbc4f0f273afb7ae4d2 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-CPP-OL2-FULLASTV.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-CPP-OL2-FULLASTV.txt @@ -6,7 +6,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -15,5 +15,5 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-INT-OL2.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-INT-OL2.txt index 4327e8d7bdbdc63ec905968b7f1ef1e83edd78c1..dad4f48b36958f3ea51c6d16e5eb258518a605d0 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-INT-OL2.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-INT-OL2.txt @@ -6,7 +6,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -15,4 +15,4 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-JIT-OL2.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-JIT-OL2.txt index 4327e8d7bdbdc63ec905968b7f1ef1e83edd78c1..dad4f48b36958f3ea51c6d16e5eb258518a605d0 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-JIT-OL2.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-JIT-OL2.txt @@ -6,7 +6,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -15,4 +15,4 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-JIT.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-JIT.txt index 97422eadcde53000e5e95de8ea56cfeeac78d343..36c90cb58a7fc41cfd6854dbc5bfb8ad16b83b12 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-JIT.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AMD64-JIT.txt @@ -6,7 +6,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -15,4 +15,4 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets \ No newline at end of file +std/core/json/JsonStringifyTest1.ets \ No newline at end of file diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AOT.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AOT.txt index 4327e8d7bdbdc63ec905968b7f1ef1e83edd78c1..dad4f48b36958f3ea51c6d16e5eb258518a605d0 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AOT.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-AOT.txt @@ -6,7 +6,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -15,4 +15,4 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-INT-ASAN.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-INT-ASAN.txt index c415b53ad66964479585efa70ea15a753cfcd630..a76e10691eb2047098192ec325fc6100614a8e24 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-INT-ASAN.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-INT-ASAN.txt @@ -12,7 +12,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -21,5 +21,5 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-JIT-ASAN.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-JIT-ASAN.txt index 04688e95b54506e9d170178ef87255b87851b465..d8d2be115f5bda73761d8df4ce601b9875216941 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-JIT-ASAN.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-JIT-ASAN.txt @@ -9,7 +9,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -18,5 +18,5 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-JIT-REPEATS.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-JIT-REPEATS.txt index dc36463051facb1eac971379be658eb3661c5928..b2d4c5206ec276d97d70e8cfffa791a11ed951b3 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-JIT-REPEATS.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-JIT-REPEATS.txt @@ -1,5 +1,5 @@ #20821 -escompat/JsonReplacerTest.ets +std/core/JsonReplacerTest.ets #24951 std/core/SortNotFromBeginningTest.ets @@ -15,7 +15,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -24,4 +24,4 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-JIT.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-JIT.txt index 822c352aad24e8704bc6a43d4a392e34631b2f76..b6a680c26bf51d7d7a20c1823a869b69262386db 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-JIT.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ARM64-JIT.txt @@ -9,7 +9,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -18,5 +18,5 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ASAN.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ASAN.txt index af5b1049b58b505b9884580c172d905e7bb69b98..c80b0e01aa30fb3ad2c6b25fe21433cb54527631 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ASAN.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-ASAN.txt @@ -9,7 +9,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -18,7 +18,7 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets #29145 std/core/json/JsonStringifyParseBigIntTest.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-CPP-OL0.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-CPP-OL0.txt index 4aed32745a4ade58b2cc38d1b03b34dae95cdc92..10962597252b491c7a35ddbc4f0f273afb7ae4d2 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-CPP-OL0.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-CPP-OL0.txt @@ -6,7 +6,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -15,5 +15,5 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-JIT-REPEATS.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-JIT-REPEATS.txt index b5cf76e0dc66cca7bdc752fafd2560dff53c5301..94ee71f5c05db4bd4fae1d240d7e509b9fcca19e 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-JIT-REPEATS.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-JIT-REPEATS.txt @@ -15,7 +15,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -24,7 +24,7 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets #28746 std/core/EAWorker_out_of_coro_creation.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-TSAN.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-TSAN.txt index 97f4035d6043a850ebdd79b16c962c4c796118c7..cc6519d813ce9bb02c6da97cceac56fd86357504 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-TSAN.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored-TSAN.txt @@ -10,7 +10,7 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets regression/15867_spread_in_arrayof_segfaut.ets spec/05.Generics/callFromAsyncLambda.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets @@ -19,5 +19,5 @@ spec/17.Experimental_Features/17.3.Indexable_Types/idx-s02-0030.ets std/containers/concurrent_set/ConcurrentSet_ConstructorTest.ets std/containers/linked_blocking_queue/LinkedBlockingQueue_ConstructorTest.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored.txt index 45e71d8a3080f93932aa622133af0f6b70716abd..bebf7c939a735bab87460e117bc65a693ebc8830 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-ignored.txt @@ -397,13 +397,13 @@ std/core/IntlPluralRulesTest.ets std/core/TypeAssignableFromTest.ets std/core/std_core_char_instance_Char_toLowerCase.ets std/core/std_core_type_numeric_type_numeric_type.ets -escompat/JsonTest.ets +std/core/JsonTest.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets std/core/NumberTest.ets -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets #28345 -escompat/JsonParseTest.ets +std/core/JsonParseTest.ets ############ # temporary place for the tests related to primitive types refactoring @@ -438,7 +438,7 @@ std/core/std_core_typedarrays_methods__Float64Array_001.ets std/core/std_core_typedarrays_methods__Int16Array.ets std/core/std_core_typedarrays_methods__Int32Array.ets std/core/std_core_typedarrays_methods__Int8Array.ets -escompat/JsonTest.ets +std/core/JsonTest.ets spec/09.classes/Accessor_Declarations/issue-15142_9.ets # 7. @@ -453,7 +453,7 @@ std/core/NumberTest.ets # 9. # other fails -escompat/JsonStringifyTest.ets +std/core/json/JsonStringifyTest1.ets escompat/escompat_BigInt_instance_BigInt_toString_011.ets spec/03.types/References_Types/Bigint/bigint-arithmetic-comparison-11.ets spec/03.types/References_Types/Bigint/bigint-arithmetic-comparison-12.ets @@ -487,8 +487,8 @@ std/core/std_core_typeduarrays_methods__Uint16Array.ets std/core/std_core_typeduarrays_methods__Uint32Array.ets std/core/std_core_typeduarrays_methods__Uint8Array.ets std/core/std_core_typeduarrays_methods__Uint8ClampedArray.ets -escompat/JsonReplacerTest.ets -escompat/JsonStringifyRegExpExecArrayTest.ets +std/core/JsonReplacerTest.ets +std/core/JsonStringifyRegExpExecArrayTest.ets std/core/std_core_typeduarrays_methods__BigUint64Array.ets regression/15278_0.ets spec/07.expressions/7.32.Lambda_Expressions/callMethodFromAsyncLambda2.ets