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
02483cc1
Commit
02483cc1
authored
Jan 20, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save the exc_info in JITted code as well
parent
b4d71529
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
2 deletions
+40
-2
src/analysis/type_analysis.cpp
src/analysis/type_analysis.cpp
+1
-0
src/codegen/irgen/irgenerator.cpp
src/codegen/irgen/irgenerator.cpp
+24
-0
src/codegen/unwinding.cpp
src/codegen/unwinding.cpp
+8
-0
src/runtime/stacktrace.cpp
src/runtime/stacktrace.cpp
+7
-2
No files found.
src/analysis/type_analysis.cpp
View file @
02483cc1
...
...
@@ -371,6 +371,7 @@ private:
case
AST_LangPrimitive
:
:
IMPORT_NAME
:
return
UNKNOWN
;
case
AST_LangPrimitive
:
:
NONE
:
case
AST_LangPrimitive
:
:
SET_EXC_INFO
:
return
NONE
;
case
AST_LangPrimitive
:
:
NONZERO
:
return
BOOL
;
...
...
src/codegen/irgen/irgenerator.cpp
View file @
02483cc1
...
...
@@ -600,6 +600,30 @@ private:
return
boolFromI1
(
emitter
,
v
);
}
case
AST_LangPrimitive
:
:
SET_EXC_INFO
:
{
assert
(
node
->
args
.
size
()
==
3
);
CompilerVariable
*
type
=
evalExpr
(
node
->
args
[
0
],
unw_info
);
CompilerVariable
*
value
=
evalExpr
(
node
->
args
[
1
],
unw_info
);
CompilerVariable
*
traceback
=
evalExpr
(
node
->
args
[
2
],
unw_info
);
auto
*
builder
=
emitter
.
getBuilder
();
llvm
::
Value
*
frame_info
=
irstate
->
getFrameInfoVar
();
llvm
::
Value
*
exc_info
=
builder
->
CreateConstInBoundsGEP2_32
(
frame_info
,
0
,
0
);
assert
(
exc_info
->
getType
()
==
g
.
llvm_excinfo_type
->
getPointerTo
());
ConcreteCompilerVariable
*
converted_type
=
type
->
makeConverted
(
emitter
,
UNKNOWN
);
builder
->
CreateStore
(
converted_type
->
getValue
(),
builder
->
CreateConstInBoundsGEP2_32
(
exc_info
,
0
,
0
));
converted_type
->
decvref
(
emitter
);
ConcreteCompilerVariable
*
converted_value
=
value
->
makeConverted
(
emitter
,
UNKNOWN
);
builder
->
CreateStore
(
converted_value
->
getValue
(),
builder
->
CreateConstInBoundsGEP2_32
(
exc_info
,
0
,
1
));
converted_value
->
decvref
(
emitter
);
ConcreteCompilerVariable
*
converted_traceback
=
traceback
->
makeConverted
(
emitter
,
UNKNOWN
);
builder
->
CreateStore
(
converted_traceback
->
getValue
(),
builder
->
CreateConstInBoundsGEP2_32
(
exc_info
,
0
,
2
));
converted_traceback
->
decvref
(
emitter
);
return
getNone
();
}
default:
RELEASE_ASSERT
(
0
,
"%d"
,
node
->
opcode
);
}
...
...
src/codegen/unwinding.cpp
View file @
02483cc1
...
...
@@ -236,6 +236,9 @@ public:
if
(
loc
.
type
==
StackMap
::
Record
::
Location
::
LocationType
::
Register
)
{
// TODO: need to make sure we deal with patchpoints appropriately
return
getReg
(
loc
.
regnum
);
}
else
if
(
loc
.
type
==
StackMap
::
Record
::
Location
::
LocationType
::
Direct
)
{
uint64_t
reg_val
=
getReg
(
loc
.
regnum
);
return
reg_val
+
loc
.
offset
;
}
else
if
(
loc
.
type
==
StackMap
::
Record
::
Location
::
LocationType
::
Indirect
)
{
uint64_t
reg_val
=
getReg
(
loc
.
regnum
);
uint64_t
addr
=
reg_val
+
loc
.
offset
;
...
...
@@ -283,6 +286,11 @@ public:
FrameInfo
*
getFrameInfo
()
{
if
(
id
.
type
==
PythonFrameId
::
COMPILED
)
{
CompiledFunction
*
cf
=
getCF
();
assert
(
cf
->
location_map
->
frameInfoFound
());
const
auto
&
frame_info_loc
=
cf
->
location_map
->
frame_info_location
;
return
reinterpret_cast
<
FrameInfo
*>
(
readLocation
(
frame_info_loc
));
}
else
if
(
id
.
type
==
PythonFrameId
::
INTERPRETED
)
{
return
getFrameInfoForInterpretedFrame
((
void
*
)
id
.
bp
);
}
...
...
src/runtime/stacktrace.cpp
View file @
02483cc1
...
...
@@ -100,6 +100,11 @@ static std::vector<const LineInfo*> last_tb;
void
raiseRaw
(
const
ExcInfo
&
e
)
__attribute__
((
__noreturn__
));
void
raiseRaw
(
const
ExcInfo
&
e
)
{
// Should set these to None before getting here:
assert
(
e
.
type
);
assert
(
e
.
value
);
assert
(
e
.
traceback
);
// Using libgcc:
throw
e
;
...
...
@@ -112,7 +117,7 @@ void raiseExc(Box* exc_obj) {
last_tb
=
std
::
move
(
entries
);
last_exc
=
exc_obj
;
raiseRaw
(
ExcInfo
(
exc_obj
->
cls
,
exc_obj
,
N
ULL
));
raiseRaw
(
ExcInfo
(
exc_obj
->
cls
,
exc_obj
,
N
one
));
}
// Have a special helper function for syntax errors, since we want to include the location
...
...
@@ -125,7 +130,7 @@ void raiseSyntaxError(const char* msg, int lineno, int col_offset, const std::st
// TODO: leaks this!
last_tb
.
push_back
(
new
LineInfo
(
lineno
,
col_offset
,
file
,
func
));
raiseRaw
(
ExcInfo
(
SyntaxError
,
last_exc
,
N
ULL
));
raiseRaw
(
ExcInfo
(
SyntaxError
,
last_exc
,
N
one
));
}
static
void
_printTraceback
(
const
std
::
vector
<
const
LineInfo
*>&
tb
)
{
...
...
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