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
353e7876
Commit
353e7876
authored
Nov 09, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gets pretty far
parent
62728299
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
9 deletions
+18
-9
src/capi/typeobject.cpp
src/capi/typeobject.cpp
+7
-5
src/core/types.h
src/core/types.h
+2
-0
src/runtime/int.cpp
src/runtime/int.cpp
+0
-2
src/runtime/types.cpp
src/runtime/types.cpp
+3
-2
src/runtime/types.h
src/runtime/types.h
+6
-0
No files found.
src/capi/typeobject.cpp
View file @
353e7876
...
...
@@ -1769,7 +1769,7 @@ static void init_slotdefs() noexcept {
return
;
for
(
int
i
=
0
;
i
<
sizeof
(
slotdefs
)
/
sizeof
(
slotdefs
[
0
]);
i
++
)
{
slotdefs
[
i
].
name_strobj
=
internStringImmortal
(
slotdefs
[
i
].
name
.
data
());
slotdefs
[
i
].
name_strobj
=
getStringConstant
(
slotdefs
[
i
].
name
.
data
());
if
(
i
>
0
)
{
if
(
!
slotdefs
[
i
].
name
.
size
())
...
...
@@ -1860,13 +1860,13 @@ static const slotdef* update_one_slot(BoxedClass* type, const slotdef* p) noexce
// there was only one:
assert
((
p
+
1
)
->
offset
>
p
->
offset
);
static
BoxedString
*
class_str
=
internStringImmortal
(
"__class__"
);
static
BoxedString
*
class_str
=
getStringConstant
(
"__class__"
);
if
(
p
->
name_strobj
==
class_str
)
{
if
(
descr
==
object_cls
->
getattr
(
class_str
))
descr
=
NULL
;
}
static
BoxedString
*
getattribute_str
=
internStringImmortal
(
"__getattribute__"
);
static
BoxedString
*
getattribute_str
=
getStringConstant
(
"__getattribute__"
);
if
(
p
->
name_strobj
==
getattribute_str
)
{
if
(
descr
&&
descr
->
cls
==
wrapperdescr_cls
&&
((
BoxedWrapperDescriptor
*
)
descr
)
->
wrapped
==
PyObject_GenericGetAttr
)
...
...
@@ -2095,9 +2095,11 @@ void add_operators(BoxedClass* cls) noexcept {
continue
;
if
(
*
ptr
==
PyObject_HashNotImplemented
)
{
cls
->
giveAttr
(
p
.
name_strobj
,
None
);
cls
->
setattr
(
p
.
name_strobj
,
None
,
NULL
);
}
else
{
cls
->
giveAttr
(
p
.
name_strobj
,
new
BoxedWrapperDescriptor
(
&
p
,
cls
,
*
ptr
));
auto
descr
=
new
BoxedWrapperDescriptor
(
&
p
,
cls
,
*
ptr
);
cls
->
setattr
(
p
.
name_strobj
,
descr
,
NULL
);
Py_DECREF
(
descr
);
}
}
...
...
src/core/types.h
View file @
353e7876
...
...
@@ -295,6 +295,8 @@ class ICInfo;
class
LocationMap
;
class
JitCodeBlock
;
extern
std
::
vector
<
Box
*>
constants
;
// A specific compilation of a FunctionMetadata. Usually these will be created by the LLVM JIT, which will take a FunctionMetadata
// and some compilation settings, and produce a CompiledFunction
// CompiledFunctions can also be created from raw function pointers, using FunctionMetadata::create.
...
...
src/runtime/int.cpp
View file @
353e7876
...
...
@@ -1172,8 +1172,6 @@ void setupInt() {
int_cls
->
giveAttr
(
"__getnewargs__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
int_getnewargs
,
UNKNOWN
,
1
,
ParamNames
::
empty
(),
CAPI
)));
return
;
_addFuncIntFloatUnknown
(
"__add__"
,
(
void
*
)
intAddInt
,
(
void
*
)
intAddFloat
,
(
void
*
)
intAdd
);
_addFuncIntUnknown
(
"__and__"
,
BOXED_INT
,
(
void
*
)
intAndInt
,
(
void
*
)
intAnd
);
_addFuncIntUnknown
(
"__or__"
,
BOXED_INT
,
(
void
*
)
intOrInt
,
(
void
*
)
intOr
);
...
...
src/runtime/types.cpp
View file @
353e7876
...
...
@@ -414,6 +414,7 @@ extern "C" BoxedFunctionBase::BoxedFunctionBase(FunctionMetadata* md, std::initi
int
i
=
0
;
for
(
auto
e
:
defaults
)
{
assert
(
!
e
||
gc
::
isValidGCObject
(
e
));
Py_XINCREF
(
e
);
this
->
defaults
->
elts
[
i
]
=
e
;
++
i
;
}
...
...
@@ -3676,10 +3677,10 @@ done:
#define PRINT_TOTAL_REFS() fprintf(stderr, "[%" PY_FORMAT_SIZE_T "d refs]\n", _Py_GetRefTotal())
#endif
std
::
vector
<
Box
*>
constants
;
bool
TRACK_ALLOCATIONS
=
false
;
void
setupRuntime
()
{
std
::
vector
<
Box
*>
constants
;
root_hcls
=
HiddenClass
::
makeRoot
();
gc
::
registerPermanentRoot
(
root_hcls
);
HiddenClass
::
dict_backed
=
HiddenClass
::
makeDictBacked
();
...
...
src/runtime/types.h
View file @
353e7876
...
...
@@ -1197,6 +1197,12 @@ inline Box*& getArg(int idx, Box*& arg1, Box*& arg2, Box*& arg3, Box** args) {
return
arg3
;
return
args
[
idx
-
3
];
}
inline
BoxedString
*
getStringConstant
(
llvm
::
StringRef
s
)
{
BoxedString
*
r
=
internStringImmortal
(
s
);
constants
.
push_back
(
r
);
return
r
;
}
}
#endif
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