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
1ac82dda
Commit
1ac82dda
authored
Dec 20, 2015
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apply experimental complex changes
parent
9dbcaa45
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
33 additions
and
1235 deletions
+33
-1235
Makefile
Makefile
+1
-0
src/CMakeLists.txt
src/CMakeLists.txt
+0
-1
src/codegen/runtime_hooks.cpp
src/codegen/runtime_hooks.cpp
+1
-1
src/core/options.cpp
src/core/options.cpp
+1
-0
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+1
-0
src/runtime/complex.cpp
src/runtime/complex.cpp
+0
-1175
src/runtime/complex.h
src/runtime/complex.h
+0
-25
src/runtime/inline/boxing.h
src/runtime/inline/boxing.h
+4
-4
src/runtime/inline/link_forcer.cpp
src/runtime/inline/link_forcer.cpp
+2
-2
src/runtime/types.cpp
src/runtime/types.cpp
+10
-10
src/runtime/types.h
src/runtime/types.h
+13
-17
No files found.
Makefile
View file @
1ac82dda
...
...
@@ -324,6 +324,7 @@ STDMODULE_SRCS := \
STDOBJECT_SRCS
:=
\
structseq.c
\
capsule.c
\
complexobject.c
\
stringobject.c
\
exceptions.c
\
floatobject.c
\
...
...
src/CMakeLists.txt
View file @
1ac82dda
...
...
@@ -86,7 +86,6 @@ add_library(PYSTON_OBJECTS OBJECT ${OPTIONAL_SRCS}
runtime/capi.cpp
runtime/classobj.cpp
runtime/code.cpp
runtime/complex.cpp
runtime/ctxswitching.S
runtime/cxx_unwind.cpp
runtime/descr.cpp
...
...
src/codegen/runtime_hooks.cpp
View file @
1ac82dda
...
...
@@ -36,7 +36,7 @@
#include "codegen/irgen/util.h"
#include "core/threading.h"
#include "core/types.h"
#include "runtime/complex.h"
//
#include "runtime/complex.h"
#include "runtime/float.h"
#include "runtime/generator.h"
#include "runtime/import.h"
...
...
src/core/options.cpp
View file @
1ac82dda
...
...
@@ -91,5 +91,6 @@ int Py_NoSiteFlag = 0;
int
Py_OptimizeFlag
=
0
;
int
Py_VerboseFlag
=
0
;
int
Py_UnicodeFlag
=
0
;
int
Py_DivisionWarningFlag
=
0
;
}
}
src/runtime/builtin_modules/builtins.cpp
View file @
1ac82dda
...
...
@@ -2083,6 +2083,7 @@ void setupBuiltins() {
builtins_module
->
giveAttr
(
"set"
,
set_cls
);
builtins_module
->
giveAttr
(
"frozenset"
,
frozenset_cls
);
builtins_module
->
giveAttr
(
"tuple"
,
tuple_cls
);
assert
(
complex_cls
);
builtins_module
->
giveAttr
(
"complex"
,
complex_cls
);
builtins_module
->
giveAttr
(
"super"
,
super_cls
);
builtins_module
->
giveAttr
(
"property"
,
property_cls
);
...
...
src/runtime/complex.cpp
deleted
100644 → 0
View file @
9dbcaa45
This diff is collapsed.
Click to expand it.
src/runtime/complex.h
deleted
100644 → 0
View file @
9dbcaa45
// Copyright (c) 2014-2015 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef PYSTON_RUNTIME_COMPLEX_H
#define PYSTON_RUNTIME_COMPLEX_H
#include "core/types.h"
namespace
pyston
{
extern
"C"
Box
*
createPureImaginary
(
double
i
);
}
#endif
src/runtime/inline/boxing.h
View file @
1ac82dda
...
...
@@ -26,10 +26,10 @@ extern "C" inline Box* boxFloat(double d) {
return
new
BoxedFloat
(
d
);
}
extern
"C"
inline
Box
*
boxComplex
(
double
r
,
double
i
)
__attribute__
((
visibility
(
"default"
)));
extern
"C"
inline
Box
*
boxComplex
(
double
r
,
double
i
)
{
return
new
BoxedComplex
(
r
,
i
);
}
//
extern "C" inline Box* boxComplex(double r, double i) __attribute__((visibility("default")));
//
extern "C" inline Box* boxComplex(double r, double i) {
//
return new BoxedComplex(r, i);
//
}
extern
"C"
inline
bool
unboxBool
(
Box
*
b
)
__attribute__
((
visibility
(
"default"
)));
extern
"C"
inline
bool
unboxBool
(
Box
*
b
)
{
...
...
src/runtime/inline/link_forcer.cpp
View file @
1ac82dda
...
...
@@ -20,7 +20,7 @@
#include "core/ast.h"
#include "core/threading.h"
#include "core/types.h"
#include "runtime/complex.h"
//
#include "runtime/complex.h"
#include "runtime/float.h"
#include "runtime/generator.h"
#include "runtime/import.h"
...
...
@@ -69,7 +69,7 @@ void force() {
FORCE
(
createClosure
);
FORCE
(
createGenerator
);
FORCE
(
createLong
);
FORCE
(
createPureImaginary
);
//
FORCE(createPureImaginary);
FORCE
(
createSet
);
FORCE
(
decodeUTF8StringPtr
);
...
...
src/runtime/types.cpp
View file @
1ac82dda
...
...
@@ -35,7 +35,7 @@
#include "core/types.h"
#include "runtime/classobj.h"
#include "runtime/code.h"
#include "runtime/complex.h"
//
#include "runtime/complex.h"
#include "runtime/dict.h"
#include "runtime/file.h"
#include "runtime/hiddenclass.h"
...
...
@@ -568,7 +568,7 @@ BoxedFloat* BoxedModule::getFloatConstant(double d) {
Box
*
BoxedModule
::
getPureImaginaryConstant
(
double
d
)
{
Box
*&
r
=
imaginary_constants
[
getDoubleBits
(
d
)];
if
(
!
r
)
r
=
createPureImaginary
(
d
);
r
=
PyComplex_FromDoubles
(
0.0
,
d
);
return
r
;
}
...
...
@@ -1557,9 +1557,9 @@ void BoxedClosure::gcHandler(GCVisitor* v, Box* b) {
extern
"C"
{
BoxedClass
*
object_cls
,
*
type_cls
,
*
none_cls
,
*
bool_cls
,
*
int_cls
,
*
float_cls
,
*
str_cls
=
NULL
,
*
function_cls
,
*
instancemethod_cls
,
*
list_cls
,
*
slice_cls
,
*
module_cls
,
*
dict_cls
,
*
tuple_cls
,
*
file_cls
,
*
member_descriptor_cls
,
*
closure_cls
,
*
generator_cls
,
*
null_importer_cls
,
*
complex
_cls
,
*
basestring_cls
,
*
property_cls
,
*
staticmethod_cls
,
*
classmethod_cls
,
*
attrwrapper_cls
,
*
pyston
_getset_cls
,
*
capi_getset_cls
,
*
builtin_function_or_method_cls
,
*
attrwrapperiter_cls
,
*
set_cls
,
*
frozenset_cls
;
*
file_cls
,
*
member_descriptor_cls
,
*
closure_cls
,
*
generator_cls
,
*
null_importer_cls
,
*
basestring
_cls
,
*
property_cls
,
*
staticmethod_cls
,
*
classmethod_cls
,
*
attrwrapper_cls
,
*
pyston_getset_cls
,
*
capi
_getset_cls
,
*
builtin_function_or_method_cls
,
*
attrwrapperiter_cls
,
*
set_cls
,
*
frozenset_cls
;
BoxedTuple
*
EmptyTuple
;
}
...
...
@@ -3689,7 +3689,7 @@ void setupRuntime() {
int_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
NULL
,
0
,
0
,
sizeof
(
BoxedInt
),
false
,
"int"
);
int_cls
->
tp_flags
|=
Py_TPFLAGS_INT_SUBCLASS
;
bool_cls
=
new
(
0
)
BoxedClass
(
int_cls
,
NULL
,
0
,
0
,
sizeof
(
BoxedBool
),
false
,
"bool"
);
complex_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
NULL
,
0
,
0
,
sizeof
(
BoxedComplex
),
false
,
"complex"
);
//
complex_cls = new (0) BoxedClass(object_cls, NULL, 0, 0, sizeof(BoxedComplex), false, "complex");
long_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
&
BoxedLong
::
gchandler
,
0
,
0
,
sizeof
(
BoxedLong
),
false
,
"long"
);
long_cls
->
tp_flags
|=
Py_TPFLAGS_LONG_SUBCLASS
;
float_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
NULL
,
0
,
0
,
sizeof
(
BoxedFloat
),
false
,
"float"
);
...
...
@@ -3739,7 +3739,7 @@ void setupRuntime() {
file_cls
->
tp_mro
=
BoxedTuple
::
create
({
file_cls
,
object_cls
});
int_cls
->
tp_mro
=
BoxedTuple
::
create
({
int_cls
,
object_cls
});
bool_cls
->
tp_mro
=
BoxedTuple
::
create
({
bool_cls
,
object_cls
});
complex_cls
->
tp_mro
=
BoxedTuple
::
create
({
complex_cls
,
object_cls
});
//
complex_cls->tp_mro = BoxedTuple::create({ complex_cls, object_cls });
long_cls
->
tp_mro
=
BoxedTuple
::
create
({
long_cls
,
object_cls
});
float_cls
->
tp_mro
=
BoxedTuple
::
create
({
float_cls
,
object_cls
});
function_cls
->
tp_mro
=
BoxedTuple
::
create
({
function_cls
,
object_cls
});
...
...
@@ -3794,7 +3794,7 @@ void setupRuntime() {
file_cls
->
finishInitialization
();
int_cls
->
finishInitialization
();
bool_cls
->
finishInitialization
();
complex_cls
->
finishInitialization
();
//
complex_cls->finishInitialization();
long_cls
->
finishInitialization
();
float_cls
->
finishInitialization
();
function_cls
->
finishInitialization
();
...
...
@@ -3925,7 +3925,6 @@ void setupRuntime() {
setupBool
();
setupLong
();
setupFloat
();
setupComplex
();
setupStr
();
setupList
();
setupDict
();
...
...
@@ -4078,6 +4077,7 @@ void setupRuntime() {
attrwrapperiter_cls
->
tp_iter
=
PyObject_SelfIter
;
attrwrapperiter_cls
->
tp_iternext
=
AttrWrapperIter
::
next_capi
;
PyType_Ready
(
&
PyComplex_Type
);
setupBuiltins
();
_PyExc_Init
();
setupThread
();
...
...
@@ -4181,7 +4181,7 @@ void teardownRuntime() {
teardownList
();
teardownInt
();
teardownFloat
();
teardownComplex
();
//
teardownComplex();
teardownStr
();
teardownBool
();
teardownDict
();
...
...
src/runtime/types.h
View file @
1ac82dda
...
...
@@ -46,8 +46,6 @@ void setupInt();
void
teardownInt
();
void
setupFloat
();
void
teardownFloat
();
void
setupComplex
();
void
teardownComplex
();
void
setupStr
();
void
teardownStr
();
void
setupList
();
...
...
@@ -91,13 +89,11 @@ extern "C" {
extern
BoxedClass
*
object_cls
,
*
type_cls
,
*
bool_cls
,
*
int_cls
,
*
long_cls
,
*
float_cls
,
*
str_cls
,
*
function_cls
,
*
none_cls
,
*
instancemethod_cls
,
*
list_cls
,
*
slice_cls
,
*
module_cls
,
*
dict_cls
,
*
tuple_cls
,
*
file_cls
,
*
enumerate_cls
,
*
xrange_cls
,
*
member_descriptor_cls
,
*
null_importer_cls
,
*
method_cls
,
*
closure_cls
,
*
generator_cls
,
*
complex_cls
,
*
basestring_cls
,
*
property_cls
,
*
staticmethod_cls
,
*
classmethod_cls
,
*
attrwrapper
_cls
,
*
pyston_getset_cls
,
*
capi_getset_cls
,
*
builtin_function_or_method_cls
,
*
set_cls
,
*
frozenset_cls
,
*
code
_cls
,
*
frame_cls
,
*
capifunc_cls
,
*
wrapperdescr_cls
,
*
wrapperobject_cls
;
*
basestring_cls
,
*
property_cls
,
*
staticmethod_cls
,
*
classmethod_cls
,
*
attrwrapper_cls
,
*
pyston_getset
_cls
,
*
capi_getset_cls
,
*
builtin_function_or_method_cls
,
*
set_cls
,
*
frozenset_cls
,
*
code_cls
,
*
frame_cls
,
*
capifunc
_cls
,
*
wrapperdescr_cls
,
*
wrapperobject_cls
;
}
#define unicode_cls (&PyUnicode_Type)
#define memoryview_cls (&PyMemoryView_Type)
#define complex_cls (&PyComplex_Type)
#define unicode_cls (&PyUnicode_Type)
#define memoryview_cls (&PyMemoryView_Type)
...
...
@@ -380,15 +376,15 @@ public:
static_assert
(
sizeof
(
BoxedFloat
)
==
sizeof
(
PyFloatObject
),
""
);
static_assert
(
offsetof
(
BoxedFloat
,
d
)
==
offsetof
(
PyFloatObject
,
ob_fval
),
""
);
class
BoxedComplex
:
public
Box
{
public:
double
real
;
double
imag
;
BoxedComplex
(
double
r
,
double
i
)
__attribute__
((
visibility
(
"default"
)))
:
real
(
r
),
imag
(
i
)
{}
DEFAULT_CLASS_SIMPLE
(
complex_cls
);
};
//
class BoxedComplex : public Box {
//
public:
//
double real;
//
double imag;
//
//
BoxedComplex(double r, double i) __attribute__((visibility("default"))) : real(r), imag(i) {}
//
//
DEFAULT_CLASS_SIMPLE(complex_cls);
//
};
class
BoxedBool
:
public
BoxedInt
{
public:
...
...
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