mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-08 08:54:12 +00:00
e68673a13f
add baseline builtins Change-Id: Ib8d7c392c62e21eab19b17e45c0fafb499cbbed9 support running baseline compiler by option --compiler-force-baseline-compile-main=true Change-Id: I7c7337faf9fad39ccffb2de28d46403e2f6cb22b baseline jit part3 Change-Id: I36e8dd6a6fa6fffb738029a8620bbcd01df1e017 baseline part4 Change-Id: Ib45bcf7255a85aa48f864a6021adf819927e6a13 baseline part5 move baseline into compiler folder Change-Id: Ia8781c95ae00c4f300e7267a6da0078b5d04e4c8 !185 support BaselinePrologue * support BaselinePrologue part3 * support BaselinePrologue part2 * support BaselinePrologue !187 [BaselineJit] support load baseline builtins * [BaselineJit]support load baseline builtins !186[BaselineJIT] workaround for baselinejit support install code * install code part3 * install code part2 * baseline jit support intall code !188 [BaselineJit] support CallBuiltin * [BaselineJit] baseline support CallBuiltin !189 [BaselineJIT]implement StackOffset class * [BaselineJIT]implement StackOffset class !190 [BaselineJIT]refactor BaselineAssembler and MacroAssembler * [BaselineJIT]refactor BaselineAssembler and MacroAssembler !191 [BaselineJIT] refactor class BaselineCompiler * [BaselineJIT] refactor class BaselineCompiler !192 [BaselineJIT] callbuiltin support new parameter type new parameter type: int32_t,SpecialParameter,VirtualRegister !193 [BaselineJIT]modify BaselineLoadObjByName function * [BaselineJIT]modify BaselineLoadObjByName function !194 [BaselineJIT] support new builtins * [BaselineJIT] add BaselineTryLdGLobalByNameImm8ID16, BaselineStToGlobalRecordImm16ID16, BaselineLdaStrID16 !196 [BaselineJIT]bugfix for BaselinePrologue, align the rsp * [BaselineJIT]bugfix for BaselinePrologue, align the rsp !197 [BaselineJIT]bugfix for StackOffsetDescriptor * [BaselineJIT]bugfix for StackOffsetDescriptor !198 [BaselineJIT]workaround for helloworld testcase, helloworld can run successfully * workaround for helloworld testcase, helloworld can run successfully !200 [BaselineJIT]adapt profile collection * [BaselineJIT]adapt profile collection !201 [BaselineJIT]refactor baseline jit * [BaselineJIT]refactor baseline jit !203 [BaselineJIT]support trigger BaselineJITCompile and call baselinecode async * [BaselineJIT]support trigger BaselineJITCompile and call baselinecode async !202 [BaselineJIT]enable update hotness * [BaselineJIT]enable update hotness !205 [BaselineJIT]adapt JSCallDispatch interface * [BaselineJIT]adapt JSCallDispatch interface Change-Id: I4efce4346f985c7e074d7fc4bbfe3b081272e950 !195 [Baseline JIT] bytecode to builtin funs * !206 enable bytecode builtins and call CHECK_PENDING_EXCEPTION * [Baseline JIT] builtins:StobjbynameImm9Id16V8,StobjbynameImm16Id16V8,S… * [Baseline JIT] builtins:CopyrestargsImm8,LdlexvarImm4Imm4,StlexvarImm4… * [Baseline JIT] builtins: LdsuperbyvalueImm8V8,LdsuperbyvalueImm16V8,St… * [Baseline JIT] builtins: DelobjpropV8,AsyncfunctionawaituncaughtV8,Cop… * !204 enable bytecode builtins * [Baseline JIT] builtins: DefineclasswithbufferImm8Id16Id16Imm16V8,Defi… * [Baseline JIT] builtins: LdthisbynameImm8Id16,Definegettersetterbyval… * [Baseline JIT] builtins: Callarg0Imm8,SupercallspreadImm8V8,ApplyImm8V… * !199 enable bytecode builtin func * [Baseline JIT] builtins: StrictnoteqImm8V8,StricteqImm8V8,Istrue,Isfal… * [Baseline JIT] builtins: NegImm8,NotImm8,IncImm8,DecImm8,IsinImm8V8,In… * [Baseline JIT] builtins: And2Imm8V8,Or2Imm8V8,Xor2Imm8V8,ExpImm8V8,Typ… * [Baseline JIT] builtins:LessImm8V8,LesseqImm8V8,GreaterImm8V8,Greatere… * [Baseline JIT] builtins:Add2Imm8V8,SUB2_IMM8_V8,MUL2_IMM8_V8,DIV2_IMM8… * [Baseline JIT] builtins:CreateobjectwithbufferImm8Id16,Createobjectwit… * [Baseline JIT]builtins:Createemptyobject,CreateemptyarrayImm8,Createem… * [Baseline JIT] builtins:GetiteratorImm16,Asyncfunctionenter,Createasyn… * [Baseline JIT] builtins:ldsymbol,ldglobal,Poplexenv,Getunmappedargs,Ge… * [BaselineJIT] builtins: add base class !209 handle opcode in baseline compiler * handle opcode in baseline compiler !210 [baseline jit]: add baseline stub call signature target kind info * [baseline jit]: add baseline stub call signature target kind info !212 [BaselineJIT]baseline builtin bugfix * [BaselineJIT]baseline builtin bugfix !207 [BaselineJIT]support BaselineBuiltinFrame * [BaselineJIT]support BaselineBuiltinFrame !214 [BaselineJIT]baseline builtin bugfix of using JSCallDispatch * [BaselineJIT]baseline builtin bugfix JSCallDispatch Change-Id: Id67b991df5dee753a38c284234d15b02f0d8a091 !215 [BaselineJIT]bugfix for StackOffsetDescriptor * [BaselineJIT]bugfix for StackOffsetDescriptor !216 [baseline jit]update bytecode builtins * [baseline jit]update bytecode builtins !213 [BaselineJIT]support BaselineReturn and BaselineReturnundefined * [BaselineJIT]support BaselineReturn and BaselineReturnundefined !218 [BaselineJIT]baseline builtin * [BaselineJIT]baseline builtin:ldfunction,ldthis,asyncgeneratorresolvev… !217 parse baseline-jit bytecode v1.0 * parse bytecode in baseline-jit !220 [BaselineJIT]baseline refactor ParameterIndex * [BaselineJIT]baseline refactor ParameterIndex !223 [BaselineJIT]get function and method from stack, avoiding method is used after call * [BaselineJIT]get function and method from stack, avoiding method is us… !224 [BaselineJIT]bugfix for compiling x64.release * [BaselineJIT]bugfix for compiling x64.release !226 [BaselineJIT] adapt gc for BASELINE_BUILTIN_FRAME type * [BaselineJIT]adapt gc for BASELINE_BUILTIN_FRAME type !222 [BaselineJIT] parse baseline builtin args * [BaselineJIT] parse baseline builtin args:part 2 * [BaselineJIT] parse baseline builtin args !229 parse baseline-jit bytecode v2.0 * [BaselineJIT] parse bytecode v2.0 !230 [BaselineJIT] remove including undefined_function file * [BaselineJIT] remove including undefined_function file !228 handle byte opcode of jmp v2 * [baseline jit]handle opcode of jmp V2 [BaselineJIT]rebase bugfix Change-Id: I078298849139317dfa89fb139979c1b7d938b344 !231 [BaselineJIT] fix bugs about reading bytecode * [BaselineJIT] fix bugs about read bytecode !232 [BaselineJIT] fix bug about processing arguments in stub * [BaselineJIT] fix bug about processing argument in baseline-stubs !233 handle int64_t type in CallBuiltin * [baseline jit]handle int64_t type in CallBuiltin !234 [BaselineJIT] fix bug for StToGlobalRecordImm16ID16 * [BaselineJIT] fix bug for StToGlobalRecordImm16ID16 !235 [BaselineJIT] fix bugs about args type * [BaselineJIT] fix type of args that passing to builtins !236 [BaselineJIT] do not pass constpool to builtins * [BaselineJIT] do not passing constpool to builtin Change-Id: I8c46d70527a3fedd841d28ac1908a02d4a66edeb !237 [baselineJit]Bugfix for sp used in JSCallDispatch and incorretc type * [baselineJit]Bugfix for sp used in JSCallDispatch and incorretc type Change-Id: I3f42ecd06266a20b2b145cfe98bcbd97a2848bab [BaselineJIT] dump_test bugfix Change-Id: I97d21960ca98cd1a6fc9b1e81b647ff9d8d5d0c2 [BaselineJIT]codecheck fix Change-Id: I93eb02e45b70f4a5bfee84fec0c8e2cdc765d348 code check bugfix part2 Change-Id: I8680dd2c098193705709691fa78e8e6f3ad8cd6c bugfix for review Change-Id: I49b28e109530b9f8b403ba22ba39948e02834021 [BaselineJIT]change file folder Change-Id: I1f46110a804f17270badcff7cdeb2058ca164161 [BaselineJIT]bugfix for review part2 Change-Id: I190406652697f9b17ac6c84dd706262046dbb5f7 !238 [BaselineJIT] fix more than 6 args builtins * [BaselineJIT] fix more than 6 args builtins !239 [BaselineJIT] fix bug in parsing CALLTHISRANGE_IMM8_IMM8_V8 * [BaselineJIT] fix bug in parsing CALLTHISRANGE_IMM8_IMM8_V8 !240 [BaselineJIT] fix bug and add NewobjrangeImm8Imm8V8,NewobjrangeImm16Imm8V8 * [BaselineJIT] fix bug and add NewobjrangeImm8Imm8V8,NewobjrangeImm16Imm8V8 !241 [BaselineJIT] fix bug of ldnan, ldinfinity * [BaselineJIT] fix bug of ldnan, ldinfinity !242 [BaselineJIT] return JSCallDispatch result * [BaselineJIT] return result of JSCallDispatch for baselinecode !245 [BaselineJIT] fix builtins return value * [BaselineJIT] fix builtins return value !244 [BaselineJIT] save result to acc * [BaselineJIT] save result to acc !243 Bugfix for StlexvarImm4Imm4 * [baselineJit]Bugfix for StlexvarImm4Imm4 !246 [BaselineJIT] remove ldfunction * [BaselineJIT] remove ldfunction !248 [BaselineJIT] save result of DEFINECLASSWITHBUFFER_IMM8_ID16_ID16_IMM16_V8 * [BaselineJIT] fix return !247 [baselineJit]Bugfix for Stlexvar and Ldlexvar * [baselineJit]Bugfix for Stlexvar and Ldlexvar !249 [BaselineJIT] Revert "!242[BaselineJIT] return JSCallDispatch result" * Revert "!242 [BaselineJIT] return JSCallDispatch result" !251 Bugfix for BaselineCreateobjectwithexcludedkeysImm8V8V8 * [baselineJit]Bugfix for BaselineCreateobjectwithexcludedkeysImm8V8V8 !252 [baselineJit]Bugfix for notException branch * [baselineJit]Bugfix for notException branch !250 [BaselineJIT] save result to acc in JSCallDispatch for baselinemethodcode * [BaselineJIT] save result of JSCallDispatch to acc for baselinecode !254 [BaselineJIT] fix type bug * [BaselineJIT] fix type bug !255 [BaselineJIT] fix bug of LDAI_IMM32 * [BaselineJIT] fix bug of LDAI_IMM32 !253 Bugfix for Poplexenv * [baselineJit]Bugfix for Poplexenv !256 [BaselineJIT] fix pc & refractor jscalldispatch for baseline-jit * [BaselineJIT] fix pc of baseline-jit & refactor jscalldispatch for baseline-jit !257 [BaselineJIT] replace indirectly jscalldispatch with jscalldispatchforbaseline * [BaselineJIT] replace indirectly jscalldispatch with jscalldispatchforbaseline !258 [BaselineJIT] fix using shl2 builtin bug * [BaselineJIT] fix using shl2 builtin bug !259 Bugfix and enable BaselineIstrue and BaselineIsFalse * [baselineJit]Bugfix and enable BaselineIstrue and BaselineIsFalse !260 [BaselineJIT] fix bug about passing FUNC parameter * [BaselineJIT] fix bug about passing FUNC parameter !261 [BaselineJIT] support passing parameters by stack and fix offset param bug * [BaselineJIT] support passing parameters by stack and fix offset param bug !263 [BaselineJIT] fix parameters bug of LdobjbyvalueImm16V8 & StobjbyvalueImm16V8V8 * [BaselineJIT] fix parameters bug of LdobjbyvalueImm16V8 & StobjbyvalueImm16V8V8 !262 Bugfix for jump offset * [baselineJit]Bugfix for jump offset !264 [BaselineJIT] fix intermediates v8 parameters bug * [BaselineJIT] fix intermediates v8 parameters bug Change-Id: I8bf4fdf7621770a1976925423de23693570365c9 !267 [BaselineJIT] fix bug of BaselineInstanceofImm8V8 * [BaselineJIT] fix bug of BaselineInstanceofImm8V8 !269 [BaselineJIT] support NEWOBJRANGE_IMM16_IMM8_V8 & fix calling DefineMethod runtimeStub * [BaselineJIT] support NEWOBJRANGE_IMM16_IMM8_V8 & fix calling DefineMe… !268 [BaselineJIT]support update hotness * [BaselineJIT]enable update hotness part2 * [BaselineJIT]support update hotness Change-Id: I24b02a9e015df7263b1e9d7210377add0bfc558c CI bugfix Change-Id: I2d5aef07a1f14b3c64585790cff99d64be0d6396 Signed-off-by: w00443755 <wangzhilei2@huawei.com>
1256 lines
58 KiB
C++
1256 lines
58 KiB
C++
/*
|
|
* Copyright (c) 2022 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.
|
|
*/
|
|
|
|
#include "ecmascript/js_runtime_options.h"
|
|
|
|
#include <cerrno>
|
|
#include <cstdlib>
|
|
#include <iostream>
|
|
#include <getopt.h>
|
|
|
|
#include "ecmascript/compiler/aot_file/an_file_data_manager.h"
|
|
#include "ecmascript/mem/mem_common.h"
|
|
#include "ecmascript/compiler/ecma_opcode_des.h"
|
|
|
|
namespace panda::ecmascript {
|
|
const std::string PUBLIC_API COMMON_HELP_HEAD_MSG =
|
|
"Usage: jsvm <option> <filename.abc>\n"
|
|
"\n"
|
|
"Options:\n";
|
|
|
|
const std::string PUBLIC_API COMPILER_HELP_HEAD_MSG =
|
|
"Usage: ark_aot_compiler <option> --aot-file=<filename> <filename.abc>\n"
|
|
"\n"
|
|
"Options:\n";
|
|
|
|
const std::string PUBLIC_API STUB_HELP_HEAD_MSG =
|
|
"Usage: ark_stub_compiler <option>\n"
|
|
"\n"
|
|
"Options:\n";
|
|
|
|
const std::string PUBLIC_API HELP_OPTION_MSG =
|
|
"--aot-file: Path (file suffix not needed) to AOT output file. Default: 'aot_file'\n"
|
|
"--ark-properties: Set ark properties\n"
|
|
"--ark-bundle-name: Set ark bundle name\n"
|
|
"--asm-interpreter: Enable asm interpreter. Default: 'true'\n"
|
|
"--asm-opcode-disable-range: Opcode range when asm interpreter is enabled.\n"
|
|
"--builtins-lazy: Load some builtins function later.This option is only valid in workervm.\n"
|
|
"--compiler-log: Log Option For aot compiler and stub compiler,\n"
|
|
" 'none': no log,\n"
|
|
" 'allllircirasm' or 'all012': print all log for all methods,\n"
|
|
" 'allcir' or 'all0': print IR info for all methods,\n"
|
|
" 'allllir' or 'all1': print llir info for all methods,\n"
|
|
" 'allasm' or 'all2': print asm log for all methods,\n"
|
|
" 'alltype' or 'all3': print type infer log for all methods,\n"
|
|
" 'cerllircirasm' or 'cer0112': print all log for certain method defined "
|
|
"in 'mlist-for-log',\n"
|
|
" 'cercir' or 'cer0': print IR for methods in 'mlist-for-log',\n"
|
|
" 'cerasm' or 'cer2': print log for methods in 'mlist-for-log',\n"
|
|
" Default: 'none'\n"
|
|
"--compiler-log-methods: Specific method list for compiler log, only used when compiler-log. "
|
|
"Default: 'none'\n"
|
|
"--compiler-type-threshold: enable to skip methods whose type is no more than threshold. Default: -1\n"
|
|
"--compiler-log-snapshot: Enable to print snapshot information. Default: 'false'\n"
|
|
"--compiler-log-time: Enable to print pass compiler time. Default: 'false'\n"
|
|
"--enable-ark-tools: Enable ark tools to debug. Default: 'false'\n"
|
|
"--compiler-trace-bc: Enable tracing bytecode for aot runtime. Default: 'false'\n"
|
|
"--compiler-trace-deopt: Enable tracing deopt for aot runtime. Default: 'false'\n"
|
|
"--compiler-trace-inline: Enable tracing inline function for aot runtime. Default: 'false'\n"
|
|
"--compiler-trace-value-numbering: Enable tracing value numbering for aot runtime. Default: 'false'\n"
|
|
"--compiler-max-inline-bytecodes Set max bytecodes count which aot function can be inlined. Default: '25'\n"
|
|
"--compiler-deopt-threshold: Set max count which aot function can occur deoptimization. Default: '10'\n"
|
|
"--compiler-device-state Compiler device state for aot. Check device screen state. Default: 'false'\n"
|
|
"--compiler-stress-deopt: Enable stress deopt for aot compiler. Default: 'false'\n"
|
|
"--compiler-opt-code-profiler: Enable opt code Bytecode Statistics for aot runtime. Default: 'false'\n"
|
|
"--compiler-opt-bc-range: Range list for EcmaOpCode range Example '1:2,5:8'\n"
|
|
"--compiler-opt-bc-range-help: Range list for EcmaOpCode range help. Default: 'false''\n"
|
|
"--enable-force-gc: Enable force gc when allocating object. Default: 'true'\n"
|
|
"--force-shared-gc-frequency: How frequency force shared gc . Default: '1'\n"
|
|
"--enable-ic: Switch of inline cache. Default: 'true'\n"
|
|
"--enable-runtime-stat: Enable statistics of runtime state. Default: 'false'\n"
|
|
"--compiler-opt-array-bounds-check-elimination: Enable Index Check elimination. Default: 'true'\n"
|
|
"--compiler-opt-constant-folding: Enable constant folding. Default: 'true'\n"
|
|
"--compiler-opt-type-lowering: Enable all type optimization pass for aot compiler. Default: 'true'\n"
|
|
"--compiler-opt-early-elimination: Enable EarlyElimination for aot compiler. Default: 'true'\n"
|
|
"--compiler-opt-later-elimination: Enable LaterElimination for aot compiler. Default: 'true'\n"
|
|
"--compiler-opt-string: Enable string optimization pass for aot compiler. Default: 'true'\n"
|
|
"--compiler-opt-value-numbering: Enable ValueNumbering for aot compiler. Default: 'true'\n"
|
|
"--compiler-opt-inlining: Enable inlining function for aot compiler: Default: 'true'\n"
|
|
"--compiler-opt-pgotype: Enable pgo type for aot compiler: Default: 'true'\n"
|
|
"--compiler-opt-track-field: Enable track field for aot compiler: Default: 'false'\n"
|
|
"--entry-point: Full name of entrypoint function. Default: '_GLOBAL::func_main_0'\n"
|
|
"--force-full-gc: If true trigger full gc, else trigger semi and old gc. Default: 'true'\n"
|
|
"--framework-abc-file: Snapshot file. Default: 'strip.native.min.abc'\n"
|
|
"--gc-long-paused-time: Set gc's longPauseTime in millisecond. Default: '40'\n"
|
|
"--gc-thread-num: Set gc thread number. Default: '7'\n"
|
|
"--heap-size-limit: Max heap size (MB). Default: '512'\n"
|
|
"--help: Print this message and exit\n"
|
|
"--icu-data-path: Path to generated icu data file. Default: 'default'\n"
|
|
"--enable-worker: Whether is worker vm. Default: 'false'\n"
|
|
"--log-level: Log level: ['debug', 'info', 'warning', 'error', 'fatal'].\n"
|
|
"--log-components: Enable logs from specified components: ['all', 'gc', 'ecma','interpreter',\n"
|
|
" 'debugger', 'compiler', 'builtins', 'trace', 'jit', 'baselinejit', 'all']. \n"
|
|
" Default: 'all'\n"
|
|
"--log-debug: Enable debug or above logs for components: ['all', 'gc', 'ecma',\n"
|
|
" 'interpreter', 'debugger', 'compiler', 'builtins', 'trace', 'jit',\n"
|
|
" 'baselinejit', 'all']. Default: 'all'\n"
|
|
"--log-error: Enable error log for components: ['all', 'gc', 'ecma',\n"
|
|
" 'interpreter', 'debugger', 'compiler', 'builtins', 'trace', 'jit',\n"
|
|
" 'baselinejit', 'all']. Default: 'all'\n"
|
|
"--log-fatal: Enable fatal log for components: ['all', 'gc', 'ecma',\n"
|
|
" 'interpreter', 'debugger', 'compiler', 'builtins', 'trace', 'jit',\n"
|
|
" 'baselinejit', 'all']. Default: 'all'\n"
|
|
"--log-info: Enable info log for components: ['all', 'gc', 'ecma',\n"
|
|
" 'interpreter', 'debugger', 'compiler', 'builtins', 'trace', 'jit',\n"
|
|
" 'baselinejit', 'all']. Default: 'all'\n"
|
|
"--log-warning: Enable warning log for components: ['all', 'gc', 'ecma',\n"
|
|
" 'interpreter', 'debugger', 'compiler', 'trace', 'jit', \n"
|
|
" 'baselinejit', 'builtins', 'all']. Default: 'all'\n"
|
|
"--compiler-opt-max-method: Enable aot compiler to skip method larger than limit (KB). Default: '32'\n"
|
|
"--compiler-module-methods: The number of max compiled methods in a module. Default: '100'\n"
|
|
"--max-unmovable-space: Set max unmovable space capacity\n"
|
|
"--merge-abc: ABC file is merge abc. Default: 'false'\n"
|
|
"--compiler-opt-level: Optimization level configuration of aot compiler. Default: '3'\n"
|
|
"--options: Print compiler and runtime options\n"
|
|
"--serializer-buffer-size-limit: Max serializer buffer size used by the VM in Byte. Default size is 2GB\n"
|
|
"--snapshot-file: Snapshot file. Default: '/system/etc/snapshot'\n"
|
|
"--startup-time: Print the start time of command execution. Default: 'false'\n"
|
|
"--stub-file: Path of file includes common stubs module compiled by stub compiler. "
|
|
"Default: 'stub.an'\n"
|
|
"--enable-pgo-profiler: Enable pgo profiler to sample jsfunction call and output to file. "
|
|
"Default: 'false'\n"
|
|
"--enable-elements-kind: Enable elementsKind sampling and usage. Default: 'false'\n"
|
|
"--compiler-pgo-hotness-threshold: Set hotness threshold for pgo in aot compiler. Default: '2'\n"
|
|
"--compiler-pgo-profiler-path: The pgo file output dir or the pgo file dir of AOT compiler. Default: ''\n"
|
|
"--compiler-pgo-save-min-interval: Set the minimum time interval for automatically saving profile, "
|
|
"Unit seconds. Default: '30s'\n"
|
|
"--compiler-target-triple: CPU triple for aot compiler or stub compiler. \n"
|
|
" values: ['x86_64-unknown-linux-gnu', 'arm-unknown-linux-gnu', \n"
|
|
" 'aarch64-unknown-linux-gnu'], Default: 'x86_64-unknown-linux-gnu'\n"
|
|
"--enable-print-execute-time: Enable print execute panda file spent time\n"
|
|
"--compiler-verify-vtable: Verify vtable result for aot compiler. Default: 'false'\n"
|
|
"--compiler-select-methods Compiler selected methods for aot. Only work in full compiling mode\n"
|
|
" Format:--compile-methods=record1:m1,m2,record2:m3\n"
|
|
"--compiler-skip-methods Compiler skpped methods for aot. Only work in full compiling mode\n"
|
|
" Format:--compile-skip-methods=record1:m1,m2,record2:m3\n"
|
|
"--target-compiler-mode The compilation mode at the device side, including partial, full and none."
|
|
" Default: ''\n"
|
|
"--hap-path(Deprecated) The path of the app hap. Default: ''\n"
|
|
"--hap-abc-offset(Deprecated) The offset of the abc file in app hap. Default: '0'\n"
|
|
"--hap-abc-size(Deprecated) The size of the abc file in app hap. Default: '0'\n"
|
|
"--compiler-fast-compile Disable some time-consuming pass. Default: 'true'\n"
|
|
"--compiler-no-check Enable remove checks for aot compiler. Default: 'false'\n"
|
|
"--compiler-opt-loop-peeling: Enable loop peeling for aot compiler: Default: 'false'\n"
|
|
"--compiler-pkg-info Specify the package json info for ark aot compiler\n"
|
|
"--compiler-external-pkg-info Specify the external package json info for ark aot compiler\n"
|
|
"--compiler-enable-external-pkg Enable compile with external package for ark aot compiler\n"
|
|
"--compiler-enable-lexenv-specialization: Enable replace ldlexvar with specific values: Default: 'true'\n"
|
|
"--compiler-enable-native-inline: Enable inline native function: Default: 'false'\n"
|
|
"--compiler-enable-lowering-builtin: Enable lowering global object: Default: 'false'\n"
|
|
"--compiler-opt-array-onheap-check: Enable TypedArray on heap check for aot compiler: Default: 'false'\n"
|
|
"--compiler-enable-litecg: Enable LiteCG: Default: 'false'\n"
|
|
"--compiler-enable-jit: Enable jit: Default: 'false'\n"
|
|
"--compiler-enable-osr: Enable osr: Default: 'false'\n"
|
|
"--compiler-jit-hotness-threshold: Set hotness threshold for jit. Default: '2'\n"
|
|
"--compiler-osr-hotness-threshold: Set hotness threshold for osr. Default: '2'\n"
|
|
"--compiler-force-jit-compile-main: Enable jit compile main function: Default: 'false'\n"
|
|
"--compiler-trace-jit: Enable trace jit: Default: 'false'\n"
|
|
"--compiler-typed-op-profiler: Enable Typed Opcode Statistics for aot runtime. Default: 'false'\n"
|
|
"--compiler-opt-branch-profiling: Enable branch profiling for aot compiler. Default: 'true'\n"
|
|
"--test-assert: Set Assert Model. Default: 'false'\n"
|
|
"--compiler-methods-range: Enable aot compiler to compile only in-range methods."
|
|
" Default: '0:4294967295'\n"
|
|
"--compiler-codegen-options: Compile options passed to codegen. Default: ''\n"
|
|
"--compiler-opt-escape-analysis: Enable escape analysis for aot compiler. Default: 'true'\n"
|
|
"--compiler-trace-escape-analysis: Enable tracing escape analysis for aot compiler. Default: 'false'\n"
|
|
"--compiler-opt-induction-variable: Enable induciton variable analysis for aot compiler. Default: 'false'\n"
|
|
"--compiler-trace-induction-variable: Enable tracing induction variable for aot compiler. Default: 'false'\n"
|
|
"--compiler-memory-analysis: Enable memory analysis for aot compiler. Default: 'true'\n\n";
|
|
|
|
bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
|
|
{
|
|
const struct option longOptions[] = {
|
|
{"aot-file", required_argument, nullptr, OPTION_AOT_FILE},
|
|
{"ark-properties", required_argument, nullptr, OPTION_ARK_PROPERTIES},
|
|
{"ark-bundleName", required_argument, nullptr, OPTION_ARK_BUNDLENAME},
|
|
{"asm-interpreter", required_argument, nullptr, OPTION_ENABLE_ASM_INTERPRETER},
|
|
{"asm-opcode-disable-range", required_argument, nullptr, OPTION_ASM_OPCODE_DISABLE_RANGE},
|
|
{"builtins-lazy", required_argument, nullptr, OPTION_ENABLE_BUILTINS_LAZY},
|
|
{"compiler-log", required_argument, nullptr, OPTION_COMPILER_LOG_OPT},
|
|
{"compiler-log-methods", required_argument, nullptr, OPTION_COMPILER_LOG_METHODS},
|
|
{"compiler-log-snapshot", required_argument, nullptr, OPTION_COMPILER_LOG_SNAPSHOT},
|
|
{"compiler-log-time", required_argument, nullptr, OPTION_COMPILER_LOG_TIME},
|
|
{"compiler-type-threshold", required_argument, nullptr, OPTION_COMPILER_TYPE_THRESHOLD},
|
|
{"enable-ark-tools", required_argument, nullptr, OPTION_ENABLE_ARK_TOOLS},
|
|
{"compiler-trace-bc", required_argument, nullptr, OPTION_COMPILER_TRACE_BC},
|
|
{"compiler-trace-deopt", required_argument, nullptr, OPTION_COMPILER_TRACE_DEOPT},
|
|
{"compiler-trace-inline", required_argument, nullptr, OPTION_COMPILER_TRACE_INLINE},
|
|
{"compiler-trace-value-numbering", required_argument, nullptr, OPTION_COMPILER_TRACE_VALUE_NUMBERING},
|
|
{"compiler-trace-instruction-combine", required_argument, nullptr, OPTION_COMPILER_TRACE_INSTRUCTION_COMBINE},
|
|
{"compiler-max-inline-bytecodes", required_argument, nullptr, OPTION_COMPILER_MAX_INLINE_BYTECODES},
|
|
{"compiler-deopt-threshold", required_argument, nullptr, OPTION_COMPILER_DEOPT_THRESHOLD},
|
|
{"compiler-device-state", required_argument, nullptr, OPTION_COMPILER_DEVICE_STATE},
|
|
{"compiler-stress-deopt", required_argument, nullptr, OPTION_COMPILER_STRESS_DEOPT},
|
|
{"compiler-opt-code-profiler", required_argument, nullptr, OPTION_COMPILER_OPT_CODE_PROFILER},
|
|
{"compiler-opt-bc-range", required_argument, nullptr, OPTION_COMPILER_OPT_BC_RANGE},
|
|
{"compiler-opt-bc-range-help", required_argument, nullptr, OPTION_COMPILER_OPT_BC_RANGE_HELP},
|
|
{"enable-force-gc", required_argument, nullptr, OPTION_ENABLE_FORCE_GC},
|
|
{"enable-ic", required_argument, nullptr, OPTION_ENABLE_IC},
|
|
{"enable-runtime-stat", required_argument, nullptr, OPTION_ENABLE_RUNTIME_STAT},
|
|
{"compiler-opt-constant-folding", required_argument, nullptr, OPTION_COMPILER_OPT_CONSTANT_FOLDING},
|
|
{"compiler-opt-array-bounds-check-elimination", required_argument, nullptr,
|
|
OPTION_COMPILER_OPT_ARRAY_BOUNDS_CHECK_ELIMINATION},
|
|
{"compiler-opt-type-lowering", required_argument, nullptr, OPTION_COMPILER_OPT_TYPE_LOWERING},
|
|
{"compiler-opt-early-elimination", required_argument, nullptr, OPTION_COMPILER_OPT_EARLY_ELIMINATION},
|
|
{"compiler-opt-later-elimination", required_argument, nullptr, OPTION_COMPILER_OPT_LATER_ELIMINATION},
|
|
{"compiler-opt-instr-combine", required_argument, nullptr, OPTION_COMPILER_OPT_INSTRUCTIONE_COMBINE},
|
|
{"compiler-opt-string", required_argument, nullptr, OPTION_COMPILER_OPT_STRING},
|
|
{"compiler-opt-value-numbering", required_argument, nullptr, OPTION_COMPILER_OPT_VALUE_NUMBERING},
|
|
{"compiler-opt-new-value-numbering", required_argument, nullptr, OPTION_COMPILER_OPT_NEW_VALUE_NUMBERING},
|
|
{"compiler-opt-inlining", required_argument, nullptr, OPTION_COMPILER_OPT_INLINING},
|
|
{"compiler-opt-pgotype", required_argument, nullptr, OPTION_COMPILER_OPT_PGOTYPE},
|
|
{"compiler-opt-track-field", required_argument, nullptr, OPTION_COMPILER_OPT_TRACK_FIELD},
|
|
{"entry-point", required_argument, nullptr, OPTION_ENTRY_POINT},
|
|
{"force-full-gc", required_argument, nullptr, OPTION_FORCE_FULL_GC},
|
|
{"force-shared-gc-frequency", required_argument, nullptr, OPTION_ENABLE_FORCE_SHARED_GC_FREQUENCY},
|
|
{"gc-thread-num", required_argument, nullptr, OPTION_GC_THREADNUM},
|
|
{"heap-size-limit", required_argument, nullptr, OPTION_HEAP_SIZE_LIMIT},
|
|
{"help", no_argument, nullptr, OPTION_HELP},
|
|
{"icu-data-path", required_argument, nullptr, OPTION_ICU_DATA_PATH},
|
|
{"enable-worker", required_argument, nullptr, OPTION_ENABLE_WORKER},
|
|
{"log-components", required_argument, nullptr, OPTION_LOG_COMPONENTS},
|
|
{"log-debug", required_argument, nullptr, OPTION_LOG_DEBUG},
|
|
{"log-error", required_argument, nullptr, OPTION_LOG_ERROR},
|
|
{"log-fatal", required_argument, nullptr, OPTION_LOG_FATAL},
|
|
{"log-info", required_argument, nullptr, OPTION_LOG_INFO},
|
|
{"log-level", required_argument, nullptr, OPTION_LOG_LEVEL},
|
|
{"log-warning", required_argument, nullptr, OPTION_LOG_WARNING},
|
|
{"gc-long-paused-time", required_argument, nullptr, OPTION_GC_LONG_PAUSED_TIME},
|
|
{"compiler-opt-max-method", required_argument, nullptr, OPTION_COMPILER_OPT_MAX_METHOD},
|
|
{"compiler-module-methods", required_argument, nullptr, OPTION_COMPILER_MODULE_METHODS},
|
|
{"max-unmovable-space", required_argument, nullptr, OPTION_MAX_UNMOVABLE_SPACE},
|
|
{"merge-abc", required_argument, nullptr, OPTION_MERGE_ABC},
|
|
{"enable-context", required_argument, nullptr, OPTION_ENABLE_CONTEXT},
|
|
{"compiler-opt-level", required_argument, nullptr, OPTION_ASM_OPT_LEVEL},
|
|
{"reloc-mode", required_argument, nullptr, OPTION_RELOCATION_MODE},
|
|
{"serializer-buffer-size-limit", required_argument, nullptr, OPTION_SERIALIZER_BUFFER_SIZE_LIMIT},
|
|
{"startup-time", required_argument, nullptr, OPTION_STARTUP_TIME},
|
|
{"stub-file", required_argument, nullptr, OPTION_STUB_FILE},
|
|
{"compiler-target-triple", required_argument, nullptr, OPTION_COMPILER_TARGET_TRIPLE},
|
|
{"enable-print-execute-time", required_argument, nullptr, OPTION_PRINT_EXECUTE_TIME},
|
|
{"enable-pgo-profiler", required_argument, nullptr, OPTION_ENABLE_PGO_PROFILER},
|
|
{"enable-elements-kind", required_argument, nullptr, OPTION_ENABLE_ELEMENTSKIND},
|
|
{"compiler-pgo-profiler-path", required_argument, nullptr, OPTION_COMPILER_PGO_PROFILER_PATH},
|
|
{"compiler-pgo-hotness-threshold", required_argument, nullptr, OPTION_COMPILER_PGO_HOTNESS_THRESHOLD},
|
|
{"compiler-pgo-save-min-interval", required_argument, nullptr, OPTION_COMPILER_PGO_SAVE_MIN_INTERVAL},
|
|
{"compiler-verify-vtable", required_argument, nullptr, OPTION_COMPILER_VERIFY_VTABLE},
|
|
{"compiler-select-methods", required_argument, nullptr, OPTION_COMPILER_SELECT_METHODS},
|
|
{"compiler-skip-methods", required_argument, nullptr, OPTION_COMPILER_SKIP_METHODS},
|
|
{"target-compiler-mode", required_argument, nullptr, OPTION_TARGET_COMPILER_MODE},
|
|
{"hap-path", required_argument, nullptr, OPTION_HAP_PATH},
|
|
{"hap-abc-offset", required_argument, nullptr, OPTION_HAP_ABC_OFFSET},
|
|
{"hap-abc-size", required_argument, nullptr, OPTION_HAP_ABC_SIZE},
|
|
{"compiler-no-check", required_argument, nullptr, OPTION_COMPILER_NOCHECK},
|
|
{"compiler-fast-compile", required_argument, nullptr, OPTION_FAST_AOT_COMPILE_MODE},
|
|
{"compiler-opt-loop-peeling", required_argument, nullptr, OPTION_COMPILER_OPT_LOOP_PEELING},
|
|
{"compiler-opt-array-onheap-check", required_argument, nullptr, OPTION_COMPILER_OPT_ON_HEAP_CHECK},
|
|
{"compiler-pkg-info", required_argument, nullptr, OPTION_COMPILER_PKG_INFO},
|
|
{"compiler-external-pkg-info", required_argument, nullptr, OPTION_COMPILER_EXTERNAL_PKG_INFO},
|
|
{"compiler-enable-external-pkg", required_argument, nullptr, OPTION_COMPILER_ENABLE_EXTERNAL_PKG},
|
|
{"compiler-framework-abc-path", required_argument, nullptr, OPTION_COMPILER_FRAMEWORK_ABC_PATH},
|
|
{"compiler-enable-lexenv-specialization", required_argument, nullptr,
|
|
OPTION_COMPILER_ENABLE_LEXENV_SPECIALIZATION},
|
|
{"compiler-enable-native-inline", required_argument, nullptr, OPTION_COMPILER_ENABLE_NATIVE_INLINE},
|
|
{"compiler-enable-lowering-builtin", required_argument, nullptr, OPTION_COMPILER_ENABLE_LOWERING_BUILTIN},
|
|
{"compiler-enable-litecg", required_argument, nullptr, OPTION_COMPILER_ENABLE_LITECG},
|
|
{"compiler-enable-jit", required_argument, nullptr, OPTION_COMPILER_ENABLE_JIT},
|
|
{"compiler-enable-osr", required_argument, nullptr, OPTION_COMPILER_ENABLE_OSR},
|
|
{"compiler-trace-jit", required_argument, nullptr, OPTION_COMPILER_TRACE_JIT},
|
|
{"compiler-jit-hotness-threshold", required_argument, nullptr, OPTION_COMPILER_JIT_HOTNESS_THRESHOLD},
|
|
{"compiler-osr-hotness-threshold", required_argument, nullptr, OPTION_COMPILER_OSR_HOTNESS_THRESHOLD},
|
|
{"compiler-force-jit-compile-main", required_argument, nullptr, OPTION_COMPILER_FORCE_JIT_COMPILE_MAIN},
|
|
{"compiler-enable-jit-pgo", required_argument, nullptr, OPTION_COMPILER_ENABLE_JIT_PGO},
|
|
{"compiler-enable-aot-pgo", required_argument, nullptr, OPTION_COMPILER_ENABLE_AOT_PGO},
|
|
{"compiler-enable-profile-dump", required_argument, nullptr, OPTION_COMPILER_ENABLE_PROPFILE_DUMP},
|
|
{"compiler-typed-op-profiler", required_argument, nullptr, OPTION_COMPILER_TYPED_OP_PROFILER},
|
|
{"compiler-opt-branch-profiling", required_argument, nullptr, OPTION_COMPILER_OPT_BRANCH_PROFILING},
|
|
{"test-assert", required_argument, nullptr, OPTION_TEST_ASSERT},
|
|
{"compiler-methods-range", required_argument, nullptr, OPTION_COMPILER_METHODS_RANGE},
|
|
{"compiler-codegen-options", required_argument, nullptr, OPTION_COMPILER_CODEGEN_OPT},
|
|
{"compiler-opt-escape-analysis", required_argument, nullptr, OPTION_COMPILER_OPT_ESCAPE_ANALYSIS},
|
|
{"compiler-trace-escape-analysis", required_argument, nullptr, OPTION_COMPILER_TRACE_ESCAPE_ANALYSIS},
|
|
{"compiler-opt-induction-variable", required_argument, nullptr, OPTION_COMPILER_OPT_INDUCTION_VARIABLE},
|
|
{"compiler-trace-induction-variable", required_argument, nullptr, OPTION_COMPILER_TRACE_INDUCTION_VARIABLE},
|
|
{"compiler-memory-analysis", required_argument, nullptr, OPTION_COMPILER_MEMORY_ANALYSIS},
|
|
{"compiler-check-pgo-version", required_argument, nullptr, OPTION_COMPILER_CHECK_PGO_VERSION},
|
|
{"compiler-enable-baselinejit", required_argument, nullptr, OPTION_COMPILER_ENABLE_BASELINEJIT},
|
|
{"compiler-baselinejit-hotness-threshold", required_argument, nullptr, OPTION_COMPILER_BASELINEJIT_HOTNESS_THRESHOLD},
|
|
{"compiler-force-baselinejit-compile-main", required_argument, nullptr, OPTION_COMPILER_FORCE_BASELINEJIT_COMPILE_MAIN},
|
|
{nullptr, 0, nullptr, 0},
|
|
};
|
|
|
|
int index = 0;
|
|
opterr = 0;
|
|
bool ret = false;
|
|
int option = 0;
|
|
arg_list_t argListStr;
|
|
uint32_t argUint32 = 0;
|
|
uint64_t argUInt64 = 0;
|
|
int argInt = 0;
|
|
bool argBool = false;
|
|
double argDouble = 0.0;
|
|
static std::string COLON = ":";
|
|
|
|
if (argc <= 1) {
|
|
return true;
|
|
}
|
|
|
|
while (true) {
|
|
option = getopt_long_only(argc, const_cast<char **>(argv), "", longOptions, &index);
|
|
LOG_ECMA(INFO) << "option: " << option << ", optopt: " << optopt << ", optind: " << optind;
|
|
|
|
if (optind <= 0 || optind > argc) {
|
|
return false;
|
|
}
|
|
|
|
if (option == -1) {
|
|
return true;
|
|
}
|
|
|
|
// unknown option or required_argument option has no argument
|
|
if (option == OPTION_DEFAULT) {
|
|
ret = SetDefaultValue(const_cast<char *>(argv[optind - 1]));
|
|
if (ret) {
|
|
continue;
|
|
} else {
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
WasSet(option);
|
|
switch (option) {
|
|
case OPTION_AOT_FILE:
|
|
SetAOTOutputFile(optarg);
|
|
ecmascript::AnFileDataManager::GetInstance()->SetEnable(true);
|
|
break;
|
|
case OPTION_ARK_PROPERTIES:
|
|
ret = ParseIntParam("ark-properties", &argInt);
|
|
if (ret) {
|
|
SetArkProperties(argInt);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_ARK_BUNDLENAME:
|
|
SetArkBundleName(optarg);
|
|
break;
|
|
case OPTION_ENABLE_ASM_INTERPRETER:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableAsmInterpreter(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_ASM_OPCODE_DISABLE_RANGE:
|
|
SetAsmOpcodeDisableRange(optarg);
|
|
break;
|
|
case OPTION_ENABLE_BUILTINS_LAZY:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableBuiltinsLazy(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_LOG_OPT:
|
|
SetCompilerLogOption(optarg);
|
|
break;
|
|
case OPTION_COMPILER_LOG_SNAPSHOT:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetCompilerLogSnapshot(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_LOG_TIME:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetCompilerLogTime(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_ENABLE_ARK_TOOLS:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableArkTools(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_TRACE_BC:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetTraceBc(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_TRACE_DEOPT:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetTraceDeopt(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_TRACE_INLINE:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetTraceInline(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_TRACE_VALUE_NUMBERING:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetTraceValueNumbering(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_TRACE_INSTRUCTION_COMBINE:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetTraceInstructionCombine(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_MAX_INLINE_BYTECODES:
|
|
ret = ParseUint32Param("max-inline-bytecodes", &argUint32);
|
|
if (ret) {
|
|
SetMaxInlineBytecodes(argUint32);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_DEOPT_THRESHOLD:
|
|
ret = ParseUint32Param("deopt-threshol", &argUint32);
|
|
if (ret) {
|
|
SetDeoptThreshold(argUint32);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_DEVICE_STATE:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetDeviceState(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_STRESS_DEOPT:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetStressDeopt(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_CODE_PROFILER:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetOptCodeProfiler(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_BC_RANGE:
|
|
SetOptCodeRange(optarg);
|
|
break;
|
|
case OPTION_COMPILER_OPT_BC_RANGE_HELP:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
std::string helpInfo = kungfu::GetHelpForEcmaCodeListForRange();
|
|
LOG_COMPILER(ERROR) << helpInfo.c_str();
|
|
exit(1);
|
|
}
|
|
break;
|
|
case OPTION_ENABLE_FORCE_GC:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableForceGC(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_FORCE_FULL_GC:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetForceFullGC(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_ENABLE_FORCE_SHARED_GC_FREQUENCY:
|
|
ret = ParseUint32Param("force-shared-gc-frequency", &argUint32);
|
|
if (ret) {
|
|
SetForceSharedGCFrequency(argUint32);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_ENABLE_IC:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableIC(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_ENABLE_RUNTIME_STAT:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableRuntimeStat(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_GC_THREADNUM:
|
|
ret = ParseUint32Param("gc-thread-num", &argUint32);
|
|
if (ret) {
|
|
SetGcThreadNum(argUint32);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_HEAP_SIZE_LIMIT:
|
|
ret = ParseUint32Param("heap-size-limit", &argUint32);
|
|
if (ret) {
|
|
SetHeapSizeLimit(argUint32);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_HELP:
|
|
return false;
|
|
case OPTION_ICU_DATA_PATH:
|
|
SetIcuDataPath(optarg);
|
|
break;
|
|
case OPTION_ENABLE_WORKER:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetIsWorker(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_LOG_COMPONENTS:
|
|
ParseListArgParam(optarg, &argListStr, COLON);
|
|
SetLogComponents(argListStr);
|
|
break;
|
|
case OPTION_LOG_DEBUG:
|
|
ParseListArgParam(optarg, &argListStr, COLON);
|
|
SetLogDebug(argListStr);
|
|
break;
|
|
case OPTION_LOG_ERROR:
|
|
ParseListArgParam(optarg, &argListStr, COLON);
|
|
SetLogError(argListStr);
|
|
break;
|
|
case OPTION_LOG_FATAL:
|
|
ParseListArgParam(optarg, &argListStr, COLON);
|
|
SetLogFatal(argListStr);
|
|
break;
|
|
case OPTION_LOG_INFO:
|
|
ParseListArgParam(optarg, &argListStr, COLON);
|
|
SetLogInfo(argListStr);
|
|
break;
|
|
case OPTION_LOG_LEVEL:
|
|
SetLogLevel(optarg);
|
|
break;
|
|
case OPTION_LOG_WARNING:
|
|
ParseListArgParam(optarg, &argListStr, COLON);
|
|
SetLogWarning(argListStr);
|
|
break;
|
|
case OPTION_GC_LONG_PAUSED_TIME:
|
|
ret = ParseUint32Param("gc-long-paused-time", &argUint32);
|
|
if (ret) {
|
|
SetLongPauseTime(argUint32);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_MAX_METHOD:
|
|
ret = ParseUint32Param("compiler-opt-max-method", &argUint32);
|
|
if (ret) {
|
|
SetMaxAotMethodSize(argUint32);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_MODULE_METHODS:
|
|
ret = ParseUint32Param("compiler-module-methods", &argUint32);
|
|
if (!ret) {
|
|
return false;
|
|
}
|
|
SetCompilerModuleMethods(argUint32);
|
|
break;
|
|
case OPTION_COMPILER_TYPE_THRESHOLD:
|
|
ret = ParseDoubleParam("compiler-type-threshold", &argDouble);
|
|
if (ret) {
|
|
SetTypeThreshold(argDouble);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_MAX_UNMOVABLE_SPACE:
|
|
ret = ParseUint32Param("max-unmovable-space", &argUint32);
|
|
if (ret) {
|
|
SetMaxNonmovableSpaceCapacity(argUint32);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_LOG_METHODS:
|
|
SetMethodsListForLog(optarg);
|
|
break;
|
|
case OPTION_ASM_OPT_LEVEL:
|
|
ret = ParseUint32Param("compiler-opt-level", &argUint32);
|
|
if (ret) {
|
|
SetOptLevel(argUint32);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_PRINT_EXECUTE_TIME:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnablePrintExecuteTime(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_ENABLE_PGO_PROFILER:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnablePGOProfiler(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_ENABLE_ELEMENTSKIND:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableElementsKind(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_PGO_PROFILER_PATH:
|
|
if (*optarg == '\0') {
|
|
return false;
|
|
}
|
|
SetPGOProfilerPath(optarg);
|
|
break;
|
|
case OPTION_COMPILER_PGO_HOTNESS_THRESHOLD:
|
|
ret = ParseUint32Param("pgo-hotness-threshold", &argUint32);
|
|
if (ret) {
|
|
SetPGOHotnessThreshold(argUint32);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_PGO_SAVE_MIN_INTERVAL:
|
|
ret = ParseUint32Param("compiler-pgo-save-min-interval", &argUint32);
|
|
if (ret) {
|
|
SetPGOSaveMinInterval(argUint32);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_RELOCATION_MODE:
|
|
ret = ParseUint32Param("reloc-mode", &argUint32);
|
|
if (ret) {
|
|
SetRelocMode(argUint32);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_SERIALIZER_BUFFER_SIZE_LIMIT:
|
|
ret = ParseUint64Param("serializer-buffer-size-limit", &argUInt64);
|
|
if (ret) {
|
|
SetSerializerBufferSizeLimit(argUInt64);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_STARTUP_TIME:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetStartupTime(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_STUB_FILE:
|
|
SetStubFile(optarg);
|
|
break;
|
|
case OPTION_COMPILER_TARGET_TRIPLE:
|
|
SetTargetTriple(optarg);
|
|
break;
|
|
case OPTION_ENTRY_POINT:
|
|
SetEntryPoint(optarg);
|
|
break;
|
|
case OPTION_MERGE_ABC:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetMergeAbc(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_ENABLE_CONTEXT:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableContext(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_TYPE_LOWERING:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableTypeLowering(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_ARRAY_BOUNDS_CHECK_ELIMINATION:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableArrayBoundsCheckElimination(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_EARLY_ELIMINATION:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableEarlyElimination(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_LATER_ELIMINATION:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableLaterElimination(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_INSTRUCTIONE_COMBINE:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableInstrcutionCombine(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_STRING:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableOptString(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_VALUE_NUMBERING:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableValueNumbering(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_NEW_VALUE_NUMBERING:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableNewValueNumbering(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_INLINING:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableOptInlining(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_PGOTYPE:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableOptPGOType(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_TRACK_FIELD:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableOptTrackField(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_VERIFY_VTABLE:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetVerifyVTable(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_SELECT_METHODS:
|
|
SetCompilerSelectMethods(optarg);
|
|
break;
|
|
case OPTION_COMPILER_SKIP_METHODS:
|
|
SetCompilerSkipMethods(optarg);
|
|
break;
|
|
case OPTION_TARGET_COMPILER_MODE:
|
|
SetTargetCompilerMode(optarg);
|
|
break;
|
|
case OPTION_COMPILER_FRAMEWORK_ABC_PATH:
|
|
SetCompilerFrameworkAbcPath(optarg);
|
|
break;
|
|
case OPTION_HAP_PATH:
|
|
SetHapPath(optarg);
|
|
break;
|
|
case OPTION_HAP_ABC_OFFSET:
|
|
ret = ParseUint32Param("hap-abc-offset", &argUint32);
|
|
if (!ret) {
|
|
return false;
|
|
}
|
|
SetHapAbcOffset(argUint32);
|
|
break;
|
|
case OPTION_HAP_ABC_SIZE:
|
|
ret = ParseUint32Param("hap-abc-size", &argUint32);
|
|
if (!ret) {
|
|
return false;
|
|
}
|
|
SetHapAbcSize(argUint32);
|
|
break;
|
|
case OPTION_COMPILER_NOCHECK:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (!ret) {
|
|
return false;
|
|
}
|
|
SetCompilerNoCheck(argBool);
|
|
break;
|
|
case OPTION_FAST_AOT_COMPILE_MODE:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (!ret) {
|
|
return false;
|
|
}
|
|
SetFastAOTCompileMode(argBool);
|
|
break;
|
|
case OPTION_COMPILER_OPT_CONSTANT_FOLDING:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableOptConstantFolding(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_LOOP_PEELING:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableOptLoopPeeling(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_ON_HEAP_CHECK:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableOptOnHeapCheck(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_PKG_INFO:
|
|
SetCompilerPkgJsonInfo(optarg);
|
|
break;
|
|
case OPTION_COMPILER_EXTERNAL_PKG_INFO:
|
|
SetCompilerExternalPkgJsonInfo(optarg);
|
|
break;
|
|
case OPTION_COMPILER_ENABLE_EXTERNAL_PKG:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetCompilerEnableExternalPkg(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_ENABLE_LEXENV_SPECIALIZATION:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableLexenvSpecialization(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_ENABLE_NATIVE_INLINE:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableNativeInline(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_ENABLE_LOWERING_BUILTIN:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableLoweringBuiltin(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_ENABLE_LITECG:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetCompilerEnableLiteCG(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_ENABLE_JIT:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableJIT(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_ENABLE_OSR:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableOSR(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_JIT_HOTNESS_THRESHOLD:
|
|
ret = ParseUint32Param("compiler-jit-hotness-threshold", &argUint32);
|
|
if (ret) {
|
|
uint16_t val = argUint32 > std::numeric_limits<uint16_t>::max() ?
|
|
std::numeric_limits<uint16_t>::max() : static_cast<uint16_t>(argUint32);
|
|
SetJitHotnessThreshold(val);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OSR_HOTNESS_THRESHOLD:
|
|
ret = ParseUint32Param("compiler-osr-hotness-threshold", &argUint32);
|
|
if (ret) {
|
|
uint16_t val = argUint32 > std::numeric_limits<uint16_t>::max() ?
|
|
std::numeric_limits<uint16_t>::max() : static_cast<uint16_t>(argUint32);
|
|
SetOsrHotnessThreshold(val);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_FORCE_JIT_COMPILE_MAIN:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetForceJitCompileMain(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_TRACE_JIT:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetTraceJIT(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_TYPED_OP_PROFILER:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetTypedOpProfiler(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_BRANCH_PROFILING:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableBranchProfiling(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_TEST_ASSERT:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetTestAssert(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_ENABLE_JIT_PGO:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableJITPGO(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_ENABLE_PROPFILE_DUMP:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableProfileDump(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_ENABLE_AOT_PGO:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableAOTPGO(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_ENABLE_BASELINEJIT:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableBaselineJIT(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_METHODS_RANGE:
|
|
ParseListArgParam(optarg, &argListStr, COLON);
|
|
SetCompilerMethodsRange(&argListStr);
|
|
break;
|
|
case OPTION_COMPILER_CODEGEN_OPT:
|
|
ParseListArgParam(optarg, &argListStr, " ");
|
|
SetCompilerCodegenOptions(argListStr);
|
|
break;
|
|
case OPTION_COMPILER_OPT_ESCAPE_ANALYSIS:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableEscapeAnalysis(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_TRACE_ESCAPE_ANALYSIS:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableTraceEscapeAnalysis(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_OPT_INDUCTION_VARIABLE:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableInductionVariableAnalysis(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_TRACE_INDUCTION_VARIABLE:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableTraceInductionVariableAnalysis(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_BASELINEJIT_HOTNESS_THRESHOLD:
|
|
ret = ParseUint32Param("compiler-baselinejit-hotness-threshold", &argUint32);
|
|
if (ret) {
|
|
uint16_t val = argUint32 > std::numeric_limits<uint16_t>::max() ?
|
|
std::numeric_limits<uint16_t>::max() : static_cast<uint16_t>(argUint32);
|
|
SetBaselineJitHotnessThreshold(val);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_MEMORY_ANALYSIS:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetEnableMemoryAnalysis(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_CHECK_PGO_VERSION:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetCheckPgoVersion(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
case OPTION_COMPILER_FORCE_BASELINEJIT_COMPILE_MAIN:
|
|
ret = ParseBoolParam(&argBool);
|
|
if (ret) {
|
|
SetForceBaselineCompileMain(argBool);
|
|
} else {
|
|
return false;
|
|
}
|
|
break;
|
|
default:
|
|
LOG_ECMA(ERROR) << "Invalid option\n";
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
bool JSRuntimeOptions::SetDefaultValue(char* argv)
|
|
{
|
|
WasSet(optopt);
|
|
|
|
if (optopt == OPTION_DEFAULT) { // unknown option
|
|
LOG_ECMA(ERROR) << " Invalid option \"" << argv << "\"";
|
|
return false;
|
|
}
|
|
|
|
if (optopt >= OPTION_LAST) { // unknown argument
|
|
LOG_ECMA(ERROR) << "getopt: \"" << argv <<"\" argument has invalid parameter value \n";
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool JSRuntimeOptions::ParseBoolParam(bool* argBool)
|
|
{
|
|
if ((strcmp(optarg, "false") == 0) || (strcmp(optarg, "0") == 0)) {
|
|
*argBool = false;
|
|
} else {
|
|
*argBool = true;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool JSRuntimeOptions::ParseDoubleParam(const std::string &option, double *argDouble)
|
|
{
|
|
*argDouble = std::stod(optarg, nullptr);
|
|
if (errno == ERANGE) {
|
|
LOG_ECMA(ERROR) << "getopt: \"" << option << "\" argument has invalid parameter value \"" << optarg <<"\"\n";
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool JSRuntimeOptions::ParseIntParam(const std::string &option, int *argInt)
|
|
{
|
|
if (StartsWith(optarg, "0x")) {
|
|
const int HEX = 16;
|
|
*argInt = std::stoi(optarg, nullptr, HEX);
|
|
} else {
|
|
*argInt = std::stoi(optarg);
|
|
}
|
|
|
|
if (errno == ERANGE) {
|
|
LOG_ECMA(ERROR) << "getopt: \"" << option << "\" argument has invalid parameter value \"" << optarg <<"\"\n";
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool JSRuntimeOptions::ParseUint32Param(const std::string &option, uint32_t *argUInt32)
|
|
{
|
|
if (StartsWith(optarg, "0x")) {
|
|
const int HEX = 16;
|
|
*argUInt32 = std::strtoull(optarg, nullptr, HEX);
|
|
} else {
|
|
const int DEC = 10;
|
|
*argUInt32 = std::strtoull(optarg, nullptr, DEC);
|
|
}
|
|
|
|
if (errno == ERANGE) {
|
|
LOG_ECMA(ERROR) << "getopt: \"" << option << "\" argument has invalid parameter value \"" << optarg <<"\"\n";
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool JSRuntimeOptions::ParseUint64Param(const std::string &option, uint64_t *argUInt64)
|
|
{
|
|
if (StartsWith(optarg, "0x")) {
|
|
const int HEX = 16;
|
|
*argUInt64 = std::strtoull(optarg, nullptr, HEX);
|
|
} else {
|
|
const int DEC = 10;
|
|
*argUInt64 = std::strtoull(optarg, nullptr, DEC);
|
|
}
|
|
|
|
if (errno == ERANGE) {
|
|
LOG_ECMA(ERROR) << "getopt: \"" << option << "\" argument has invalid parameter value \"" << optarg <<"\"\n";
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void JSRuntimeOptions::ParseListArgParam(const std::string &option, arg_list_t *argListStr, std::string delimiter)
|
|
{
|
|
argListStr->clear();
|
|
std::size_t strIndex = 0;
|
|
std::size_t pos = option.find_first_of(delimiter, strIndex);
|
|
while ((pos < option.size()) && (pos > strIndex)) {
|
|
argListStr->push_back(option.substr(strIndex, pos - strIndex));
|
|
strIndex = pos;
|
|
strIndex = option.find_first_not_of(delimiter, strIndex);
|
|
pos = option.find_first_of(delimiter, strIndex);
|
|
}
|
|
if (pos > strIndex) {
|
|
argListStr->push_back(option.substr(strIndex, pos - strIndex));
|
|
}
|
|
return;
|
|
}
|
|
|
|
void JSRuntimeOptions::SetOptionsForTargetCompilation()
|
|
{
|
|
if (IsTargetCompilerMode()) {
|
|
SetTargetTriple("aarch64-unknown-linux-gnu");
|
|
SetEnableOptTrackField(false);
|
|
SetEnableOptInlining(false);
|
|
if (IsPartialCompilerMode()) {
|
|
SetEnableOptPGOType(true);
|
|
if (IsPGOProfilerPathEmpty()) {
|
|
LOG_ECMA(DEBUG) << "no pgo profile file in partial mode!";
|
|
}
|
|
} else {
|
|
SetEnableOptPGOType(false);
|
|
SetPGOProfilerPath("");
|
|
}
|
|
}
|
|
}
|
|
}
|