Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Open Source Software
Zipr Backend
Commits
a83b4e65
Commit
a83b4e65
authored
9 years ago
by
whh8b
Browse files
Options
Downloads
Patches
Plain Diff
Add UpdateAllTargets() and fix bugs in UpdateTargets
parent
c94c0202
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/zipr_dollop_man.h
+2
-1
2 additions, 1 deletion
include/zipr_dollop_man.h
src/zipr_dollop_man.cpp
+44
-10
44 additions, 10 deletions
src/zipr_dollop_man.cpp
with
46 additions
and
11 deletions
include/zipr_dollop_man.h
+
2
−
1
View file @
a83b4e65
...
...
@@ -54,7 +54,8 @@ class ZiprDollopManager_t {
return
m_patches_to_dollops
.
at
(
target
);
}
void
PrintDollopPatches
(
const
std
::
ostream
&
);
void
UpdateTargets
(
Dollop_t
*
);
bool
UpdateTargets
(
Dollop_t
*
);
void
UpdateAllTargets
();
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
ZiprDollopManager_t
&
dollop_man
);
private
:
std
::
list
<
Dollop_t
*>
m_dollops
;
...
...
This diff is collapsed.
Click to expand it.
src/zipr_dollop_man.cpp
+
44
−
10
View file @
a83b4e65
...
...
@@ -11,6 +11,7 @@ namespace zipr {
Dollop_t
*
ZiprDollopManager_t
::
AddNewDollop
(
Instruction_t
*
start
)
{
Dollop_t
*
new_dollop
=
NULL
;
Dollop_t
*
existing_dollop
=
GetContainingDollop
(
start
);
/*
* This is the target dollop *only*
* if the target instruction is the first instruction.
...
...
@@ -80,19 +81,52 @@ namespace zipr {
m_dollops
.
push_back
(
dollop
);
}
void
ZiprDollopManager_t
::
UpdateTargets
(
Dollop_t
*
dollop
)
{
bool
ZiprDollopManager_t
::
UpdateTargets
(
Dollop_t
*
dollop
)
{
list
<
DollopEntry_t
*>::
iterator
it
,
it_end
;
for
(
it
=
dollop
->
begin
(),
it_end
=
dollop
->
end
();
it
!=
it_end
;
it
++
)
{
DollopEntry_t
*
entry
=
*
it
;
if
(
entry
->
Instruction
()
&&
entry
->
Instruction
()
->
GetTarget
())
{
bool
changed
=
false
;
bool
local_changed
=
false
;
do
{
local_changed
=
false
;
for
(
it
=
dollop
->
begin
(),
it_end
=
dollop
->
end
();
it
!=
it_end
;
/* nop */
)
{
DollopEntry_t
*
entry
=
*
it
;
it
++
;
if
(
entry
->
Instruction
()
&&
entry
->
Instruction
()
->
GetTarget
())
{
Dollop_t
*
new_target
=
AddNewDollop
(
entry
->
Instruction
()
->
GetTarget
());
entry
->
TargetDollop
(
AddNewDollop
(
entry
->
Instruction
()
->
GetTarget
()));
/*
* In the case there is a change, we have to restart.
* The dollop that we are updating could itself have
* contained the target and the call would have
* split this dollop. That makes the iterator go
* haywire.
*/
if
(
new_target
!=
entry
->
TargetDollop
())
{
entry
->
TargetDollop
(
new_target
);
changed
=
local_changed
=
true
;
break
;
}
}
}
}
return
;
}
while
(
local_changed
);
return
changed
;
}
void
ZiprDollopManager_t
::
UpdateAllTargets
(
void
)
{
std
::
list
<
Dollop_t
*>::
const_iterator
it
,
it_end
;
bool
changed
=
false
;
do
{
changed
=
false
;
for
(
it
=
m_dollops
.
begin
(),
it_end
=
m_dollops
.
end
();
it
!=
m_dollops
.
end
();
/* nop */
)
{
Dollop_t
*
entry
=
*
it
;
it
++
;
changed
|=
UpdateTargets
(
entry
);
}
}
while
(
changed
);
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
ZiprDollopManager_t
&
dollop_man
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment