You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Gecode 7: pass large parameters by const reference - #288
Several Gecode APIs took owned handles, argument arrays, callbacks, and FloatVal by value even when they only read them, paying for reference-count updates or allocations on every call. This PR enables performance-unnecessary-value-param and updates the codebase to match.
The parameter rule added to docs/code-style.md splits types into two groups:
Shallow handles stay passed by value (listed in the check's AllowedTypes): Home, groups, Pos, Reify, variables (IntVar, etc.), variable arrays, ViewArray, open lists, and views. Copying one copies a few pointers or ids with no allocation or reference count.
Reference-counted and owning types (SharedHandle subclasses such as IntSet, TupleSet, DFA, Rnd, Action, and CHB, SharedArray, *Args, REG, strings, and callbacks) along with FloatVal (two doubles, not a handle) are now taken by const& when only read, or taken by value and moved with std::move when stored.
Most of the diff is mechanical, split into commits by area to keep review manageable:
Branch configuration handles, moving brancher filter and print callbacks into SharedData storage so they are moved rather than copied.
CBS hooks, shared posting data, execution callbacks, open lists, and tracing.
FlatZinc, Gist, search, tests, and examples.
FloatVal, in its own commit.
The last commit enables performance-unnecessary-value-param in .clang-tidy and documents the rule in docs/code-style.md.
Stack
Merge in this order. #242, #282, #283, #241, #284, and #285 are merged. #286 targets main, and each later PR builds on the one before it so its diff shows only its own commits. The first four PRs are standalone search and random-number changes; #284 through #274 are the Gecode 7 changes split out of what used to be a single branch.
Gecode 7.0.0 updates parameter signatures across branching, assignment, floating-point constraints, tracing, and other APIs. Calls generally compile unchanged, but overrides of `solution-distribution or domain-size-sum methods must now use const-reference parameters.
Functions that retain by-value arguments now require those types to be movable.
Performance
Callback and other retained values are moved into place where supported, while shallow handles continue to be passed by value.
Review was skipped as selected files did not have any reviewable changes.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 1af61cb9-aa10-42b8-856b-413163c038dd
Commits
Reviewing files that changed from the base of the PR and between 3300f02 and 52dad66.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Changes: Parameter and ownership updates
Layer / File(s)
Summary
Parameter-passing rules and examples .clang-tidy, changelog.in, docs/code-style.md, examples/*
The clang-tidy configuration enables performance-unnecessary-value-param and lists allowed shallow-handle types. The style guide and changelog document const-reference and move conventions. Two examples change parameters to const references.
Kernel branch objects, wait propagators, and trace recorders move callbacks into storage or forwarding calls. SharedData adds a constrained move-taking constructor and retains its copy-taking constructor. Related callbacks and retained values are moved in other execution and test paths. A test checks SharedData construction with copyable, non-movable data.
Integer and Boolean branching declarations and implementations use const references for strategy objects. Branching and LDSB forwarding paths move filters and print callbacks. FlatZinc selectors and related tests use the updated parameter conventions.
Float branching APIs and forwarding gecode/float.hh, gecode/float/branch*
Float branching and assignment strategies use const-reference parameters where applicable. Posting and forwarding paths move filters and print callbacks.
Float constraint, view, expression, test, relaxation, and tracing parameters change to const references where applicable. The shown constraint and comparison logic remains unchanged.
Integer counting, distinct, element, extensional, and sequence APIs use const references for read-only parameters. Integer and Boolean relaxation and tracing declarations also use const references.
Set branching, weights, and LDSB gecode/set.hh, gecode/set/*
Set branching strategies and shared arrays use const references. Branching and LDSB paths move callbacks. Relaxation and tracing parameters use const references.
FlatZinc parser and black-box paths, Gist names, minimodel inputs, and profiler names update parameter passing or ownership transfer. Related test helpers use the updated conventions.
Possibly related PRs
Gecode/gecode#291: It changes FloatVal and Float::ScaleView type properties related to the value-parameter rule enabled here.
Change: Refactor
Merge Risk: Low · previous review 3300f
This change switches many Gecode API parameters to const references or move semantics. It is documented in the changelog as an ABI change, so downstream code needs to be recompiled, and custom propagator overrides must be updated. No concrete defect was found in the reviewed changes.
Security architecture risk: Low · up to 3300f
The main risk is binary compatibility, not expanded access. If a build from this revision replaces the previous shared libraries without a new ABI version, applications built against the old signatures can fail to load or resolve symbols. The break is documented for the unreleased Gecode 7, and the updated consumer checks target the new signatures.
Retained concerns
Low · architecture · inferred: The head changes public binary signatures but retains the base shared-library ABI version. If this build is distributed as a replacement, the loader can select it for an older consumer even though changed symbols no longer match. The unreleased Gecode 7 heading documents the intended break but does not isolate intermediate builds or make a library-only rollback compatible.
Security review details
Trust Boundaries and Controls
observed — In the inspected open-list path, the PR forwards the same caller-supplied filter and printer to the existing brancher policies. It retains the posting guard and selector validation rather than adding an alternate route around either check.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 0ad59182-9f5d-4b7b-a699-36046653f2dd
Commits
Reviewing files that changed from the base of the PR and between 99fcd12 and 3300f02.
Files selected for processing: 2
docs/code-style.md
gecode/kernel/branch/tiebreak.hpp
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
The Qt consumer smokes take the string of Comparator::compare by const
reference to match.
Zdev-Change-Id: Za9107647ee8a830efc792dd21dd7b38a4435f208b81cc6f685607cf606421094
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several Gecode APIs took owned handles, argument arrays, callbacks, and
FloatValby value even when they only read them, paying for reference-count updates or allocations on every call. This PR enablesperformance-unnecessary-value-paramand updates the codebase to match.The parameter rule added to
docs/code-style.mdsplits types into two groups:AllowedTypes):Home, groups,Pos,Reify, variables (IntVar, etc.), variable arrays,ViewArray, open lists, and views. Copying one copies a few pointers or ids with no allocation or reference count.SharedHandlesubclasses such asIntSet,TupleSet,DFA,Rnd,Action, andCHB,SharedArray,*Args,REG, strings, and callbacks) along withFloatVal(two doubles, not a handle) are now taken byconst&when only read, or taken by value and moved withstd::movewhen stored.Most of the diff is mechanical, split into commits by area to keep review manageable:
SharedDatastorage so they are moved rather than copied.FloatVal, in its own commit.The last commit enables
performance-unnecessary-value-paramin.clang-tidyand documents the rule indocs/code-style.md.Stack
Merge in this order. #242, #282, #283, #241, #284, and #285 are merged. #286 targets
main, and each later PR builds on the one before it so its diff shows only its own commits. The first four PRs are standalone search and random-number changes; #284 through #274 are the Gecode 7 changes split out of what used to be a single branch.Summary by CodeRabbit