-
-
Notifications
You must be signed in to change notification settings - Fork 219
Improvements for unwind-protect #877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements for unwind-protect #877
Conversation
For easier debugging
Because the new API is now more general than just evaluation of R code
@eddelbuettel Would you like to rename |
Codecov Report
@@ Coverage Diff @@
## master #877 +/- ##
=======================================
Coverage 90.09% 90.09%
=======================================
Files 71 71
Lines 3271 3271
=======================================
Hits 2947 2947
Misses 324 324
Continue to review full report at Codecov.
|
oops R CMD check fails on Windows with this branch, will investigate. |
Hi @lionel- -- there is a lot to unpack here. I am wondering if we should split it over several smaller PRs. Lots of it looks really good and like something we can / should do (the plugin, moving to a normal header included included early, ...) but it seems we are wrapping this up with turning more things on automatically which may still be risky. I was also thinking about a release "soon" so maybe doing this in parts may be safer? |
Sorry I didn't understand that. What do you mean?
I have put off all new/risky things for later PRs that I will send after the release. I think almost all of this should be in the next release:
On the other hand including Oh and also I meant to remove the default argument of Likewise, it would be preferable to rename fast_eval to make it consistent with the rest of the Rcpp API before release. |
60472f3
to
40872fc
Compare
It was not Windows but on 3.5 in general, my bad for not checking the last commit properly. Now fixed. |
Maybe I misread above at first. Does it, or does it not, turn the new behaviour on by default? Last time we still had three important packages fail. Can you clarify? |
The plugin is for enabling unwind-protect, which is disabled by default. The three package fails were actually normal failures but I've prepared some tools to help fix those. I will send a new PR after the release. Any objection to including the following commit to this PR? lionel-@2ba5095 It removes the default argument for fast_eval(). This commit passes R CMD check on mac, Linux, Windows, with R 3.4 and R 3.5. |
Yes toss it in. May as well test all at once. |
What about renaming to |
Yes we can do that but we don't have to do it for this round of testing. We have time to do that I think. |
"No change to worse", ie no new rev.dep failures in this PR relative to the master branch, so merging in. |
Add a plugin for enabling unwind-protect. Using
// [[Rcpp::plugins(unwindProtect)]]
is safer than#define
because the plugin ensures unwind-protect is enabled in all compilation units including RcppExports.cpp. This avoids linking issues.Make
LongjumpException
public. Users should catch and rethrow it beforecatch (...)
so longjumps are not ignored.Move
unwindProtect()
to Rcpp/unwindProtect.h. Include it early in RcppCommon to make it available in other header files. This will be useful for calling into R APIs for initialising static variables etc (more on that later).Rename
RCPP_PROTECTED_EVAL
toRCPP_USE_UNWIND_PROTECT
. ThenRCPP_USING_UNWIND_PROTECT
is defined in headers.h if the R version is sufficient. The latter define can be used in the rest of header files.Refactor unit tests so that the unwound indicator is an environment rather than a logical vector. I got into trouble with the latter because the bytecode compiler replaces scalar logical with globally shared
TRUE
orFALSE
values. Mutating these values corrupts the runtime.Pass
...
fromunitTestSetup()
tosourceCpp()
for easy debugging.