1 /* 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ECMASCRIPT_JS_RUNTIME_OPTIONS_H_ 17 #define ECMASCRIPT_JS_RUNTIME_OPTIONS_H_ 18 19 #include <optional> 20 #include <string> 21 #include <string_view> 22 #include <vector> 23 #include <set> 24 25 #include "common_components/common_runtime/base_runtime_param.h" 26 #include "common_components/log/log_base.h" 27 #include "common_interfaces/base/common.h" 28 #include "common_interfaces/base/runtime_param.h" 29 #include "ecmascript/base/bit_helper.h" 30 #include "ecmascript/base/config.h" 31 #include "ecmascript/common.h" 32 #include "ecmascript/mem/c_string.h" 33 #include "ecmascript/mem/mem_common.h" 34 #include "libpandabase/os/file.h" 35 36 namespace { 37 constexpr size_t DEFAULT_OPT_LEVEL = 3; // 3: default opt level 38 constexpr size_t DEFAULT_REL_MODE = 2; 39 } // namespace 40 41 // namespace panda { 42 namespace panda::ecmascript { 43 using arg_list_t = std::vector<std::string>; 44 enum ArkProperties { 45 DEFAULT = -1, // default value 000'0000'0001'0000'0101'1100 -> 0x105c 46 OPTIONAL_LOG = 1, 47 GC_STATS_PRINT = 1 << 1, 48 PARALLEL_GC = 1 << 2, // default enable 49 CONCURRENT_MARK = 1 << 3, // default enable 50 CONCURRENT_SWEEP = 1 << 4, // default enable 51 THREAD_CHECK = 1 << 5, 52 ENABLE_ARKTOOLS = 1 << 6, // default enable 53 ENABLE_SNAPSHOT_SERIALIZE = 1 << 7, 54 ENABLE_SNAPSHOT_DESERIALIZE = 1 << 8, 55 EXCEPTION_BACKTRACE = 1 << 9, 56 GLOBAL_OBJECT_LEAK_CHECK = 1 << 10, 57 GLOBAL_PRIMITIVE_LEAK_CHECK = 1 << 11, 58 ENABLE_IDLE_GC = 1 << 12, // default enable 59 CPU_PROFILER_COLD_START_MAIN_THREAD = 1 << 13, 60 ENABLE_CPU_PROFILER_VM_TAG = 1 << 14, 61 ENABLE_GC_TRACER = 1 << 15, 62 CPU_PROFILER_COLD_START_WORKER_THREAD = 1 << 16, 63 CPU_PROFILER_ANY_TIME_MAIN_THREAD = 1 << 17, 64 CPU_PROFILER_ANY_TIME_WORKER_THREAD = 1 << 18, 65 ENABLE_HEAP_VERIFY = 1 << 19, 66 ENABLE_MICROJOB_TRACE = 1 << 20, 67 ENABLE_MULTI_CONTEXT = 1 << 21, 68 // Use DISABLE to adapt to the exsiting ArkProperties in testing scripts. 69 DISABLE_SHARED_CONCURRENT_MARK = 1 << 22, 70 ENABLE_ESM_TRACE = 1 << 24, 71 ENABLE_MODULE_LOG = 1 << 25, 72 ENABLE_SERIALIZATION_TIMEOUT_CHECK = 1 << 26, 73 ENABLE_PAGETAG_THREAD_ID = 1 << 27, 74 DISABLE_JSPANDAFILE_MODULE_SNAPSHOT = 1 << 28, 75 ENABLE_MODULE_EXCEPTION = 1 << 29, 76 ENABLE_PENDING_CHEAK = 1 << 30, 77 ENABLE_RAWHEAP_CROP = 1 << 31, 78 }; 79 80 // asm interpreter control parsed option 81 struct AsmInterParsedOption { 82 int handleStart {-1}; 83 int handleEnd {-1}; 84 bool enableAsm {false}; 85 }; 86 87 extern const std::string PUBLIC_API COMMON_HELP_HEAD_MSG; 88 extern const std::string PUBLIC_API STUB_HELP_HEAD_MSG; 89 extern const std::string PUBLIC_API COMPILER_HELP_HEAD_MSG; 90 extern const std::string PUBLIC_API HELP_OPTION_MSG; 91 92 enum CommandValues { 93 OPTION_DEFAULT, 94 OPTION_HELP, 95 OPTION_ENABLE_ARK_TOOLS, 96 OPTION_STUB_FILE, 97 OPTION_ENABLE_FORCE_GC, 98 OPTION_ENABLE_CMC_GC, 99 OPTION_MAX_GARBAGE_CACHE_SIZE, 100 OPTION_ENABLE_CMC_GC_CONCURRENT_ROOT_MARKING, 101 OPTION_FORCE_FULL_GC, 102 OPTION_ENABLE_FORCE_SHARED_GC_FREQUENCY, 103 OPTION_ARK_PROPERTIES, 104 OPTION_ARK_BUNDLENAME, 105 OPTION_GC_THREADNUM, 106 OPTION_GC_LONG_PAUSED_TIME, 107 OPTION_AOT_FILE, 108 OPTION_COMPILER_TARGET_TRIPLE, 109 OPTION_ASM_OPT_LEVEL, 110 OPTION_RELOCATION_MODE, 111 OPTION_MAX_UNMOVABLE_SPACE, 112 OPTION_ENABLE_ASM_INTERPRETER, 113 OPTION_ENABLE_BUILTINS_LAZY, 114 OPTION_ASM_OPCODE_DISABLE_RANGE, 115 OPTION_SERIALIZER_BUFFER_SIZE_LIMIT, 116 OPTION_HEAP_SIZE_LIMIT, 117 OPTION_ENABLE_IC, 118 OPTION_ICU_DATA_PATH, 119 OPTION_STARTUP_TIME, 120 OPTION_COMPILER_LOG_OPT, 121 OPTION_COMPILER_LOG_METHODS, 122 OPTION_COMPILER_TYPE_THRESHOLD, 123 OPTION_ENABLE_RUNTIME_STAT, 124 OPTION_COMPILER_LOG_SNAPSHOT, 125 OPTION_COMPILER_LOG_TIME, 126 OPTION_ENABLE_WORKER, 127 OPTION_COMPILER_TRACE_BC, 128 OPTION_COMPILER_TRACE_DEOPT, 129 OPTION_COMPILER_TRACE_INLINE, 130 OPTION_COMPILER_MAX_INLINE_BYTECODES, 131 OPTION_COMPILER_DEOPT_THRESHOLD, 132 OPTION_COMPILER_STRESS_DEOPT, 133 OPTION_COMPILER_OPT_CODE_PROFILER, 134 OPTION_COMPILER_OPT_BC_RANGE, 135 OPTION_LOG_LEVEL, 136 OPTION_LOG_DEBUG, 137 OPTION_LOG_INFO, 138 OPTION_LOG_WARNING, 139 OPTION_LOG_ERROR, 140 OPTION_LOG_FATAL, 141 OPTION_LOG_COMPONENTS, 142 OPTION_COMPILER_OPT_MAX_METHOD, 143 OPTION_COMPILER_MODULE_METHODS, 144 OPTION_ENTRY_POINT, 145 OPTION_MERGE_ABC, 146 OPTION_ENABLE_CONTEXT, 147 OPTION_COMPILER_OPT_TYPE_LOWERING, 148 OPTION_COMPILER_OPT_EARLY_ELIMINATION, 149 OPTION_COMPILER_OPT_LATER_ELIMINATION, 150 OPTION_COMPILER_THERMAL_LEVEL, 151 OPTION_COMPILER_OPT_VALUE_NUMBERING, 152 OPTION_COMPILER_OPT_INLINING, 153 OPTION_COMPILER_OPT_PGOTYPE, 154 OPTION_COMPILER_OPT_TRACK_FIELD, 155 OPTION_COMPILER_PGO_PROFILER_PATH, 156 OPTION_COMPILER_PGO_HOTNESS_THRESHOLD, 157 OPTION_COMPILER_PGO_SAVE_MIN_INTERVAL, 158 OPTION_ENABLE_PGO_PROFILER, 159 OPTION_PRINT_EXECUTE_TIME, 160 OPTION_COMPILER_DEVICE_STATE, 161 OPTION_COMPILER_VERIFY_VTABLE, 162 OPTION_COMPILER_SELECT_METHODS, 163 OPTION_COMPILER_SKIP_METHODS, 164 OPTION_TARGET_COMPILER_MODE, 165 OPTION_HAP_PATH, 166 OPTION_HAP_ABC_OFFSET, 167 OPTION_HAP_ABC_SIZE, 168 OPTION_COMPILER_NOCHECK, 169 OPTION_COMPILER_PIPELINE_HOST_AOT, 170 OPTION_FAST_AOT_COMPILE_MODE, 171 OPTION_COMPILER_OPT_LOOP_PEELING, 172 OPTION_COMPILER_OPT_ON_HEAP_CHECK, 173 OPTION_COMPILER_PKG_INFO, 174 OPTION_COMPILER_EXTERNAL_PKG_INFO, 175 OPTION_COMPILER_ENABLE_EXTERNAL_PKG, 176 OPTION_COMPILER_FRAMEWORK_ABC_PATH, 177 OPTION_COMPILER_OPT_ARRAY_BOUNDS_CHECK_ELIMINATION, 178 OPTION_COMPILER_OPT_LOOP_INVARIANT_CODE_MOTION, 179 OPTION_COMPILER_OPT_CONSTANT_FOLDING, 180 OPTION_COMPILER_ENABLE_LEXENV_SPECIALIZATION, 181 OPTION_COMPILER_TRACE_INSTRUCTION_COMBINE, 182 OPTION_COMPILER_TRACE_VALUE_NUMBERING, 183 OPTION_COMPILER_OPT_INSTRUCTIONE_COMBINE, 184 OPTION_COMPILER_OPT_NEW_VALUE_NUMBERING, 185 OPTION_COMPILER_ENABLE_NATIVE_INLINE, 186 OPTION_COMPILER_ENABLE_LOWERING_BUILTIN, 187 OPTION_COMPILER_ENABLE_LITECG, 188 OPTION_COMPILER_ENABLE_JIT, 189 OPTION_COMPILER_ENABLE_OSR, 190 OPTION_COMPILER_JIT_HOTNESS_THRESHOLD, 191 OPTION_COMPILER_JIT_CALL_THRESHOLD, 192 OPTION_COMPILER_OSR_HOTNESS_THRESHOLD, 193 OPTION_COMPILER_FORCE_JIT_COMPILE_MAIN, 194 OPTION_COMPILER_TRACE_JIT, 195 OPTION_COMPILER_ENABLE_JIT_PGO, 196 OPTION_COMPILER_ENABLE_AOT_PGO, 197 OPTION_COMPILER_ENABLE_FRAMEWORK_AOT, 198 OPTION_COMPILER_ENABLE_PROPFILE_DUMP, 199 OPTION_ENABLE_MUTANT_ARRAY, 200 OPTION_ENABLE_ELEMENTS_KIND, 201 OPTION_COMPILER_TYPED_OP_PROFILER, 202 OPTION_COMPILER_OPT_BRANCH_PROFILING, 203 OPTION_TEST_ASSERT, 204 OPTION_COMPILER_METHODS_RANGE, 205 OPTION_COMPILER_CODEGEN_OPT, 206 OPTION_COMPILER_OPT_BC_RANGE_HELP, 207 OPTION_COMPILER_MEMORY_ANALYSIS, 208 OPTION_COMPILER_CHECK_PGO_VERSION, 209 OPTION_COMPILER_OPT_ESCAPE_ANALYSIS, 210 OPTION_COMPILER_TRACE_ESCAPE_ANALYSIS, 211 OPTION_ENABLE_JITFORT, 212 OPTION_CODESIGN_DISABLE, 213 OPTION_ENABLE_ASYNC_COPYTOFORT, 214 OPTION_COMPILER_OPT_INDUCTION_VARIABLE, 215 OPTION_COMPILER_TRACE_INDUCTION_VARIABLE, 216 OPTION_COMPILER_ENABLE_BASELINEJIT, 217 OPTION_COMPILER_BASELINEJIT_HOTNESS_THRESHOLD, 218 OPTION_COMPILER_FORCE_BASELINEJIT_COMPILE_MAIN, 219 OPTION_ENABLE_AOT_CRASH_ESCAPE, 220 OPTION_COMPILER_ENABLE_JIT_FAST_COMPILE, 221 OPTION_COMPILER_ENABLE_MEGA_IC, 222 OPTION_COMPILER_BASELINE_PGO, 223 OPTION_ASYNC_LOAD_ABC, 224 OPTION_ASYNC_LOAD_ABC_TEST, 225 OPTION_PGO_TRACE, 226 OPTION_COMPILER_PGO_FORCE_DUMP, 227 OPTION_COMPILER_ENABLE_CONCURRENT, 228 OPTION_COMPILER_ENABLE_STORE_BARRIER_OPT, 229 OPTION_COMPILER_ENABLE_LDOBJVALUE_OPT, 230 OPTION_COMPILER_OPT_STRING, 231 OPTION_OPEN_ARK_TOOLS, 232 OPTION_COMPILER_OPT_FRAME_STATE_ELIMINATION, 233 OPTION_COMPILER_ENABLE_PGO_SPACE, 234 OPTION_ENABLE_INLINE_PROPERTY_OPTIMIZATION, 235 OPTION_COMPILER_ENABLE_AOT_CODE_COMMENT, 236 OPTION_ENABLE_JIT_VERIFY_PASS, 237 OPTION_COMPILER_AN_FILE_MAX_SIZE, 238 OPTION_COMPILER_TRACE_BUILTINS, 239 OPTION_ENABLE_HEAP_VERIFY, 240 OPTION_COMPILER_ENABLE_DFX_HISYS_EVENT, 241 OPTION_COMPILER_ENABLE_AOT_LAZY_DEOPT, 242 OPTION_COMPILER_ENABLE_JIT_LAZY_DEOPT, 243 OPTION_COMPILER_ENABLE_LAZY_DEOPT_TRACE, 244 OPTION_ENABLE_LOADING_STUBS_LOG, 245 OPTION_COMPILER_JIT_METHOD_DICHOTOMY, 246 OPTION_COMPILER_JIT_METHOD_PATH, 247 OPTION_COMPILER_ENABLE_MERGE_POLY, 248 OPTION_MEM_CONFIG, 249 OPTION_MULTI_CONTEXT, 250 251 // OPTION_LAST should at the last 252 OPTION_LAST, 253 }; 254 255 class PUBLIC_API JSRuntimeOptions { 256 public: 257 JSRuntimeOptions(); 258 ~JSRuntimeOptions() = default; 259 DEFAULT_COPY_SEMANTIC(JSRuntimeOptions); 260 DEFAULT_MOVE_SEMANTIC(JSRuntimeOptions); 261 GetLogOptions()262 common::LogOptions GetLogOptions() const 263 { 264 common::LogOptions option; 265 // For ArkTS runtime log 266 if (WasSetLogFatal()) { 267 option.level = Level::FATAL; 268 option.component = GetLogComponentFromString(GetLogFatal()); 269 } else if (WasSetLogError()) { 270 option.level = Level::ERROR; 271 option.component = GetLogComponentFromString(GetLogError()); 272 } else if (WasSetLogWarning()) { 273 option.level = Level::WARN; 274 option.component = GetLogComponentFromString(GetLogWarning()); 275 } else if (WasSetLogInfo()) { 276 option.level = Level::INFO; 277 option.component = GetLogComponentFromString(GetLogInfo()); 278 } else if (WasSetLogDebug()) { 279 option.level = Level::DEBUG; 280 option.component = GetLogComponentFromString(GetLogDebug()); 281 } else { 282 option.level = GetLogLevelFromString(GetLogLevel()); 283 option.component = GetLogComponentFromString(GetLogComponents()); 284 } 285 286 return option; 287 } 288 GetRuntimeParam()289 common::RuntimeParam GetRuntimeParam() const 290 { 291 return param_; 292 } 293 294 void SetConfigHeapSize(size_t configHeapSize); 295 296 bool ParseCommand(const int argc, const char** argv); 297 bool SetDefaultValue(char* argv); 298 void SetConfigMaxGarbageCacheSize(uint64_t maxGarbageCacheSize); 299 EnableArkTools()300 bool EnableArkTools() const 301 { 302 return (enableArkTools_) || ((static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_ARKTOOLS) != 0); 303 } 304 SetEnableArkTools(bool value)305 void SetEnableArkTools(bool value) 306 { 307 enableArkTools_ = value; 308 } 309 WasSetEnableArkTools()310 bool WasSetEnableArkTools() const 311 { 312 return WasOptionSet(OPTION_ENABLE_ARK_TOOLS); 313 } 314 IsOpenArkTools()315 bool IsOpenArkTools() const 316 { 317 return openArkTools_; 318 } 319 SetOpenArkTools(bool value)320 void SetOpenArkTools(bool value) 321 { 322 openArkTools_ = value; 323 } 324 WasSetOpenArkTools()325 bool WasSetOpenArkTools() const 326 { 327 return WasOptionSet(OPTION_OPEN_ARK_TOOLS); 328 } 329 IsEnableRuntimeStat()330 bool IsEnableRuntimeStat() const 331 { 332 return enableRuntimeStat_; 333 } 334 SetEnableRuntimeStat(bool value)335 void SetEnableRuntimeStat(bool value) 336 { 337 enableRuntimeStat_ = value; 338 } 339 WasSetEnableRuntimeStat()340 bool WasSetEnableRuntimeStat() const 341 { 342 return WasOptionSet(OPTION_ENABLE_RUNTIME_STAT); 343 } 344 GetStubFile()345 std::string GetStubFile() const 346 { 347 return stubFile_; 348 } 349 SetStubFile(std::string value)350 void SetStubFile(std::string value) 351 { 352 stubFile_ = std::move(value); 353 } 354 SetCompilerPkgJsonInfo(std::string pkgJsonInfo)355 void SetCompilerPkgJsonInfo(std::string pkgJsonInfo) 356 { 357 compilerPkgInfo_ = std::move(pkgJsonInfo); 358 } 359 GetCompilerPkgJsonInfo()360 const std::string& GetCompilerPkgJsonInfo() const 361 { 362 return compilerPkgInfo_; 363 } 364 SetCompilerExternalPkgJsonInfo(std::string pkgJsonInfo)365 void SetCompilerExternalPkgJsonInfo(std::string pkgJsonInfo) 366 { 367 compilerExternalPkgInfo_ = std::move(pkgJsonInfo); 368 } 369 GetCompilerExternalPkgJsonInfo()370 const std::string& GetCompilerExternalPkgJsonInfo() const 371 { 372 return compilerExternalPkgInfo_; 373 } 374 SetCompilerEnableExternalPkg(bool compilerEnableExternalPkg)375 void SetCompilerEnableExternalPkg(bool compilerEnableExternalPkg) 376 { 377 compilerEnableExternalPkg_ = compilerEnableExternalPkg; 378 } 379 GetCompilerEnableExternalPkg()380 bool GetCompilerEnableExternalPkg() const 381 { 382 return compilerEnableExternalPkg_; 383 } 384 WasStubFileSet()385 bool WasStubFileSet() const 386 { 387 return WasOptionSet(OPTION_STUB_FILE); 388 } 389 SetEnableAOT(bool value)390 void SetEnableAOT(bool value) 391 { 392 enableAOT_ = value; 393 } 394 GetEnableAOT()395 bool GetEnableAOT() const 396 { 397 return enableAOT_; 398 } 399 GetAOTOutputFile()400 std::string GetAOTOutputFile() const 401 { 402 return aotOutputFile_; 403 } 404 SetAOTOutputFile(const std::string & value)405 void SetAOTOutputFile(const std::string& value) 406 { 407 aotOutputFile_ = panda::os::file::File::GetExtendedFilePath(value); 408 } 409 WasAOTOutputFileSet()410 bool WasAOTOutputFileSet() const 411 { 412 return WasOptionSet(OPTION_AOT_FILE); 413 } 414 GetTargetTriple()415 std::string GetTargetTriple() const 416 { 417 return targetTriple_; 418 } 419 SetTargetTriple(std::string value)420 void SetTargetTriple(std::string value) 421 { 422 targetTriple_ = std::move(value); 423 } 424 GetOptLevel()425 size_t GetOptLevel() const 426 { 427 return asmOptLevel_; 428 } 429 SetOptLevel(size_t value)430 void SetOptLevel(size_t value) 431 { 432 asmOptLevel_ = value; 433 } 434 GetRelocMode()435 size_t GetRelocMode() const 436 { 437 return relocationMode_; 438 } 439 SetRelocMode(size_t value)440 void SetRelocMode(size_t value) 441 { 442 relocationMode_ = value; 443 } 444 EnableForceGC()445 bool EnableForceGC() const 446 { 447 return enableForceGc_; 448 } 449 SetEnableForceGC(bool value)450 void SetEnableForceGC(bool value) 451 { 452 enableForceGc_ = value; 453 } 454 EnableLoadingStubsLog()455 bool EnableLoadingStubsLog() const 456 { 457 return enableLoadingStubsLog_; 458 } 459 SetEnableLoadingStubsLog(bool value)460 void SetEnableLoadingStubsLog(bool value) 461 { 462 enableLoadingStubsLog_ = value; 463 } 464 ForceFullGC()465 bool ForceFullGC() const 466 { 467 return forceFullGc_; 468 } 469 SetForceFullGC(bool value)470 void SetForceFullGC(bool value) 471 { 472 forceFullGc_ = value; 473 } 474 SetForceSharedGCFrequency(size_t frequency)475 void SetForceSharedGCFrequency(size_t frequency) 476 { 477 forceSharedGc_ = frequency; 478 } 479 GetForceSharedGCFrequency()480 uint32_t GetForceSharedGCFrequency() const 481 { 482 return forceSharedGc_; 483 } 484 SetEnableHeapVerify(bool value)485 void SetEnableHeapVerify(bool value) 486 { 487 enableHeapVerify_ = value; 488 } 489 SetGcThreadNum(size_t num)490 void SetGcThreadNum(size_t num) 491 { 492 gcThreadNum_ = num; 493 } 494 GetGcThreadNum()495 size_t GetGcThreadNum() const 496 { 497 return gcThreadNum_; 498 } 499 SetLongPauseTime(size_t time)500 void SetLongPauseTime(size_t time) 501 { 502 longPauseTime_ = time; 503 } 504 GetLongPauseTime()505 size_t GetLongPauseTime() const 506 { 507 return longPauseTime_; 508 } 509 SetArkProperties(int prop)510 void SetArkProperties(int prop) 511 { 512 if (prop != ArkProperties::DEFAULT) { 513 arkProperties_ = prop; 514 } 515 } 516 SetArkBundleName(const std::string & bundleName)517 void SetArkBundleName(const std::string &bundleName) 518 { 519 if (bundleName != "") { 520 arkBundleName_ = bundleName; 521 } 522 } 523 524 void SetMemConfigProperty(const std::string &configProperty); 525 GetHeapSize()526 size_t GetHeapSize() const 527 { 528 return heapSize_; 529 } 530 GetDefaultProperties()531 int GetDefaultProperties() 532 { 533 return ArkProperties::PARALLEL_GC | ArkProperties::CONCURRENT_MARK | ArkProperties::CONCURRENT_SWEEP | 534 ArkProperties::ENABLE_ARKTOOLS | ArkProperties::ENABLE_IDLE_GC; 535 } 536 GetArkProperties()537 int GetArkProperties() 538 { 539 return arkProperties_; 540 } 541 GetArkBundleName()542 std::string GetArkBundleName() const 543 { 544 return arkBundleName_; 545 } 546 FindTraceBundleName(CString s)547 bool FindTraceBundleName(CString s) const 548 { 549 return traceBundleName_.find(s) != traceBundleName_.end(); 550 } 551 EnableOptionalLog()552 bool EnableOptionalLog() const 553 { 554 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::OPTIONAL_LOG) != 0; 555 } 556 EnableGCStatsPrint()557 bool EnableGCStatsPrint() const 558 { 559 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::GC_STATS_PRINT) != 0; 560 } 561 EnableParallelGC()562 bool EnableParallelGC() const 563 { 564 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::PARALLEL_GC) != 0; 565 } 566 EnableConcurrentMark()567 bool EnableConcurrentMark() const 568 { 569 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CONCURRENT_MARK) != 0; 570 } 571 EnableMultiContext()572 bool EnableMultiContext() const 573 { 574 return (multiContext_) || ((static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_MULTI_CONTEXT) != 0); 575 } 576 EnableSharedConcurrentMark()577 bool EnableSharedConcurrentMark() const 578 { 579 // Use DISABLE to adapt to the exsiting ArkProperties in testing scripts. 580 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::DISABLE_SHARED_CONCURRENT_MARK) == 0; 581 } 582 EnableExceptionBacktrace()583 bool EnableExceptionBacktrace() const 584 { 585 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::EXCEPTION_BACKTRACE) != 0; 586 } 587 EnableConcurrentSweep()588 bool EnableConcurrentSweep() const 589 { 590 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CONCURRENT_SWEEP) != 0; 591 } 592 EnableThreadCheck()593 uint32_t EnableThreadCheck() const 594 { 595 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::THREAD_CHECK) != 0; 596 } 597 EnableIdleGC()598 bool EnableIdleGC() const 599 { 600 return false; 601 } 602 EnableGCTracer()603 bool EnableGCTracer() const 604 { 605 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_GC_TRACER) != 0; 606 } 607 EnableGlobalObjectLeakCheck()608 bool EnableGlobalObjectLeakCheck() const 609 { 610 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::GLOBAL_OBJECT_LEAK_CHECK) != 0; 611 } 612 EnableGlobalPrimitiveLeakCheck()613 bool EnableGlobalPrimitiveLeakCheck() const 614 { 615 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::GLOBAL_PRIMITIVE_LEAK_CHECK) != 0; 616 } 617 EnableGlobalLeakCheck()618 bool EnableGlobalLeakCheck() const 619 { 620 return EnableGlobalObjectLeakCheck() || EnableGlobalPrimitiveLeakCheck(); 621 } 622 EnableCpuProfilerColdStartMainThread()623 bool EnableCpuProfilerColdStartMainThread() const 624 { 625 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_COLD_START_MAIN_THREAD) != 0; 626 } 627 EnableCpuProfilerColdStartWorkerThread()628 bool EnableCpuProfilerColdStartWorkerThread() const 629 { 630 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_COLD_START_WORKER_THREAD) != 0; 631 } 632 EnableCpuProfilerAnyTimeMainThread()633 bool EnableCpuProfilerAnyTimeMainThread() const 634 { 635 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_ANY_TIME_MAIN_THREAD) != 0; 636 } 637 EnableCpuProfilerAnyTimeWorkerThread()638 bool EnableCpuProfilerAnyTimeWorkerThread() const 639 { 640 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_ANY_TIME_WORKER_THREAD) != 0; 641 } 642 EnableCpuProfilerVMTag()643 bool EnableCpuProfilerVMTag() const 644 { 645 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_CPU_PROFILER_VM_TAG) != 0; 646 } 647 IsStartGlobalLeakCheck()648 bool IsStartGlobalLeakCheck() const 649 { 650 return startGlobalLeakCheck_; 651 } 652 SwitchStartGlobalLeakCheck()653 void SwitchStartGlobalLeakCheck() 654 { 655 startGlobalLeakCheck_ = !startGlobalLeakCheck_; 656 } 657 EnableSnapshotSerialize()658 bool EnableSnapshotSerialize() const 659 { 660 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_SNAPSHOT_SERIALIZE) != 0; 661 } 662 EnableSnapshotDeserialize()663 bool EnableSnapshotDeserialize() const 664 { 665 if (WIN_OR_MAC_OR_IOS_PLATFORM) { 666 return false; 667 } 668 669 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_SNAPSHOT_DESERIALIZE) != 0; 670 } 671 EnableHeapVerify()672 bool EnableHeapVerify() const 673 { 674 return enableHeapVerify_ && (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_HEAP_VERIFY) != 0; 675 } 676 EnableMicroJobTrace()677 bool EnableMicroJobTrace() const 678 { 679 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_MICROJOB_TRACE) != 0; 680 } 681 EnableESMTrace()682 bool EnableESMTrace() const 683 { 684 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_ESM_TRACE) != 0; 685 } 686 EnableModuleLog()687 bool EnableModuleLog() const 688 { 689 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_MODULE_LOG) != 0; 690 } 691 EnableSerializationTimeoutCheck()692 bool EnableSerializationTimeoutCheck() const 693 { 694 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_SERIALIZATION_TIMEOUT_CHECK) != 0; 695 } 696 EnablePageTagThreadId()697 bool EnablePageTagThreadId() const 698 { 699 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_PAGETAG_THREAD_ID) != 0; 700 } 701 EnableModuleException()702 bool EnableModuleException() const 703 { 704 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_MODULE_EXCEPTION) != 0; 705 } 706 EnablePendingCheak()707 bool EnablePendingCheak() const 708 { 709 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_PENDING_CHEAK) != 0; 710 } 711 EnableRawHeapCrop()712 bool EnableRawHeapCrop() const 713 { 714 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_RAWHEAP_CROP) != 0; 715 } DisableJSPandaFileAndModuleSnapshot()716 bool DisableJSPandaFileAndModuleSnapshot() const 717 { 718 return (static_cast<uint32_t>(arkProperties_) & ArkProperties::DISABLE_JSPANDAFILE_MODULE_SNAPSHOT) != 0; 719 } 720 WasSetMaxNonmovableSpaceCapacity()721 bool WasSetMaxNonmovableSpaceCapacity() const 722 { 723 return WasOptionSet(OPTION_MAX_UNMOVABLE_SPACE); 724 } 725 MaxNonmovableSpaceCapacity()726 size_t MaxNonmovableSpaceCapacity() const 727 { 728 return maxNonmovableSpaceCapacity_; 729 } 730 SetMaxNonmovableSpaceCapacity(uint32_t value)731 void SetMaxNonmovableSpaceCapacity(uint32_t value) 732 { 733 maxNonmovableSpaceCapacity_ = value; 734 } 735 SetEnableAsmInterpreter(bool value)736 void SetEnableAsmInterpreter(bool value) 737 { 738 enableAsmInterpreter_ = value; 739 } 740 GetEnableAsmInterpreter()741 bool GetEnableAsmInterpreter() const 742 { 743 return enableAsmInterpreter_; 744 } 745 SetEnableBuiltinsLazy(bool value)746 void SetEnableBuiltinsLazy(bool value) 747 { 748 enableBuiltinsLazy_ = value; 749 } 750 GetEnableBuiltinsLazy()751 bool GetEnableBuiltinsLazy() const 752 { 753 return enableBuiltinsLazy_; 754 } 755 SetAsmOpcodeDisableRange(std::string value)756 void SetAsmOpcodeDisableRange(std::string value) 757 { 758 asmOpcodeDisableRange_ = std::move(value); 759 } 760 SetDisableCodeSign(bool value)761 void SetDisableCodeSign(bool value) 762 { 763 disableCodeSign_ = value; 764 } 765 GetDisableCodeSign()766 bool GetDisableCodeSign() const 767 { 768 return disableCodeSign_; 769 } 770 SetEnableJitFort(bool value)771 void SetEnableJitFort(bool value) 772 { 773 enableJitFort_ = value; 774 } 775 GetEnableJitFort()776 bool GetEnableJitFort() const 777 { 778 return enableJitFort_; 779 } 780 SetEnableAsyncCopyToFort(bool value)781 void SetEnableAsyncCopyToFort(bool value) 782 { 783 enableAsyncCopyToFort_ = value; 784 } 785 GetEnableAsyncCopyToFort()786 bool GetEnableAsyncCopyToFort() const 787 { 788 return enableAsyncCopyToFort_; 789 } 790 SetLargeHeap(bool largeHeap)791 void SetLargeHeap(bool largeHeap) 792 { 793 enableLargeHeap_ = largeHeap; 794 } 795 GetLargeHeap()796 bool GetLargeHeap() const 797 { 798 return enableLargeHeap_; 799 } 800 801 void ParseAsmInterOption(); 802 GetAsmInterParsedOption()803 AsmInterParsedOption GetAsmInterParsedOption() const 804 { 805 return asmInterParsedOption_; 806 } 807 GetCompilerLogOption()808 std::string GetCompilerLogOption() const 809 { 810 return compilerLogOpt_; 811 } 812 SetCompilerLogOption(std::string value)813 void SetCompilerLogOption(std::string value) 814 { 815 compilerLogOpt_ = std::move(value); 816 } 817 WasSetCompilerLogOption()818 bool WasSetCompilerLogOption() const 819 { 820 return WasOptionSet(OPTION_COMPILER_LOG_OPT) && GetCompilerLogOption().find("none") == std::string::npos; 821 } 822 GetMethodsListForLog()823 std::string GetMethodsListForLog() const 824 { 825 return compilerLogMethods_; 826 } 827 SetMethodsListForLog(std::string value)828 void SetMethodsListForLog(std::string value) 829 { 830 compilerLogMethods_ = std::move(value); 831 } 832 WasSetMethodsListForLog()833 bool WasSetMethodsListForLog() const 834 { 835 return WasOptionSet(OPTION_COMPILER_LOG_METHODS) && GetCompilerLogOption().find("none") == std::string::npos && 836 GetCompilerLogOption().find("all") == std::string::npos; 837 } 838 SetCompilerLogSnapshot(bool value)839 void SetCompilerLogSnapshot(bool value) 840 { 841 compilerLogSnapshot_ = value; 842 } 843 IsEnableCompilerLogSnapshot()844 bool IsEnableCompilerLogSnapshot() const 845 { 846 return compilerLogSnapshot_; 847 } 848 WasSetCompilerLogSnapshot()849 bool WasSetCompilerLogSnapshot() const 850 { 851 return WasOptionSet(OPTION_COMPILER_LOG_SNAPSHOT); 852 } 853 SetCompilerLogTime(bool value)854 void SetCompilerLogTime(bool value) 855 { 856 compilerLogTime_ = value; 857 } 858 IsEnableCompilerLogTime()859 bool IsEnableCompilerLogTime() const 860 { 861 return compilerLogTime_; 862 } 863 WasSetCompilerLogTime()864 bool WasSetCompilerLogTime() const 865 { 866 return WasOptionSet(OPTION_COMPILER_LOG_TIME); 867 } 868 GetSerializerBufferSizeLimit()869 uint64_t GetSerializerBufferSizeLimit() const 870 { 871 return serializerBufferSizeLimit_; 872 } 873 SetSerializerBufferSizeLimit(uint64_t value)874 void SetSerializerBufferSizeLimit(uint64_t value) 875 { 876 serializerBufferSizeLimit_ = value; 877 } 878 SetIsWorker(bool isWorker)879 void SetIsWorker(bool isWorker) 880 { 881 isWorker_ = isWorker; 882 } 883 SetIsRestrictedWorker(bool isRestrictedWorker)884 void SetIsRestrictedWorker(bool isRestrictedWorker) 885 { 886 isRestrictedWorker_ = isRestrictedWorker; 887 } 888 IsWorker()889 bool IsWorker() const 890 { 891 return isWorker_; 892 } 893 IsRestrictedWorker()894 bool IsRestrictedWorker() const 895 { 896 return isRestrictedWorker_; 897 } 898 EnableIC()899 bool EnableIC() const 900 { 901 return enableIC_; 902 } 903 SetEnableIC(bool value)904 void SetEnableIC(bool value) 905 { 906 enableIC_ = value; 907 } 908 WasSetEnableIC()909 bool WasSetEnableIC() const 910 { 911 return WasOptionSet(OPTION_ENABLE_IC); 912 } 913 GetIcuDataPath()914 std::string GetIcuDataPath() const 915 { 916 return icuDataPath_; 917 } 918 SetIcuDataPath(std::string value)919 void SetIcuDataPath(std::string value) 920 { 921 icuDataPath_ = std::move(value); 922 } 923 WasSetIcuDataPath()924 bool WasSetIcuDataPath() const 925 { 926 return WasOptionSet(OPTION_ICU_DATA_PATH); 927 } 928 IsStartupTime()929 bool IsStartupTime() const 930 { 931 return startupTime_; 932 } 933 SetStartupTime(bool value)934 void SetStartupTime(bool value) 935 { 936 startupTime_ = value; 937 } 938 WasSetStartupTime()939 bool WasSetStartupTime() const 940 { 941 return WasOptionSet(OPTION_STARTUP_TIME); 942 } 943 SetTraceBc(bool value)944 void SetTraceBc(bool value) 945 { 946 traceBc_ = value; 947 } 948 IsTraceBC()949 bool IsTraceBC() const 950 { 951 return traceBc_; 952 } 953 WasSetTraceBc()954 bool WasSetTraceBc() const 955 { 956 return WasOptionSet(OPTION_COMPILER_TRACE_BC); 957 } 958 GetLogLevel()959 std::string GetLogLevel() const 960 { 961 return logLevel_; 962 } 963 SetLogLevel(std::string value)964 void SetLogLevel(std::string value) 965 { 966 logLevel_ = std::move(value); 967 } 968 WasSetLogLevel()969 bool WasSetLogLevel() const 970 { 971 return WasOptionSet(OPTION_LOG_LEVEL); 972 } 973 GetLogComponents()974 arg_list_t GetLogComponents() const 975 { 976 return logComponents_; 977 } 978 SetLogComponents(arg_list_t value)979 void SetLogComponents(arg_list_t value) 980 { 981 logComponents_ = std::move(value); 982 } 983 WasSetLogComponents()984 bool WasSetLogComponents() const 985 { 986 return WasOptionSet(OPTION_LOG_COMPONENTS); 987 } 988 GetLogDebug()989 arg_list_t GetLogDebug() const 990 { 991 return logDebug_; 992 } 993 SetLogDebug(arg_list_t value)994 void SetLogDebug(arg_list_t value) 995 { 996 logDebug_ = std::move(value); 997 } 998 WasSetLogDebug()999 bool WasSetLogDebug() const 1000 { 1001 return WasOptionSet(OPTION_LOG_DEBUG); 1002 } 1003 GetLogInfo()1004 arg_list_t GetLogInfo() const 1005 { 1006 return logInfo_; 1007 } 1008 SetLogInfo(arg_list_t value)1009 void SetLogInfo(arg_list_t value) 1010 { 1011 logInfo_ = std::move(value); 1012 } 1013 WasSetLogInfo()1014 bool WasSetLogInfo() const 1015 { 1016 return WasOptionSet(OPTION_LOG_INFO); 1017 } 1018 GetLogWarning()1019 arg_list_t GetLogWarning() const 1020 { 1021 return logWarning_; 1022 } 1023 SetLogWarning(arg_list_t value)1024 void SetLogWarning(arg_list_t value) 1025 { 1026 logWarning_ = std::move(value); 1027 } 1028 WasSetLogWarning()1029 bool WasSetLogWarning() const 1030 { 1031 return WasOptionSet(OPTION_LOG_WARNING); 1032 } 1033 GetLogError()1034 arg_list_t GetLogError() const 1035 { 1036 return logError_; 1037 } 1038 SetLogError(arg_list_t value)1039 void SetLogError(arg_list_t value) 1040 { 1041 logError_ = std::move(value); 1042 } 1043 WasSetLogError()1044 bool WasSetLogError() const 1045 { 1046 return WasOptionSet(OPTION_LOG_ERROR); 1047 } 1048 GetLogFatal()1049 arg_list_t GetLogFatal() const 1050 { 1051 return logFatal_; 1052 } 1053 SetLogFatal(arg_list_t value)1054 void SetLogFatal(arg_list_t value) 1055 { 1056 logFatal_ = std::move(value); 1057 } 1058 WasSetLogFatal()1059 bool WasSetLogFatal() const 1060 { 1061 return WasOptionSet(OPTION_LOG_FATAL); 1062 } 1063 GetMaxAotMethodSize()1064 size_t GetMaxAotMethodSize() const 1065 { 1066 return maxAotMethodSize_; 1067 } 1068 SetMaxAotMethodSize(uint32_t value)1069 void SetMaxAotMethodSize(uint32_t value) 1070 { 1071 maxAotMethodSize_ = value; 1072 } 1073 GetTypeThreshold()1074 double GetTypeThreshold() const 1075 { 1076 return typeThreshold_; 1077 } 1078 SetTypeThreshold(double threshold)1079 void SetTypeThreshold(double threshold) 1080 { 1081 typeThreshold_ = threshold; 1082 } 1083 GetEntryPoint()1084 std::string GetEntryPoint() const 1085 { 1086 return entryPoint_; 1087 } 1088 SetEntryPoint(std::string value)1089 void SetEntryPoint(std::string value) 1090 { 1091 entryPoint_ = std::move(value); 1092 } 1093 WasSetEntryPoint()1094 bool WasSetEntryPoint() const 1095 { 1096 return WasOptionSet(OPTION_ENTRY_POINT); 1097 } 1098 GetMergeAbc()1099 bool GetMergeAbc() const 1100 { 1101 return mergeAbc_; 1102 } 1103 SetMergeAbc(bool value)1104 void SetMergeAbc(bool value) 1105 { 1106 mergeAbc_ = value; 1107 } 1108 SetEnableContext(bool value)1109 void SetEnableContext(bool value) 1110 { 1111 enableContext_ = value; 1112 } 1113 IsEnableContext()1114 bool IsEnableContext() const 1115 { 1116 return enableContext_; 1117 } 1118 SetEnablePrintExecuteTime(bool value)1119 void SetEnablePrintExecuteTime(bool value) 1120 { 1121 enablePrintExecuteTime_ = value; 1122 } 1123 IsEnablePrintExecuteTime()1124 bool IsEnablePrintExecuteTime() const 1125 { 1126 return enablePrintExecuteTime_; 1127 } 1128 SetEnableMutantArray(bool value)1129 void SetEnableMutantArray(bool value) 1130 { 1131 enableMutantArray_ = value; 1132 } 1133 IsEnableMutantArray()1134 bool IsEnableMutantArray() const 1135 { 1136 return enableMutantArray_; 1137 } 1138 SetEnableElementsKind(bool value)1139 void SetEnableElementsKind(bool value) 1140 { 1141 enableElementsKind_ = value; 1142 } 1143 IsEnableElementsKind()1144 bool IsEnableElementsKind() const 1145 { 1146 return enableElementsKind_; 1147 } 1148 SetEnablePGOProfiler(bool value)1149 void SetEnablePGOProfiler(bool value) 1150 { 1151 enablePGOProfiler_ = value; 1152 } 1153 IsEnablePGOProfiler()1154 bool IsEnablePGOProfiler() const 1155 { 1156 return enablePGOProfiler_; 1157 } 1158 GetPGOHotnessThreshold()1159 uint32_t GetPGOHotnessThreshold() const 1160 { 1161 return pgoHotnessThreshold_; 1162 } 1163 SetPGOHotnessThreshold(uint32_t threshold)1164 void SetPGOHotnessThreshold(uint32_t threshold) 1165 { 1166 pgoHotnessThreshold_ = threshold; 1167 } 1168 GetPGOSaveMinInterval()1169 uint32_t GetPGOSaveMinInterval() const 1170 { 1171 return pgoSaveMinInterval_; 1172 } 1173 SetPGOSaveMinInterval(uint32_t value)1174 void SetPGOSaveMinInterval(uint32_t value) 1175 { 1176 pgoSaveMinInterval_ = value; 1177 } 1178 GetPGOProfilerPath()1179 std::string GetPGOProfilerPath() const 1180 { 1181 return pgoProfilerPath_; 1182 } 1183 SetEnableBaselinePgo(bool value)1184 void SetEnableBaselinePgo(bool value) 1185 { 1186 enableBaselinePgo_ = value; 1187 } 1188 IsEnableBaselinePgo()1189 bool IsEnableBaselinePgo() const 1190 { 1191 return enableBaselinePgo_; 1192 } 1193 SetPGOProfilerPath(const std::string & value)1194 void SetPGOProfilerPath(const std::string& value) 1195 { 1196 pgoProfilerPath_ = panda::os::file::File::GetExtendedFilePath(value); 1197 } 1198 IsPGOProfilerPathEmpty()1199 bool IsPGOProfilerPathEmpty() const 1200 { 1201 return pgoProfilerPath_.empty(); 1202 } 1203 SetEnableTypeLowering(bool value)1204 void SetEnableTypeLowering(bool value) 1205 { 1206 enableTypeLowering_ = value; 1207 } 1208 IsEnableArrayBoundsCheckElimination()1209 bool IsEnableArrayBoundsCheckElimination() const 1210 { 1211 return enableArrayBoundsCheckElimination_; 1212 } 1213 SetEnableArrayBoundsCheckElimination(bool value)1214 void SetEnableArrayBoundsCheckElimination(bool value) 1215 { 1216 enableArrayBoundsCheckElimination_ = value; 1217 } 1218 IsEnableFrameStateElimination()1219 bool IsEnableFrameStateElimination() const 1220 { 1221 return enableFrameStateElimination_; 1222 } 1223 SetEnableFrameStateElimination(bool value)1224 void SetEnableFrameStateElimination(bool value) 1225 { 1226 enableFrameStateElimination_ = value; 1227 } 1228 IsEnableTypeLowering()1229 bool IsEnableTypeLowering() const 1230 { 1231 return enableTypeLowering_; 1232 } 1233 SetEnableEarlyElimination(bool value)1234 void SetEnableEarlyElimination(bool value) 1235 { 1236 enableEarlyElimination_ = value; 1237 } 1238 IsEnableEarlyElimination()1239 bool IsEnableEarlyElimination() const 1240 { 1241 return enableEarlyElimination_; 1242 } 1243 SetEnableLaterElimination(bool value)1244 void SetEnableLaterElimination(bool value) 1245 { 1246 enableLaterElimination_ = value; 1247 } 1248 IsEnableLaterElimination()1249 bool IsEnableLaterElimination() const 1250 { 1251 return enableLaterElimination_; 1252 } 1253 SetEnableInstrcutionCombine(bool value)1254 void SetEnableInstrcutionCombine(bool value) 1255 { 1256 enableInstrcutionCombine = value; 1257 } 1258 IsEnableInstrcutionCombine()1259 bool IsEnableInstrcutionCombine() const 1260 { 1261 return enableInstrcutionCombine; 1262 } 1263 SetEnableValueNumbering(bool value)1264 void SetEnableValueNumbering(bool value) 1265 { 1266 enableValueNumbering_ = value; 1267 } 1268 IsEnableValueNumbering()1269 bool IsEnableValueNumbering() const 1270 { 1271 return enableValueNumbering_; 1272 } 1273 SetEnableJIT(bool value)1274 void SetEnableJIT(bool value) 1275 { 1276 enableFastJIT_ = value; 1277 } 1278 IsEnableJIT()1279 bool IsEnableJIT() const 1280 { 1281 return enableFastJIT_; 1282 } 1283 SetEnableDFXHiSysEvent(bool value)1284 void SetEnableDFXHiSysEvent(bool value) 1285 { 1286 enableDFXHiSysEvent_ = value; 1287 } 1288 IsEnableDFXHiSysEvent()1289 bool IsEnableDFXHiSysEvent() const 1290 { 1291 return enableDFXHiSysEvent_; 1292 } 1293 SetEnableAPPJIT(bool value)1294 void SetEnableAPPJIT(bool value) 1295 { 1296 enableAPPJIT_ = value; 1297 } 1298 IsEnableAPPJIT()1299 bool IsEnableAPPJIT() const 1300 { 1301 return enableAPPJIT_; 1302 } 1303 SetEnableJitFrame(bool value)1304 void SetEnableJitFrame(bool value) 1305 { 1306 enableJitFrame_ = value; 1307 } 1308 IsEnableJitFrame()1309 bool IsEnableJitFrame() const 1310 { 1311 return enableJitFrame_; 1312 } 1313 SetEnableWarmStartupSmartGC(bool value)1314 void SetEnableWarmStartupSmartGC(bool value) 1315 { 1316 enableWarmStartupSmartGC_ = value; 1317 } 1318 GetEnableWarmStartupSmartGC()1319 bool GetEnableWarmStartupSmartGC() const 1320 { 1321 return enableWarmStartupSmartGC_; 1322 } 1323 IsEnableJitDfxDump()1324 bool IsEnableJitDfxDump() const 1325 { 1326 return isEnableJitDfxDump_; 1327 } 1328 SetEnableJitDfxDump(bool value)1329 void SetEnableJitDfxDump(bool value) 1330 { 1331 isEnableJitDfxDump_ = value; 1332 } 1333 SetEnableOSR(bool value)1334 void SetEnableOSR(bool value) 1335 { 1336 enableOSR_ = value; 1337 } 1338 IsEnableOSR()1339 bool IsEnableOSR() const 1340 { 1341 return enableOSR_; 1342 } 1343 SetJitHotnessThreshold(uint16_t value)1344 void SetJitHotnessThreshold(uint16_t value) 1345 { 1346 jitHotnessThreshold_ = value; 1347 } 1348 GetJitHotnessThreshold()1349 uint16_t GetJitHotnessThreshold() const 1350 { 1351 return jitHotnessThreshold_; 1352 } 1353 SetJitCallThreshold(uint16_t value)1354 void SetJitCallThreshold(uint16_t value) 1355 { 1356 jitCallThreshold_ = value; 1357 } 1358 GetJitCallThreshold()1359 uint16_t GetJitCallThreshold() const 1360 { 1361 return jitCallThreshold_; 1362 } 1363 SetOsrHotnessThreshold(uint16_t value)1364 void SetOsrHotnessThreshold(uint16_t value) 1365 { 1366 osrHotnessThreshold_ = value; 1367 } 1368 GetOsrHotnessThreshold()1369 uint16_t GetOsrHotnessThreshold() const 1370 { 1371 return osrHotnessThreshold_; 1372 } 1373 SetForceJitCompileMain(bool value)1374 void SetForceJitCompileMain(bool value) 1375 { 1376 forceJitCompileMain_ = value; 1377 } 1378 IsEnableForceJitCompileMain()1379 bool IsEnableForceJitCompileMain() const 1380 { 1381 return forceJitCompileMain_; 1382 } 1383 SetEnableBaselineJIT(bool value)1384 void SetEnableBaselineJIT(bool value) 1385 { 1386 enableBaselineJIT_ = value; 1387 } 1388 IsEnableBaselineJIT()1389 bool IsEnableBaselineJIT() const 1390 { 1391 return enableBaselineJIT_; 1392 } 1393 SetBaselineJitHotnessThreshold(uint16_t value)1394 void SetBaselineJitHotnessThreshold(uint16_t value) 1395 { 1396 baselineJitHotnessThreshold_ = value; 1397 } 1398 GetBaselineJitHotnessThreshold()1399 uint16_t GetBaselineJitHotnessThreshold() const 1400 { 1401 return baselineJitHotnessThreshold_; 1402 } 1403 SetForceBaselineCompileMain(bool value)1404 void SetForceBaselineCompileMain(bool value) 1405 { 1406 forceBaselineCompileMain_ = value; 1407 } 1408 IsEnableForceBaselineCompileMain()1409 bool IsEnableForceBaselineCompileMain() const 1410 { 1411 return forceBaselineCompileMain_; 1412 } 1413 SetEnableNewValueNumbering(bool value)1414 void SetEnableNewValueNumbering(bool value) 1415 { 1416 enableNewValueNumbering_ = value; 1417 } 1418 IsEnableNewValueNumbering()1419 bool IsEnableNewValueNumbering() const 1420 { 1421 return enableNewValueNumbering_; 1422 } 1423 SetEnableOptString(bool value)1424 void SetEnableOptString(bool value) 1425 { 1426 enableOptString_ = value; 1427 } 1428 IsEnableOptString()1429 bool IsEnableOptString() const 1430 { 1431 return enableOptString_; 1432 } 1433 SetEnableOptInlining(bool value)1434 void SetEnableOptInlining(bool value) 1435 { 1436 enableOptInlining_ = value; 1437 } 1438 IsEnableOptInlining()1439 bool IsEnableOptInlining() const 1440 { 1441 return enableOptInlining_; 1442 } 1443 SetEnableJitLazyDeopt(bool value)1444 void SetEnableJitLazyDeopt(bool value) 1445 { 1446 enableJitLazyDeopt_ = value; 1447 } 1448 IsEnableJitLazyDeopt()1449 bool IsEnableJitLazyDeopt() const 1450 { 1451 return enableJitLazyDeopt_; 1452 } 1453 SetEnableAotLazyDeopt(bool value)1454 void SetEnableAotLazyDeopt(bool value) 1455 { 1456 enableAotLazyDeopt_ = value; 1457 } 1458 IsEnableAotLazyDeopt()1459 bool IsEnableAotLazyDeopt() const 1460 { 1461 return enableAotLazyDeopt_; 1462 } 1463 SetEnableLazyDeoptTrace(bool value)1464 void SetEnableLazyDeoptTrace(bool value) 1465 { 1466 enableLazyDeoptTrace_ = value; 1467 } 1468 IsEnableLazyDeoptTrace()1469 bool IsEnableLazyDeoptTrace() const 1470 { 1471 return enableLazyDeoptTrace_; 1472 } 1473 SetEnableOptPGOType(bool value)1474 void SetEnableOptPGOType(bool value) 1475 { 1476 enableOptPGOType_ = value; 1477 } 1478 IsEnableOptPGOType()1479 bool IsEnableOptPGOType() const 1480 { 1481 return enableOptPGOType_; 1482 } 1483 SetEnableOptTrackField(bool value)1484 void SetEnableOptTrackField(bool value) 1485 { 1486 enableOptTrackField_ = value; 1487 } 1488 IsEnableOptTrackField()1489 bool IsEnableOptTrackField() const 1490 { 1491 return enableOptTrackField_; 1492 } 1493 GetCompilerModuleMethods()1494 uint32_t GetCompilerModuleMethods() const 1495 { 1496 return compilerModuleMethods_; 1497 } 1498 SetCompilerModuleMethods(uint32_t compilerModuleMethods)1499 void SetCompilerModuleMethods(uint32_t compilerModuleMethods) 1500 { 1501 compilerModuleMethods_ = compilerModuleMethods; 1502 } 1503 SetTraceDeopt(bool value)1504 void SetTraceDeopt(bool value) 1505 { 1506 traceDeopt_ = value; 1507 } 1508 GetTraceDeopt()1509 bool GetTraceDeopt() const 1510 { 1511 return traceDeopt_; 1512 } 1513 SetDeoptThreshold(uint8_t value)1514 void SetDeoptThreshold(uint8_t value) 1515 { 1516 deoptThreshold_ = value; 1517 } 1518 GetDeoptThreshold()1519 uint32_t GetDeoptThreshold() const 1520 { 1521 return deoptThreshold_; 1522 } 1523 SetStressDeopt(bool value)1524 void SetStressDeopt(bool value) 1525 { 1526 stressDeopt_ = value; 1527 } 1528 GetStressDeopt()1529 bool GetStressDeopt() const 1530 { 1531 return stressDeopt_; 1532 } 1533 SetDeviceState(bool value)1534 void SetDeviceState(bool value) 1535 { 1536 deviceIsScreenOff_ = value; 1537 } 1538 GetDeviceState()1539 bool GetDeviceState() const 1540 { 1541 return deviceIsScreenOff_; 1542 } 1543 WasSetDeviceState()1544 bool WasSetDeviceState() const 1545 { 1546 return WasOptionSet(OPTION_COMPILER_DEVICE_STATE); 1547 } 1548 SetThermalLevel(int32_t level)1549 void SetThermalLevel(int32_t level) 1550 { 1551 deviceThermalLevel_ = level; 1552 } 1553 GetThermalLevel()1554 int32_t GetThermalLevel() const 1555 { 1556 return deviceThermalLevel_; 1557 } 1558 WasSetThermalLevel()1559 bool WasSetThermalLevel() const 1560 { 1561 return WasOptionSet(OPTION_COMPILER_THERMAL_LEVEL); 1562 } 1563 SetOptCodeProfiler(bool value)1564 void SetOptCodeProfiler(bool value) 1565 { 1566 optCodeProfiler_ = value; 1567 } 1568 GetOptCodeProfiler()1569 bool GetOptCodeProfiler() const 1570 { 1571 return optCodeProfiler_; 1572 } 1573 SetVerifyVTable(bool value)1574 void SetVerifyVTable(bool value) 1575 { 1576 verifyVTable_ = value; 1577 } 1578 GetVerifyVTable()1579 bool GetVerifyVTable() const 1580 { 1581 return verifyVTable_; 1582 } 1583 GetCompilerSelectMethods()1584 std::string GetCompilerSelectMethods() const 1585 { 1586 return compilerSelectMethods_; 1587 } 1588 SetCompilerSelectMethods(std::string value)1589 void SetCompilerSelectMethods(std::string value) 1590 { 1591 compilerSelectMethods_ = std::move(value); 1592 } 1593 GetCompilerSkipMethods()1594 std::string GetCompilerSkipMethods() const 1595 { 1596 return compilerSkipMethods_; 1597 } 1598 SetCompilerSkipMethods(std::string value)1599 void SetCompilerSkipMethods(std::string value) 1600 { 1601 compilerSkipMethods_ = std::move(value); 1602 } 1603 SetPGOTrace(bool value)1604 void SetPGOTrace(bool value) 1605 { 1606 pgoTrace_ = value; 1607 } 1608 GetPGOTrace()1609 bool GetPGOTrace() const 1610 { 1611 return pgoTrace_; 1612 } 1613 SetTraceInline(bool value)1614 void SetTraceInline(bool value) 1615 { 1616 traceInline_ = value; 1617 } 1618 GetTraceInline()1619 bool GetTraceInline() const 1620 { 1621 return traceInline_; 1622 } 1623 GetTraceBuiltins()1624 bool GetTraceBuiltins() const 1625 { 1626 return traceBuiltins_; 1627 } 1628 SetTraceBuiltins(bool value)1629 void SetTraceBuiltins(bool value) 1630 { 1631 traceBuiltins_ = value; 1632 } 1633 SetTraceValueNumbering(bool value)1634 void SetTraceValueNumbering(bool value) 1635 { 1636 traceValueNumbering_ = value; 1637 } 1638 GetTraceValueNumbering()1639 bool GetTraceValueNumbering() const 1640 { 1641 return traceValueNumbering_; 1642 } 1643 SetTraceJIT(bool value)1644 void SetTraceJIT(bool value) 1645 { 1646 traceJIT_ = value; 1647 } 1648 GetTraceJIT()1649 bool GetTraceJIT() const 1650 { 1651 return traceJIT_; 1652 } 1653 SetTraceInstructionCombine(bool value)1654 void SetTraceInstructionCombine(bool value) 1655 { 1656 traceInstructionCombine_ = value; 1657 } 1658 GetTraceInstructionCombine()1659 bool GetTraceInstructionCombine() const 1660 { 1661 return traceInstructionCombine_; 1662 } 1663 SetMaxInlineBytecodes(size_t value)1664 void SetMaxInlineBytecodes(size_t value) 1665 { 1666 maxInlineBytecodes_ = value; 1667 } 1668 GetMaxInlineBytecodes()1669 size_t GetMaxInlineBytecodes() 1670 { 1671 return maxInlineBytecodes_; 1672 } 1673 SetCompilerFrameworkAbcPath(std::string frameworkAbcPath)1674 void SetCompilerFrameworkAbcPath(std::string frameworkAbcPath) 1675 { 1676 frameworkAbcPath_ = std::move(frameworkAbcPath); 1677 } 1678 GetCompilerFrameworkAbcPath()1679 std::string GetCompilerFrameworkAbcPath() const 1680 { 1681 return frameworkAbcPath_; 1682 } 1683 WasSetCompilerFrameworkAbcPath()1684 bool WasSetCompilerFrameworkAbcPath() const 1685 { 1686 return WasOptionSet(OPTION_COMPILER_FRAMEWORK_ABC_PATH); 1687 } 1688 SetTargetCompilerMode(std::string mode)1689 void SetTargetCompilerMode(std::string mode) 1690 { 1691 targetCompilerMode_ = std::move(mode); 1692 } 1693 GetTargetCompilerMode()1694 std::string GetTargetCompilerMode() const 1695 { 1696 return targetCompilerMode_; 1697 } 1698 IsTargetCompilerMode()1699 bool IsTargetCompilerMode() const 1700 { 1701 return IsPartialCompilerMode() || IsFullCompilerMode(); 1702 } 1703 IsPartialCompilerMode()1704 bool IsPartialCompilerMode() const 1705 { 1706 return targetCompilerMode_ == "partial"; 1707 } 1708 IsFullCompilerMode()1709 bool IsFullCompilerMode() const 1710 { 1711 return targetCompilerMode_ == "full"; 1712 } 1713 IsApplicationCompilation()1714 bool IsApplicationCompilation() const 1715 { 1716 return IsTargetCompilerMode() || IsCompilerPipelineHostAOT(); 1717 } 1718 SetHapPath(std::string path)1719 void SetHapPath(std::string path) 1720 { 1721 hapPath_ = std::move(path); 1722 } 1723 GetHapPath()1724 std::string GetHapPath() const 1725 { 1726 return hapPath_; 1727 } 1728 SetHapAbcOffset(uint32_t offset)1729 void SetHapAbcOffset(uint32_t offset) 1730 { 1731 hapAbcOffset_ = offset; 1732 } 1733 GetHapAbcOffset()1734 uint32_t GetHapAbcOffset() const 1735 { 1736 return hapAbcOffset_; 1737 } 1738 SetHapAbcSize(uint32_t size)1739 void SetHapAbcSize(uint32_t size) 1740 { 1741 hapAbcSize_ = size; 1742 } 1743 GetHapAbcSize()1744 uint32_t GetHapAbcSize() const 1745 { 1746 return hapAbcSize_; 1747 } 1748 SetCompilerNoCheck(bool value)1749 void SetCompilerNoCheck(bool value) 1750 { 1751 compilerNoCheck_ = value; 1752 } 1753 IsCompilerNoCheck()1754 bool IsCompilerNoCheck() const 1755 { 1756 return compilerNoCheck_; 1757 } 1758 1759 void SetOptionsForTargetCompilation(); 1760 1761 void BindCPUCoreForTargetCompilation(); 1762 SetCompilerPipelineHostAOT(bool value)1763 void SetCompilerPipelineHostAOT(bool value) 1764 { 1765 compilerPipelineHostAOT_ = value; 1766 } 1767 IsCompilerPipelineHostAOT()1768 bool IsCompilerPipelineHostAOT() const 1769 { 1770 return compilerPipelineHostAOT_; 1771 } 1772 SetFastAOTCompileMode(bool value)1773 void SetFastAOTCompileMode(bool value) 1774 { 1775 fastAOTCompileMode_ = value; 1776 } 1777 GetFastAOTCompileMode()1778 bool GetFastAOTCompileMode() const 1779 { 1780 return fastAOTCompileMode_; 1781 } 1782 SetEnableOptLoopPeeling(bool value)1783 void SetEnableOptLoopPeeling(bool value) 1784 { 1785 enableOptLoopPeeling_ = value; 1786 } 1787 IsEnableOptLoopPeeling()1788 bool IsEnableOptLoopPeeling() const 1789 { 1790 return enableOptLoopPeeling_; 1791 } 1792 SetEnableOptLoopInvariantCodeMotion(bool value)1793 void SetEnableOptLoopInvariantCodeMotion(bool value) 1794 { 1795 enableOptLoopInvariantCodeMotion_ = value; 1796 } 1797 IsEnableOptLoopInvariantCodeMotion()1798 bool IsEnableOptLoopInvariantCodeMotion() const 1799 { 1800 return enableOptLoopInvariantCodeMotion_; 1801 } 1802 IsEnableOptConstantFolding()1803 bool IsEnableOptConstantFolding() const 1804 { 1805 return enableOptConstantFolding_; 1806 } 1807 SetEnableOptConstantFolding(bool value)1808 void SetEnableOptConstantFolding(bool value) 1809 { 1810 enableOptConstantFolding_ = value; 1811 } 1812 SetEnableOptOnHeapCheck(bool value)1813 void SetEnableOptOnHeapCheck(bool value) 1814 { 1815 enableOptOnHeapCheck_ = value; 1816 } 1817 IsEnableOptOnHeapCheck()1818 bool IsEnableOptOnHeapCheck() const 1819 { 1820 return enableOptOnHeapCheck_; 1821 } 1822 IsEnableLexenvSpecialization()1823 bool IsEnableLexenvSpecialization() const 1824 { 1825 return enableLexenvSpecialization_; 1826 } 1827 SetEnableLexenvSpecialization(bool value)1828 void SetEnableLexenvSpecialization(bool value) 1829 { 1830 enableLexenvSpecialization_ = value; 1831 } 1832 IsEnableNativeInline()1833 bool IsEnableNativeInline() const 1834 { 1835 return enableNativeInline_; 1836 } 1837 SetEnableNativeInline(bool value)1838 void SetEnableNativeInline(bool value) 1839 { 1840 enableNativeInline_ = value; 1841 } 1842 IsEnableLoweringBuiltin()1843 bool IsEnableLoweringBuiltin() const 1844 { 1845 return enableLoweringBuiltin_; 1846 } 1847 SetEnableLoweringBuiltin(bool value)1848 void SetEnableLoweringBuiltin(bool value) 1849 { 1850 enableLoweringBuiltin_ = value; 1851 } 1852 SetCompilerEnableLiteCG(bool value)1853 void SetCompilerEnableLiteCG(bool value) 1854 { 1855 enableLiteCG_ = value; 1856 } 1857 IsCompilerEnableLiteCG()1858 bool IsCompilerEnableLiteCG() const 1859 { 1860 return enableLiteCG_; 1861 } 1862 SetTypedOpProfiler(bool value)1863 void SetTypedOpProfiler(bool value) 1864 { 1865 enableTypedOpProfiler_ = value; 1866 } 1867 GetTypedOpProfiler()1868 bool GetTypedOpProfiler() const 1869 { 1870 return enableTypedOpProfiler_; 1871 } 1872 IsEnableBranchProfiling()1873 bool IsEnableBranchProfiling() const 1874 { 1875 return enableBranchProfiling_; 1876 } 1877 SetEnableBranchProfiling(bool value)1878 void SetEnableBranchProfiling(bool value) 1879 { 1880 enableBranchProfiling_ = value; 1881 } 1882 SetTestAssert(bool value)1883 void SetTestAssert(bool value) 1884 { 1885 testAssert_ = value; 1886 } 1887 GetTestAssert()1888 bool GetTestAssert() const 1889 { 1890 return testAssert_; 1891 } 1892 SetCompilerMethodsRange(arg_list_t * argListStr)1893 void SetCompilerMethodsRange(arg_list_t* argListStr) 1894 { 1895 compileMethodsRange_.first = std::stoull((*argListStr)[0]); 1896 compileMethodsRange_.second = std::stoull((*argListStr)[1]); 1897 } 1898 GetCompilerMethodsRange()1899 const std::pair<uint32_t, uint32_t>& GetCompilerMethodsRange() const 1900 { 1901 return compileMethodsRange_; 1902 } 1903 SetCompilerCodegenOptions(arg_list_t argListStr)1904 void SetCompilerCodegenOptions(arg_list_t argListStr) 1905 { 1906 compileCodegenOption_ = std::move(argListStr); 1907 } 1908 GetCompilerCodegenOptions()1909 const arg_list_t& GetCompilerCodegenOptions() const 1910 { 1911 return compileCodegenOption_; 1912 } 1913 SetOptCodeRange(std::string value)1914 void SetOptCodeRange(std::string value) 1915 { 1916 optBCRange_ = std::move(value); 1917 } 1918 GetOptCodeRange()1919 std::string GetOptCodeRange() const 1920 { 1921 return optBCRange_; 1922 } 1923 SetEnableEscapeAnalysis(bool value)1924 void SetEnableEscapeAnalysis(bool value) 1925 { 1926 enableEscapeAnalysis_ = value; 1927 } 1928 IsEnableEscapeAnalysis()1929 bool IsEnableEscapeAnalysis() const 1930 { 1931 return enableEscapeAnalysis_; 1932 } 1933 SetEnableTraceEscapeAnalysis(bool value)1934 void SetEnableTraceEscapeAnalysis(bool value) 1935 { 1936 traceEscapeAnalysis_ = value; 1937 } 1938 GetTraceEscapeAnalysis()1939 bool GetTraceEscapeAnalysis() const 1940 { 1941 return traceEscapeAnalysis_; 1942 } 1943 SetEnableInductionVariableAnalysis(bool value)1944 void SetEnableInductionVariableAnalysis(bool value) 1945 { 1946 enableInductionVariableAnalysis_ = value; 1947 } 1948 IsEnableInductionVariableAnalysis()1949 bool IsEnableInductionVariableAnalysis() const 1950 { 1951 return enableInductionVariableAnalysis_; 1952 } 1953 SetEnableTraceInductionVariableAnalysis(bool value)1954 void SetEnableTraceInductionVariableAnalysis(bool value) 1955 { 1956 traceInductionVariableAnalysis_ = value; 1957 } 1958 GetTraceInductionVariableAnalysis()1959 bool GetTraceInductionVariableAnalysis() const 1960 { 1961 return traceInductionVariableAnalysis_; 1962 } 1963 SetEnableMemoryAnalysis(bool value)1964 void SetEnableMemoryAnalysis(bool value) 1965 { 1966 enableMemoryAnalysis_ = value; 1967 } 1968 IsEnableMemoryAnalysis()1969 bool IsEnableMemoryAnalysis() const 1970 { 1971 return enableMemoryAnalysis_; 1972 } 1973 SetEnableJITPGO(bool value)1974 void SetEnableJITPGO(bool value) 1975 { 1976 enableJITPGO_ = value; 1977 } 1978 IsEnableJITPGO()1979 bool IsEnableJITPGO() const 1980 { 1981 return enableJITPGO_; 1982 } 1983 SetEnableProfileDump(bool value)1984 void SetEnableProfileDump(bool value) 1985 { 1986 enableProfileDump_ = value; 1987 } 1988 IsEnableProfileDump()1989 bool IsEnableProfileDump() const 1990 { 1991 return enableProfileDump_; 1992 } 1993 SetEnableAOTPGO(bool value)1994 void SetEnableAOTPGO(bool value) 1995 { 1996 enableAOTPGO_ = value; 1997 } 1998 IsEnableAOTPGO()1999 bool IsEnableAOTPGO() const 2000 { 2001 return enableAOTPGO_; 2002 } 2003 SetCheckPgoVersion(bool value)2004 void SetCheckPgoVersion(bool value) 2005 { 2006 checkPgoVersion_ = value; 2007 } 2008 IsCheckPgoVersion()2009 bool IsCheckPgoVersion() const 2010 { 2011 return checkPgoVersion_; 2012 } 2013 SetEnableJitFastCompile(bool value)2014 void SetEnableJitFastCompile(bool value) 2015 { 2016 enableJitFastCompile_ = value; 2017 } 2018 IsEnableJitFastCompile()2019 bool IsEnableJitFastCompile() const 2020 { 2021 return enableJitFastCompile_; 2022 } 2023 SetEnableMegaIC(bool value)2024 void SetEnableMegaIC(bool value) 2025 { 2026 enableMegaIC_ = value; 2027 isMegaICInitialized = true; 2028 } 2029 IsEnableMegaIC()2030 bool IsEnableMegaIC() const 2031 { 2032 return enableMegaIC_ && IsEnableJIT(); 2033 } 2034 IsMegaICInitialized()2035 bool IsMegaICInitialized() const 2036 { 2037 return isMegaICInitialized; 2038 } 2039 SetEnableFrameworkAOT(bool value)2040 void SetEnableFrameworkAOT(bool value) 2041 { 2042 enableFrameworkAOT_ = value; 2043 } 2044 IsEnableFrameworkAOT()2045 bool IsEnableFrameworkAOT() const 2046 { 2047 return enableFrameworkAOT_; 2048 } 2049 SetAsyncLoadAbc(bool value)2050 void SetAsyncLoadAbc(bool value) 2051 { 2052 asyncLoadAbc_ = value; 2053 } 2054 IsAsyncLoadAbc()2055 bool IsAsyncLoadAbc() const 2056 { 2057 return asyncLoadAbc_; 2058 } 2059 SetAsyncLoadAbcTest(bool value)2060 void SetAsyncLoadAbcTest(bool value) 2061 { 2062 asyncLoadAbcTest_ = value; 2063 } 2064 IsAsyncLoadAbcTest()2065 bool IsAsyncLoadAbcTest() const 2066 { 2067 return asyncLoadAbcTest_; 2068 } 2069 IsPgoForceDump()2070 bool IsPgoForceDump() const 2071 { 2072 return forceDump_; 2073 } 2074 SetPgoForceDump(bool value)2075 void SetPgoForceDump(bool value) 2076 { 2077 forceDump_ = value; 2078 } 2079 SetConcurrentCompile(bool value)2080 void SetConcurrentCompile(bool value) 2081 { 2082 concurrentCompile = value; 2083 } 2084 IsConcurrentCompile()2085 bool IsConcurrentCompile() const 2086 { 2087 return concurrentCompile; 2088 } 2089 SetStoreBarrierOpt(bool value)2090 void SetStoreBarrierOpt(bool value) 2091 { 2092 storeBarrierOpt_ = value; 2093 } 2094 IsStoreBarrierOpt()2095 bool IsStoreBarrierOpt() const 2096 { 2097 return storeBarrierOpt_; 2098 } 2099 SetLdObjValueOpt(bool value)2100 void SetLdObjValueOpt(bool value) 2101 { 2102 enableLdObjValueOpt_ = value; 2103 } 2104 IsLdObjValueOpt()2105 bool IsLdObjValueOpt() const 2106 { 2107 return enableLdObjValueOpt_; 2108 } 2109 SetEnableCMCGC(bool value)2110 void SetEnableCMCGC(bool value) 2111 { 2112 enableCMCGC_ = value; 2113 } 2114 IsEnableCMCGC()2115 bool IsEnableCMCGC() const 2116 { 2117 return enableCMCGC_; 2118 } 2119 SetEnableCMCGCConcurrentRootMarking(bool value)2120 void SetEnableCMCGCConcurrentRootMarking(bool value) 2121 { 2122 enableCMCGCConcurrentRootMarking_ = value; 2123 } 2124 IsEnableCMCGCConcurrentRootMarking()2125 bool IsEnableCMCGCConcurrentRootMarking() const 2126 { 2127 return enableCMCGCConcurrentRootMarking_; 2128 } 2129 SetAOTHasException(bool value)2130 void SetAOTHasException(bool value) 2131 { 2132 aotHasException_ = value; 2133 } 2134 GetAOTHasException()2135 bool GetAOTHasException() const 2136 { 2137 return aotHasException_; 2138 } 2139 SetCompilerEnablePgoSpace(bool value)2140 void SetCompilerEnablePgoSpace(bool value) 2141 { 2142 enablePgoSpace_ = value; 2143 } 2144 IsCompilerEnablePgoSpace()2145 bool IsCompilerEnablePgoSpace() const 2146 { 2147 return enablePgoSpace_; 2148 } 2149 SetEnableAotCodeComment(bool value)2150 void SetEnableAotCodeComment(bool value) 2151 { 2152 enableAotCodeComment_ = value; 2153 } 2154 IsEnableAotCodeComment()2155 bool IsEnableAotCodeComment() const 2156 { 2157 return enableAotCodeComment_; 2158 } 2159 SetEnableInlinePropertyOptimization(bool value)2160 void SetEnableInlinePropertyOptimization(bool value) 2161 { 2162 enableInlinePropertyOptimization_ = value; 2163 } 2164 IsEnableInlinePropertyOptimization()2165 bool IsEnableInlinePropertyOptimization() const 2166 { 2167 return enableInlinePropertyOptimization_; 2168 } 2169 SetEnableJitVerifyPass(bool value)2170 void SetEnableJitVerifyPass(bool value) 2171 { 2172 enableJitVerifyPass_ = value; 2173 } 2174 IsEnableJitVerifyPass()2175 bool IsEnableJitVerifyPass() const 2176 { 2177 return enableJitVerifyPass_; 2178 } 2179 SetCompilerAnFileMaxByteSize(uint64_t value)2180 void SetCompilerAnFileMaxByteSize(uint64_t value) 2181 { 2182 CompilerAnFileMaxByteSize_ = value; 2183 } 2184 GetCompilerAnFileMaxByteSize()2185 uint64_t GetCompilerAnFileMaxByteSize() const 2186 { 2187 return CompilerAnFileMaxByteSize_; 2188 } 2189 SetCMCMaxGarbageCacheSize(uint64_t value)2190 void SetCMCMaxGarbageCacheSize(uint64_t value) 2191 { 2192 cmcMaxGarbageCacheSize_ = value; 2193 } 2194 GetCMCMaxGarbageCacheSize()2195 uint64_t GetCMCMaxGarbageCacheSize() const 2196 { 2197 return cmcMaxGarbageCacheSize_; 2198 } 2199 IsCompilerAnFileMaxByteSizeDefault()2200 bool IsCompilerAnFileMaxByteSizeDefault() const 2201 { 2202 return CompilerAnFileMaxByteSize_ == 0; 2203 } 2204 SetJitMethodDichotomy(std::string jitMethodDichotomy)2205 void SetJitMethodDichotomy(std::string jitMethodDichotomy) 2206 { 2207 jitMethodDichotomy_ = jitMethodDichotomy; 2208 } 2209 GetJitMethodDichotomy()2210 std::string GetJitMethodDichotomy() const 2211 { 2212 return jitMethodDichotomy_; 2213 } 2214 IsEnableJitMethodCollect()2215 bool IsEnableJitMethodCollect() const 2216 { 2217 return jitMethodDichotomy_ == "collect"; 2218 } 2219 IsEnableJitMethodFilter()2220 bool IsEnableJitMethodFilter() const 2221 { 2222 return jitMethodDichotomy_ == "filter"; 2223 } 2224 SetJitMethodPath(std::string jitMethodPath)2225 void SetJitMethodPath(std::string jitMethodPath) 2226 { 2227 jitMethodPath_ = jitMethodPath; 2228 } 2229 GetJitMethodPath()2230 std::string GetJitMethodPath() const 2231 { 2232 return jitMethodPath_; 2233 } 2234 SetEnableMergePoly(bool value)2235 void SetEnableMergePoly(bool value) 2236 { 2237 enableMergePoly_ = value; 2238 } 2239 IsEnableMergePoly()2240 bool IsEnableMergePoly() const 2241 { 2242 return enableMergePoly_; 2243 } 2244 SetMultiContext(bool value)2245 void SetMultiContext(bool value) 2246 { 2247 multiContext_ = value; 2248 } 2249 IsMultiContext()2250 bool IsMultiContext() const 2251 { 2252 return multiContext_; 2253 } 2254 SetDisableModuleSnapshot(bool isdisable)2255 void SetDisableModuleSnapshot(bool isdisable) 2256 { 2257 disableModuleSnapshot_ = isdisable; 2258 } 2259 DisableModuleSnapshot()2260 bool DisableModuleSnapshot() const 2261 { 2262 return disableModuleSnapshot_; 2263 } 2264 DisableGCTimeoutCheck()2265 void DisableGCTimeoutCheck() 2266 { 2267 enableGCTimeoutCheck_ = false; 2268 } 2269 IsEnableGCTimeoutCheck()2270 bool IsEnableGCTimeoutCheck() const 2271 { 2272 return enableGCTimeoutCheck_; 2273 } 2274 2275 static bool ParseBool(const std::string &arg, bool* argBool); 2276 static bool ParseInt(const std::string &arg, int* argInt); 2277 static bool ParseUint32(const std::string &arg, uint32_t* argUInt32); 2278 static bool ParseUint64(const std::string &arg, uint64_t* argUInt64); 2279 static bool ParseDouble(const std::string &arg, double* argDouble); 2280 2281 public: 2282 static constexpr int32_t MAX_APP_COMPILE_METHOD_SIZE = 4_KB; 2283 2284 private: 2285 void ParseRuntimeParam(const std::string &str); 2286 StartsWith(const std::string & haystack,const std::string & needle)2287 static bool StartsWith(const std::string& haystack, const std::string& needle) 2288 { 2289 return std::equal(needle.begin(), needle.end(), haystack.begin()); 2290 } 2291 SetOption(int option)2292 void SetOption(int option) 2293 { 2294 int index = option / BIT_COUNT; 2295 ASSERT(index >= 0 && index < SPLIT_COUNT); 2296 wasSet_[index] |= (1ULL << static_cast<uint64_t>(option % BIT_COUNT)); 2297 } 2298 WasOptionSet(int option)2299 bool WasOptionSet(int option) const 2300 { 2301 int index = option / BIT_COUNT; 2302 ASSERT(index >= 0 && index < SPLIT_COUNT); 2303 return wasSet_[index] & (1ULL << static_cast<uint64_t>(option % BIT_COUNT)); 2304 } 2305 StringToInt64(const std::string & str,int64_t & value)2306 bool StringToInt64(const std::string& str, int64_t& value) 2307 { 2308 if (str.empty()) { 2309 return false; 2310 } 2311 2312 char *end; 2313 errno = 0; 2314 value = std::strtoll(str.c_str(), &end, 0); // Automatic check of the number system 2315 2316 // If no number is converted 2317 if (end == str.c_str()) { 2318 return false; 2319 } 2320 // If there is a range error (too large or to small) 2321 if (errno == ERANGE && (value == LLONG_MAX || value == LLONG_MIN)) { 2322 return false; 2323 } 2324 // If the character string contains non-digit chaaracters 2325 if (*end != '\0') { 2326 return false; 2327 } 2328 2329 return true; 2330 } 2331 GetLogComponentFromString(const std::vector<std::string> & components)2332 static ComponentMark GetLogComponentFromString(const std::vector<std::string>& components) 2333 { 2334 ComponentMark componentMark = static_cast<ComponentMark>(Component::NONE); 2335 for (const auto &component : components) { 2336 if (component == "all") { 2337 componentMark = static_cast<ComponentMark>(Component::ALL); 2338 return componentMark; 2339 } 2340 if (component == "gc") { 2341 componentMark |= static_cast<ComponentMark>(Component::GC); 2342 continue; 2343 } 2344 if (component == "ecmascript") { 2345 componentMark |= static_cast<ComponentMark>(Component::ECMASCRIPT); 2346 continue; 2347 } 2348 if (component == "pgo") { 2349 componentMark |= static_cast<ComponentMark>(Component::PGO); 2350 continue; 2351 } 2352 if (component == "interpreter") { 2353 componentMark |= static_cast<ComponentMark>(Component::INTERPRETER); 2354 continue; 2355 } 2356 if (component == "debugger") { 2357 componentMark |= static_cast<ComponentMark>(Component::DEBUGGER); 2358 continue; 2359 } 2360 if (component == "compiler") { 2361 componentMark |= static_cast<ComponentMark>(Component::COMPILER); 2362 continue; 2363 } 2364 if (component == "builtins") { 2365 componentMark |= static_cast<ComponentMark>(Component::BUILTINS); 2366 continue; 2367 } 2368 if (component == "jit") { 2369 componentMark |= static_cast<ComponentMark>(Component::JIT); 2370 continue; 2371 } 2372 if (component == "baselinejit") { 2373 componentMark |= static_cast<ComponentMark>(Component::BASELINEJIT); 2374 continue; 2375 } 2376 if (component == "trace") { 2377 componentMark |= static_cast<ComponentMark>(Component::TRACE); 2378 continue; 2379 } 2380 if (component == "sa") { 2381 componentMark |= static_cast<ComponentMark>(Component::SA); 2382 continue; 2383 } 2384 } 2385 return componentMark; 2386 } 2387 GetLogLevelFromString(const std::string & level)2388 static Level GetLogLevelFromString(const std::string& level) 2389 { 2390 if (level == "fatal") { 2391 return Level::FATAL; 2392 } 2393 if (level == "error") { 2394 return Level::ERROR; 2395 } 2396 if (level == "warning") { 2397 return Level::WARN; 2398 } 2399 if (level == "info") { 2400 return Level::INFO; 2401 } 2402 if (level == "debug") { 2403 return Level::DEBUG; 2404 } 2405 if (level == "verbose") { 2406 return Level::VERBOSE; 2407 } 2408 return Level::DEBUG; 2409 } 2410 2411 bool ParseBoolParam(bool* argBool); 2412 bool ParseDoubleParam(const std::string& option, double* argDouble); 2413 bool ParseIntParam(const std::string& option, int* argInt); 2414 bool ParseUint32Param(const std::string& option, uint32_t* argUInt32); 2415 bool ParseUint64Param(const std::string& option, uint64_t* argUInt64); 2416 void ParseListArgParam(const std::string& option, arg_list_t* argListStr, std::string delimiter); 2417 2418 static constexpr int BIT_COUNT = static_cast<int>(base::BitNumbers<uint64_t>()); 2419 static constexpr int SPLIT_COUNT = static_cast<int>(OPTION_LAST) / BIT_COUNT + 1; 2420 uint64_t wasSet_[SPLIT_COUNT] = {0}; 2421 2422 bool enableArkTools_ {true}; 2423 bool openArkTools_ {false}; 2424 std::string stubFile_ {"stub.an"}; 2425 std::string compilerPkgInfo_ {}; 2426 std::string compilerExternalPkgInfo_ {}; 2427 bool compilerEnableExternalPkg_ {true}; 2428 bool enableForceGc_ {true}; 2429 bool enableLoadingStubsLog_ {false}; 2430 bool forceFullGc_ {true}; 2431 bool enableHeapVerify_ {true}; 2432 uint32_t forceSharedGc_ {1}; 2433 int32_t deviceThermalLevel_ {0}; 2434 int arkProperties_ = GetDefaultProperties(); 2435 std::string arkBundleName_ = {""}; 2436 std::set<CString> traceBundleName_ = {}; 2437 uint32_t gcThreadNum_ {7}; // 7: default thread num 2438 uint32_t longPauseTime_ {40}; // 40: default pause time 2439 std::string aotOutputFile_ {""}; 2440 std::string targetTriple_ {TARGET_X64}; 2441 uint32_t asmOptLevel_ {2}; 2442 uint32_t relocationMode_ {2}; // 2: default relocation mode 2443 uint32_t maxNonmovableSpaceCapacity_ {4_MB}; 2444 bool enableAsmInterpreter_ {true}; 2445 bool enableBuiltinsLazy_ {true}; 2446 std::string asmOpcodeDisableRange_ {""}; 2447 AsmInterParsedOption asmInterParsedOption_; 2448 uint64_t serializerBufferSizeLimit_ {2_GB}; 2449 bool enableIC_ {true}; 2450 std::string icuDataPath_ {"default"}; 2451 bool startupTime_ {false}; 2452 std::string compilerLogOpt_ {"none"}; 2453 std::string compilerLogMethods_ {"none"}; 2454 bool compilerLogSnapshot_ {false}; 2455 bool compilerLogTime_ {false}; 2456 bool enableRuntimeStat_ {false}; 2457 bool isWorker_ {false}; 2458 bool isRestrictedWorker_ {false}; 2459 bool traceBc_ {false}; 2460 std::string logLevel_ {"error"}; 2461 arg_list_t logDebug_ {{"all"}}; 2462 arg_list_t logInfo_ {{"all"}}; 2463 arg_list_t logWarning_ {{"all"}}; 2464 arg_list_t logError_ {{"all"}}; 2465 arg_list_t logFatal_ {{"all"}}; 2466 arg_list_t logComponents_ {{"all"}}; 2467 bool enableAOT_ {false}; 2468 uint32_t maxAotMethodSize_ {32_KB}; 2469 double typeThreshold_ {-1}; 2470 std::string entryPoint_ {"_GLOBAL::func_main_0"}; 2471 bool mergeAbc_ {false}; 2472 bool enableArrayBoundsCheckElimination_ {false}; 2473 bool enableFrameStateElimination_ {true}; 2474 bool enableTypeLowering_ {true}; 2475 bool enableEarlyElimination_ {true}; 2476 bool enableLaterElimination_ {true}; 2477 bool enableValueNumbering_ {true}; 2478 bool enableOptString_ {true}; 2479 bool enableMutantArray_ {false}; 2480 #if ENABLE_NEXT_OPTIMIZATION 2481 bool enableElementsKind_ {false}; 2482 #else 2483 bool enableElementsKind_ {false}; 2484 #endif 2485 bool enableInstrcutionCombine {true}; 2486 bool enableNewValueNumbering_ {true}; 2487 bool enableOptInlining_ {true}; 2488 bool enableAotLazyDeopt_ {false}; 2489 bool enableJitLazyDeopt_ {true}; 2490 bool enableLazyDeoptTrace_{false}; 2491 bool enableOptPGOType_ {true}; 2492 bool enableFastJIT_ {false}; 2493 bool enableDFXHiSysEvent_ {true}; 2494 bool enableAPPJIT_ {false}; 2495 bool isEnableJitDfxDump_ {false}; 2496 bool enableOSR_ {false}; 2497 uint16_t jitHotnessThreshold_ {2}; 2498 uint16_t jitCallThreshold_ {1}; 2499 uint16_t osrHotnessThreshold_ {2}; 2500 bool forceJitCompileMain_ {false}; 2501 bool enableBaselineJIT_ {false}; 2502 uint16_t baselineJitHotnessThreshold_ {1}; 2503 bool forceBaselineCompileMain_ {false}; 2504 bool enableOptTrackField_ {true}; 2505 uint32_t compilerModuleMethods_ {100}; 2506 bool enableContext_ {false}; 2507 bool enablePrintExecuteTime_ {false}; 2508 bool enablePGOProfiler_ {false}; 2509 bool enableJITPGO_ {true}; 2510 bool enableAOTPGO_ {true}; 2511 bool enableProfileDump_ {true}; 2512 bool enableFrameworkAOT_ {false}; 2513 uint32_t pgoHotnessThreshold_ {1}; 2514 std::string pgoProfilerPath_ {""}; 2515 uint32_t pgoSaveMinInterval_ {30}; 2516 bool traceDeopt_ {false}; 2517 uint8_t deoptThreshold_ {10}; 2518 bool stressDeopt_ {false}; 2519 bool deviceIsScreenOff_ {true}; 2520 bool optCodeProfiler_ {false}; 2521 bool startGlobalLeakCheck_ {false}; 2522 bool verifyVTable_ {false}; 2523 std::string compilerSelectMethods_ {""}; 2524 std::string compilerSkipMethods_ {""}; 2525 bool pgoTrace_ {false}; 2526 bool traceInline_ {false}; 2527 bool traceBuiltins_ {false}; 2528 bool traceJIT_ {false}; 2529 bool traceValueNumbering_ {false}; 2530 bool traceInstructionCombine_ {false}; 2531 bool compilerPipelineHostAOT_ {false}; 2532 size_t maxInlineBytecodes_ {45}; 2533 std::string targetCompilerMode_ {""}; 2534 std::string frameworkAbcPath_ {""}; 2535 std::string hapPath_ {""}; 2536 uint32_t hapAbcOffset_ {0}; 2537 uint32_t hapAbcSize_ {0}; 2538 std::string optBCRange_ {""}; 2539 bool compilerNoCheck_ {false}; 2540 bool fastAOTCompileMode_ {false}; 2541 bool enableOptLoopPeeling_ {true}; 2542 bool enableOptConstantFolding_ {true}; 2543 bool enableOptOnHeapCheck_ {true}; 2544 bool enableOptLoopInvariantCodeMotion_ {false}; 2545 bool enableLexenvSpecialization_ {false}; 2546 bool enableNativeInline_ {true}; 2547 bool enableLoweringBuiltin_ {true}; 2548 bool enableLiteCG_ {false}; 2549 bool enableTypedOpProfiler_ {false}; 2550 bool enableBranchProfiling_ {true}; 2551 bool enablePgoSpace_ {false}; 2552 bool enableAotCodeComment_ {false}; 2553 bool testAssert_ {false}; 2554 std::pair<uint32_t, uint32_t> compileMethodsRange_ {0, UINT32_MAX}; 2555 arg_list_t compileCodegenOption_ {{""}}; 2556 bool enableEscapeAnalysis_ {false}; 2557 bool traceEscapeAnalysis_ {false}; 2558 bool enableInductionVariableAnalysis_ {false}; 2559 bool traceInductionVariableAnalysis_ {false}; 2560 bool enableMemoryAnalysis_ {true}; 2561 bool checkPgoVersion_ {false}; 2562 bool enableJitFastCompile_ {false}; 2563 bool enableJitFrame_ {false}; 2564 bool enableMegaIC_ {false}; 2565 bool isMegaICInitialized {false}; 2566 bool disableCodeSign_ {true}; 2567 bool enableJitFort_ {true}; 2568 bool enableAsyncCopyToFort_ {true}; 2569 bool enableBaselinePgo_ {false}; 2570 bool enableLargeHeap_ {false}; 2571 bool asyncLoadAbc_ {true}; 2572 bool asyncLoadAbcTest_ {false}; 2573 bool forceDump_ {true}; 2574 bool concurrentCompile {true}; 2575 bool aotHasException_ {false}; 2576 bool enableInlinePropertyOptimization_ {NEXT_OPTIMIZATION_BOOL}; 2577 bool enableLdObjValueOpt_ {true}; 2578 #ifdef USE_CMC_GC 2579 bool enableCMCGC_ {true}; 2580 #else 2581 bool enableCMCGC_ {false}; 2582 #endif 2583 bool enableCMCGCConcurrentRootMarking_ {true}; 2584 bool storeBarrierOpt_ {true}; 2585 uint64_t CompilerAnFileMaxByteSize_ {0_MB}; 2586 uint64_t cmcMaxGarbageCacheSize_ {16_MB}; 2587 bool enableJitVerifyPass_ {true}; 2588 bool enableMergePoly_ {true}; 2589 bool multiContext_ {false}; 2590 std::string jitMethodDichotomy_ {"disable"}; 2591 std::string jitMethodPath_ {"method_compiled_by_jit.cfg"}; 2592 size_t heapSize_ = {0}; 2593 common::RuntimeParam param_; 2594 bool enableWarmStartupSmartGC_ {false}; 2595 bool disableModuleSnapshot_ { false }; 2596 bool enableGCTimeoutCheck_ {true}; 2597 }; 2598 } // namespace panda::ecmascript 2599 2600 #endif // ECMASCRIPT_JS_RUNTIME_OPTIONS_H_ 2601