Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zipr-sdk
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
Show more breadcrumbs
Open Source Software
zipr-sdk
Commits
5343f1a0
Commit
5343f1a0
authored
9 years ago
by
whh8b
Browse files
Options
Downloads
Plain Diff
Merge dollops refactor branch.
parents
ab76a5ae
4e5c62ae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/dollop.h
+79
-3
79 additions, 3 deletions
include/dollop.h
include/zipr.h
+21
-6
21 additions, 6 deletions
include/zipr.h
include/zipr_plugin.h
+3
-5
3 additions, 5 deletions
include/zipr_plugin.h
with
103 additions
and
14 deletions
include/dollop.h
+
79
−
3
View file @
5343f1a0
...
...
@@ -31,16 +31,92 @@
#ifndef dollop_h
#define dollop_h
#include
<assert.h>
#include
<list>
namespace
Zipr_SDK
{
class
Dollop_t
{
class
Placeable_t
{
public:
Placeable_t
()
:
m_is_placed
(
false
),
m_placed_address
(
0
)
{}
void
Place
(
Zipr_SDK
::
RangeAddress_t
place
)
{
assert
(
!
m_is_placed
);
m_is_placed
=
true
;
m_placed_address
=
place
;
};
Zipr_SDK
::
RangeAddress_t
Place
()
{
return
m_placed_address
;
}
bool
IsPlaced
()
const
{
return
m_is_placed
;
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
Placeable_t
&
);
protected
:
bool
m_is_placed
;
Zipr_SDK
::
RangeAddress_t
m_placed_address
;
};
class
Dollop_t
;
class
DollopPatch_t
:
public
Placeable_t
{
public:
DollopPatch_t
(
Dollop_t
*
target
)
:
m_target
(
target
)
{};
DollopPatch_t
()
:
m_target
(
NULL
)
{
};
Dollop_t
*
Target
()
const
{
return
m_target
;
}
void
Target
(
Dollop_t
*
target
)
{
m_target
=
target
;
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
DollopPatch_t
&
);
private
:
Dollop_t
*
m_target
;
};
class
DollopEntry_t
:
public
Placeable_t
{
public:
DollopEntry_t
(
libIRDB
::
Instruction_t
*
insn
,
Dollop_t
*
member_of
);
libIRDB
::
Instruction_t
*
Instruction
()
const
{
return
m_instruction
;
}
void
TargetDollop
(
Dollop_t
*
target
)
{
m_target_dollop
=
target
;
}
Dollop_t
*
TargetDollop
()
const
{
return
m_target_dollop
;
}
Dollop_t
*
MemberOfDollop
()
const
{
return
m_member_of_dollop
;
}
void
MemberOfDollop
(
Dollop_t
*
member_of
)
{
m_member_of_dollop
=
member_of
;
}
bool
operator
==
(
const
DollopEntry_t
&
);
bool
operator
!=
(
const
DollopEntry_t
&
);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
DollopEntry_t
&
);
private
:
libIRDB
::
Instruction_t
*
m_instruction
;
Dollop_t
*
m_target_dollop
,
*
m_member_of_dollop
;
};
class
Dollop_t
:
public
Placeable_t
,
public
std
::
list
<
DollopEntry_t
*>
{
public:
static
Dollop_t
*
CreateNewDollop
(
libIRDB
::
Instruction_t
*
start
);
Dollop_t
(
libIRDB
::
Instruction_t
*
start
);
size_t
GetSize
()
const
{
return
m_size
;
}
Dollop_t
()
{
m_size
=
0
;
m_was_truncated
=
false
;
}
size_t
GetSize
()
const
{
return
m_size
;
}
size_t
GetDollopEntryCount
()
const
{
return
size
();
}
Dollop_t
*
Split
(
libIRDB
::
Instruction_t
*
split_point
);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
Dollop_t
&
);
void
FallthroughDollop
(
Dollop_t
*
fallthrough
)
{
m_fallthrough_dollop
=
fallthrough
;
}
Dollop_t
*
FallthroughDollop
(
void
)
const
{
return
m_fallthrough_dollop
;
}
DollopEntry_t
*
FallthroughDollopEntry
(
DollopEntry_t
*
)
const
;
void
WasTruncated
(
bool
truncated
)
{
m_was_truncated
=
truncated
;
}
bool
WasTruncated
(
void
)
const
{
return
m_was_truncated
;
}
private
:
size_t
CalculateWorstCaseSize
();
size_t
m_size
;
libIRDB
::
Instruction_t
*
m_start
;
Dollop_t
*
m_fallthrough_dollop
;
bool
m_was_truncated
;
};
}
#endif
This diff is collapsed.
Click to expand it.
include/zipr.h
+
21
−
6
View file @
5343f1a0
...
...
@@ -50,10 +50,12 @@ class Zipr_t
virtual
void
PreReserve2ByteJumpTargets
()
=
0
;
virtual
void
ExpandPinnedInstructions
()
=
0
;
virtual
void
Fix2BytePinnedInstructions
()
=
0
;
virtual
void
CreateDollops
()
=
0
;
virtual
void
PlaceDollops
()
=
0
;
virtual
void
WriteDollops
()
=
0
;
virtual
void
UpdatePins
()
=
0
;
virtual
void
OptimizePinnedInstructions
()
=
0
;
virtual
void
OptimizePinnedFallthroughs
()
=
0
;
virtual
void
AskPluginsAboutPlopping
()
=
0
;
virtual
void
PlopTheUnpinnedInstructions
()
=
0
;
virtual
void
UpdateCallbacks
()
=
0
;
virtual
void
PrintStats
()
=
0
;
virtual
void
RecordPinnedInsnAddrs
()
=
0
;
...
...
@@ -63,10 +65,23 @@ class Zipr_t
* These are public functions that the SDK user
* way want to use.
*/
virtual
int
DetermineWorstCaseInsnSize
(
libIRDB
::
Instruction_t
*
)
=
0
;
virtual
Zipr_SDK
::
RangeAddress_t
PlopInstruction
(
libIRDB
::
Instruction_t
*
insn
,
Zipr_SDK
::
RangeAddress_t
addr
)
=
0
;
virtual
Zipr_SDK
::
RangeAddress_t
PlopWithTarget
(
libIRDB
::
Instruction_t
*
insn
,
Zipr_SDK
::
RangeAddress_t
at
)
=
0
;
virtual
Zipr_SDK
::
RangeAddress_t
PlopWithCallback
(
libIRDB
::
Instruction_t
*
insn
,
Zipr_SDK
::
RangeAddress_t
at
)
=
0
;
virtual
int
DetermineWorstCaseInsnSize
(
libIRDB
::
Instruction_t
*
,
bool
account_for_jump
=
true
)
=
0
;
virtual
Zipr_SDK
::
RangeAddress_t
PlopDollopEntry
(
DollopEntry_t
*
,
RangeAddress_t
=
0
)
=
0
;
virtual
Zipr_SDK
::
RangeAddress_t
PlopDollopEntryWithTarget
(
DollopEntry_t
*
,
RangeAddress_t
=
0
)
=
0
;
virtual
Zipr_SDK
::
RangeAddress_t
PlopDollopEntryWithCallback
(
DollopEntry_t
*
,
RangeAddress_t
=
0
)
=
0
;
virtual
Zipr_SDK
::
MemorySpace_t
*
GetMemorySpace
()
=
0
;
virtual
ELFIO
::
elfio
*
GetELFIO
()
=
0
;
virtual
libIRDB
::
FileIR_t
*
GetFileIR
()
=
0
;
...
...
This diff is collapsed.
Click to expand it.
include/zipr_plugin.h
+
3
−
5
View file @
5343f1a0
...
...
@@ -31,8 +31,7 @@ class ZiprPluginInterface_t
{
}
virtual
ZiprPreference
PlopAddress
(
const
RangeAddress_t
&
jump
,
const
Dollop_t
&
dollop
,
Range_t
&
place
)
virtual
ZiprPreference
AddressDollop
(
const
Dollop_t
*
dollop
,
const
RangeAddress_t
&
source
,
Range_t
&
place
)
{
return
None
;
}
...
...
@@ -41,12 +40,11 @@ class ZiprPluginInterface_t
{
return
false
;
}
virtual
size_t
WorstCaseInsnSize
(
libIRDB
::
Instruction_t
*
,
Zipr_t
*
)
virtual
size_t
WorstCaseInsnSize
(
libIRDB
::
Instruction_t
*
,
bool
,
Zipr_t
*
)
{
return
0
;
}
virtual
RangeAddress_t
PlopInstruction
(
libIRDB
::
Instruction_t
*
,
RangeAddress_t
,
virtual
RangeAddress_t
PlopDollopEntry
(
Zipr_SDK
::
DollopEntry_t
*
,
RangeAddress_t
&
,
Zipr_t
*
)
{
...
...
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