Skip to content
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

control libffi dependency with SOUFFLE_USE_LIBFFI #2188

Merged
merged 2 commits into from
Mar 5, 2022

Conversation

quentin
Copy link
Member

@quentin quentin commented Feb 15, 2022

Hi, the goal of this change is allow building Souffle without libffi and still provide some user-defined functors capabilities in interpreted mode.

When SOUFFLE_USE_LIBFFI=OFF:

  • stateful user-defined functors are supported in interpreted mode up to arity 16.
  • stateless user-defined functors are supported in interpreted mode up to arity 2 (all combinations of return and argument types available).
  • those arity limits are hard-coded but easy to modify.

When SOUFFLE_USE_LIBFFI=ON (default):

  • the user-defined functors are called using the non-libffi method when arity allows it.
  • otherwise the libffi method is used.

This change also moves some operations to avoid repeating them at each call of a user-defined functor:

  • functor libraries are loaded before node generation.
  • functor C functions are looked-up during node generation and the function pointer is stored in the node.
  • libffi dynamic call structures are prepared in advance during node generation and stored in the node.

@quentin quentin marked this pull request as ready for review February 15, 2022 07:40
@quentin quentin force-pushed the nolibffi branch 2 times, most recently from 7110be8 to 2f8907b Compare February 15, 2022 09:00
@codecov
Copy link

codecov bot commented Feb 15, 2022

Codecov Report

Merging #2188 (f1b1eee) into master (bfc54a5) will decrease coverage by 0.08%.
The diff coverage is 78.78%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2188      +/-   ##
==========================================
- Coverage   75.59%   75.51%   -0.09%     
==========================================
  Files         452      452              
  Lines       27259    27355      +96     
==========================================
+ Hits        20607    20657      +50     
- Misses       6652     6698      +46     
Impacted Files Coverage Δ
src/ast/Aggregator.h 100.00% <ø> (ø)
src/ast/Clause.h 100.00% <ø> (ø)
src/ast/FunctorDeclaration.cpp 38.09% <ø> (ø)
src/ast/analysis/typesystem/Type.cpp 45.84% <0.00%> (ø)
src/ast/analysis/typesystem/TypeSystem.h 84.33% <0.00%> (ø)
src/ast/transform/InlineRelations.cpp 66.10% <0.00%> (ø)
src/ast/transform/RemoveRedundantSums.cpp 50.00% <0.00%> (ø)
src/ast/utility/SipsMetric.cpp 21.33% <ø> (ø)
src/ast/utility/Utils.cpp 91.47% <ø> (ø)
src/ast/utility/Utils.h 100.00% <ø> (ø)
... and 50 more

Copy link
Member

@b-scholz b-scholz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@b-scholz b-scholz merged commit 39c20d5 into souffle-lang:master Mar 5, 2022
@quentin quentin deleted the nolibffi branch March 15, 2022 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants