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
92c78799
Commit
92c78799
authored
Mar 11, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the build issues
parent
e78dc8d7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
20 deletions
+45
-20
from_cpython/Include/object.h
from_cpython/Include/object.h
+2
-2
src/runtime/descr.cpp
src/runtime/descr.cpp
+15
-0
src/runtime/dict.cpp
src/runtime/dict.cpp
+4
-2
src/runtime/exceptions.cpp
src/runtime/exceptions.cpp
+5
-0
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+8
-7
src/runtime/set.cpp
src/runtime/set.cpp
+1
-1
src/runtime/types.cpp
src/runtime/types.cpp
+8
-7
src/runtime/types.h
src/runtime/types.h
+2
-1
No files found.
from_cpython/Include/object.h
View file @
92c78799
...
...
@@ -8,8 +8,8 @@ extern "C" {
// Pyston addition: refcounting annotations:
#define BORROWED(
T) T
#define STOLEN(
T) T
#define BORROWED(
...) __VA_ARGS__
#define STOLEN(
...) __VA_ARGS__
#define NOREFCHECK ;
/* Object and type object interface */
...
...
src/runtime/descr.cpp
View file @
92c78799
...
...
@@ -469,6 +469,21 @@ int BoxedMethodDescriptor::traverse(Box* _self, visitproc visit, void *arg) noex
return
0
;
}
void
BoxedWrapperDescriptor
::
dealloc
(
Box
*
_self
)
noexcept
{
BoxedWrapperDescriptor
*
self
=
static_cast
<
BoxedWrapperDescriptor
*>
(
_self
);
PyObject_GC_UnTrack
(
self
);
Py_XDECREF
(
self
->
type
);
self
->
cls
->
tp_free
(
self
);
}
int
BoxedWrapperDescriptor
::
traverse
(
Box
*
_self
,
visitproc
visit
,
void
*
arg
)
noexcept
{
BoxedWrapperDescriptor
*
self
=
static_cast
<
BoxedWrapperDescriptor
*>
(
_self
);
Py_VISIT
(
self
->
type
);
return
0
;
}
void
BoxedWrapperObject
::
dealloc
(
Box
*
_self
)
noexcept
{
BoxedWrapperObject
*
self
=
static_cast
<
BoxedWrapperObject
*>
(
_self
);
...
...
src/runtime/dict.cpp
View file @
92c78799
...
...
@@ -457,14 +457,16 @@ static int dict_ass_sub(PyDictObject* mp, PyObject* v, PyObject* w) noexcept {
extern
"C"
int
PyDict_DelItem
(
PyObject
*
op
,
PyObject
*
key
)
noexcept
{
if
(
PyDict_Check
(
op
))
{
BoxedDict
*
self
=
static_cast
<
BoxedDict
*>
(
op
);
assert
(
0
&&
"untested"
);
decltype
(
self
->
d
)
::
iterator
it
;
try
{
auto
it
=
self
->
d
.
find
(
k
);
it
=
self
->
d
.
find
(
key
);
}
catch
(
ExcInfo
e
)
{
setCAPIException
(
e
);
return
-
1
;
}
if
(
it
==
self
->
d
.
end
())
if
(
it
==
self
->
d
.
end
())
{
PyErr_SetObject
(
KeyError
,
autoDecref
(
BoxedTuple
::
create1
(
key
)));
return
-
1
;
}
...
...
src/runtime/exceptions.cpp
View file @
92c78799
...
...
@@ -302,6 +302,11 @@ void caughtCxxException(ExcInfo* exc_info) {
struct
ExcState
{
bool
is_reraise
;
constexpr
ExcState
()
:
is_reraise
(
false
)
{}
}
static
__thread
exc_state
;
bool
exceptionAtLineCheck
()
{
if
(
exc_state
.
is_reraise
)
{
exc_state
.
is_reraise
=
false
;
...
...
src/runtime/objmodel.cpp
View file @
92c78799
...
...
@@ -143,7 +143,7 @@ extern "C" Box* deopt(AST_expr* expr, Box* value) {
}
extern
"C"
void
printHelper
(
Box
*
w
,
Box
*
v
,
bool
nl
)
{
assert
(
0
&&
"is this tested?"
);
`
assert
(
0
&&
"is this tested?"
);
// copied from cpythons PRINT_ITEM and PRINT_NEWLINE op handling code
if
(
w
==
NULL
||
w
==
None
)
{
w
=
PySys_GetObject
(
"stdout"
);
...
...
@@ -2878,7 +2878,7 @@ extern "C" void setattr(Box* obj, BoxedString* attr, STOLEN(Box*) attr_val) {
return
;
}
AUTO_DECREF
(
val
);
AUTO_DECREF
(
attr_
val
);
if
(
rewriter
.
get
())
{
assert
(
setattr
);
...
...
@@ -5312,8 +5312,9 @@ Box* compareInternal(Box* lhs, Box* rhs, int op_type, CompareRewriteArgs* rewrit
bool
negate
=
(
op_type
==
AST_TYPE
::
NotIn
);
if
(
rewrite_args
)
{
RewriterVar
*
r_contained_box
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
nonzeroAndBox
<
negate
>
,
r_contained
,
r_negate
)
->
setType
(
RefType
::
OWNED
);
RewriterVar
*
r_contained_box
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)(
negate
?
nonzeroAndBox
<
true
>
:
nonzeroAndBox
<
false
>
),
r_contained
)
->
setType
(
RefType
::
OWNED
);
rewrite_args
->
out_rtn
=
r_contained_box
;
rewrite_args
->
out_success
=
true
;
}
...
...
@@ -5430,7 +5431,7 @@ Box* compareInternal(Box* lhs, Box* rhs, int op_type, CompareRewriteArgs* rewrit
}
return
lrtn
;
}
else
{
Py_DECREF
(
ltn
);
Py_DECREF
(
l
r
tn
);
rewrite_args
=
NULL
;
}
}
...
...
@@ -6921,8 +6922,8 @@ extern "C" void boxedLocalsDel(Box* boxedLocals, BoxedString* attr) {
assert
(
attr
->
data
()[
attr
->
size
()]
==
'\0'
);
assertNameDefined
(
0
,
attr
->
data
(),
NameError
,
false
/* local_var_msg */
);
}
Box
*
key
=
it
.
first
.
value
;
Box
*
value
=
it
.
second
;
Box
*
key
=
it
->
first
.
value
;
Box
*
value
=
it
->
second
;
d
.
erase
(
it
);
Py_DECREF
(
key
);
Py_DECREF
(
value
);
...
...
src/runtime/set.cpp
View file @
92c78799
...
...
@@ -48,7 +48,7 @@ public:
static
void
dealloc
(
BoxedSetIterator
*
o
)
noexcept
{
PyObject_GC_UnTrack
(
o
);
PyObject_ClearWeakRefs
((
PyObject
*
)
self
);
PyObject_ClearWeakRefs
((
PyObject
*
)
o
);
Py_DECREF
(
o
->
s
);
...
...
src/runtime/types.cpp
View file @
92c78799
...
...
@@ -40,6 +40,7 @@
#include "runtime/dict.h"
#include "runtime/hiddenclass.h"
#include "runtime/ics.h"
#include "runtime/inline/list.h"
#include "runtime/iterobject.h"
#include "runtime/list.h"
#include "runtime/long.h"
...
...
@@ -2398,7 +2399,7 @@ public:
HCAttrs
*
attrs
=
self
->
b
->
getHCAttrsPtr
();
RELEASE_ASSERT
(
attrs
->
hcls
->
type
==
HiddenClass
::
NORMAL
||
attrs
->
hcls
->
type
==
HiddenClass
::
SINGLETON
,
""
);
for
(
const
auto
&
p
:
attrs
->
hcls
->
getStrAttrOffsets
())
{
listAppend
(
rtn
,
p
.
first
);
listAppend
Internal
(
rtn
,
p
.
first
);
}
return
rtn
;
}
...
...
@@ -2412,7 +2413,7 @@ public:
HCAttrs
*
attrs
=
self
->
b
->
getHCAttrsPtr
();
RELEASE_ASSERT
(
attrs
->
hcls
->
type
==
HiddenClass
::
NORMAL
||
attrs
->
hcls
->
type
==
HiddenClass
::
SINGLETON
,
""
);
for
(
const
auto
&
p
:
attrs
->
hcls
->
getStrAttrOffsets
())
{
listAppend
(
rtn
,
attrs
->
attr_list
->
attrs
[
p
.
second
]);
listAppend
Internal
(
rtn
,
attrs
->
attr_list
->
attrs
[
p
.
second
]);
}
return
rtn
;
}
...
...
@@ -2427,7 +2428,7 @@ public:
RELEASE_ASSERT
(
attrs
->
hcls
->
type
==
HiddenClass
::
NORMAL
||
attrs
->
hcls
->
type
==
HiddenClass
::
SINGLETON
,
""
);
for
(
const
auto
&
p
:
attrs
->
hcls
->
getStrAttrOffsets
())
{
BoxedTuple
*
t
=
BoxedTuple
::
create
({
p
.
first
,
attrs
->
attr_list
->
attrs
[
p
.
second
]
});
listAppendStolen
(
rtn
,
t
);
listAppend
Internal
Stolen
(
rtn
,
t
);
}
return
rtn
;
}
...
...
@@ -2469,7 +2470,6 @@ public:
HCAttrs
*
attrs
=
self
->
b
->
getHCAttrsPtr
();
RELEASE_ASSERT
(
attrs
->
hcls
->
type
==
HiddenClass
::
NORMAL
||
attrs
->
hcls
->
type
==
HiddenClass
::
SINGLETON
,
""
);
attrs
->
clear
();
AOEU
// Add the existing attrwrapper object (ie self) back as the attrwrapper:
self
->
b
->
appendNewHCAttr
(
self
,
NULL
);
...
...
@@ -3529,7 +3529,7 @@ void BoxedModule::dealloc(Box* b) noexcept {
int
BoxedModule
::
traverse
(
Box
*
_m
,
visitproc
visit
,
void
*
arg
)
noexcept
{
BoxedModule
*
m
=
static_cast
<
BoxedModule
*>
(
_m
);
Py_VISIT_HCATTRS
(
m
->
attrs
);
assert
(
!
self
->
keep_alive
.
size
());
assert
(
!
m
->
keep_alive
.
size
());
return
0
;
}
...
...
@@ -3964,8 +3964,9 @@ void setupRuntime() {
wrapperobject_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
0
,
0
,
sizeof
(
BoxedWrapperObject
),
false
,
"method-wrapper"
,
false
,
BoxedWrapperObject
::
dealloc
,
NULL
,
true
,
BoxedWrapperObject
::
traverse
,
NOCLEAR
);
wrapperdescr_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
0
,
0
,
sizeof
(
BoxedWrapperDescriptor
),
false
,
"wrapper_descriptor"
,
false
,
BoxedWrapperDescriptor
::
dealloc
,
NULL
,
false
);
wrapperdescr_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
0
,
0
,
sizeof
(
BoxedWrapperDescriptor
),
false
,
"wrapper_descriptor"
,
false
,
BoxedWrapperDescriptor
::
dealloc
,
NULL
,
true
,
BoxedWrapperDescriptor
::
traverse
,
NOCLEAR
);
EmptyString
=
new
(
0
)
BoxedString
(
""
);
constants
.
push_back
(
EmptyString
);
...
...
src/runtime/types.h
View file @
92c78799
...
...
@@ -1200,7 +1200,8 @@ public:
Py_INCREF
(
type
);
}
void
dealloc
(
Box
*
b
)
noexcept
;
static
void
dealloc
(
Box
*
b
)
noexcept
;
static
int
traverse
(
Box
*
_self
,
visitproc
visit
,
void
*
arg
)
noexcept
;
DEFAULT_CLASS
(
wrapperdescr_cls
);
...
...
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