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
3d9bca6b
Commit
3d9bca6b
authored
Nov 04, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the GCVisitor non-virtual for a small speedup
parent
873de691
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
31 deletions
+29
-31
src/codegen/llvm_interpreter.h
src/codegen/llvm_interpreter.h
+5
-2
src/core/types.h
src/core/types.h
+16
-6
src/gc/collector.cpp
src/gc/collector.cpp
+6
-6
src/gc/collector.h
src/gc/collector.h
+0
-15
src/gc/root_finder.cpp
src/gc/root_finder.cpp
+2
-2
No files found.
src/codegen/llvm_interpreter.h
View file @
3d9bca6b
...
...
@@ -21,15 +21,18 @@ class Function;
namespace
pyston
{
namespace
gc
{
class
GCVisitor
;
}
class
Box
;
class
BoxedDict
;
class
GCVisitor
;
class
LineInfo
;
Box
*
interpretFunction
(
llvm
::
Function
*
f
,
int
nargs
,
Box
*
closure
,
Box
*
generator
,
Box
*
arg1
,
Box
*
arg2
,
Box
*
arg3
,
Box
**
args
);
void
gatherInterpreterRoots
(
GCVisitor
*
visitor
);
void
gatherInterpreterRoots
(
gc
::
GCVisitor
*
visitor
);
const
LineInfo
*
getLineInfoForInterpretedFrame
(
void
*
frame_ptr
);
BoxedDict
*
localsForInterpretedFrame
(
void
*
frame_ptr
,
bool
only_user_visible
);
}
...
...
src/core/types.h
View file @
3d9bca6b
...
...
@@ -72,16 +72,26 @@ struct ArgPassSpec {
};
static_assert
(
sizeof
(
ArgPassSpec
)
<=
sizeof
(
void
*
),
"ArgPassSpec doesn't fit in register!"
);
namespace
gc
{
class
TraceStack
;
class
GCVisitor
{
private:
bool
isValid
(
void
*
p
);
public:
virtual
~
GCVisitor
()
{}
virtual
void
visit
(
void
*
p
)
=
0
;
virtual
void
visitRange
(
void
*
const
*
start
,
void
*
const
*
end
)
=
0
;
virtual
void
visitPotential
(
void
*
p
)
=
0
;
virtual
void
visitPotentialRange
(
void
*
const
*
start
,
void
*
const
*
end
)
=
0
;
TraceStack
*
stack
;
GCVisitor
(
TraceStack
*
stack
)
:
stack
(
stack
)
{}
// These all work on *user* pointers, ie pointers to the user_data section of GCAllocations
void
visit
(
void
*
p
);
void
visitRange
(
void
*
const
*
start
,
void
*
const
*
end
);
void
visitPotential
(
void
*
p
);
void
visitPotentialRange
(
void
*
const
*
start
,
void
*
const
*
end
);
};
}
// namespace gc
using
gc
::
GCVisitor
;
namespace
EffortLevel
{
enum
EffortLevel
{
...
...
src/gc/collector.cpp
View file @
3d9bca6b
...
...
@@ -86,11 +86,11 @@ GCRootHandle::~GCRootHandle() {
bool
TraceStack
GCVisitor
::
isValid
(
void
*
p
)
{
bool
GCVisitor
::
isValid
(
void
*
p
)
{
return
global_heap
.
getAllocationFromInteriorPointer
(
p
)
!=
NULL
;
}
void
TraceStack
GCVisitor
::
visit
(
void
*
p
)
{
void
GCVisitor
::
visit
(
void
*
p
)
{
if
(
isNonheapRoot
(
p
))
{
return
;
}
else
{
...
...
@@ -99,21 +99,21 @@ void TraceStackGCVisitor::visit(void* p) {
}
}
void
TraceStack
GCVisitor
::
visitRange
(
void
*
const
*
start
,
void
*
const
*
end
)
{
void
GCVisitor
::
visitRange
(
void
*
const
*
start
,
void
*
const
*
end
)
{
while
(
start
<
end
)
{
visit
(
*
start
);
start
++
;
}
}
void
TraceStack
GCVisitor
::
visitPotential
(
void
*
p
)
{
void
GCVisitor
::
visitPotential
(
void
*
p
)
{
GCAllocation
*
a
=
global_heap
.
getAllocationFromInteriorPointer
(
p
);
if
(
a
)
{
visit
(
a
->
user_data
);
}
}
void
TraceStack
GCVisitor
::
visitPotentialRange
(
void
*
const
*
start
,
void
*
const
*
end
)
{
void
GCVisitor
::
visitPotentialRange
(
void
*
const
*
start
,
void
*
const
*
end
)
{
while
(
start
<
end
)
{
visitPotential
(
*
start
);
start
++
;
...
...
@@ -130,7 +130,7 @@ static void markPhase() {
TraceStack
stack
(
roots
);
collectStackRoots
(
&
stack
);
TraceStack
GCVisitor
visitor
(
&
stack
);
GCVisitor
visitor
(
&
stack
);
for
(
void
*
p
:
nonheap_roots
)
{
Box
*
b
=
reinterpret_cast
<
Box
*>
(
p
);
...
...
src/gc/collector.h
View file @
3d9bca6b
...
...
@@ -45,21 +45,6 @@ public:
}
};
class
TraceStackGCVisitor
:
public
GCVisitor
{
private:
bool
isValid
(
void
*
p
);
public:
TraceStack
*
stack
;
TraceStackGCVisitor
(
TraceStack
*
stack
)
:
stack
(
stack
)
{}
// These all work on *user* pointers, ie pointers to the user_data section of GCAllocations
void
visit
(
void
*
p
)
override
;
void
visitRange
(
void
*
const
*
start
,
void
*
const
*
end
)
override
;
void
visitPotential
(
void
*
p
)
override
;
void
visitPotentialRange
(
void
*
const
*
start
,
void
*
const
*
end
)
override
;
};
// Mark this gc-allocated object as being a root, even if there are no visible references to it.
// (Note: this marks the gc allocation itself, not the pointer that points to one. For that, use
// a GCRootHandle)
...
...
src/gc/root_finder.cpp
View file @
3d9bca6b
...
...
@@ -42,7 +42,7 @@ void collectRoots(void* start, void* end, TraceStack* stack) {
ASSERT
((
char
*
)
end
-
(
char
*
)
start
<=
1000000000
,
"Asked to scan %.1fGB -- a bug?"
,
((
char
*
)
end
-
(
char
*
)
start
)
*
1.0
/
(
1
<<
30
));
TraceStack
GCVisitor
(
stack
).
visitPotentialRange
((
void
**
)
start
,
(
void
**
)
end
);
GCVisitor
(
stack
).
visitPotentialRange
((
void
**
)
start
,
(
void
**
)
end
);
}
...
...
@@ -81,7 +81,7 @@ void collectStackRoots(TraceStack* stack) {
collectLocalStack
(
stack
);
collectOtherThreadsStacks
(
stack
);
TraceStack
GCVisitor
visitor
(
stack
);
GCVisitor
visitor
(
stack
);
gatherInterpreterRoots
(
&
visitor
);
}
}
...
...
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