代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/pin-server 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 5be0d63fe19decadaebb012efeb03b75aa868228 Mon Sep 17 00:00:00 2001
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
Date: Tue, 21 Feb 2023 16:52:39 +0800
Subject: [PATCH 06/23] [Pin-server] Fix bug for BuildCallOp. Now we can
convert the function pointer.
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
index f4062ad..3a88846 100644
--- a/include/Dialect/PluginOps.td
+++ b/include/Dialect/PluginOps.td
@@ -107,11 +107,13 @@ def CallOp : Plugin_Op<"call", [
The arguments list must match the arguments expected by the callee.
}];
let arguments = (ins UI64Attr:$id,
- FlatSymbolRefAttr:$callee,
+ OptionalAttr<FlatSymbolRefAttr>:$callee,
Variadic<AnyType>:$inputs);
let builders = [
OpBuilderDAG<(ins "int64_t":$id, "StringRef":$callee,
"ArrayRef<Value>":$arguments)>,
+ OpBuilderDAG<(ins "int64_t":$id,
+ "ArrayRef<Value>":$arguments)>,
// Only for server.
OpBuilderDAG<(ins "Value":$func,
"ArrayRef<Value>":$arguments, "Block *":$block)>,
diff --git a/lib/Dialect/PluginOps.cpp b/lib/Dialect/PluginOps.cpp
index a49ce16..a30e9ed 100644
--- a/lib/Dialect/PluginOps.cpp
+++ b/lib/Dialect/PluginOps.cpp
@@ -357,6 +357,13 @@ void CallOp::build(OpBuilder &builder, OperationState &state,
state.addAttribute("callee", builder.getSymbolRefAttr(callee));
}
+void CallOp::build(OpBuilder &builder, OperationState &state,
+ int64_t id, ArrayRef<Value> arguments)
+{
+ state.addAttribute("id", builder.getI64IntegerAttr(id));
+ state.addOperands(arguments);
+}
+
/// Return the callee of the generic call operation, this is required by the
/// call interface.
CallInterfaceCallable CallOp::getCallableForCallee()
diff --git a/lib/PluginServer/PluginJson.cpp b/lib/PluginServer/PluginJson.cpp
index d89945c..7bbf681 100755
--- a/lib/PluginServer/PluginJson.cpp
+++ b/lib/PluginServer/PluginJson.cpp
@@ -467,10 +467,16 @@ mlir::Operation *PluginJson::CallOpJsonDeSerialize(const string& data)
ops.push_back(opValue);
}
int64_t id = GetID(node["id"]);
- mlir::StringRef callName(node["callee"].asString());
mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder();
- CallOp op = opBuilder->create<CallOp>(opBuilder->getUnknownLoc(),
- id, callName, ops);
+ Json::Value calleeJson = node["callee"];
+ CallOp op;
+ if (calleeJson.isNull()) {
+ op = opBuilder->create<CallOp>(opBuilder->getUnknownLoc(), id, ops);
+ } else {
+ mlir::StringRef callName(calleeJson.asString());
+ op = opBuilder->create<CallOp>(opBuilder->getUnknownLoc(),
+ id, callName, ops);
+ }
return op.getOperation();
}
diff --git a/lib/PluginServer/PluginServer.cpp b/lib/PluginServer/PluginServer.cpp
index 05d0d3d..d2a1736 100644
--- a/lib/PluginServer/PluginServer.cpp
+++ b/lib/PluginServer/PluginServer.cpp
@@ -50,7 +50,7 @@ bool PluginServer::RegisterOpt(std::shared_ptr<PluginOptBase> optBase)
string name = "funcname" + std::to_string((uintptr_t)optBase.get());
userOpts[inject].push_back(RecordedOpt(name, optBase));
this->context = optBase->GetContext();
- mlir::OpBuilder opBuilder_temp = mlir::OpBuilder(context);
+ static mlir::OpBuilder opBuilder_temp = mlir::OpBuilder(context);
opBuilder = &opBuilder_temp;
return true;
}
@@ -305,7 +305,7 @@ void PluginServer::RunServer()
ServerSemPost(port);
RegisterCallbacks();
- printf("RunServer: RegisterCallbacks Done.\n");
+ log->LOGI("RunServer: RegisterCallbacks Done.\n");
pluginCom.Run();
}
} // namespace PinServer
diff --git a/lib/PluginServer/main.cpp b/lib/PluginServer/main.cpp
index fac574e..333d55e 100644
--- a/lib/PluginServer/main.cpp
+++ b/lib/PluginServer/main.cpp
@@ -29,7 +29,6 @@ int main(int argc, char** argv)
printf("param num:%d, should be:%d\n", argc, argcNum);
return -1;
}
- printf("main arg: %s, %s\n", argv[0], argv[1]);
std::string port = argv[0];
LogPriority priority = (LogPriority)atoi(argv[1]);
PluginServer server(priority, port);
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。