Skip to content

Commit

Permalink
remove useless comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sy0307 committed Mar 2, 2025
1 parent cdd6b82 commit 7de548b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
5 changes: 2 additions & 3 deletions vm/compat/include/bpftime_vm_compat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,12 @@ using create_vm_instance_func = std::unique_ptr<bpftime_vm_impl>(*)();

namespace detail {
inline std::map<std::string, create_vm_instance_func>& get_vm_factory_map() {
// printf("get vm factory map\n");
static std::map<std::string, create_vm_instance_func> factory_map;
return factory_map;
}
}

inline std::unique_ptr<bpftime_vm_impl> create_vm_instance(const char *vm_name_str) { // 内联实现
inline std::unique_ptr<bpftime_vm_impl> create_vm_instance(const char *vm_name_str) {
if (vm_name_str == nullptr) {
SPDLOG_ERROR("VM name string is null");
throw std::runtime_error("VM name cannot be null");
Expand All @@ -218,7 +217,7 @@ inline std::unique_ptr<bpftime_vm_impl> create_vm_instance(const char *vm_name_s
}


inline void register_vm_factory(const std::string &vm_name, create_vm_instance_func factory_func) { // 内联实现
inline void register_vm_factory(const std::string &vm_name, create_vm_instance_func factory_func) {
auto& vm_factory_map = detail::get_vm_factory_map();
if (vm_factory_map.count(vm_name)) {
SPDLOG_WARN("VM factory for name: {} already registered, overwriting", vm_name);
Expand Down
4 changes: 1 addition & 3 deletions vm/compat/llvm-vm/compat_llvm.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <bpftime_vm_compat.hpp>
#include <compat_llvm.hpp>
#include <optional>
#include <memory> // 确保包含 memory 头文件,使用 std::make_unique 和 std::unique_ptr
#include <memory>

namespace bpftime::vm::compat
{
Expand Down Expand Up @@ -73,8 +73,6 @@ namespace bpftime::vm::compat
{
namespace llvm
{

// 静态构造函数,用于注册 LLVM VM 工厂函数
__attribute__((constructor)) static inline void register_llvm_vm_factory()
{
register_vm_factory("llvm", create_llvm_vm_instance);
Expand Down
3 changes: 0 additions & 3 deletions vm/vm-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ target_include_directories(bpftime_vm PRIVATE ./include INTERFACE ./include)
message("The runtime is ${BPFTIME_BPF_RUNTIME_NAME}")

if(BPFTIME_LLVM_JIT AND BPFTIME_UBPF_JIT)
# 如果两个 JIT 都启用
target_link_options(bpftime_vm PUBLIC "-Wl,--whole-archive" "$<TARGET_FILE:bpftime_ubpf_vm>" "$<TARGET_FILE:bpftime_llvm_vm>" "-Wl,--no-whole-archive")
elseif(BPFTIME_LLVM_JIT)
# 如果只启用 LLVM JIT
target_link_options(bpftime_vm PUBLIC "-Wl,--whole-archive" "$<TARGET_FILE:bpftime_llvm_vm>" "-Wl,--no-whole-archive")
elseif(BPFTIME_UBPF_JIT)
# 如果只启用 UBPF JIT
target_link_options(bpftime_vm PUBLIC "-Wl,--whole-archive" "$<TARGET_FILE:bpftime_ubpf_vm>" "-Wl,--no-whole-archive")
endif()

Expand Down

0 comments on commit 7de548b

Please sign in to comment.