Repository navigation
run the module body only once per dll - #1528
kevinushey wants to merge 3 commits into
Conversation
|
I have a new 'PLAN.md' from the LLM, derived on 'master plus #1526 rebased'. Plan: Implement PR #1528 -- run the module body only once per dllSummary of findings
Local verification of the codebase
AssessmentCorrect and well-scoped. The fix addresses the reported duplication at the Concerns
Implementation steps1.
|
0354a9b to
0f6dad8
Compare
|
Here is an updated review of the rebased PR. Plan (v2): Review PR #1528 against the merged PR #1526Summary of findings
Local verification of the codebase
AssessmentPR #1528 is in order and remains valid on top of the updated #1526. The
The #1528 test is the current, more robust form: it locates the DLL that owns Concerns
Implementation stepsBecause #1528 is already present and correct, this plan requires no code 1. Confirm the snapshot contents (done)
2. Optional, only if explicitly instructed
Verification
Open questions
|
|
I made the suggested one-line change to ChangeLog, and also remove two redundant 'date' paragraph headers. |
Fixes #1527. Stacked on #1526 (same macro); the base branch is
bugfix/module-boot-exceptions, so the diff here only shows this change. Once #1526 is merged I'll retarget this tomaster.Module("name", PACKAGE = ...)calls the module's boot function every time it is given a module name, and the boot function re-ran theRCPP_MODULEbody each time. The body adds to astatic Rcpp::Modulethat lives as long as the DLL, so every load appended another copy of each constructor and method overload, which shows up inshow()and leaks. See #1527 for the reprex.Change (
inst/include/Rcpp/Module.h,RCPP_MODULE):static boolflag next to the staticRcpp::Modulerecords that the body has completed; later calls of the boot function skip the body and just return the module pointer. The flag lives in the same DLL instance as the module object, so a DLL that is unloaded and loaded again starts over with a fresh module and flag, as it should.As with #1526, this is confined to the macro and applies once a package is rebuilt.
Test (
inst/tinytest/test_module.R): aftersourceCpp()has loadeddemoModule, load it twice more withModule(..., mustStart = TRUE)and check thatModuleWorldstill has one constructor and onegreet()overload. It sits at the end of the file becauseModule()redefines the module's reference classes.Verification:
1 constructor(s), 1 overload(s) of inc()on every iteration with this branch;show()lists a single constructor and method.Expected '1', got '3'). With it,test_module.R(49/49),test_modref.R,test_expose_class.Randtest_module_client_package.Rpass withRunAllRcppTests=yes RunVerboseRcppTests=yes(R 4.6.1, macOS).Checklist
R CMD checkstill passes all tests (module test files run locally as above)