mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-06 23:54:03 +00:00
!4760 bugfix about combined pass visitor
Merge pull request !4760 from yycc/bugfix
This commit is contained in:
commit
c633d4a865
@ -152,6 +152,9 @@ void CombinedPassVisitor::VisitTopGate(Edge& current)
|
||||
}
|
||||
auto numIns = acc_.GetNumIns(gate);
|
||||
auto start = current.GetIndex();
|
||||
if (start >= numIns) {
|
||||
start = 0;
|
||||
}
|
||||
for (size_t i = start; i < numIns; i++) {
|
||||
GateRef input = acc_.GetIn(gate, i);
|
||||
if (input == gate) {
|
||||
|
@ -19,13 +19,28 @@
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
|
||||
GateRef NTypeHCRLowering::VisitGate(GateRef gate)
|
||||
void NTypeHCRLowering::RunNTypeHCRLowering()
|
||||
{
|
||||
auto op = acc_.GetOpCode(gate);
|
||||
if (op == OpCode::JS_BYTECODE) {
|
||||
Lower(gate);
|
||||
std::vector<GateRef> gateList;
|
||||
circuit_->GetAllGates(gateList);
|
||||
for (const auto &gate : gateList) {
|
||||
auto op = acc_.GetOpCode(gate);
|
||||
if (op == OpCode::JS_BYTECODE) {
|
||||
Lower(gate);
|
||||
}
|
||||
}
|
||||
|
||||
if (IsLogEnabled()) {
|
||||
LOG_COMPILER(INFO) << "";
|
||||
LOG_COMPILER(INFO) << "\033[34m"
|
||||
<< "===================="
|
||||
<< " After NTypeHCRlowering "
|
||||
<< "[" << GetMethodName() << "]"
|
||||
<< "===================="
|
||||
<< "\033[0m";
|
||||
circuit_->PrintAllGatesWithBytecode();
|
||||
LOG_COMPILER(INFO) << "\033[34m" << "========================= End ==========================" << "\033[0m";
|
||||
}
|
||||
return Circuit::NullGate();
|
||||
}
|
||||
|
||||
void NTypeHCRLowering::Lower(GateRef gate)
|
||||
|
@ -20,29 +20,29 @@
|
||||
#include "ecmascript/compiler/builtins/builtins_call_signature.h"
|
||||
#include "ecmascript/compiler/bytecode_circuit_builder.h"
|
||||
#include "ecmascript/compiler/circuit_builder-inl.h"
|
||||
#include "ecmascript/compiler/combined_pass_visitor.h"
|
||||
#include "ecmascript/compiler/pass_manager.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
class NTypeHCRLowering : public PassVisitor {
|
||||
class NTypeHCRLowering {
|
||||
public:
|
||||
NTypeHCRLowering(Circuit *circuit, RPOVisitor *visitor, PassContext *ctx, TSManager *tsManager,
|
||||
const MethodLiteral *methodLiteral, const CString &recordName, Chunk *chunk)
|
||||
: PassVisitor(circuit, chunk, visitor),
|
||||
circuit_(circuit),
|
||||
NTypeHCRLowering(Circuit *circuit, PassContext *ctx, TSManager *tsManager, const MethodLiteral *methodLiteral,
|
||||
const CString &recordName, bool enableLog, const std::string& name)
|
||||
: circuit_(circuit),
|
||||
acc_(circuit),
|
||||
builder_(circuit, ctx->GetCompilerConfig()),
|
||||
recordName_(recordName),
|
||||
tsManager_(tsManager),
|
||||
jsPandaFile_(ctx->GetJSPandaFile()),
|
||||
methodLiteral_(methodLiteral),
|
||||
enableLog_(enableLog),
|
||||
profiling_(ctx->GetCompilerConfig()->IsProfiling()),
|
||||
traceBc_(ctx->GetCompilerConfig()->IsTraceBC()),
|
||||
methodName_(name),
|
||||
glue_(acc_.GetGlueFromArgList()) {}
|
||||
|
||||
~NTypeHCRLowering() = default;
|
||||
|
||||
GateRef VisitGate(GateRef gate) override;
|
||||
void RunNTypeHCRLowering();
|
||||
private:
|
||||
void Lower(GateRef gate);
|
||||
void LowerNTypedCreateEmptyArray(GateRef gate);
|
||||
@ -54,11 +54,21 @@ private:
|
||||
void LowerThrowUndefinedIfHoleWithName(GateRef gate);
|
||||
uint64_t GetBcAbsoluteOffset(GateRef gate) const;
|
||||
|
||||
bool IsLogEnabled() const
|
||||
{
|
||||
return enableLog_;
|
||||
}
|
||||
|
||||
bool IsProfiling() const
|
||||
{
|
||||
return profiling_;
|
||||
}
|
||||
|
||||
const std::string& GetMethodName() const
|
||||
{
|
||||
return methodName_;
|
||||
}
|
||||
|
||||
bool IsTraceBC() const
|
||||
{
|
||||
return traceBc_;
|
||||
@ -72,8 +82,10 @@ private:
|
||||
TSManager *tsManager_ {nullptr};
|
||||
const JSPandaFile *jsPandaFile_ {nullptr};
|
||||
const MethodLiteral *methodLiteral_ {nullptr};
|
||||
bool enableLog_ {false};
|
||||
bool profiling_ {false};
|
||||
bool traceBc_ {false};
|
||||
std::string methodName_;
|
||||
GateRef glue_ {Circuit::NullGate()};
|
||||
};
|
||||
} // panda::ecmascript::kungfu
|
||||
|
@ -310,13 +310,9 @@ public:
|
||||
}
|
||||
TimeScope timescope("NTypeHCRLoweringPass", data->GetMethodName(), data->GetMethodOffset(), data->GetLog());
|
||||
bool enableLog = data->GetLog()->EnableMethodCIRLog();
|
||||
Chunk chunk(data->GetNativeAreaAllocator());
|
||||
CombinedPassVisitor visitor(data->GetCircuit(), enableLog, data->GetMethodName(), &chunk);
|
||||
NTypeHCRLowering lowering(data->GetCircuit(), &visitor, data->GetPassContext(),
|
||||
data->GetTSManager(), data->GetMethodLiteral(), data->GetRecordName(), &chunk);
|
||||
visitor.AddPass(&lowering);
|
||||
visitor.VisitGraph();
|
||||
visitor.PrintLog("NTypeHCRlowering");
|
||||
NTypeHCRLowering lowering(data->GetCircuit(), data->GetPassContext(), data->GetTSManager(),
|
||||
data->GetMethodLiteral(), data->GetRecordName(), enableLog, data->GetMethodName());
|
||||
lowering.RunNTypeHCRLowering();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user