diff options
| author | Olivier De Cannière <olivier.decanniere@qt.io> | 2023-07-04 09:39:37 +0200 |
|---|---|---|
| committer | Olivier De Cannière <olivier.decanniere@qt.io> | 2023-07-10 10:56:10 +0200 |
| commit | 55ef0833254d4861059950dad9b935af6c27315c (patch) | |
| tree | 70d6f14a88d31061104a432140e63d02be89114e /src/qml/compiler/qv4codegen.cpp | |
| parent | 4e7a83156d47683f777e92d2790cb617f0bb09d5 (diff) | |
Compiler: Allow dumping the basic blocks for visualization and debugging
If the QV4_DUMP_BASIC_BLOCKS environment variable is set, the compiler
will output the details of the basic blocks of the compiled functions to
the console.
It will also generate a control flow graph containing the byte code in
DOT format for easier visualization and debugging of the program
execution and of the structure of the generated code. The value of
QV4_DUMP_BASIC_BLOCKS will be used as the path to the folder in which to
output the DOT files. If the path is any of ["-", "1", "true"] or if
files can't be opened, it will be dumped to stdout instead.
The logic in dumpByteCode has been adapted to use a QTextStream. This
way it can continue to be used to dump the byte code of the whole
program as before and also to construct the CFG.
Change-Id: If398d795e4fc0950b5fa8ee1349e80b1ae262deb
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
| -rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index d6f2716bbc..f9c4398490 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -3414,8 +3414,9 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, AST::FormalPara if (showCode) { qDebug() << "=== Bytecode for" << _context->name << "strict mode" << _context->isStrict << "register count" << _context->registerCountInFunction << "implicit return" << requiresReturnValue; - QV4::Moth::dumpBytecode(_context->code, _context->locals.size(), _context->arguments.size(), - _context->line, _context->lineAndStatementNumberMapping); + qDebug().noquote() << QV4::Moth::dumpBytecode( + _context->code, _context->locals.size(), _context->arguments.size(), + _context->line, _context->lineAndStatementNumberMapping); qDebug(); } } |
