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
0009190e
Commit
0009190e
authored
Dec 08, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor improvements
parent
9aef343b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
16 deletions
+32
-16
src/asm_writing/assembler.cpp
src/asm_writing/assembler.cpp
+8
-4
src/asm_writing/assembler.h
src/asm_writing/assembler.h
+7
-4
src/codegen/ast_interpreter.cpp
src/codegen/ast_interpreter.cpp
+5
-3
src/codegen/entry.cpp
src/codegen/entry.cpp
+0
-3
src/runtime/types.cpp
src/runtime/types.cpp
+3
-0
tools/annotate.py
tools/annotate.py
+9
-2
No files found.
src/asm_writing/assembler.cpp
View file @
0009190e
...
...
@@ -1138,21 +1138,25 @@ void Assembler::skipBytes(int num) {
addr
+=
num
;
}
ForwardJump
::
ForwardJump
(
Assembler
&
assembler
,
ConditionCode
condition
)
template
<
int
MaxJumpSize
>
ForwardJumpBase
<
MaxJumpSize
>::
ForwardJumpBase
(
Assembler
&
assembler
,
ConditionCode
condition
)
:
assembler
(
assembler
),
condition
(
condition
),
jmp_inst
(
assembler
.
curInstPointer
())
{
assembler
.
jmp_cond
(
JumpDestination
::
fromStart
(
assembler
.
bytesWritten
()
+
max_jump_s
ize
),
condition
);
assembler
.
jmp_cond
(
JumpDestination
::
fromStart
(
assembler
.
bytesWritten
()
+
MaxJumpS
ize
),
condition
);
jmp_end
=
assembler
.
curInstPointer
();
}
ForwardJump
::~
ForwardJump
()
{
template
<
int
MaxJumpSize
>
ForwardJumpBase
<
MaxJumpSize
>::~
ForwardJumpBase
()
{
uint8_t
*
new_pos
=
assembler
.
curInstPointer
();
int
offset
=
new_pos
-
jmp_inst
;
RELEASE_ASSERT
(
offset
<
max_jump_s
ize
,
""
);
RELEASE_ASSERT
(
offset
<
MaxJumpS
ize
,
""
);
assembler
.
setCurInstPointer
(
jmp_inst
);
assembler
.
jmp_cond
(
JumpDestination
::
fromStart
(
assembler
.
bytesWritten
()
+
offset
),
condition
);
while
(
assembler
.
curInstPointer
()
<
jmp_end
)
assembler
.
nop
();
assembler
.
setCurInstPointer
(
new_pos
);
}
template
class
ForwardJumpBase
<
128
>;
template
class
ForwardJumpBase
<
1048576
>;
}
}
src/asm_writing/assembler.h
View file @
0009190e
...
...
@@ -214,19 +214,22 @@ public:
// This class helps generating a forward jump with a relative offset.
// It keeps track of the current assembler offset at construction time and in the destructor patches the
// generated conditional jump with the correct offset depending on the number of bytes emitted in between.
class
ForwardJump
{
template
<
int
MaxJumpSize
=
128
>
class
ForwardJumpBase
{
private:
const
int
max_jump_size
=
1048587
;
Assembler
&
assembler
;
ConditionCode
condition
;
uint8_t
*
jmp_inst
;
uint8_t
*
jmp_end
;
public:
ForwardJump
(
Assembler
&
assembler
,
ConditionCode
condition
);
~
ForwardJump
();
ForwardJump
Base
(
Assembler
&
assembler
,
ConditionCode
condition
);
~
ForwardJump
Base
();
};
#define ForwardJump ForwardJumpBase<128>
#define LargeForwardJump ForwardJumpBase<1048576>
uint8_t
*
initializePatchpoint2
(
uint8_t
*
start_addr
,
uint8_t
*
slowpath_start
,
uint8_t
*
end_addr
,
StackInfo
stack_info
,
const
std
::
unordered_set
<
int
>&
live_outs
);
}
...
...
src/codegen/ast_interpreter.cpp
View file @
0009190e
...
...
@@ -414,9 +414,11 @@ Box* ASTInterpreter::executeInner(ASTInterpreter& interpreter, CFGBlock* start_b
interpreter
.
current_inst
=
s
;
if
(
interpreter
.
jit
)
interpreter
.
jit
->
emitSetCurrentInst
(
s
);
Py_XDECREF
(
v
.
o
);
if
(
v
.
var
)
v
.
var
->
xdecref
();
if
(
v
.
o
)
{
Py_XDECREF
(
v
.
o
);
if
(
v
.
var
)
v
.
var
->
decref
();
}
v
=
interpreter
.
visit_stmt
(
s
);
}
}
...
...
src/codegen/entry.cpp
View file @
0009190e
...
...
@@ -529,9 +529,6 @@ extern "C" void Py_Initialize() noexcept {
}
void
teardownCodegen
()
{
if
(
PROFILE
)
g
.
func_addr_registry
.
dumpPerfMap
();
for
(
int
i
=
0
;
i
<
g
.
jit_listeners
.
size
();
i
++
)
{
g
.
engine
->
UnregisterJITEventListener
(
g
.
jit_listeners
[
i
]);
delete
g
.
jit_listeners
[
i
];
...
...
src/runtime/types.cpp
View file @
0009190e
...
...
@@ -4325,6 +4325,9 @@ extern "C" void Py_Finalize() noexcept {
// wait_for_thread_shutdown();
if
(
PROFILE
)
g
.
func_addr_registry
.
dumpPerfMap
();
call_sys_exitfunc
();
// initialized = 0;
...
...
tools/annotate.py
View file @
0009190e
...
...
@@ -57,6 +57,7 @@ def lookupAsHeapAddr(n):
lines
=
[]
while
True
:
l
=
_heap_proc
.
stdout
.
readline
()
assert
l
,
"heapmap subprocess exited? code: %r"
%
_heap_proc
.
poll
()
if
l
==
'!!!!
\
n
'
:
break
lines
.
append
(
l
)
...
...
@@ -95,7 +96,7 @@ if __name__ == "__main__":
parser
=
argparse
.
ArgumentParser
(
formatter_class
=
argparse
.
RawTextHelpFormatter
)
parser
.
add_argument
(
"func_name"
,
metavar
=
"FUNC_NAME"
)
parser
.
add_argument
(
"--collapse-nops"
,
dest
=
"collapse_nops"
,
action
=
"store
_true"
,
default
=
True
)
parser
.
add_argument
(
"--collapse-nops"
,
dest
=
"collapse_nops"
,
action
=
"store
"
,
default
=
5
,
type
=
int
)
parser
.
add_argument
(
"--no-collapse-nops"
,
dest
=
"collapse_nops"
,
action
=
"store_false"
)
parser
.
add_argument
(
"--heap-map-args"
,
nargs
=
'+'
,
help
=
"""
Command to run that will provide heap map information.
...
...
@@ -157,7 +158,13 @@ equivalent to '--heap-map-args ./pyston_release -i BENCHMARK'.
nops
=
(
nops
[
0
]
+
count
,
nops
[
1
]
+
1
,
nops
[
2
],
addr
)
else
:
if
nops
:
print
str
(
nops
[
0
]).
rjust
(
8
),
(
" %s-%s nop*%d"
%
(
nops
[
2
],
nops
[
3
],
nops
[
1
])).
ljust
(
70
)
if
int
(
nops
[
3
],
16
)
-
int
(
nops
[
2
],
16
)
+
1
<=
args
.
collapse_nops
:
nop_count
=
nops
[
0
]
for
addr
in
xrange
(
int
(
nops
[
2
],
16
),
int
(
nops
[
3
],
16
)
+
1
):
print
str
(
nop_count
).
rjust
(
8
),
(
" %s nop"
%
(
"%x: 90"
%
addr
).
ljust
(
29
)).
ljust
(
70
)
nop_count
=
0
else
:
print
str
(
nops
[
0
]).
rjust
(
8
),
(
" %s nop*%d"
%
((
"%s-%s"
%
(
nops
[
2
],
nops
[
3
])).
ljust
(
29
),
nops
[
1
])).
ljust
(
70
)
nops
=
None
print
str
(
count
).
rjust
(
8
),
l
.
ljust
(
70
),
extra
...
...
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