From 194cae715cbebcadf9668febea8ae16119a15e2f Mon Sep 17 00:00:00 2001 From: ctw-ian Date: Wed, 10 May 2023 10:58:30 +0800 Subject: [PATCH] Set max bytecode size for optimizer Issue:https://gitee.com/openharmony/arkcompiler_runtime_core/issues/I71U4S Signed-off-by: ctw-ian Change-Id: I5bc70f3687848febdea01155f22a878f935bea83 --- bytecode_optimizer/common.h | 1 + bytecode_optimizer/optimize_bytecode.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bytecode_optimizer/common.h b/bytecode_optimizer/common.h index c2d9d4f32a..ff12a24c38 100644 --- a/bytecode_optimizer/common.h +++ b/bytecode_optimizer/common.h @@ -25,6 +25,7 @@ static constexpr compiler::Register MAX_NUM_SHORT_CALL_ARGS = 2; static constexpr compiler::Register MAX_NUM_NON_RANGE_ARGS = 4; static constexpr compiler::Register MAX_NUM_INPUTS = MAX_NUM_NON_RANGE_ARGS; static constexpr panda::compiler::Register NUM_COMPACTLY_ENCODED_REGS = 16; +static constexpr uint32_t MAX_BYTECODE_SIZE = 100000U; // Get the position where accumulator read happens. uint8_t AccReadIndex(const compiler::Inst *inst); diff --git a/bytecode_optimizer/optimize_bytecode.cpp b/bytecode_optimizer/optimize_bytecode.cpp index 29c8b8df8f..878474b686 100644 --- a/bytecode_optimizer/optimize_bytecode.cpp +++ b/bytecode_optimizer/optimize_bytecode.cpp @@ -277,7 +277,7 @@ static void SetCompilerOptions(bool is_dynamic) compiler::options.SetCompilerUseSafepoint(false); compiler::options.SetCompilerSupportInitObjectInst(true); if (!compiler::options.WasSetCompilerMaxBytecodeSize()) { - compiler::options.SetCompilerMaxBytecodeSize(~0U); + compiler::options.SetCompilerMaxBytecodeSize(MAX_BYTECODE_SIZE); } if (is_dynamic) { panda::bytecodeopt::options.SetSkipMethodsWithEh(true); -- Gitee