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
bb4092a9
Commit
bb4092a9
authored
Jul 09, 2015
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bjit: fix wrong traceback issue: try/catch block is not allowed inside ASTInterpreter::executeInner
parent
f7546648
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
22 deletions
+88
-22
src/codegen/ast_interpreter.cpp
src/codegen/ast_interpreter.cpp
+28
-22
test/tests/incremental_tb_bjit.py
test/tests/incremental_tb_bjit.py
+60
-0
No files found.
src/codegen/ast_interpreter.cpp
View file @
bb4092a9
...
...
@@ -91,7 +91,6 @@ public:
__attribute__
((
__no_inline__
))
__attribute__
((
noinline
))
static
Value
executeInner
(
ASTInterpreter
&
interpreter
,
CFGBlock
*
start_block
,
AST_stmt
*
start_at
,
RegisterHelper
*
reg
);
private:
Box
*
createFunction
(
AST
*
node
,
AST_arguments
*
args
,
const
std
::
vector
<
AST_stmt
*>&
body
);
Value
doBinOp
(
Value
left
,
Value
right
,
int
op
,
BinExpType
exp_type
);
...
...
@@ -148,6 +147,8 @@ private:
void
startJITing
(
CFGBlock
*
block
,
int
exit_offset
=
0
);
void
abortJITing
();
void
finishJITing
(
CFGBlock
*
continue_block
=
NULL
);
// This method is not allowed to get inlined into 'executeInner' otherwise tracebacks are wrong.
__attribute__
((
__no_inline__
))
__attribute__
((
noinline
))
Box
*
execJITedBlock
(
CFGBlock
*
b
);
// this variables are used by the baseline JIT, make sure they have an offset < 0x80 so we can use shorter
// instructions
...
...
@@ -374,6 +375,27 @@ void ASTInterpreter::finishJITing(CFGBlock* continue_block) {
startJITing
(
continue_block
,
exit_offset
);
}
Box
*
ASTInterpreter
::
execJITedBlock
(
CFGBlock
*
b
)
{
try
{
UNAVOIDABLE_STAT_TIMER
(
t0
,
"us_timer_in_baseline_jitted_code"
);
std
::
pair
<
CFGBlock
*
,
Box
*>
rtn
=
b
->
entry_code
(
this
,
b
);
next_block
=
rtn
.
first
;
if
(
!
next_block
)
return
rtn
.
second
;
}
catch
(
ExcInfo
e
)
{
AST_stmt
*
stmt
=
getCurrentStatement
();
if
(
stmt
->
type
!=
AST_TYPE
::
Invoke
)
throw
e
;
auto
source
=
getCF
()
->
clfunc
->
source
.
get
();
exceptionCaughtInInterpreter
(
LineInfo
(
stmt
->
lineno
,
stmt
->
col_offset
,
source
->
fn
,
source
->
getName
()),
&
e
);
next_block
=
((
AST_Invoke
*
)
stmt
)
->
exc_dest
;
last_exception
=
e
;
}
return
nullptr
;
}
Value
ASTInterpreter
::
executeInner
(
ASTInterpreter
&
interpreter
,
CFGBlock
*
start_block
,
AST_stmt
*
start_at
,
RegisterHelper
*
reg
)
{
...
...
@@ -428,26 +450,10 @@ Value ASTInterpreter::executeInner(ASTInterpreter& interpreter, CFGBlock* start_
CFGBlock
*
b
=
interpreter
.
current_block
;
if
(
b
->
entry_code
)
{
should_jit
=
true
;
try
{
UNAVOIDABLE_STAT_TIMER
(
t0
,
"us_timer_in_baseline_jitted_code"
);
std
::
pair
<
CFGBlock
*
,
Box
*>
rtn
=
b
->
entry_code
(
&
interpreter
,
b
);
interpreter
.
next_block
=
rtn
.
first
;
if
(
!
interpreter
.
next_block
)
return
Value
(
rtn
.
second
,
0
);
}
catch
(
ExcInfo
e
)
{
AST_stmt
*
stmt
=
interpreter
.
getCurrentStatement
();
if
(
stmt
->
type
!=
AST_TYPE
::
Invoke
)
throw
e
;
auto
source
=
interpreter
.
getCF
()
->
clfunc
->
source
.
get
();
exceptionCaughtInInterpreter
(
LineInfo
(
stmt
->
lineno
,
stmt
->
col_offset
,
source
->
fn
,
source
->
getName
()),
&
e
);
interpreter
.
next_block
=
((
AST_Invoke
*
)
stmt
)
->
exc_dest
;
interpreter
.
last_exception
=
e
;
}
continue
;
Box
*
rtn
=
interpreter
.
execJITedBlock
(
b
);
if
(
interpreter
.
next_block
)
continue
;
return
Value
(
rtn
,
nullptr
);
}
}
...
...
@@ -1604,7 +1610,7 @@ Box* ASTInterpreterJitInterface::getLocalHelper(void* _interpreter, InternedStri
Box
*
ASTInterpreterJitInterface
::
landingpadHelper
(
void
*
_interpreter
)
{
ASTInterpreter
*
interpreter
=
(
ASTInterpreter
*
)
_interpreter
;
aut
o
&
last_exception
=
interpreter
->
last_exception
;
ExcInf
o
&
last_exception
=
interpreter
->
last_exception
;
Box
*
type
=
last_exception
.
type
;
Box
*
value
=
last_exception
.
value
?
last_exception
.
value
:
None
;
Box
*
traceback
=
last_exception
.
traceback
?
last_exception
.
traceback
:
None
;
...
...
test/tests/incremental_tb_bjit.py
0 → 100644
View file @
bb4092a9
# This is the same as incremental_tb_bjit.py but tests the baseline JIT.
try
:
import
__pyston__
__pyston__
.
setOption
(
"REOPT_THRESHOLD_INTERPRETER"
,
1
)
except
:
pass
import
traceback
import
sys
def
f
():
a
,
b
,
c
=
sys
.
exc_info
()
raise
a
,
b
,
c
et0
,
ev0
,
tb0
=
None
,
None
,
None
try
:
1
/
0
except
:
pass
for
i
in
xrange
(
10
):
try
:
f
()
except
:
et0
,
ev0
,
tb0
=
sys
.
exc_info
()
print
"******** 0"
,
''
.
join
(
traceback
.
format_exception
(
et0
,
ev0
,
tb0
))
et1
,
ev1
,
tb1
=
None
,
None
,
None
et2
,
ev2
,
tb2
=
None
,
None
,
None
def
f1
():
raise
def
f2
():
f1
()
def
f21
():
raise
Exception
()
def
f3
():
try
:
f21
()
except
:
global
et1
,
tv1
,
tb1
et1
,
tv1
,
tb1
=
sys
.
exc_info
()
f2
()
try
:
f3
()
except
:
et2
,
tv2
,
tb2
=
sys
.
exc_info
()
print
"******** 1"
,
''
.
join
(
traceback
.
format_exception
(
et1
,
ev1
,
tb1
))
print
"******** 2"
,
''
.
join
(
traceback
.
format_exception
(
et2
,
ev2
,
tb2
))
print
et1
is
et2
print
ev1
is
ev2
print
tb1
is
tb2
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