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
30d4579b
Commit
30d4579b
authored
Feb 24, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More fixes
parent
584f94a8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
31 deletions
+46
-31
src/codegen/compvars.cpp
src/codegen/compvars.cpp
+4
-3
src/codegen/irgen/irgenerator.cpp
src/codegen/irgen/irgenerator.cpp
+1
-0
src/runtime/capi.cpp
src/runtime/capi.cpp
+14
-5
src/runtime/descr.cpp
src/runtime/descr.cpp
+23
-13
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+3
-8
src/runtime/types.cpp
src/runtime/types.cpp
+1
-2
No files found.
src/codegen/compvars.cpp
View file @
30d4579b
...
@@ -2337,9 +2337,10 @@ public:
...
@@ -2337,9 +2337,10 @@ public:
}
}
ASSERT
(
other_type
==
UNKNOWN
||
other_type
==
BOXED_BOOL
,
"%s"
,
other_type
->
debugName
().
c_str
());
ASSERT
(
other_type
==
UNKNOWN
||
other_type
==
BOXED_BOOL
,
"%s"
,
other_type
->
debugName
().
c_str
());
llvm
::
Value
*
boxed
=
emitter
.
getBuilder
()
->
CreateSelect
(
i1FromBool
(
emitter
,
var
),
llvm
::
Value
*
boxed
=
emitter
.
getBuilder
()
->
CreateSelect
(
embedConstantPtr
(
True
,
g
.
llvm_value_type_ptr
),
i1FromBool
(
emitter
,
var
),
emitter
.
setType
(
embedConstantPtr
(
True
,
g
.
llvm_value_type_ptr
),
RefType
::
BORROWED
),
embedConstantPtr
(
False
,
g
.
llvm_value_type_ptr
));
emitter
.
setType
(
embedConstantPtr
(
False
,
g
.
llvm_value_type_ptr
),
RefType
::
BORROWED
));
emitter
.
setType
(
boxed
,
RefType
::
BORROWED
);
return
new
ConcreteCompilerVariable
(
other_type
,
boxed
);
return
new
ConcreteCompilerVariable
(
other_type
,
boxed
);
}
}
...
...
src/codegen/irgen/irgenerator.cpp
View file @
30d4579b
...
@@ -1191,6 +1191,7 @@ private:
...
@@ -1191,6 +1191,7 @@ private:
emitter
.
setType
(
attr
,
RefType
::
BORROWED
);
emitter
.
setType
(
attr
,
RefType
::
BORROWED
);
llvm
::
Value
*
module
=
irstate
->
getGlobals
();
llvm
::
Value
*
module
=
irstate
->
getGlobals
();
llvm
::
Value
*
r
=
emitter
.
createCall3
(
unw_info
,
g
.
funcs
.
boxedLocalsGet
,
boxedLocals
,
attr
,
module
);
llvm
::
Value
*
r
=
emitter
.
createCall3
(
unw_info
,
g
.
funcs
.
boxedLocalsGet
,
boxedLocals
,
attr
,
module
);
emitter
.
setType
(
r
,
RefType
::
OWNED
);
return
new
ConcreteCompilerVariable
(
UNKNOWN
,
r
);
return
new
ConcreteCompilerVariable
(
UNKNOWN
,
r
);
}
else
{
}
else
{
// vst is one of {FAST, CLOSURE}
// vst is one of {FAST, CLOSURE}
...
...
src/runtime/capi.cpp
View file @
30d4579b
...
@@ -1855,11 +1855,6 @@ Box* BoxedCApiFunction::tppCall(Box* _self, CallRewriteArgs* rewrite_args, ArgPa
...
@@ -1855,11 +1855,6 @@ Box* BoxedCApiFunction::tppCall(Box* _self, CallRewriteArgs* rewrite_args, ArgPa
if
(
!
rewrite_success
)
if
(
!
rewrite_success
)
rewrite_args
=
NULL
;
rewrite_args
=
NULL
;
assert
(
!
oargs
);
AUTO_XDECREF
(
arg1
);
AUTO_XDECREF
(
arg2
);
AUTO_XDECREF
(
arg3
);
RewriterVar
*
r_passthrough
=
NULL
;
RewriterVar
*
r_passthrough
=
NULL
;
if
(
rewrite_args
)
if
(
rewrite_args
)
r_passthrough
=
rewrite_args
->
rewriter
->
loadConst
((
intptr_t
)
self
->
passthrough
,
Location
::
forArg
(
0
));
r_passthrough
=
rewrite_args
->
rewriter
->
loadConst
((
intptr_t
)
self
->
passthrough
,
Location
::
forArg
(
0
));
...
@@ -1921,11 +1916,25 @@ Box* BoxedCApiFunction::tppCall(Box* _self, CallRewriteArgs* rewrite_args, ArgPa
...
@@ -1921,11 +1916,25 @@ Box* BoxedCApiFunction::tppCall(Box* _self, CallRewriteArgs* rewrite_args, ArgPa
RELEASE_ASSERT
(
0
,
"0x%x"
,
flags
);
RELEASE_ASSERT
(
0
,
"0x%x"
,
flags
);
}
}
assert
(
paramspec
.
totalReceived
()
<
3
);
assert
(
!
oargs
);
if
(
rewrite_args
)
{
if
(
rewrite_args
)
{
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
rewrite_args
->
out_rtn
);
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
rewrite_args
->
out_rtn
);
rewrite_args
->
out_success
=
true
;
rewrite_args
->
out_success
=
true
;
}
}
switch
(
paramspec
.
totalReceived
())
{
case
3
:
Py_XDECREF
(
arg3
);
case
2
:
Py_XDECREF
(
arg2
);
case
1
:
Py_XDECREF
(
arg1
);
default:
break
;
}
checkAndThrowCAPIException
();
checkAndThrowCAPIException
();
assert
(
rtn
&&
"should have set + thrown an exception!"
);
assert
(
rtn
&&
"should have set + thrown an exception!"
);
return
rtn
;
return
rtn
;
...
...
src/runtime/descr.cpp
View file @
30d4579b
...
@@ -610,19 +610,12 @@ Box* BoxedWrapperDescriptor::tppCall(Box* _self, CallRewriteArgs* rewrite_args,
...
@@ -610,19 +610,12 @@ Box* BoxedWrapperDescriptor::tppCall(Box* _self, CallRewriteArgs* rewrite_args,
rearrangeArguments
(
paramspec
,
NULL
,
self
->
wrapper
->
name
.
data
(),
NULL
,
rewrite_args
,
rewrite_success
,
argspec
,
arg1
,
rearrangeArguments
(
paramspec
,
NULL
,
self
->
wrapper
->
name
.
data
(),
NULL
,
rewrite_args
,
rewrite_success
,
argspec
,
arg1
,
arg2
,
arg3
,
args
,
oargs
,
keyword_names
);
arg2
,
arg3
,
args
,
oargs
,
keyword_names
);
AUTO_XDECREF
(
arg1
);
AUTO_XDECREF
(
arg2
);
AUTO_XDECREF
(
arg3
);
assert
(
!
oargs
);
if
(
paramspec
.
takes_varargs
)
if
(
paramspec
.
takes_varargs
)
assert
(
arg2
&&
arg2
->
cls
==
tuple_cls
);
assert
(
arg2
&&
arg2
->
cls
==
tuple_cls
);
if
(
!
rewrite_success
)
if
(
!
rewrite_success
)
rewrite_args
=
NULL
;
rewrite_args
=
NULL
;
assert
(
!
rewrite_args
&&
"check refcounting"
);
Box
*
rtn
;
Box
*
rtn
;
if
(
flags
==
PyWrapperFlag_KEYWORDS
)
{
if
(
flags
==
PyWrapperFlag_KEYWORDS
)
{
wrapperfunc_kwds
wk
=
(
wrapperfunc_kwds
)
wrapper
;
wrapperfunc_kwds
wk
=
(
wrapperfunc_kwds
)
wrapper
;
...
@@ -630,9 +623,9 @@ Box* BoxedWrapperDescriptor::tppCall(Box* _self, CallRewriteArgs* rewrite_args,
...
@@ -630,9 +623,9 @@ Box* BoxedWrapperDescriptor::tppCall(Box* _self, CallRewriteArgs* rewrite_args,
if
(
rewrite_args
)
{
if
(
rewrite_args
)
{
auto
rewriter
=
rewrite_args
->
rewriter
;
auto
rewriter
=
rewrite_args
->
rewriter
;
rewrite_args
->
out_rtn
rewrite_args
->
out_rtn
=
rewriter
->
call
(
true
,
(
void
*
)
wk
,
rewrite_args
->
arg1
,
rewrite_args
->
arg2
,
=
rewriter
->
call
(
true
,
(
void
*
)
wk
,
rewrite_args
->
arg1
,
rewrite_args
->
arg2
,
rewriter
->
loadConst
((
intptr_t
)
self
->
wrapped
,
Location
::
forArg
(
2
))
,
rewriter
->
loadConst
((
intptr_t
)
self
->
wrapped
,
Location
::
forArg
(
2
)),
rewrite_args
->
arg3
);
rewrite_args
->
arg3
)
->
setType
(
RefType
::
OWNED
);
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
rewrite_args
->
out_rtn
);
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
rewrite_args
->
out_rtn
);
rewrite_args
->
out_success
=
true
;
rewrite_args
->
out_success
=
true
;
}
}
...
@@ -642,7 +635,8 @@ Box* BoxedWrapperDescriptor::tppCall(Box* _self, CallRewriteArgs* rewrite_args,
...
@@ -642,7 +635,8 @@ Box* BoxedWrapperDescriptor::tppCall(Box* _self, CallRewriteArgs* rewrite_args,
if
(
rewrite_args
)
{
if
(
rewrite_args
)
{
auto
rewriter
=
rewrite_args
->
rewriter
;
auto
rewriter
=
rewrite_args
->
rewriter
;
rewrite_args
->
out_rtn
=
rewriter
->
call
(
true
,
(
void
*
)
wrapper
,
rewrite_args
->
arg1
,
rewrite_args
->
arg2
,
rewrite_args
->
out_rtn
=
rewriter
->
call
(
true
,
(
void
*
)
wrapper
,
rewrite_args
->
arg1
,
rewrite_args
->
arg2
,
rewriter
->
loadConst
((
intptr_t
)
self
->
wrapped
,
Location
::
forArg
(
2
)));
rewriter
->
loadConst
((
intptr_t
)
self
->
wrapped
,
Location
::
forArg
(
2
)))
->
setType
(
RefType
::
OWNED
);
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
rewrite_args
->
out_rtn
);
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
rewrite_args
->
out_rtn
);
rewrite_args
->
out_success
=
true
;
rewrite_args
->
out_success
=
true
;
}
}
...
@@ -653,7 +647,8 @@ Box* BoxedWrapperDescriptor::tppCall(Box* _self, CallRewriteArgs* rewrite_args,
...
@@ -653,7 +647,8 @@ Box* BoxedWrapperDescriptor::tppCall(Box* _self, CallRewriteArgs* rewrite_args,
if
(
rewrite_args
)
{
if
(
rewrite_args
)
{
auto
rewriter
=
rewrite_args
->
rewriter
;
auto
rewriter
=
rewrite_args
->
rewriter
;
rewrite_args
->
out_rtn
=
rewriter
->
call
(
true
,
(
void
*
)
wrapper
,
rewrite_args
->
arg1
,
rewrite_args
->
out_rtn
=
rewriter
->
call
(
true
,
(
void
*
)
wrapper
,
rewrite_args
->
arg1
,
rewriter
->
loadConst
((
intptr_t
)
self
->
wrapped
,
Location
::
forArg
(
1
)));
rewriter
->
loadConst
((
intptr_t
)
self
->
wrapped
,
Location
::
forArg
(
1
)))
->
setType
(
RefType
::
OWNED
);
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
rewrite_args
->
out_rtn
);
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
rewrite_args
->
out_rtn
);
rewrite_args
->
out_success
=
true
;
rewrite_args
->
out_success
=
true
;
}
}
...
@@ -663,7 +658,8 @@ Box* BoxedWrapperDescriptor::tppCall(Box* _self, CallRewriteArgs* rewrite_args,
...
@@ -663,7 +658,8 @@ Box* BoxedWrapperDescriptor::tppCall(Box* _self, CallRewriteArgs* rewrite_args,
if
(
rewrite_args
)
{
if
(
rewrite_args
)
{
auto
rewriter
=
rewrite_args
->
rewriter
;
auto
rewriter
=
rewrite_args
->
rewriter
;
rewrite_args
->
out_rtn
=
rewriter
->
call
(
true
,
(
void
*
)
wrapper
,
rewrite_args
->
arg1
,
rewrite_args
->
arg2
,
rewrite_args
->
out_rtn
=
rewriter
->
call
(
true
,
(
void
*
)
wrapper
,
rewrite_args
->
arg1
,
rewrite_args
->
arg2
,
rewriter
->
loadConst
((
intptr_t
)
self
->
wrapped
,
Location
::
forArg
(
2
)));
rewriter
->
loadConst
((
intptr_t
)
self
->
wrapped
,
Location
::
forArg
(
2
)))
->
setType
(
RefType
::
OWNED
);
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
rewrite_args
->
out_rtn
);
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
rewrite_args
->
out_rtn
);
rewrite_args
->
out_success
=
true
;
rewrite_args
->
out_success
=
true
;
}
}
...
@@ -671,6 +667,20 @@ Box* BoxedWrapperDescriptor::tppCall(Box* _self, CallRewriteArgs* rewrite_args,
...
@@ -671,6 +667,20 @@ Box* BoxedWrapperDescriptor::tppCall(Box* _self, CallRewriteArgs* rewrite_args,
RELEASE_ASSERT
(
0
,
"%d"
,
flags
);
RELEASE_ASSERT
(
0
,
"%d"
,
flags
);
}
}
assert
(
paramspec
.
totalReceived
()
<
3
);
assert
(
!
oargs
);
switch
(
paramspec
.
totalReceived
())
{
case
3
:
Py_XDECREF
(
arg3
);
case
2
:
Py_XDECREF
(
arg2
);
case
1
:
Py_XDECREF
(
arg1
);
default:
break
;
}
checkAndThrowCAPIException
();
checkAndThrowCAPIException
();
assert
(
rtn
&&
"should have set + thrown an exception!"
);
assert
(
rtn
&&
"should have set + thrown an exception!"
);
return
rtn
;
return
rtn
;
...
...
src/runtime/objmodel.cpp
View file @
30d4579b
...
@@ -1892,19 +1892,14 @@ Box* dataDescriptorInstanceSpecialCases(GetattrRewriteArgs* rewrite_args, BoxedS
...
@@ -1892,19 +1892,14 @@ Box* dataDescriptorInstanceSpecialCases(GetattrRewriteArgs* rewrite_args, BoxedS
getTypeName
(
getset_descr
));
getTypeName
(
getset_descr
));
}
}
// Abort because right now we can't call twice in a rewrite
if
(
for_call
)
{
rewrite_args
=
NULL
;
}
if
(
rewrite_args
)
{
if
(
rewrite_args
)
{
assert
(
0
&&
"check refcounting"
);
// hmm, maybe we should write assembly which can look up the function address and call any function
// hmm, maybe we should write assembly which can look up the function address and call any function
r_descr
->
addAttrGuard
(
offsetof
(
BoxedGetsetDescriptor
,
get
),
(
intptr_t
)
getset_descr
->
get
);
r_descr
->
addAttrGuard
(
offsetof
(
BoxedGetsetDescriptor
,
get
),
(
intptr_t
)
getset_descr
->
get
);
RewriterVar
*
r_closure
=
r_descr
->
getAttr
(
offsetof
(
BoxedGetsetDescriptor
,
closure
));
RewriterVar
*
r_closure
=
r_descr
->
getAttr
(
offsetof
(
BoxedGetsetDescriptor
,
closure
));
RewriterVar
*
r_rtn
=
rewrite_args
->
rewriter
->
call
(
RewriterVar
*
r_rtn
=
rewrite_args
->
rewriter
->
call
(
/* has_side_effects */
true
,
(
void
*
)
getset_descr
->
get
,
rewrite_args
->
obj
,
r_closure
);
/* has_side_effects */
true
,
(
void
*
)
getset_descr
->
get
,
rewrite_args
->
obj
,
r_closure
)
->
setType
(
RefType
::
OWNED
);
rewrite_args
->
setReturn
(
r_rtn
,
descr
->
cls
==
capi_getset_cls
?
ReturnConvention
::
CAPI_RETURN
rewrite_args
->
setReturn
(
r_rtn
,
descr
->
cls
==
capi_getset_cls
?
ReturnConvention
::
CAPI_RETURN
:
ReturnConvention
::
HAS_RETURN
);
:
ReturnConvention
::
HAS_RETURN
);
...
@@ -6869,7 +6864,7 @@ extern "C" Box* boxedLocalsGet(Box* boxedLocals, BoxedString* attr, Box* globals
...
@@ -6869,7 +6864,7 @@ extern "C" Box* boxedLocalsGet(Box* boxedLocals, BoxedString* attr, Box* globals
auto
it
=
d
.
find
(
attr
);
auto
it
=
d
.
find
(
attr
);
if
(
it
!=
d
.
end
())
{
if
(
it
!=
d
.
end
())
{
Box
*
value
=
it
->
second
;
Box
*
value
=
it
->
second
;
return
value
;
return
incref
(
value
)
;
}
}
}
else
{
}
else
{
try
{
try
{
...
...
src/runtime/types.cpp
View file @
30d4579b
...
@@ -1023,7 +1023,7 @@ static Box* typeCallInner(CallRewriteArgs* rewrite_args, ArgPassSpec argspec, Bo
...
@@ -1023,7 +1023,7 @@ static Box* typeCallInner(CallRewriteArgs* rewrite_args, ArgPassSpec argspec, Bo
// Another option is to rely on rewriting to make this fast, which would probably require adding
// Another option is to rely on rewriting to make this fast, which would probably require adding
// a custom internal callable to object.__new__
// a custom internal callable to object.__new__
made
=
objectNewNoArgs
(
cls
);
made
=
objectNewNoArgs
(
cls
);
r_made
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
objectNewNoArgs
,
r_ccls
);
r_made
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
objectNewNoArgs
,
r_ccls
)
->
setType
(
RefType
::
OWNED
)
;
assert
(
made
);
assert
(
made
);
}
else
{
}
else
{
CallRewriteArgs
srewrite_args
(
rewrite_args
->
rewriter
,
r_new
,
rewrite_args
->
destination
);
CallRewriteArgs
srewrite_args
(
rewrite_args
->
rewriter
,
r_new
,
rewrite_args
->
destination
);
...
@@ -1174,7 +1174,6 @@ static Box* typeCallInner(CallRewriteArgs* rewrite_args, ArgPassSpec argspec, Bo
...
@@ -1174,7 +1174,6 @@ static Box* typeCallInner(CallRewriteArgs* rewrite_args, ArgPassSpec argspec, Bo
// Note: this code path includes the descriptor logic
// Note: this code path includes the descriptor logic
if
(
rewrite_args
)
{
if
(
rewrite_args
)
{
assert
(
0
&&
"check refcounting"
);
CallRewriteArgs
srewrite_args
(
rewrite_args
->
rewriter
,
r_init
,
rewrite_args
->
destination
);
CallRewriteArgs
srewrite_args
(
rewrite_args
->
rewriter
,
r_init
,
rewrite_args
->
destination
);
srewrite_args
.
arg1
=
r_made
;
srewrite_args
.
arg1
=
r_made
;
if
(
npassed_args
>=
2
)
if
(
npassed_args
>=
2
)
...
...
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