Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
af59d5ae
Commit
af59d5ae
authored
Feb 17, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change from "never retry ICs" to exponential backoff
parent
49a830b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
src/asm_writing/icinfo.cpp
src/asm_writing/icinfo.cpp
+16
-3
src/asm_writing/icinfo.h
src/asm_writing/icinfo.h
+1
-1
No files found.
src/asm_writing/icinfo.cpp
View file @
af59d5ae
...
...
@@ -30,6 +30,9 @@ namespace pyston {
using
namespace
pyston
::
assembler
;
#define MEGAMORPHIC_THRESHOLD 100
#define MAX_RETRY_BACKOFF 1024
// TODO not right place for this...
int64_t
ICInvalidator
::
version
()
{
return
cur_version
;
...
...
@@ -68,7 +71,8 @@ ICSlotRewrite::~ICSlotRewrite() {
}
void
ICSlotRewrite
::
abort
()
{
ic
->
failed
=
true
;
ic
->
retry_backoff
=
std
::
max
(
MAX_RETRY_BACKOFF
,
2
*
ic
->
retry_backoff
);
ic
->
retry_in
=
ic
->
retry_backoff
;
}
void
ICSlotRewrite
::
commit
(
CommitHook
*
hook
)
{
...
...
@@ -109,6 +113,11 @@ void ICSlotRewrite::commit(CommitHook* hook) {
ic
->
times_rewritten
++
;
if
(
ic
->
times_rewritten
==
MEGAMORPHIC_THRESHOLD
)
{
static
StatCounter
megamorphic_ics
(
"megamorphic_ics"
);
megamorphic_ics
.
log
();
}
llvm
::
sys
::
Memory
::
InvalidateInstructionCache
(
slot_start
,
ic
->
getSlotSize
());
}
...
...
@@ -177,7 +186,7 @@ ICInfo::ICInfo(void* start_addr, void* slowpath_rtn_addr, void* continue_addr, S
assembler
::
GenericRegister
return_register
,
TypeRecorder
*
type_recorder
)
:
next_slot_to_try
(
0
),
stack_info
(
stack_info
),
num_slots
(
num_slots
),
slot_size
(
slot_size
),
calling_conv
(
calling_conv
),
live_outs
(
live_outs
.
begin
(),
live_outs
.
end
()),
return_register
(
return_register
),
type_recorder
(
type_recorder
),
failed
(
false
),
times_rewritten
(
0
),
start_addr
(
start_addr
),
type_recorder
(
type_recorder
),
retry_in
(
0
),
retry_backoff
(
1
),
times_rewritten
(
0
),
start_addr
(
start_addr
),
slowpath_rtn_addr
(
slowpath_rtn_addr
),
continue_addr
(
continue_addr
)
{
for
(
int
i
=
0
;
i
<
num_slots
;
i
++
)
{
slots
.
push_back
(
ICSlotInfo
(
this
,
i
));
...
...
@@ -269,6 +278,10 @@ void ICInfo::clear(ICSlotInfo* icentry) {
}
bool
ICInfo
::
shouldAttempt
()
{
return
!
failed
&&
times_rewritten
<
100
;
if
(
retry_in
)
{
retry_in
--
;
return
false
;
}
return
times_rewritten
<
MEGAMORPHIC_THRESHOLD
;
}
}
src/asm_writing/icinfo.h
View file @
af59d5ae
...
...
@@ -100,7 +100,7 @@ private:
const
std
::
vector
<
int
>
live_outs
;
const
assembler
::
GenericRegister
return_register
;
TypeRecorder
*
const
type_recorder
;
bool
failed
;
int
retry_in
,
retry_backoff
;
int
times_rewritten
;
// for ICSlotRewrite:
...
...
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