From f631459a9c0603882db6638167e5a2aaacc1267f Mon Sep 17 00:00:00 2001 From: huyunhui Date: Mon, 11 Aug 2025 17:18:35 +0800 Subject: [PATCH] Removw wholeLine Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICTO5C Signed-off-by: huyunhui --- ets2panda/compiler/core/emitter.cpp | 69 ------------------- ets2panda/compiler/core/emitter.h | 1 - .../compiler/debugger/debuginfoDumper.cpp | 3 - 3 files changed, 73 deletions(-) diff --git a/ets2panda/compiler/core/emitter.cpp b/ets2panda/compiler/core/emitter.cpp index f6027fc99e..88f9cfb166 100644 --- a/ets2panda/compiler/core/emitter.cpp +++ b/ets2panda/compiler/core/emitter.cpp @@ -137,64 +137,6 @@ util::StringView FunctionEmitter::SourceCode() const return cg_->VarBinder()->Program()->SourceCode(); } -static Format MatchFormat(const IRNode *node, const Formats &formats) -{ - std::array regs {}; - auto regCnt = node->Registers(®s); - auto registers = Span(regs.data(), regs.data() + regCnt); - - const auto *iter = formats.begin(); - - for (; iter != formats.end(); iter++) { // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) - auto format = *iter; - size_t limit = 0; - for (const auto &formatItem : format.GetFormatItem()) { - if (formatItem.IsVReg()) { - limit = 1U << formatItem.BitWidth(); - break; - } - } - - if (std::all_of(registers.begin(), registers.end(), [limit](const VReg *reg) { return reg->IsValid(limit); })) { - return format; - } - } - - ES2PANDA_UNREACHABLE(); - return *iter; -} - -static size_t GetIRNodeWholeLength(const IRNode *node) -{ - Formats formats = node->GetFormats(); - if (formats.empty()) { - return 0; - } - - size_t len = 1; - const auto format = MatchFormat(node, formats); - - for (auto fi : format.GetFormatItem()) { - len += fi.BitWidth() / 8U; - } - - return len; -} - -static std::string WholeLine(const lexer::SourceRange &range) -{ - auto program = range.start.Program(); - ES2PANDA_ASSERT(program != nullptr); - auto source = program->SourceCode(); - if (source.Empty()) { - return {}; - } - - ES2PANDA_ASSERT(range.end.index <= source.Length()); - ES2PANDA_ASSERT(range.end.index >= range.start.index); - return source.Substr(range.start.index, range.end.index).EscapeSymbol(); -} - void FunctionEmitter::GenInstructionDebugInfo(const IRNode *ins, pandasm::Ins *pandaIns) { const ir::AstNode *astNode = ins->Node(); @@ -210,17 +152,6 @@ void FunctionEmitter::GenInstructionDebugInfo(const IRNode *ins, pandasm::Ins *p auto nodeRange = astNode->Range(); pandaIns->insDebug.SetLineNumber(nodeRange.start.line + 1U); - - if (cg_->IsDebug()) { - size_t insLen = GetIRNodeWholeLength(ins); - if (insLen != 0) { - pandaIns->insDebug.SetBoundLeft(offset_); - pandaIns->insDebug.SetBoundRight(offset_ + insLen); - } - - offset_ += insLen; - pandaIns->insDebug.SetWholeLine(WholeLine(nodeRange)); - } } void FunctionEmitter::GenFunctionInstructions(pandasm::Function *func) diff --git a/ets2panda/compiler/core/emitter.h b/ets2panda/compiler/core/emitter.h index 7e2623cc38..35e3e84c4b 100644 --- a/ets2panda/compiler/core/emitter.h +++ b/ets2panda/compiler/core/emitter.h @@ -98,7 +98,6 @@ protected: private: const CodeGen *cg_; ProgramElement *programElement_; - size_t offset_ {0}; }; class Emitter { diff --git a/ets2panda/compiler/debugger/debuginfoDumper.cpp b/ets2panda/compiler/debugger/debuginfoDumper.cpp index 77a380803e..26969f2e94 100644 --- a/ets2panda/compiler/debugger/debuginfoDumper.cpp +++ b/ets2panda/compiler/debugger/debuginfoDumper.cpp @@ -217,10 +217,7 @@ void DebugInfoDumper::WritePosInfo(const pandasm::debuginfo::Ins &posInfo) ss_ << std::endl; Indent(); ss_ << "\"debug_pos_info\": {"; - WriteProperty("boundLeft", posInfo.BoundLeft()); - WriteProperty("boundRight", posInfo.BoundRight()); WriteProperty("sourceLineNum", posInfo.LineNumber()); - WriteProperty("wholeLine", posInfo.WholeLine(), false); Indent(); ss_ << "}" << std::endl; } -- Gitee