From 0ce96821d5d10b8f7385ff4662e70d7c54c6dbdc Mon Sep 17 00:00:00 2001 From: Mikhail Sherstennikov Date: Tue, 2 Aug 2022 17:05:32 +0300 Subject: [PATCH] Support bytecode profiling Signed-off-by: Mikhail Sherstennikov --- aot/main.cpp | 5 +++++ compiler/templates/formats.h.erb | 2 ++ 2 files changed, 7 insertions(+) diff --git a/aot/main.cpp b/aot/main.cpp index 79c919ecd..c0eb079b2 100644 --- a/aot/main.cpp +++ b/aot/main.cpp @@ -76,6 +76,11 @@ static int GenerateProgram(panda::pandasm::Program *prog, const std::string &out es2panda::Compiler::DumpAsm(prog); } + if (!panda::pandasm::AsmEmitter::AssignProfileInfo(prog)) { + std::cerr << "AssignProfileInfo failed" << std::endl; + return 1; + } + if (!panda::pandasm::AsmEmitter::Emit(output, *prog, statp, mapsp, true)) { return 1; } diff --git a/compiler/templates/formats.h.erb b/compiler/templates/formats.h.erb index 71b9587a0..e1f189982 100644 --- a/compiler/templates/formats.h.erb +++ b/compiler/templates/formats.h.erb @@ -44,6 +44,8 @@ namespace panda::es2panda::compiler { % elsif op.id? % is_string_id = insn.properties.include? 'string_id' % return is_string_id ? "OperandKind::STRING_ID" : "OperandKind::ID" +% elsif op.prof? +% return "OperandKind::IMM" % else % return nil % end -- Gitee