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
ce9232aa
Commit
ce9232aa
authored
Mar 28, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix deopt
parent
c38f6248
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
19 deletions
+27
-19
src/codegen/ast_interpreter.cpp
src/codegen/ast_interpreter.cpp
+15
-7
src/codegen/compvars.cpp
src/codegen/compvars.cpp
+1
-0
src/codegen/irgen/irgenerator.cpp
src/codegen/irgen/irgenerator.cpp
+6
-3
src/codegen/unwinding.cpp
src/codegen/unwinding.cpp
+1
-3
src/runtime/frame.cpp
src/runtime/frame.cpp
+4
-4
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+0
-2
No files found.
src/codegen/ast_interpreter.cpp
View file @
ce9232aa
...
...
@@ -191,11 +191,15 @@ public:
friend
struct
pyston
::
ASTInterpreterJitInterface
;
};
void
ASTInterpreter
::
addSymbol
(
InternedString
name
,
Box
*
value
,
bool
allow_duplicates
)
{
void
ASTInterpreter
::
addSymbol
(
InternedString
name
,
Box
*
new_
value
,
bool
allow_duplicates
)
{
assert
(
getSymVRegMap
().
count
(
name
));
if
(
!
allow_duplicates
)
assert
(
vregs
[
getSymVRegMap
()[
name
]]
==
NULL
);
vregs
[
getSymVRegMap
()[
name
]]
=
value
;
Box
*&
value
=
vregs
[
getSymVRegMap
()[
name
]];
Box
*
old_value
=
value
;
value
=
incref
(
new_value
);
if
(
allow_duplicates
)
Py_XDECREF
(
old_value
);
else
assert
(
old_value
==
NULL
);
}
void
ASTInterpreter
::
setGenerator
(
Box
*
gen
)
{
...
...
@@ -223,8 +227,10 @@ void ASTInterpreter::setBoxedLocals(Box* boxedLocals) {
void
ASTInterpreter
::
setFrameInfo
(
const
FrameInfo
*
frame_info
)
{
Box
**
vregs
=
this
->
frame_info
.
vregs
;
int
num_vregs
=
this
->
frame_info
.
num_vregs
;
this
->
frame_info
=
*
frame_info
;
this
->
frame_info
.
vregs
=
vregs
;
this
->
frame_info
.
num_vregs
=
num_vregs
;
}
void
ASTInterpreter
::
setGlobals
(
Box
*
globals
)
{
...
...
@@ -402,6 +408,7 @@ Box* ASTInterpreter::executeInner(ASTInterpreter& interpreter, CFGBlock* start_b
// it will confuse our unwinder!
rtn
=
interpreter
.
doOSR
(
cur_stmt
);
}
Py_XDECREF
(
v
.
o
);
return
rtn
;
}
}
...
...
@@ -857,6 +864,7 @@ Value ASTInterpreter::visit_invoke(AST_Invoke* node) {
Value
ASTInterpreter
::
visit_clsAttribute
(
AST_ClsAttribute
*
node
)
{
Value
obj
=
visit_expr
(
node
->
value
);
BoxedString
*
attr
=
node
->
attr
.
getBox
();
AUTO_DECREF
(
obj
.
o
);
return
Value
(
getclsattr
(
obj
.
o
,
attr
),
jit
?
jit
->
emitGetClsAttr
(
obj
,
attr
)
:
NULL
);
}
...
...
@@ -891,8 +899,7 @@ Value ASTInterpreter::visit_langPrimitive(AST_LangPrimitive* node) {
assert
(
ast_str
->
str_type
==
AST_Str
::
STR
);
const
std
::
string
&
name
=
ast_str
->
str_data
;
assert
(
name
.
size
());
BoxedString
*
name_boxed
=
source_info
->
parent_module
->
getStringConstant
(
name
,
true
);
AUTO_DECREF
(
name_boxed
);
BORROWED
(
BoxedString
*
)
name_boxed
=
source_info
->
parent_module
->
getStringConstant
(
name
,
true
);
if
(
jit
)
v
.
var
=
jit
->
emitImportFrom
(
module
,
name_boxed
);
...
...
@@ -2020,6 +2027,7 @@ extern "C" Box* astInterpretDeoptFromASM(FunctionMetadata* md, AST_expr* after_e
auto
expr
=
ast_cast
<
AST_Expr
>
(
enclosing_stmt
);
RELEASE_ASSERT
(
expr
->
value
==
after_expr
,
"%p %p"
,
expr
->
value
,
after_expr
);
assert
(
expr
->
value
==
after_expr
);
assert
(
0
&&
"check refcounting"
);
break
;
}
else
if
(
enclosing_stmt
->
type
==
AST_TYPE
::
Invoke
)
{
auto
invoke
=
ast_cast
<
AST_Invoke
>
(
enclosing_stmt
);
...
...
@@ -2059,7 +2067,7 @@ extern "C" Box* astInterpretDeoptFromASM(FunctionMetadata* md, AST_expr* after_e
cur_thread_state
.
frame_info
=
frame_state
.
frame_info
->
back
;
Box
*
v
=
ASTInterpreter
::
execute
(
interpreter
,
start_block
,
starting_statement
);
return
v
?
v
:
None
;
return
v
?
v
:
incref
(
None
)
;
}
extern
"C"
void
printExprHelper
(
Box
*
obj
)
{
...
...
src/codegen/compvars.cpp
View file @
ce9232aa
...
...
@@ -289,6 +289,7 @@ public:
=
emitter
.
getBuilder
()
->
CreateConstInBoundsGEP2_32
(
var
->
getValue
(),
0
,
offsetof
(
Box
,
cls
)
/
sizeof
(
void
*
));
llvm
::
Value
*
cls_value
=
emitter
.
getBuilder
()
->
CreateLoad
(
cls_ptr
);
emitter
.
setType
(
cls_value
,
RefType
::
BORROWED
);
assert
(
cls_value
->
getType
()
==
g
.
llvm_class_type_ptr
);
llvm
::
Value
*
rtn
=
emitter
.
getBuilder
()
->
CreateICmpEQ
(
cls_value
,
emitter
.
setType
(
embedRelocatablePtr
(
cls
,
g
.
llvm_class_type_ptr
),
RefType
::
BORROWED
));
...
...
src/codegen/irgen/irgenerator.cpp
View file @
ce9232aa
...
...
@@ -623,7 +623,9 @@ public:
llvm
::
Value
*
v
=
createIC
(
pp
,
(
void
*
)
pyston
::
deopt
,
{
embedRelocatablePtr
(
node
,
g
.
llvm_astexpr_type_ptr
),
node_value
},
UnwindInfo
(
current_stmt
,
NULL
));
return
getBuilder
()
->
CreateIntToPtr
(
v
,
g
.
llvm_value_type_ptr
);
llvm
::
Value
*
rtn
=
getBuilder
()
->
CreateIntToPtr
(
v
,
g
.
llvm_value_type_ptr
);
setType
(
rtn
,
RefType
::
OWNED
);
return
rtn
;
}
void
checkAndPropagateCapiException
(
const
UnwindInfo
&
unw_info
,
llvm
::
Value
*
returned_val
,
llvm
::
Value
*
exc_val
,
...
...
@@ -808,7 +810,8 @@ private:
curblock
=
deopt_bb
;
emitter
.
getBuilder
()
->
SetInsertPoint
(
curblock
);
llvm
::
Value
*
v
=
emitter
.
createDeopt
(
current_statement
,
(
AST_expr
*
)
node
,
node_value
);
emitter
.
getBuilder
()
->
CreateRet
(
v
);
llvm
::
Instruction
*
ret_inst
=
emitter
.
getBuilder
()
->
CreateRet
(
v
);
irstate
->
getRefcounts
()
->
refConsumed
(
v
,
ret_inst
);
curblock
=
success_bb
;
emitter
.
getBuilder
()
->
SetInsertPoint
(
curblock
);
...
...
@@ -891,7 +894,7 @@ private:
// local symbols will not throw.
emitter
.
getBuilder
()
->
CreateUnreachable
();
exc_type
=
exc_value
=
exc_tb
=
emitter
.
getNone
();
endBlock
(
DEAD
);
//
endBlock(DEAD);
}
// clear this out to signal that we consumed them:
...
...
src/codegen/unwinding.cpp
View file @
ce9232aa
...
...
@@ -778,10 +778,8 @@ DeoptState getDeoptState() {
bool
found
=
false
;
unwindPythonStack
([
&
](
PythonFrameIteratorImpl
*
frame_iter
)
{
BoxedDict
*
d
;
BoxedClosure
*
closure
;
CompiledFunction
*
cf
;
if
(
frame_iter
->
getId
().
type
==
PythonFrameId
::
COMPILED
)
{
assert
(
0
&&
"check refcounting"
);
d
=
new
BoxedDict
();
cf
=
frame_iter
->
getCF
();
...
...
@@ -826,7 +824,7 @@ DeoptState getDeoptState() {
if
(
!
v
)
continue
;
d
->
d
[
p
.
first
.
getBox
(
)]
=
v
;
d
->
d
[
incref
(
p
.
first
.
getBox
()
)]
=
v
;
}
for
(
const
auto
&
p
:
cf
->
location_map
->
names
)
{
...
...
src/runtime/frame.cpp
View file @
ce9232aa
...
...
@@ -231,9 +231,9 @@ extern "C" void deinitFrame(FrameInfo* frame_info) {
}
assert
(
frame_info
->
vregs
||
frame_info
->
num_vregs
==
0
);
int
num_
user_visible_
vregs
=
frame_info
->
num_vregs
;
int
num_vregs
=
frame_info
->
num_vregs
;
decrefArray
<
true
>
(
frame_info
->
vregs
,
num_
user_visible_
vregs
);
decrefArray
<
true
>
(
frame_info
->
vregs
,
num_vregs
);
Py_CLEAR
(
frame_info
->
boxedLocals
);
...
...
@@ -248,8 +248,8 @@ int frameinfo_traverse(FrameInfo* frame_info, visitproc visit, void* arg) noexce
Py_VISIT
(
frame_info
->
frame_obj
);
if
(
frame_info
->
vregs
)
{
int
num_
user_visible_
vregs
=
frame_info
->
num_vregs
;
for
(
int
i
=
0
;
i
<
num_
user_visible_
vregs
;
i
++
)
{
int
num_vregs
=
frame_info
->
num_vregs
;
for
(
int
i
=
0
;
i
<
num_vregs
;
i
++
)
{
Py_VISIT
(
frame_info
->
vregs
[
i
]);
}
}
...
...
src/runtime/objmodel.cpp
View file @
ce9232aa
...
...
@@ -136,9 +136,7 @@ extern "C" Box* deopt(AST_expr* expr, Box* value) {
deopt_state
.
frame_state
.
frame_info
->
exc
.
value
=
NULL
;
}
assert
(
0
&&
"check refcounting"
);
AUTO_DECREF
(
deopt_state
.
frame_state
.
locals
);
return
astInterpretDeopt
(
deopt_state
.
cf
->
md
,
expr
,
deopt_state
.
current_stmt
,
value
,
deopt_state
.
frame_state
);
}
...
...
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