-
Notifications
You must be signed in to change notification settings - Fork 160
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
Add LoadKernelExtension
, IsKernelExtensionAvailable
#4231
Add LoadKernelExtension
, IsKernelExtensionAvailable
#4231
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea. See my comments.
lib/package.gi
Outdated
|
||
# also add a new mechanism to integrate kernel extensions into a package: | ||
# let the package declare in its PackageInfo.g that it has a kernel extension; | ||
# how to build it; what's its name; then GAP can take care of that dynamically |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the intended new entries in PackageInfo.g
also replace the prerequisites.sh
files used byBuildPackages.sh
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully / perhaps -- it depends a bit on what the package does in there...
ea7194d
to
a0ac0f1
Compare
a0ac0f1
to
5fff8c2
Compare
Codecov Report
@@ Coverage Diff @@
## master #4231 +/- ##
==========================================
- Coverage 82.30% 0 -82.31%
==========================================
Files 678 0 -678
Lines 287790 0 -287790
==========================================
- Hits 236876 0 -236876
+ Misses 50914 0 -50914
|
I've overhauled this now, and IMHO it is mostly ready, except for the lack of documentation. Going beyond this, I wonder if we should add an optional field |
5fff8c2
to
d69a1f9
Compare
I generally like this PR. I have one (larger) comment -- I wonder if we should separate static and dynamic modules more? Is there any evidence we can still (or demand for?) loading extensions as GAP static modules would work? The built-in ones (where we compile some library files with gac) are not handled in the "standard way", READ_GAP_ROOT calls LookupStaticModule. Therefore we could, perhaps, simplify this code some of the general loading code by removing mentions of static modules, and (even) rename 'static' to 'library' or something. Of course, if people want the option in future of doing a big static build, where we static compile extensions, that wouldn't work. |
@ChrisJefferson I am not sure what to make of your comment. It seems orthogonal to the content of this PR? If at all, this PR would help with "getting rid and/or renaming static modules": it removes the need to explicitly call into the APIs for static modules, by providing a fresh abstraction layer. So once we have this PR in, future packages could switch to using The sooner we have this in, the sooner packages could start using it. Conversely, even if we get this into 4.12, it'll take time for this to be adopted by packages. |
I notice that in the manual and various other places, we talk about "kernel modules". I (and some other places/people) use "kernel extension" (possibly a short hand for "kernel extension module") to distinguish it from built-in kernel modules; I guess one could also refer to it as "external kernel module" (but that would not be quite right for "static" kernel extension modules...). Aaaanyway: perhaps I should rename these functions then to |
I also wonder if |
d69a1f9
to
7f2573f
Compare
7f2573f
to
0682df8
Compare
Perhaps we should just merge this? There are plenty more things one could do, but this is already an improvement... |
LoadKernelExtension
, IsKernelExtensionAvailable
The idea is to provide "better" (?) APIs for packages to load kernel extensions. With
IsKernelExtensionAvailable
(and an upcoming kernel function to make it better), packages can simplify theirTestAvailability
functions, and at the same time make them more robust. Likewise,LoadKernelExtension
simplifiesinit.g
code.The big win is that it'll then make it much easier for us to change how to locate and load kernel extensions; e.g. to better support
make install
of packages, or also better Julia integration.Open questions:
LoadKernelModule
andIsKernelModuleAvailable
? Background: in the manual and various other places, we talk about "kernel modules". I (and some other places/people) use "kernel extension" (possibly a short hand for "kernel extension module") to distinguish it from built-in kernel modules; I guess one could also refer to it as "external kernel module" (but that would not be quite right for "static" kernel extension modules...).IsKernelExtensionAvailable
resp.IS_LOADABLE_DYN
should return proper error codes (instead of justfalse
) to indicate what exactly went wrong (file missing / file not a loadable module / file not a GAP kernel extension / kernel extension but built for wrong GAP version / ....). It could even be just a string; in any case, something that helps produce better error messages forAvailabilityTest
inPackageInfo.g
KernelModule
to the package info record, which when present would prompt GAP to automatically invokeIsKernelExtensionAvailable
when checking the package availability; andLoadKernelExtension
when loading the package (possible values:KernelModule := true
= use package name,KernelModule := "modname"
; or evenKernelModule := ["mod1", "mod2"]
if someone wants to support multiple kernel modules in one package. Alas, that seems very fringe, so I'd probably not do it)