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
c7bd5c40
Commit
c7bd5c40
authored
Aug 05, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ICSlotInfo: remove old invalidator entries
parent
fca39ba9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
19 deletions
+25
-19
src/asm_writing/icinfo.cpp
src/asm_writing/icinfo.cpp
+21
-16
src/asm_writing/icinfo.h
src/asm_writing/icinfo.h
+3
-3
src/core/types.h
src/core/types.h
+1
-0
No files found.
src/asm_writing/icinfo.cpp
View file @
c7bd5c40
...
...
@@ -73,10 +73,21 @@ void ICInvalidator::invalidateAll() {
dependents
.
clear
();
}
void
ICSlotInfo
::
clear
()
{
ic
->
clear
(
this
);
void
ICSlotInfo
::
clear
(
bool
should_invalidate
)
{
if
(
should_invalidate
)
ic
->
invalidate
(
this
);
used
=
false
;
for
(
auto
p
:
gc_references
)
{
Py_DECREF
(
p
);
}
gc_references
.
clear
();
for
(
auto
&&
invalidator
:
invalidators
)
{
invalidator
->
remove
(
this
);
}
invalidators
.
clear
();
if
(
num_inside
==
0
)
decref_infos
.
clear
();
}
...
...
@@ -163,11 +174,6 @@ void ICSlotRewrite::commit(CommitHook* hook, std::vector<void*> gc_references,
assert
(
original_size
==
assembler
.
bytesWritten
());
}
for
(
int
i
=
0
;
i
<
dependencies
.
size
();
i
++
)
{
ICInvalidator
*
invalidator
=
dependencies
[
i
].
first
;
invalidator
->
addDependent
(
ic_entry
);
}
ic
->
next_slot_to_try
++
;
// we can create a new IC slot if this is the last slot in the IC in addition we are checking that the new slot is
...
...
@@ -202,13 +208,17 @@ void ICSlotRewrite::commit(CommitHook* hook, std::vector<void*> gc_references,
// if (VERBOSITY()) printf("Commiting to %p-%p\n", start, start + ic->slot_size);
memcpy
(
slot_start
,
buf
,
original_size
);
for
(
auto
p
:
ic_entry
->
gc_references
)
{
Py_DECREF
(
p
);
}
ic_entry
->
clear
(
false
/* don't invalidate */
);
ic_entry
->
gc_references
=
std
::
move
(
gc_references
);
ic_entry
->
used
=
true
;
ic
->
times_rewritten
++
;
for
(
int
i
=
0
;
i
<
dependencies
.
size
();
i
++
)
{
ICInvalidator
*
invalidator
=
dependencies
[
i
].
first
;
invalidator
->
addDependent
(
ic_entry
);
}
if
(
ic
->
times_rewritten
==
IC_MEGAMORPHIC_THRESHOLD
)
{
static
StatCounter
megamorphic_ics
(
"megamorphic_ics"
);
megamorphic_ics
.
log
();
...
...
@@ -416,7 +426,7 @@ ICInfo* getICInfo(void* rtn_addr) {
return
it
->
second
;
}
void
ICInfo
::
clear
(
ICSlotInfo
*
icentry
)
{
void
ICInfo
::
invalidate
(
ICSlotInfo
*
icentry
)
{
assert
(
icentry
);
uint8_t
*
start
=
(
uint8_t
*
)
icentry
->
start_addr
;
...
...
@@ -429,11 +439,6 @@ void ICInfo::clear(ICSlotInfo* icentry) {
writer
.
jmp
(
JumpDestination
::
fromStart
(
icentry
->
size
));
assert
(
writer
.
bytesWritten
()
<=
IC_INVALDITION_HEADER_SIZE
);
for
(
auto
p
:
icentry
->
gc_references
)
{
Py_DECREF
(
p
);
}
icentry
->
gc_references
.
clear
();
// std::unique_ptr<MCWriter> writer(createMCWriter(start, getSlotSize(), 0));
// writer->emitNop();
// writer->emitGuardFalse();
...
...
src/asm_writing/icinfo.h
View file @
c7bd5c40
...
...
@@ -71,7 +71,7 @@ public:
std
::
vector
<
DecrefInfo
>
decref_infos
;
std
::
vector
<
ICInvalidator
*>
invalidators
;
// ICInvalidators that reference this slotinfo
void
clear
();
void
clear
(
bool
should_invalidate
=
true
);
};
typedef
BitSet
<
16
>
LiveOutSet
;
...
...
@@ -120,10 +120,10 @@ public:
const
LiveOutSet
&
getLiveOuts
()
{
return
live_outs
;
}
std
::
unique_ptr
<
ICSlotRewrite
>
startRewrite
(
const
char
*
debug_name
);
void
clear
(
ICSlotInfo
*
entry
);
void
invalidate
(
ICSlotInfo
*
entry
);
void
clearAll
()
{
for
(
ICSlotInfo
&
slot_info
:
slots
)
{
clear
(
&
slot_info
);
slot_info
.
clear
(
);
}
}
...
...
src/core/types.h
View file @
c7bd5c40
...
...
@@ -297,6 +297,7 @@ public:
void
addDependent
(
ICSlotInfo
*
icentry
);
int64_t
version
();
void
invalidateAll
();
void
remove
(
ICSlotInfo
*
icentry
)
{
dependents
.
erase
(
icentry
);
}
friend
class
ICInfo
;
friend
class
ICSlotInfo
;
...
...
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