Skip to content
This repository was archived by the owner on Nov 11, 2024. It is now read-only.

Commit eb88144

Browse files
committed
Update plugify
1 parent 23941e5 commit eb88144

File tree

4 files changed

+19
-22
lines changed

4 files changed

+19
-22
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
124124
MONOLM_PLATFORM_WINDOWS=$<BOOL:${WIN32}>
125125
MONOLM_PLATFORM_APPLE=$<BOOL:${APPLE}>
126126
MONOLM_PLATFORM_LINUX=$<BOOL:${LINUX}>
127+
MONOLM_IS_DEBUG=$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>
127128
)
128129

129130
set(MONOLM_VERSION "0" CACHE STRING "Set version name")

src/module.cpp

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,7 +2266,7 @@ LoadResult CSharpLanguageModule::OnPluginLoad(PluginRef plugin) {
22662266
_functions.emplace(exportMethod.get(), std::move(function));
22672267
_exportMethods.emplace_back(std::move(exportMethod));
22682268

2269-
methods.emplace_back(method.GetName(), methodAddr);
2269+
methods.emplace_back(method, methodAddr);
22702270
}
22712271

22722272
if (!methodErrors.empty()) {
@@ -2281,35 +2281,30 @@ LoadResult CSharpLanguageModule::OnPluginLoad(PluginRef plugin) {
22812281
}
22822282

22832283
void CSharpLanguageModule::OnMethodExport(PluginRef plugin) {
2284-
for (const auto& [name, addr] : plugin.GetMethods()) {
2284+
for (const auto& [method, addr] : plugin.GetMethods()) {
22852285
auto pluginName = plugin.GetName();
2286-
auto funcName = std::format("{}.{}::{}", pluginName, pluginName, name);
2286+
auto funcName = std::format("{}.{}::{}", pluginName, pluginName, method.GetName());
22872287

22882288
if (_importMethods.contains(funcName)) {
22892289
_provider->Log(std::format(LOG_PREFIX "Method name duplicate: {}", funcName), Severity::Error);
22902290
continue;
22912291
}
22922292

2293-
for (const auto& method : plugin.GetDescriptor().GetExportedMethods()) {
2294-
if (name == method.GetName()) {
2295-
if (IsMethodPrimitive(method)) {
2296-
mono_add_internal_call(funcName.c_str(), addr);
2297-
} else {
2298-
Function function(_rt);
2299-
MemAddr methodAddr = function.GetJitFunc(method, &ExternalCall, addr, [](ValueType type) { return ValueUtils::IsBetween(type, ValueType::_HiddenParamStart, ValueType::_StructEnd); });
2300-
if (!methodAddr) {
2301-
_provider->Log(std::format(LOG_PREFIX "{}: {}", method.GetFunctionName(), function.GetError()), Severity::Error);
2302-
continue;
2303-
}
2304-
_functions.emplace(methodAddr, std::move(function));
2305-
2306-
mono_add_internal_call(funcName.c_str(), methodAddr);
2307-
}
2308-
2309-
_importMethods.emplace(std::move(funcName)/*, ImportMethod{method, addr}*/);
2310-
break;
2293+
if (IsMethodPrimitive(method)) {
2294+
mono_add_internal_call(funcName.c_str(), addr);
2295+
} else {
2296+
Function function(_rt);
2297+
MemAddr methodAddr = function.GetJitFunc(method, &ExternalCall, addr, [](ValueType type) { return ValueUtils::IsBetween(type, ValueType::_HiddenParamStart, ValueType::_StructEnd); });
2298+
if (!methodAddr) {
2299+
_provider->Log(std::format(LOG_PREFIX "{}: {}", method.GetFunctionName(), function.GetError()), Severity::Error);
2300+
continue;
23112301
}
2302+
_functions.emplace(methodAddr, std::move(function));
2303+
2304+
mono_add_internal_call(funcName.c_str(), methodAddr);
23122305
}
2306+
2307+
_importMethods.emplace(std::move(funcName)/*, ImportMethod{method, addr}*/);
23132308
}
23142309
}
23152310

src/module.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ namespace monolm {
106106
void OnPluginStart(plugify::PluginRef plugin) override;
107107
void OnPluginEnd(plugify::PluginRef plugin) override;
108108
void OnMethodExport(plugify::PluginRef plugin) override;
109+
bool IsDebugBuild() override { return MONOLM_IS_DEBUG; };
109110

110111
const ScriptMap& GetScripts() const { return _scripts; }
111112
ScriptInstance* FindScript(plugify::UniqueId id);

0 commit comments

Comments
 (0)