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
c9743660
Commit
c9743660
authored
Apr 18, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'virtualenv_test'
parents
4a9c756a
290ba05a
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
164 additions
and
53 deletions
+164
-53
.gitmodules
.gitmodules
+3
-0
CMakeLists.txt
CMakeLists.txt
+1
-0
Makefile
Makefile
+3
-3
from_cpython/Lib/opcode.py
from_cpython/Lib/opcode.py
+5
-2
src/asm_writing/icinfo.cpp
src/asm_writing/icinfo.cpp
+5
-5
src/codegen/irgen.cpp
src/codegen/irgen.cpp
+8
-8
src/codegen/irgen/hooks.cpp
src/codegen/irgen/hooks.cpp
+33
-6
src/codegen/opt/aa.cpp
src/codegen/opt/aa.cpp
+12
-12
src/codegen/stackmaps.cpp
src/codegen/stackmaps.cpp
+9
-9
src/codegen/unwinding.cpp
src/codegen/unwinding.cpp
+4
-4
src/core/options.cpp
src/core/options.cpp
+1
-0
src/core/options.h
src/core/options.h
+1
-1
src/gc/heap.cpp
src/gc/heap.cpp
+1
-1
src/jit.cpp
src/jit.cpp
+3
-1
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+2
-1
src/runtime/stacktrace.cpp
src/runtime/stacktrace.cpp
+6
-0
test/integration/virtualenv
test/integration/virtualenv
+1
-0
test/integration/virtualenv_test.py
test/integration/virtualenv_test.py
+33
-0
test/tests/exec_basic.py
test/tests/exec_basic.py
+4
-0
test/tests/exec_in_test.py
test/tests/exec_in_test.py
+6
-0
test/tests/osr_maybe_undefined3.py
test/tests/osr_maybe_undefined3.py
+23
-0
No files found.
.gitmodules
View file @
c9743660
...
...
@@ -7,3 +7,6 @@
[submodule "test/integration/django"]
path = test/integration/django
url = https://github.com/django/django
[submodule "test/integration/virtualenv"]
path = test/integration/virtualenv
url = https://github.com/dropbox/virtualenv
CMakeLists.txt
View file @
c9743660
...
...
@@ -202,6 +202,7 @@ add_test(NAME analysis_unittest COMMAND analysis_unittest)
add_test
(
NAME pyston_defaults COMMAND
${
PYTHON_EXE
}
${
CMAKE_SOURCE_DIR
}
/tools/tester.py -R ./pyston -j
${
TEST_THREADS
}
-a=-S -k
${
CMAKE_SOURCE_DIR
}
/test/tests
)
# we pass -I to cpython tests and skip failing ones b/c they are slooow otherwise
add_test
(
NAME pyston_defaults_cpython_tests COMMAND
${
PYTHON_EXE
}
${
CMAKE_SOURCE_DIR
}
/tools/tester.py -R ./pyston -j
${
TEST_THREADS
}
-a=-S -a=-I -k --exit-code-only --skip-failing
${
CMAKE_SOURCE_DIR
}
/test/cpython
)
add_test
(
NAME pyston_defaults_integration_tests COMMAND
${
PYTHON_EXE
}
${
CMAKE_SOURCE_DIR
}
/tools/tester.py -R ./pyston -j
${
TEST_THREADS
}
-a=-S -k --exit-code-only --skip-failing
${
CMAKE_SOURCE_DIR
}
/test/integration
)
add_test
(
NAME pyston_max_compilation_tier COMMAND
${
PYTHON_EXE
}
${
CMAKE_SOURCE_DIR
}
/tools/tester.py -R ./pyston -j
${
TEST_THREADS
}
-a=-O -a=-S -k
${
CMAKE_SOURCE_DIR
}
/test/tests
)
add_test
(
NAME pyston_experimental_pypa_parser COMMAND
${
PYTHON_EXE
}
${
CMAKE_SOURCE_DIR
}
/tools/tester.py -a=-x -R ./pyston -j
${
TEST_THREADS
}
-a=-n -a=-S -k
${
CMAKE_SOURCE_DIR
}
/test/tests
)
...
...
Makefile
View file @
c9743660
...
...
@@ -492,7 +492,7 @@ check:
$(PYTHON)
$(TOOLS_DIR)/tester.py
-R
pyston_dbg
-j$(TEST_THREADS)
-k
-a
=
-S
$(TESTS_DIR)
$(ARGS)
@
# we pass -I to cpython tests & skip failing ones because they are sloooow otherwise
$(PYTHON)
$(TOOLS_DIR)/tester.py
-R
pyston_dbg
-j$(TEST_THREADS)
-k
-a
=
-S
-a
=
-I
--exit-code-only
--skip-failing
$(TEST_DIR)
/cpython
$(ARGS)
$(PYTHON)
$(TOOLS_DIR)/tester.py
-R
pyston_dbg
-j$(TEST_THREADS)
-k
-a
=
-S
--exit-code-only
-t60
$(TEST_DIR)
/integration
$(ARGS)
$(PYTHON)
$(TOOLS_DIR)/tester.py
-R
pyston_dbg
-j$(TEST_THREADS)
-k
-a
=
-S
--exit-code-only
-
-skip-failing
-
t60
$(TEST_DIR)
/integration
$(ARGS)
$(PYTHON)
$(TOOLS_DIR)/tester.py
-R
pyston_dbg
-j$(TEST_THREADS)
-k
-a
=
-n
-a
=
-x
-a
=
-S
$(TESTS_DIR)
$(ARGS)
@
# skip -O for dbg
...
...
@@ -509,7 +509,7 @@ check:
$(PYTHON)
$(TOOLS_DIR)/tester.py
-R
pyston_release
-j$(TEST_THREADS)
-k
-a
=
-S
$(TESTS_DIR)
$(ARGS)
@
# we pass -I to cpython tests and skip failing ones because they are sloooow otherwise
$(PYTHON)
$(TOOLS_DIR)/tester.py
-R
pyston_release
-j$(TEST_THREADS)
-k
-a
=
-S
-a
=
-I
--exit-code-only
--skip-failing
$(TEST_DIR)
/cpython
$(ARGS)
$(PYTHON)
$(TOOLS_DIR)/tester.py
-R
pyston_release
-j$(TEST_THREADS)
-k
-a
=
-S
--exit-code-only
-t60
$(TEST_DIR)
/integration
$(ARGS)
$(PYTHON)
$(TOOLS_DIR)/tester.py
-R
pyston_release
-j$(TEST_THREADS)
-k
-a
=
-S
--exit-code-only
-
-skip-failing
-
t60
$(TEST_DIR)
/integration
$(ARGS)
@
# skip -n for dbg
$(PYTHON)
$(TOOLS_DIR)/tester.py
-R
pyston_release
-j$(TEST_THREADS)
-k
-a
=
-O
-a
=
-x
-a
=
-S
$(TESTS_DIR)
$(ARGS)
...
...
@@ -954,7 +954,7 @@ check$1 test$1: $(PYTHON_EXE_DEPS) pyston$1 ext_pyston
$(PYTHON)
$(TOOLS_DIR)
/tester.py
-R
pyston
$1
-j
$(TEST_THREADS)
-a
=
-S
-k
$(TESTS_DIR)
$(ARGS)
@
# we pass -I to cpython tests and skip failing ones because they are sloooow otherwise
$(PYTHON)
$(TOOLS_DIR)
/tester.py
-R
pyston
$1
-j
$(TEST_THREADS)
-a
=
-S
-a
=
-I
-k
--exit-code-only
--skip-failing
$(TEST_DIR)
/cpython
$(ARGS)
$(PYTHON)
$(TOOLS_DIR)
/tester.py
-R
pyston
$1
-j
$(TEST_THREADS)
-k
-a
=
-S
--exit-code-only
-t
=
60
$(TEST_DIR)
/integration
$(ARGS)
$(PYTHON)
$(TOOLS_DIR)
/tester.py
-R
pyston
$1
-j
$(TEST_THREADS)
-k
-a
=
-S
--exit-code-only
-
-skip-failing
-
t
=
60
$(TEST_DIR)
/integration
$(ARGS)
$(PYTHON)
$(TOOLS_DIR)
/tester.py
-a
=
-x
-R
pyston
$1
-j
$(TEST_THREADS)
-a
=
-n
-a
=
-S
-k
$(TESTS_DIR)
$(ARGS)
$(PYTHON)
$(TOOLS_DIR)
/tester.py
-R
pyston
$1
-j
$(TEST_THREADS)
-a
=
-O
-a
=
-S
-k
$(TESTS_DIR)
$(ARGS)
...
...
from_cpython/Lib/opcode.py
View file @
c9743660
...
...
@@ -4,9 +4,11 @@ opcode module - potentially shared between dis and other modules which
operate on bytecodes (e.g. peephole optimizers).
"""
# Pyston change: disable this module
raise
NotImplementedError
()
# Pyston change: disable this module.
# distutils does 'import opcode; foo(opcode.__file__)' to determine where the standard
# library lives, so still have to provide this file as an importable module.
"""
__all__ = ["cmp_op", "hasconst", "hasname", "hasjrel", "hasjabs",
"haslocal", "hascompare", "hasfree", "opname", "opmap",
"HAVE_ARGUMENT", "EXTENDED_ARG"]
...
...
@@ -193,3 +195,4 @@ def_op('SET_ADD', 146)
def_op('MAP_ADD', 147)
del def_op, name_op, jrel_op, jabs_op
"""
src/asm_writing/icinfo.cpp
View file @
c9743660
...
...
@@ -61,7 +61,7 @@ ICSlotRewrite::ICSlotRewrite(ICInfo* ic, const char* debug_name) : ic(ic), debug
assembler
=
new
Assembler
(
buf
,
ic
->
getSlotSize
());
assembler
->
nop
();
if
(
VERBOSITY
()
>=
2
)
if
(
VERBOSITY
()
>=
4
)
printf
(
"starting %s icentry
\n
"
,
debug_name
);
}
...
...
@@ -86,7 +86,7 @@ void ICSlotRewrite::commit(CommitHook* hook) {
}
}
if
(
!
still_valid
)
{
if
(
VERBOSITY
()
>=
2
)
if
(
VERBOSITY
()
>=
3
)
printf
(
"not committing %s icentry since a dependency got updated before commit
\n
"
,
debug_name
);
return
;
}
...
...
@@ -165,14 +165,14 @@ ICSlotInfo* ICInfo::pickEntryForRewrite(const char* debug_name) {
if
(
sinfo
.
num_inside
)
continue
;
if
(
VERBOSITY
()
>=
3
)
{
if
(
VERBOSITY
()
>=
4
)
{
printf
(
"committing %s icentry to in-use slot %d at %p
\n
"
,
debug_name
,
i
,
start_addr
);
}
next_slot_to_try
=
i
+
1
;
return
&
sinfo
;
}
if
(
VERBOSITY
()
>=
3
)
if
(
VERBOSITY
()
>=
4
)
printf
(
"not committing %s icentry since there are no available slots
\n
"
,
debug_name
);
return
NULL
;
}
...
...
@@ -259,7 +259,7 @@ void ICInfo::clear(ICSlotInfo* icentry) {
uint8_t
*
start
=
(
uint8_t
*
)
start_addr
+
icentry
->
idx
*
getSlotSize
();
if
(
VERBOSITY
()
>=
3
)
if
(
VERBOSITY
()
>=
4
)
printf
(
"clearing patchpoint %p, slot at %p
\n
"
,
start_addr
,
start
);
std
::
unique_ptr
<
Assembler
>
writer
(
new
Assembler
(
start
,
getSlotSize
()));
...
...
src/codegen/irgen.cpp
View file @
c9743660
...
...
@@ -185,12 +185,12 @@ static void optimizeIR(llvm::Function* f, EffortLevel effort) {
bool
changed
=
fpm
.
run
(
*
f
);
if
(
!
changed
)
{
if
(
VERBOSITY
(
"irgen"
))
if
(
VERBOSITY
(
"irgen"
)
>=
2
)
printf
(
"done after %d optimization iterations
\n
"
,
i
-
1
);
break
;
}
if
(
VERBOSITY
(
"irgen"
)
>=
1
)
{
if
(
VERBOSITY
(
"irgen"
)
>=
2
)
{
fprintf
(
stderr
,
"after optimization %d:
\n
"
,
i
);
printf
(
"
\033
[36m"
);
fflush
(
stdout
);
...
...
@@ -266,7 +266,7 @@ static std::vector<std::pair<CFGBlock*, CFGBlock*>> computeBlockTraversalOrder(c
}
assert
(
best
!=
NULL
);
if
(
VERBOSITY
(
"irgen"
)
>=
1
)
if
(
VERBOSITY
(
"irgen"
)
>=
2
)
printf
(
"Giving up and adding block %d to the order
\n
"
,
best
->
idx
);
in_queue
.
insert
(
best
);
rtn
.
push_back
(
std
::
make_pair
(
best
,
(
CFGBlock
*
)
NULL
));
...
...
@@ -457,7 +457,7 @@ static void emitBBs(IRGenState* irstate, TypeAnalysis* types, const OSREntryDesc
phi_type
->
debugName
().
c_str
());
}
if
(
VERBOSITY
(
"irgen"
))
if
(
VERBOSITY
(
"irgen"
)
>=
2
)
v
->
setName
(
"prev_"
+
p
.
first
.
str
());
(
*
osr_syms
)[
p
.
first
]
=
new
ConcreteCompilerVariable
(
phi_type
,
v
,
true
);
...
...
@@ -507,11 +507,11 @@ static void emitBBs(IRGenState* irstate, TypeAnalysis* types, const OSREntryDesc
CFGBlock
*
block
=
traversal_order
[
_i
].
first
;
CFGBlock
*
pred
=
traversal_order
[
_i
].
second
;
if
(
VERBOSITY
(
"irgen"
)
>=
2
)
if
(
VERBOSITY
(
"irgen"
)
>=
3
)
printf
(
"processing block %d
\n
"
,
block
->
idx
);
if
(
!
blocks
.
count
(
block
))
{
if
(
VERBOSITY
(
"irgen"
)
>=
2
)
if
(
VERBOSITY
(
"irgen"
)
>=
3
)
printf
(
"Skipping this block
\n
"
);
// created_phis[block] = NULL;
// ending_symbol_tables[block] = NULL;
...
...
@@ -872,7 +872,7 @@ static void emitBBs(IRGenState* irstate, TypeAnalysis* types, const OSREntryDesc
}
static
void
computeBlockSetClosure
(
BlockSet
&
blocks
)
{
if
(
VERBOSITY
(
"irgen"
)
>=
1
)
{
if
(
VERBOSITY
(
"irgen"
)
>=
2
)
{
printf
(
"Initial:"
);
for
(
CFGBlock
*
b
:
blocks
)
{
printf
(
" %d"
,
b
->
idx
);
...
...
@@ -898,7 +898,7 @@ static void computeBlockSetClosure(BlockSet& blocks) {
}
}
if
(
VERBOSITY
(
"irgen"
)
>=
1
)
{
if
(
VERBOSITY
(
"irgen"
)
>=
2
)
{
printf
(
"Ending:"
);
for
(
CFGBlock
*
b
:
blocks
)
{
printf
(
" %d"
,
b
->
idx
);
...
...
src/codegen/irgen/hooks.cpp
View file @
c9743660
...
...
@@ -38,6 +38,7 @@
#include "core/stats.h"
#include "core/types.h"
#include "core/util.h"
#include "runtime/capi.h"
#include "runtime/objmodel.h"
#include "runtime/types.h"
...
...
@@ -169,7 +170,7 @@ static void compileIR(CompiledFunction* cf, EffortLevel effort) {
}
}
if
(
VERBOSITY
(
"irgen"
)
>=
1
)
{
if
(
VERBOSITY
(
"irgen"
)
>=
2
)
{
printf
(
"Compiled function to %p
\n
"
,
cf
->
code
);
}
...
...
@@ -199,7 +200,7 @@ CompiledFunction* compileFunction(CLFunction* f, FunctionSpecialization* spec, E
llvm
::
raw_string_ostream
ss
(
s
);
if
(
spec
)
{
ss
<<
"
\033
[34;1mJIT'ing "
<<
name
<<
" with signature ("
;
ss
<<
"
\033
[34;1mJIT'ing "
<<
source
->
parent_module
->
fn
<<
":"
<<
name
<<
" with signature ("
;
for
(
int
i
=
0
;
i
<
spec
->
arg_types
.
size
();
i
++
)
{
if
(
i
>
0
)
ss
<<
", "
;
...
...
@@ -209,8 +210,8 @@ CompiledFunction* compileFunction(CLFunction* f, FunctionSpecialization* spec, E
ss
<<
") -> "
;
ss
<<
spec
->
rtn_type
->
debugName
();
}
else
{
ss
<<
"
\033
[34;1mDoing OSR-entry partial compile of "
<<
name
<<
", starting with backedge to block "
<<
entry_descriptor
->
backedge
->
target
->
idx
;
ss
<<
"
\033
[34;1mDoing OSR-entry partial compile of "
<<
source
->
parent_module
->
fn
<<
":"
<<
name
<<
", starting with backedge to block "
<<
entry_descriptor
->
backedge
->
target
->
idx
;
}
ss
<<
" at effort level "
<<
(
int
)
effort
;
ss
<<
"
\033
[0m"
;
...
...
@@ -371,6 +372,13 @@ Box* eval(Box* boxedCode) {
if
(
globals
&&
globals
->
cls
==
attrwrapper_cls
&&
unwrapAttrWrapper
(
globals
)
==
module
)
globals
=
NULL
;
if
(
boxedCode
->
cls
==
unicode_cls
)
{
boxedCode
=
PyUnicode_AsUTF8String
(
boxedCode
);
if
(
!
boxedCode
)
throwCAPIException
();
// cf.cf_flags |= PyCF_SOURCE_IS_UTF8
}
// TODO error message if parse fails or if it isn't an expr
// TODO should have a cleaner interface that can parse the Expression directly
// TODO this memory leaks
...
...
@@ -393,6 +401,18 @@ Box* eval(Box* boxedCode) {
}
Box
*
exec
(
Box
*
boxedCode
,
Box
*
globals
,
Box
*
locals
)
{
if
(
isSubclass
(
boxedCode
->
cls
,
tuple_cls
))
{
RELEASE_ASSERT
(
!
globals
,
""
);
RELEASE_ASSERT
(
!
locals
,
""
);
BoxedTuple
*
t
=
static_cast
<
BoxedTuple
*>
(
boxedCode
);
RELEASE_ASSERT
(
t
->
size
()
>=
2
&&
t
->
size
()
<=
3
,
"%ld"
,
t
->
size
());
boxedCode
=
t
->
elts
[
0
];
globals
=
t
->
elts
[
1
];
if
(
t
->
size
()
>=
3
)
locals
=
t
->
elts
[
2
];
}
if
(
globals
==
None
)
globals
=
NULL
;
...
...
@@ -428,8 +448,15 @@ Box* exec(Box* boxedCode, Box* globals, Box* locals) {
PyDict_SetItemString
(
globals
,
"__builtins__"
,
builtins_module
);
}
if
(
boxedCode
->
cls
==
unicode_cls
)
{
boxedCode
=
PyUnicode_AsUTF8String
(
boxedCode
);
if
(
!
boxedCode
)
throwCAPIException
();
// cf.cf_flags |= PyCF_SOURCE_IS_UTF8
}
// TODO same issues as in `eval`
RELEASE_ASSERT
(
boxedCode
->
cls
==
str_cls
,
"
"
);
RELEASE_ASSERT
(
boxedCode
->
cls
==
str_cls
,
"
%s"
,
boxedCode
->
cls
->
tp_name
);
const
char
*
code
=
static_cast
<
BoxedString
*>
(
boxedCode
)
->
s
.
data
();
AST_Module
*
parsedModule
=
parse_string
(
code
);
AST_Suite
*
parsedSuite
=
new
AST_Suite
(
std
::
move
(
parsedModule
->
interned_strings
));
...
...
@@ -553,7 +580,7 @@ void* compilePartialFunc(OSRExit* exit) {
static
StatCounter
stat_reopt
(
"reopts"
);
extern
"C"
CompiledFunction
*
reoptCompiledFuncInternal
(
CompiledFunction
*
cf
)
{
if
(
VERBOSITY
(
"irgen"
)
>=
1
)
if
(
VERBOSITY
(
"irgen"
)
>=
2
)
printf
(
"In reoptCompiledFunc, %p, %ld
\n
"
,
cf
,
cf
->
times_called
);
stat_reopt
.
log
();
...
...
src/codegen/opt/aa.cpp
View file @
c9743660
...
...
@@ -67,7 +67,7 @@ public:
AliasResult
_alias
(
const
Location
&
LocA
,
const
Location
&
LocB
)
{
AliasResult
base
=
AliasAnalysis
::
alias
(
LocA
,
LocB
);
if
(
VERBOSITY
(
"opt.aa"
)
>=
2
)
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
4
)
{
indent
();
errs
()
<<
"_alias():
\n
"
;
// cast<Instruction>(LocA.Ptr)->getParent()->dump();
...
...
@@ -97,12 +97,12 @@ public:
continue
;
const
Value
*
bc_base
=
*
BI
->
op_begin
();
if
(
VERBOSITY
(
"opt.aa"
)
>=
2
)
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
4
)
{
indent
();
errs
()
<<
"loc "
<<
i
<<
" is bitcast, recursing
\n
"
;
}
AliasResult
bc_base_aliases
=
alias
(
locs
[
i
^
1
],
Location
(
bc_base
,
locs
[
i
].
Size
));
if
(
VERBOSITY
(
"opt.aa"
)
>=
2
)
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
4
)
{
indent
();
bc_base
->
dump
();
indent
();
...
...
@@ -122,12 +122,12 @@ public:
assert
(
baseA
);
assert
(
baseB
);
if
(
VERBOSITY
(
"opt.aa"
)
>=
2
)
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
4
)
{
indent
();
errs
()
<<
"2 geps, recursing
\n
"
;
}
AliasResult
bases_alias
=
alias
(
Location
(
baseA
),
Location
(
baseB
));
if
(
VERBOSITY
(
"opt.aa"
)
>=
2
)
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
4
)
{
indent
();
errs
()
<<
"2gep base aliases: "
<<
bases_alias
<<
'\n'
;
indent
();
...
...
@@ -146,7 +146,7 @@ public:
bool
accumA
=
GIa
->
accumulateConstantOffset
(
*
DL
,
offsetA
);
bool
accumB
=
GIb
->
accumulateConstantOffset
(
*
DL
,
offsetB
);
if
(
accumA
&&
accumB
)
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
2
)
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
4
)
{
indent
();
errs
()
<<
offsetA
<<
' '
<<
LocA
.
Size
<<
' '
<<
offsetB
<<
' '
<<
LocB
.
Size
<<
'\n'
;
}
...
...
@@ -184,12 +184,12 @@ public:
const
Value
*
gep_base
=
GI
->
getPointerOperand
();
assert
(
gep_base
);
if
(
VERBOSITY
(
"opt.aa"
)
>=
2
)
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
4
)
{
indent
();
errs
()
<<
"loc "
<<
i
<<
" is gep, recursing
\n
"
;
}
AliasResult
gep_base_aliases
=
alias
(
locs
[
i
^
1
],
Location
(
gep_base
));
if
(
VERBOSITY
(
"opt.aa"
)
>=
2
)
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
4
)
{
indent
();
gep_base
->
dump
();
indent
();
...
...
@@ -222,13 +222,13 @@ public:
}
AliasResult
alias
(
const
Location
&
LocA
,
const
Location
&
LocB
)
override
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
2
&&
depth
==
0
&&
isa
<
Instruction
>
(
LocA
.
Ptr
))
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
4
&&
depth
==
0
&&
isa
<
Instruction
>
(
LocA
.
Ptr
))
{
cast
<
Instruction
>
(
LocA
.
Ptr
)
->
getParent
()
->
dump
();
}
depth
++
;
AliasResult
rtn
=
_alias
(
LocA
,
LocB
);
if
(
VERBOSITY
(
"opt.aa"
)
>=
2
)
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
4
)
{
indent
();
errs
()
<<
"alias():
\n
"
;
indent
();
...
...
@@ -250,7 +250,7 @@ public:
if
(
!
CS
.
getCalledFunction
())
return
base
;
if
(
VERBOSITY
(
"opt.aa"
)
>=
2
)
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
4
)
{
errs
()
<<
"getModRefInfo():
\n
"
;
CS
->
dump
();
Loc
.
Ptr
->
dump
();
...
...
@@ -269,7 +269,7 @@ public:
if
(
escapes
!=
EscapeAnalysis
::
Escaped
)
{
StatCounter
num_improved
(
"opt_modref_noescape"
);
num_improved
.
log
();
if
(
VERBOSITY
(
"opt.aa"
)
>=
2
)
{
if
(
VERBOSITY
(
"opt.aa"
)
>=
4
)
{
errs
()
<<
"Was able to show that "
<<
*
CS
.
getInstruction
()
<<
" can't modify "
<<
*
Loc
.
Ptr
<<
'\n'
;
}
return
NoModRef
;
...
...
src/codegen/stackmaps.cpp
View file @
c9743660
...
...
@@ -71,7 +71,7 @@ void StackmapJITEventListener::NotifyObjectEmitted(const llvm::object::ObjectFil
uint64_t
stackmap_address
=
L
.
getSectionLoadAddress
(
name
);
assert
(
stackmap_address
>
0
);
if
(
VERBOSITY
()
>=
2
)
if
(
VERBOSITY
()
>=
3
)
printf
(
"Found the stackmaps at stackmap_address 0x%lx
\n
"
,
stackmap_address
);
assert
(
cur_map
==
NULL
);
...
...
@@ -102,27 +102,27 @@ void StackmapJITEventListener::NotifyObjectEmitted(const llvm::object::ObjectFil
int
nconstants
=
*
ptr
.
u32
++
;
int
nrecords
=
*
ptr
.
u32
++
;
if
(
VERBOSITY
()
>=
2
)
if
(
VERBOSITY
()
>=
3
)
printf
(
"%d functions
\n
"
,
nfunctions
);
for
(
int
i
=
0
;
i
<
nfunctions
;
i
++
)
{
const
StackMap
::
StackSizeRecord
&
size_record
=
*
ptr
.
size_record
++
;
cur_map
->
stack_size_records
.
push_back
(
size_record
);
if
(
VERBOSITY
()
>=
2
)
if
(
VERBOSITY
()
>=
3
)
printf
(
"function %d: offset 0x%lx, stack size 0x%lx
\n
"
,
i
,
size_record
.
offset
,
size_record
.
stack_size
);
}
if
(
VERBOSITY
()
>=
2
)
if
(
VERBOSITY
()
>=
3
)
printf
(
"%d constants
\n
"
,
nconstants
);
for
(
int
i
=
0
;
i
<
nconstants
;
i
++
)
{
uint64_t
constant
=
*
ptr
.
u64
++
;
if
(
VERBOSITY
()
>=
2
)
if
(
VERBOSITY
()
>=
3
)
printf
(
"Constant %d: %ld
\n
"
,
i
,
constant
);
cur_map
->
constants
.
push_back
(
constant
);
}
if
(
VERBOSITY
()
>=
2
)
if
(
VERBOSITY
()
>=
3
)
printf
(
"%d records
\n
"
,
nrecords
);
for
(
int
i
=
0
;
i
<
nrecords
;
i
++
)
{
...
...
@@ -135,7 +135,7 @@ void StackmapJITEventListener::NotifyObjectEmitted(const llvm::object::ObjectFil
int
numlocations
=
*
ptr
.
u16
++
;
if
(
VERBOSITY
()
>=
2
)
if
(
VERBOSITY
()
>=
3
)
printf
(
"Stackmap record %ld at 0x%x has %d locations:
\n
"
,
record
->
id
,
record
->
offset
,
numlocations
);
for
(
int
j
=
0
;
j
<
numlocations
;
j
++
)
{
assert
(
sizeof
(
StackMap
::
Record
::
Location
)
==
sizeof
(
*
ptr
.
u64
));
...
...
@@ -148,7 +148,7 @@ void StackmapJITEventListener::NotifyObjectEmitted(const llvm::object::ObjectFil
"%rax"
,
"%rdx"
,
"%rcx"
,
"%rbx"
,
"%rsi"
,
"%rdi"
,
"%rbp"
,
"%rsp"
,
"%r8"
,
"%r9"
,
"%r10"
,
"%r11"
,
"%r12"
,
"%r13"
,
"%r14"
,
"%r15"
,
};
if
(
VERBOSITY
()
>=
2
)
{
if
(
VERBOSITY
()
>=
3
)
{
if
(
r
.
type
==
1
)
{
printf
(
"Location %d: type %d (reg), reg %d (%s), offset %d
\n
"
,
j
,
r
.
type
,
r
.
regnum
,
dwarf_reg_names
[
r
.
regnum
],
r
.
offset
);
...
...
@@ -164,7 +164,7 @@ void StackmapJITEventListener::NotifyObjectEmitted(const llvm::object::ObjectFil
const
StackMap
::
Record
::
LiveOut
&
r
=
*
ptr
.
record_liveout
++
;
record
->
live_outs
.
push_back
(
r
);
if
(
VERBOSITY
()
>=
2
)
{
if
(
VERBOSITY
()
>=
3
)
{
printf
(
"Live out %d: reg #%d (?), size %d
\n
"
,
i
,
r
.
regnum
,
r
.
size
);
}
}
...
...
src/codegen/unwinding.cpp
View file @
c9743660
...
...
@@ -182,7 +182,7 @@ public:
Addr
,
Size
,
llvm
::
DILineInfoSpecifier
(
llvm
::
DILineInfoSpecifier
::
FileLineInfoKind
::
AbsoluteFilePath
,
llvm
::
DILineInfoSpecifier
::
FunctionNameKind
::
LinkageName
));
#endif
if
(
VERBOSITY
()
>=
2
)
{
if
(
VERBOSITY
()
>=
3
)
{
for
(
int
i
=
0
;
i
<
lines
.
size
();
i
++
)
{
printf
(
"%s:%d, %s: %lx
\n
"
,
lines
[
i
].
second
.
FileName
.
c_str
(),
lines
[
i
].
second
.
Line
,
lines
[
i
].
second
.
FunctionName
.
c_str
(),
lines
[
i
].
first
);
...
...
@@ -213,7 +213,7 @@ public:
eh_frame_addr
=
L
.
getSectionLoadAddress
(
name
);
eh_frame_size
=
sec
.
getSize
();
if
(
VERBOSITY
())
if
(
VERBOSITY
()
>=
2
)
printf
(
"eh_frame: %lx %lx
\n
"
,
eh_frame_addr
,
eh_frame_size
);
found_eh_frame
=
true
;
}
else
if
(
name
==
".text"
)
{
...
...
@@ -221,7 +221,7 @@ public:
text_addr
=
L
.
getSectionLoadAddress
(
name
);
text_size
=
sec
.
getSize
();
if
(
VERBOSITY
())
if
(
VERBOSITY
()
>=
2
)
printf
(
"text: %lx %lx
\n
"
,
text_addr
,
text_size
);
found_text
=
true
;
}
...
...
@@ -239,7 +239,7 @@ public:
dyn_info
->
u
.
rti
.
segbase
=
eh_frame_addr
;
parseEhFrame
(
eh_frame_addr
,
eh_frame_size
,
&
dyn_info
->
u
.
rti
.
table_data
,
&
dyn_info
->
u
.
rti
.
table_len
);
if
(
VERBOSITY
())
if
(
VERBOSITY
()
>=
2
)
printf
(
"dyn_info = %p, table_data = %p
\n
"
,
dyn_info
,
(
void
*
)
dyn_info
->
u
.
rti
.
table_data
);
_U_dyn_register
(
dyn_info
);
...
...
src/core/options.cpp
View file @
c9743660
...
...
@@ -40,6 +40,7 @@ bool USE_STRIPPED_STDLIB = true; // always true
bool
ENABLE_INTERPRETER
=
true
;
bool
ENABLE_PYPA_PARSER
=
true
;
bool
USE_REGALLOC_BASIC
=
true
;
bool
PAUSE_AT_ABORT
=
false
;
int
OSR_THRESHOLD_INTERPRETER
=
200
;
int
REOPT_THRESHOLD_INTERPRETER
=
100
;
...
...
src/core/options.h
View file @
c9743660
...
...
@@ -37,7 +37,7 @@ extern int OSR_THRESHOLD_T2, REOPT_THRESHOLD_T2;
extern
int
SPECULATION_THRESHOLD
;
extern
bool
SHOW_DISASM
,
FORCE_INTERPRETER
,
FORCE_OPTIMIZE
,
PROFILE
,
DUMPJIT
,
TRAP
,
USE_STRIPPED_STDLIB
,
CONTINUE_AFTER_FATAL
,
ENABLE_INTERPRETER
,
ENABLE_PYPA_PARSER
,
USE_REGALLOC_BASIC
;
CONTINUE_AFTER_FATAL
,
ENABLE_INTERPRETER
,
ENABLE_PYPA_PARSER
,
USE_REGALLOC_BASIC
,
PAUSE_AT_ABORT
;
extern
bool
ENABLE_ICS
,
ENABLE_ICGENERICS
,
ENABLE_ICGETITEMS
,
ENABLE_ICSETITEMS
,
ENABLE_ICDELITEMS
,
ENABLE_ICBINEXPS
,
ENABLE_ICNONZEROS
,
ENABLE_ICCALLSITES
,
ENABLE_ICSETATTRS
,
ENABLE_ICGETATTRS
,
ENALBE_ICDELATTRS
,
ENABLE_ICGETGLOBALS
,
...
...
src/gc/heap.cpp
View file @
c9743660
...
...
@@ -127,7 +127,7 @@ void registerGCManagedBytes(size_t bytes) {
Heap
global_heap
;
bool
_doFree
(
GCAllocation
*
al
,
std
::
list
<
Box
*
,
StlCompatAllocator
<
Box
*>>*
weakly_referenced
)
{
if
(
VERBOSITY
()
>=
2
)
if
(
VERBOSITY
()
>=
4
)
printf
(
"Freeing %p
\n
"
,
al
->
user_data
);
#ifndef NVALGRIND
...
...
src/jit.cpp
View file @
c9743660
...
...
@@ -80,7 +80,7 @@ static int main(int argc, char** argv) {
bool
stats
=
false
;
bool
unbuffered
=
false
;
const
char
*
command
=
NULL
;
while
((
code
=
getopt
(
argc
,
argv
,
"+OqdIibpjtrsSvnxc:Fu"
))
!=
-
1
)
{
while
((
code
=
getopt
(
argc
,
argv
,
"+OqdIibpjtrsSvnxc:Fu
P
"
))
!=
-
1
)
{
if
(
code
==
'O'
)
FORCE_OPTIMIZE
=
true
;
else
if
(
code
==
't'
)
...
...
@@ -113,6 +113,8 @@ static int main(int argc, char** argv) {
USE_REGALLOC_BASIC
=
false
;
}
else
if
(
code
==
'x'
)
{
ENABLE_PYPA_PARSER
=
false
;
}
else
if
(
code
==
'P'
)
{
PAUSE_AT_ABORT
=
true
;
}
else
if
(
code
==
'F'
)
{
CONTINUE_AFTER_FATAL
=
true
;
}
else
if
(
code
==
'c'
)
{
...
...
src/runtime/builtin_modules/builtins.cpp
View file @
c9743660
...
...
@@ -78,7 +78,8 @@ extern "C" Box* dir(Box* obj) {
}
extern
"C"
Box
*
vars
(
Box
*
obj
)
{
RELEASE_ASSERT
(
obj
,
"Don't support 0-arg vars() calls yet"
);
if
(
!
obj
)
return
fastLocalsToBoxedLocals
();
return
makeAttrWrapper
(
obj
);
}
...
...
src/runtime/stacktrace.cpp
View file @
c9743660
...
...
@@ -182,6 +182,12 @@ extern "C" void abort() {
alarm
(
0
);
}
if
(
PAUSE_AT_ABORT
)
{
printf
(
"PID %d about to call libc abort; pausing for a debugger...
\n
"
,
getpid
());
while
(
true
)
{
sleep
(
1
);
}
}
libc_abort
();
__builtin_unreachable
();
}
...
...
virtualenv
@
ee62ccfd
Subproject commit ee62ccfda4950352bcad9612f0951fb38d805350
test/integration/virtualenv_test.py
0 → 100644
View file @
c9743660
# expected: fail
# - jit issue
import
os
import
sys
import
subprocess
import
shutil
VIRTUALENV_SCRIPT
=
os
.
path
.
dirname
(
__file__
)
+
"/virtualenv/virtualenv.py"
if
os
.
path
.
exists
(
"test_env"
):
print
"Removing the existing 'test_env/' directory"
subprocess
.
check_call
([
"rm"
,
"-rf"
,
"test_env"
])
# shutil follows symlinks to directories, and deletes whatever those contain.
# shutil.rmtree("test_env")
args
=
[
sys
.
executable
,
VIRTUALENV_SCRIPT
,
"-p"
,
sys
.
executable
,
"test_env"
]
print
"Running"
,
args
subprocess
.
check_call
(
args
)
sh_script
=
"""
set -e
. test_env/bin/activate
set -ux
python -c 'import __future__'
python -c 'import sys; print sys.executable'
pip install bcrypt==1.1.0
python -c 'import bcrypt; assert bcrypt.__version__ == "1.1.0"; assert bcrypt.hashpw("password1", "$2a$12$0123456789012345678901").endswith("I1hdtg4K"); print "bcrypt seems to work"'
"""
.
strip
()
# print sh_script
subprocess
.
check_call
([
"sh"
,
"-c"
,
sh_script
])
test/tests/exec_basic.py
View file @
c9743660
...
...
@@ -3,3 +3,7 @@ a = 5
print a"""
exec
""
# Exec of a unicode encodes as utf8:
exec
u"print repr('
\
u0180
')"
print
repr
(
eval
(
u"'
\
u0180
'"
))
test/tests/exec_in_test.py
View file @
c9743660
...
...
@@ -125,3 +125,9 @@ def show(obj, msg):
print
msg
return
obj
exec
show
(
"print 'in exec'"
,
"body"
)
in
show
(
None
,
"globals"
),
show
(
None
,
"locals"
)
g
=
{}
l
=
{}
exec
(
"a=1; print a"
,
g
,
l
)
print
g
.
keys
(),
l
.
keys
()
test/tests/osr_maybe_undefined3.py
0 → 100644
View file @
c9743660
# fail-if: '-O' not in EXTRA_JIT_ARGS
# - wip
# Regression test: make sure we can handle variables that are only defined
# on excluded parts of an osr compilation
def
f
():
if
True
:
for
i
in
xrange
(
20000
):
pass
else
:
a
=
1
f
()
def
f2
():
if
True
:
for
i
in
xrange
(
20000
):
pass
else
:
a
=
1
if
False
:
print
a
f2
()
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