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
da2a9964
Commit
da2a9964
authored
Nov 24, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enough refcounting to test the bjit for real
parent
247869a5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
13 deletions
+22
-13
src/codegen/ast_interpreter.cpp
src/codegen/ast_interpreter.cpp
+6
-0
src/codegen/irgen/hooks.cpp
src/codegen/irgen/hooks.cpp
+3
-3
src/core/options.cpp
src/core/options.cpp
+2
-2
src/runtime/bool.cpp
src/runtime/bool.cpp
+5
-5
src/runtime/inline/tuple.cpp
src/runtime/inline/tuple.cpp
+2
-0
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+1
-0
src/runtime/types.cpp
src/runtime/types.cpp
+3
-3
No files found.
src/codegen/ast_interpreter.cpp
View file @
da2a9964
...
@@ -871,6 +871,9 @@ Value ASTInterpreter::visit_langPrimitive(AST_LangPrimitive* node) {
...
@@ -871,6 +871,9 @@ Value ASTInterpreter::visit_langPrimitive(AST_LangPrimitive* node) {
assert
(
node
->
args
.
size
()
==
1
);
assert
(
node
->
args
.
size
()
==
1
);
Value
val
=
visit_expr
(
node
->
args
[
0
]);
Value
val
=
visit_expr
(
node
->
args
[
0
]);
v
=
Value
(
getPystonIter
(
val
.
o
),
jit
?
jit
->
emitGetPystonIter
(
val
)
:
NULL
);
v
=
Value
(
getPystonIter
(
val
.
o
),
jit
?
jit
->
emitGetPystonIter
(
val
)
:
NULL
);
Py_DECREF
(
val
.
o
);
if
(
jit
)
val
.
var
->
decref
();
}
else
if
(
node
->
opcode
==
AST_LangPrimitive
::
IMPORT_FROM
)
{
}
else
if
(
node
->
opcode
==
AST_LangPrimitive
::
IMPORT_FROM
)
{
assert
(
node
->
args
.
size
()
==
2
);
assert
(
node
->
args
.
size
()
==
2
);
assert
(
node
->
args
[
0
]
->
type
==
AST_TYPE
::
Name
);
assert
(
node
->
args
[
0
]
->
type
==
AST_TYPE
::
Name
);
...
@@ -956,6 +959,9 @@ Value ASTInterpreter::visit_langPrimitive(AST_LangPrimitive* node) {
...
@@ -956,6 +959,9 @@ Value ASTInterpreter::visit_langPrimitive(AST_LangPrimitive* node) {
assert
(
node
->
args
.
size
()
==
1
);
assert
(
node
->
args
.
size
()
==
1
);
Value
obj
=
visit_expr
(
node
->
args
[
0
]);
Value
obj
=
visit_expr
(
node
->
args
[
0
]);
v
=
Value
(
boxBool
(
hasnext
(
obj
.
o
)),
jit
?
jit
->
emitHasnext
(
obj
)
:
NULL
);
v
=
Value
(
boxBool
(
hasnext
(
obj
.
o
)),
jit
?
jit
->
emitHasnext
(
obj
)
:
NULL
);
Py_DECREF
(
obj
.
o
);
if
(
jit
)
obj
.
var
->
decref
();
}
else
if
(
node
->
opcode
==
AST_LangPrimitive
::
PRINT_EXPR
)
{
}
else
if
(
node
->
opcode
==
AST_LangPrimitive
::
PRINT_EXPR
)
{
abortJITing
();
abortJITing
();
Value
obj
=
visit_expr
(
node
->
args
[
0
]);
Value
obj
=
visit_expr
(
node
->
args
[
0
]);
...
...
src/codegen/irgen/hooks.cpp
View file @
da2a9964
...
@@ -342,9 +342,9 @@ void compileAndRunModule(AST_Module* m, BoxedModule* bm) {
...
@@ -342,9 +342,9 @@ void compileAndRunModule(AST_Module* m, BoxedModule* bm) {
Py_DECREF
(
r
);
Py_DECREF
(
r
);
// XXX for bjit testing
// XXX for bjit testing
r
=
astInterpretFunction
(
md
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
//
r = astInterpretFunction(md, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
assert
(
r
==
None
);
//
assert(r == None);
Py_DECREF
(
r
);
//
Py_DECREF(r);
}
}
Box
*
evalOrExec
(
FunctionMetadata
*
md
,
Box
*
globals
,
Box
*
boxedLocals
)
{
Box
*
evalOrExec
(
FunctionMetadata
*
md
,
Box
*
globals
,
Box
*
boxedLocals
)
{
...
...
src/core/options.cpp
View file @
da2a9964
...
@@ -46,8 +46,8 @@ bool ENABLE_TRACEBACKS = true;
...
@@ -46,8 +46,8 @@ bool ENABLE_TRACEBACKS = true;
bool
FORCE_LLVM_CAPI_CALLS
=
false
;
bool
FORCE_LLVM_CAPI_CALLS
=
false
;
bool
FORCE_LLVM_CAPI_THROWS
=
false
;
bool
FORCE_LLVM_CAPI_THROWS
=
false
;
int
OSR_THRESHOLD_INTERPRETER
=
1
;
int
OSR_THRESHOLD_INTERPRETER
=
25
;
// XXX
int
REOPT_THRESHOLD_INTERPRETER
=
1
;
int
REOPT_THRESHOLD_INTERPRETER
=
2
;
// XXX
int
OSR_THRESHOLD_BASELINE
=
2500
;
int
OSR_THRESHOLD_BASELINE
=
2500
;
int
REOPT_THRESHOLD_BASELINE
=
1500
;
int
REOPT_THRESHOLD_BASELINE
=
1500
;
int
OSR_THRESHOLD_T2
=
10000
;
int
OSR_THRESHOLD_T2
=
10000
;
...
...
src/runtime/bool.cpp
View file @
da2a9964
...
@@ -34,8 +34,8 @@ extern "C" Box* boolRepr(BoxedBool* v) {
...
@@ -34,8 +34,8 @@ extern "C" Box* boolRepr(BoxedBool* v) {
static
BoxedString
*
false_str
=
getStaticString
(
"False"
);
static
BoxedString
*
false_str
=
getStaticString
(
"False"
);
if
(
v
==
True
)
if
(
v
==
True
)
return
true_str
;
return
incref
(
true_str
)
;
return
false_str
;
return
incref
(
false_str
)
;
}
}
size_t
bool_hash
(
BoxedBool
*
v
)
{
size_t
bool_hash
(
BoxedBool
*
v
)
{
...
@@ -59,7 +59,7 @@ extern "C" Box* boolAnd(BoxedBool* lhs, BoxedBool* rhs) {
...
@@ -59,7 +59,7 @@ extern "C" Box* boolAnd(BoxedBool* lhs, BoxedBool* rhs) {
getTypeName
(
lhs
));
getTypeName
(
lhs
));
if
(
rhs
->
cls
!=
bool_cls
)
if
(
rhs
->
cls
!=
bool_cls
)
return
NotImplemented
;
return
incref
(
NotImplemented
)
;
return
boxBool
(
lhs
->
n
&&
rhs
->
n
);
return
boxBool
(
lhs
->
n
&&
rhs
->
n
);
}
}
...
@@ -69,7 +69,7 @@ extern "C" Box* boolOr(BoxedBool* lhs, BoxedBool* rhs) {
...
@@ -69,7 +69,7 @@ extern "C" Box* boolOr(BoxedBool* lhs, BoxedBool* rhs) {
raiseExcHelper
(
TypeError
,
"descriptor '__or__' requires a 'bool' object but received a '%s'"
,
getTypeName
(
lhs
));
raiseExcHelper
(
TypeError
,
"descriptor '__or__' requires a 'bool' object but received a '%s'"
,
getTypeName
(
lhs
));
if
(
rhs
->
cls
!=
bool_cls
)
if
(
rhs
->
cls
!=
bool_cls
)
return
NotImplemented
;
return
incref
(
NotImplemented
)
;
return
boxBool
(
lhs
->
n
||
rhs
->
n
);
return
boxBool
(
lhs
->
n
||
rhs
->
n
);
}
}
...
@@ -80,7 +80,7 @@ extern "C" Box* boolXor(BoxedBool* lhs, BoxedBool* rhs) {
...
@@ -80,7 +80,7 @@ extern "C" Box* boolXor(BoxedBool* lhs, BoxedBool* rhs) {
getTypeName
(
lhs
));
getTypeName
(
lhs
));
if
(
rhs
->
cls
!=
bool_cls
)
if
(
rhs
->
cls
!=
bool_cls
)
return
NotImplemented
;
return
incref
(
NotImplemented
)
;
return
boxBool
(
lhs
->
n
^
rhs
->
n
);
return
boxBool
(
lhs
->
n
^
rhs
->
n
);
}
}
...
...
src/runtime/inline/tuple.cpp
View file @
da2a9964
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
namespace
pyston
{
namespace
pyston
{
BoxedTupleIterator
::
BoxedTupleIterator
(
BoxedTuple
*
t
)
:
t
(
t
),
pos
(
0
)
{
BoxedTupleIterator
::
BoxedTupleIterator
(
BoxedTuple
*
t
)
:
t
(
t
),
pos
(
0
)
{
Py_INCREF
(
t
);
}
}
Box
*
tupleIterIter
(
Box
*
s
)
{
Box
*
tupleIterIter
(
Box
*
s
)
{
...
@@ -53,6 +54,7 @@ Box* tupleiter_next(Box* s) noexcept {
...
@@ -53,6 +54,7 @@ Box* tupleiter_next(Box* s) noexcept {
Box
*
rtn
=
self
->
t
->
elts
[
self
->
pos
];
Box
*
rtn
=
self
->
t
->
elts
[
self
->
pos
];
self
->
pos
++
;
self
->
pos
++
;
Py_INCREF
(
rtn
);
return
rtn
;
return
rtn
;
}
}
...
...
src/runtime/tuple.cpp
View file @
da2a9964
...
@@ -240,6 +240,7 @@ Box* tupleRepr(BoxedTuple* t) {
...
@@ -240,6 +240,7 @@ Box* tupleRepr(BoxedTuple* t) {
}
}
BoxedString
*
elt_repr
=
static_cast
<
BoxedString
*>
(
repr
(
t
->
elts
[
i
]));
BoxedString
*
elt_repr
=
static_cast
<
BoxedString
*>
(
repr
(
t
->
elts
[
i
]));
chars
.
insert
(
chars
.
end
(),
elt_repr
->
s
().
begin
(),
elt_repr
->
s
().
end
());
chars
.
insert
(
chars
.
end
(),
elt_repr
->
s
().
begin
(),
elt_repr
->
s
().
end
());
Py_DECREF
(
elt_repr
);
}
}
if
(
n
==
1
)
if
(
n
==
1
)
...
...
src/runtime/types.cpp
View file @
da2a9964
...
@@ -2626,7 +2626,7 @@ static PyObject* object_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
...
@@ -2626,7 +2626,7 @@ static PyObject* object_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
static
Box
*
typeName
(
Box
*
b
,
void
*
);
static
Box
*
typeName
(
Box
*
b
,
void
*
);
Box
*
objectRepr
(
Box
*
self
)
{
Box
*
objectRepr
(
Box
*
self
)
{
BoxedClass
*
type
=
self
->
cls
;
BoxedClass
*
type
=
self
->
cls
;
Box
*
mod
=
NULL
;
DecrefHandle
<
Box
,
true
>
mod
(
NULL
)
;
try
{
try
{
mod
=
typeModule
(
type
,
NULL
);
mod
=
typeModule
(
type
,
NULL
);
if
(
!
PyString_Check
(
mod
))
if
(
!
PyString_Check
(
mod
))
...
@@ -2634,7 +2634,7 @@ Box* objectRepr(Box* self) {
...
@@ -2634,7 +2634,7 @@ Box* objectRepr(Box* self) {
}
catch
(
ExcInfo
)
{
}
catch
(
ExcInfo
)
{
}
}
Box
*
name
=
typeName
(
type
,
NULL
);
DecrefHandle
<
Box
>
name
(
typeName
(
type
,
NULL
)
);
if
(
mod
!=
NULL
&&
strcmp
(
PyString_AS_STRING
(
mod
),
"__builtin__"
))
if
(
mod
!=
NULL
&&
strcmp
(
PyString_AS_STRING
(
mod
),
"__builtin__"
))
return
PyString_FromFormat
(
"<%s.%s object at %p>"
,
PyString_AS_STRING
(
mod
),
PyString_AS_STRING
(
name
),
self
);
return
PyString_FromFormat
(
"<%s.%s object at %p>"
,
PyString_AS_STRING
(
mod
),
PyString_AS_STRING
(
name
),
self
);
return
PyString_FromFormat
(
"<%s object at %p>"
,
type
->
tp_name
,
self
);
return
PyString_FromFormat
(
"<%s object at %p>"
,
type
->
tp_name
,
self
);
...
@@ -3023,7 +3023,7 @@ static Box* typeName(Box* b, void*) {
...
@@ -3023,7 +3023,7 @@ static Box* typeName(Box* b, void*) {
if
(
type
->
tp_flags
&
Py_TPFLAGS_HEAPTYPE
)
{
if
(
type
->
tp_flags
&
Py_TPFLAGS_HEAPTYPE
)
{
BoxedHeapClass
*
et
=
static_cast
<
BoxedHeapClass
*>
(
type
);
BoxedHeapClass
*
et
=
static_cast
<
BoxedHeapClass
*>
(
type
);
return
et
->
ht_name
;
return
incref
(
et
->
ht_name
)
;
}
else
{
}
else
{
const
char
*
s
=
strrchr
(
type
->
tp_name
,
'.'
);
const
char
*
s
=
strrchr
(
type
->
tp_name
,
'.'
);
if
(
s
==
NULL
)
if
(
s
==
NULL
)
...
...
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