Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
apk-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
61
Issues
61
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
apk-tools
Commits
01d0e4c4
Commit
01d0e4c4
authored
Oct 08, 2012
by
Timo Teräs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
solver: optimize backjumping
to be functional when backtracking
parent
831bce5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
src/apk_package.h
src/apk_package.h
+2
-1
src/solver.c
src/solver.c
+7
-7
No files found.
src/apk_package.h
View file @
01d0e4c4
...
...
@@ -60,7 +60,8 @@ struct apk_sign_ctx {
struct
apk_dependency
{
struct
apk_name
*
name
;
apk_blob_t
*
version
;
unsigned
short
repository_tag
;
unsigned
solver_state
:
22
;
unsigned
repository_tag
:
6
;
unsigned
conflict
:
1
;
unsigned
result_mask
:
3
;
};
...
...
src/solver.c
View file @
01d0e4c4
...
...
@@ -1029,8 +1029,10 @@ static void apply_constraint(struct apk_solver_state *ss, struct apk_dependency
}
}
if
(
name
->
ss
.
last_touched_decision
==
0
||
changed
)
if
(
name
->
ss
.
last_touched_decision
==
0
||
changed
)
{
dep
->
solver_state
=
name
->
ss
.
last_touched_decision
;
name
->
ss
.
last_touched_decision
=
ss
->
num_decisions
;
}
if
(
!
dep
->
conflict
)
{
dbg_printf
(
"%s requirers += %d
\n
"
,
name
->
name
,
strength
);
...
...
@@ -1099,12 +1101,10 @@ static void undo_constraint(struct apk_solver_state *ss, struct apk_dependency *
}
}
/* note: for perfection, we should revert here to the
* *previous* value, but that'd require keeping track
* of it which would require dynamic memory allocations
* or additional solver state field in apk_dependency
* to store it (or hefty recalculations). */
name
->
ss
.
last_touched_decision
=
0
;
if
(
dep
->
solver_state
)
{
name
->
ss
.
last_touched_decision
=
dep
->
solver_state
;
dep
->
solver_state
=
0
;
}
if
(
!
dep
->
conflict
)
{
name
->
ss
.
requirers
-=
strength
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment