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
02ff68f2
Commit
02ff68f2
authored
May 30, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
I guess setattr has been completely moved to the Rewriter2
parent
d4d92177
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
41 additions
and
90 deletions
+41
-90
src/Makefile
src/Makefile
+2
-0
src/core/types.h
src/core/types.h
+2
-4
src/runtime/bool.cpp
src/runtime/bool.cpp
+1
-1
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+15
-15
src/runtime/capi.cpp
src/runtime/capi.cpp
+1
-1
src/runtime/dict.cpp
src/runtime/dict.cpp
+4
-4
src/runtime/file.cpp
src/runtime/file.cpp
+1
-1
src/runtime/float.cpp
src/runtime/float.cpp
+2
-2
src/runtime/int.cpp
src/runtime/int.cpp
+1
-1
src/runtime/list.cpp
src/runtime/list.cpp
+1
-1
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+5
-54
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+1
-1
src/runtime/types.cpp
src/runtime/types.cpp
+5
-5
No files found.
src/Makefile
View file @
02ff68f2
...
@@ -802,6 +802,7 @@ $(call make_search,oprofcg_%)
...
@@ -802,6 +802,7 @@ $(call make_search,oprofcg_%)
opreportcg
:
opreportcg
:
opreport lib-image:pyston_oprof
-l
-t
0.2
-a
--callgraph
opreport lib-image:pyston_oprof
-l
-t
0.2
-a
--callgraph
.PHONY
:
watch_% watch wdbg_%
watch_%
:
watch_%
:
@
(
ulimit
-t
60
;
ulimit
-d
$(MAK_MEM_KB)
;
ulimit
-v
$(MAK_MEM_KB)
;
\
@
(
ulimit
-t
60
;
ulimit
-d
$(MAK_MEM_KB)
;
ulimit
-v
$(MAK_MEM_KB)
;
\
TARGET
=
$(
dir
$@
)$(
patsubst
watch_%,%,
$(
notdir
$@
))
;
\
TARGET
=
$(
dir
$@
)$(
patsubst
watch_%,%,
$(
notdir
$@
))
;
\
...
@@ -810,6 +811,7 @@ watch_%:
...
@@ -810,6 +811,7 @@ watch_%:
Makefile
$$
(
find ..
\(
-name
'*.cpp'
-o
-name
'*.h'
-o
-name
'*.py'
\)
)
;
do
clear
;
$(MAKE)
$$
TARGET
;
done
)
Makefile
$$
(
find ..
\(
-name
'*.cpp'
-o
-name
'*.h'
-o
-name
'*.py'
\)
)
;
do
clear
;
$(MAKE)
$$
TARGET
;
done
)
# Makefile $
$
(
find
\(
-name
'*.cpp'
-o
-name
'*.h'
-o
-name
'*.py'
\)
-o
-type
d
)
;
do
clear
;
$(MAKE)
$(
patsubst
watch_%,%,
$@
)
;
done
)
# Makefile $
$
(
find
\(
-name
'*.cpp'
-o
-name
'*.h'
-o
-name
'*.py'
\)
-o
-type
d
)
;
do
clear
;
$(MAKE)
$(
patsubst
watch_%,%,
$@
)
;
done
)
# -r . ; do clear;
$(MAKE)
$(
patsubst
watch_%,%,
$@
)
;
done
# -r . ; do clear;
$(MAKE)
$(
patsubst
watch_%,%,
$@
)
;
done
watch
:
watch_pyston_dbg
wdbg_%
:
wdbg_%
:
$(MAKE)
$(
patsubst
wdbg_%,watch_dbg_%,
$@
)
GDB_CMDS
=
"--ex quit"
$(MAKE)
$(
patsubst
wdbg_%,watch_dbg_%,
$@
)
GDB_CMDS
=
"--ex quit"
...
...
src/core/types.h
View file @
02ff68f2
...
@@ -302,7 +302,6 @@ private:
...
@@ -302,7 +302,6 @@ private:
};
};
class
SetattrRewriteArgs
;
class
SetattrRewriteArgs2
;
class
SetattrRewriteArgs2
;
class
GetattrRewriteArgs
;
class
GetattrRewriteArgs
;
class
GetattrRewriteArgs2
;
class
GetattrRewriteArgs2
;
...
@@ -329,11 +328,10 @@ public:
...
@@ -329,11 +328,10 @@ public:
HCAttrs
*
getAttrs
();
HCAttrs
*
getAttrs
();
void
setattr
(
const
std
::
string
&
attr
,
Box
*
val
,
SetattrRewriteArgs
*
rewrite_args
,
void
setattr
(
const
std
::
string
&
attr
,
Box
*
val
,
SetattrRewriteArgs2
*
rewrite_args2
);
SetattrRewriteArgs2
*
rewrite_args2
);
void
giveAttr
(
const
std
::
string
&
attr
,
Box
*
val
)
{
void
giveAttr
(
const
std
::
string
&
attr
,
Box
*
val
)
{
assert
(
this
->
getattr
(
attr
)
==
NULL
);
assert
(
this
->
getattr
(
attr
)
==
NULL
);
this
->
setattr
(
attr
,
val
,
NULL
,
NULL
);
this
->
setattr
(
attr
,
val
,
NULL
);
}
}
Box
*
getattr
(
const
std
::
string
&
attr
,
GetattrRewriteArgs
*
rewrite_args
,
GetattrRewriteArgs2
*
rewrite_args2
);
Box
*
getattr
(
const
std
::
string
&
attr
,
GetattrRewriteArgs
*
rewrite_args
,
GetattrRewriteArgs2
*
rewrite_args2
);
...
...
src/runtime/bool.cpp
View file @
02ff68f2
...
@@ -65,7 +65,7 @@ void setupBool() {
...
@@ -65,7 +65,7 @@ void setupBool() {
bool_cls
->
giveAttr
(
"__neg__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
boolNeg
,
NULL
,
1
,
false
)));
bool_cls
->
giveAttr
(
"__neg__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
boolNeg
,
NULL
,
1
,
false
)));
bool_cls
->
giveAttr
(
"__nonzero__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
boolNonzero
,
NULL
,
1
,
false
)));
bool_cls
->
giveAttr
(
"__nonzero__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
boolNonzero
,
NULL
,
1
,
false
)));
bool_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
boolRepr
,
NULL
,
1
,
false
)));
bool_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
boolRepr
,
NULL
,
1
,
false
)));
bool_cls
->
setattr
(
"__str__"
,
bool_cls
->
getattr
(
"__repr__"
),
NULL
,
NULL
);
bool_cls
->
giveAttr
(
"__str__"
,
bool_cls
->
getattr
(
"__repr__"
)
);
CLFunction
*
__new__
=
boxRTFunction
((
void
*
)
boolNew1
,
NULL
,
1
,
false
);
CLFunction
*
__new__
=
boxRTFunction
((
void
*
)
boolNew1
,
NULL
,
1
,
false
);
addRTFunction
(
__new__
,
(
void
*
)
boolNew2
,
NULL
,
2
,
false
);
addRTFunction
(
__new__
,
(
void
*
)
boolNew2
,
NULL
,
2
,
false
);
...
...
src/runtime/builtin_modules/builtins.cpp
View file @
02ff68f2
...
@@ -386,7 +386,7 @@ static BoxedClass* makeBuiltinException(const char* name) {
...
@@ -386,7 +386,7 @@ static BoxedClass* makeBuiltinException(const char* name) {
void
setupBuiltins
()
{
void
setupBuiltins
()
{
builtins_module
=
createModule
(
"__builtin__"
,
"__builtin__"
);
builtins_module
=
createModule
(
"__builtin__"
,
"__builtin__"
);
builtins_module
->
setattr
(
"None"
,
None
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"None"
,
None
);
notimplemented_cls
=
new
BoxedClass
(
0
,
sizeof
(
Box
),
false
);
notimplemented_cls
=
new
BoxedClass
(
0
,
sizeof
(
Box
),
false
);
notimplemented_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"NotImplementedType"
));
notimplemented_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"NotImplementedType"
));
...
@@ -456,8 +456,8 @@ void setupBuiltins() {
...
@@ -456,8 +456,8 @@ void setupBuiltins() {
builtins_module
->
giveAttr
(
"sorted"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
sorted
,
NULL
,
1
,
false
)));
builtins_module
->
giveAttr
(
"sorted"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
sorted
,
NULL
,
1
,
false
)));
builtins_module
->
setattr
(
"True"
,
True
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"True"
,
True
);
builtins_module
->
setattr
(
"False"
,
False
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"False"
,
False
);
CLFunction
*
range_clf
=
boxRTFunction
((
void
*
)
range1
,
NULL
,
1
,
false
);
CLFunction
*
range_clf
=
boxRTFunction
((
void
*
)
range1
,
NULL
,
1
,
false
);
addRTFunction
(
range_clf
,
(
void
*
)
range2
,
NULL
,
2
,
false
);
addRTFunction
(
range_clf
,
(
void
*
)
range2
,
NULL
,
2
,
false
);
...
@@ -476,17 +476,17 @@ void setupBuiltins() {
...
@@ -476,17 +476,17 @@ void setupBuiltins() {
builtins_module
->
giveAttr
(
"map"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
map2
,
LIST
,
2
,
false
)));
builtins_module
->
giveAttr
(
"map"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
map2
,
LIST
,
2
,
false
)));
builtins_module
->
giveAttr
(
"zip"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
zip2
,
LIST
,
2
,
false
)));
builtins_module
->
giveAttr
(
"zip"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
zip2
,
LIST
,
2
,
false
)));
builtins_module
->
setattr
(
"str"
,
str_cls
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"str"
,
str_cls
);
builtins_module
->
setattr
(
"int"
,
int_cls
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"int"
,
int_cls
);
builtins_module
->
setattr
(
"float"
,
float_cls
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"float"
,
float_cls
);
builtins_module
->
setattr
(
"list"
,
list_cls
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"list"
,
list_cls
);
builtins_module
->
setattr
(
"slice"
,
slice_cls
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"slice"
,
slice_cls
);
builtins_module
->
setattr
(
"type"
,
type_cls
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"type"
,
type_cls
);
builtins_module
->
setattr
(
"file"
,
file_cls
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"file"
,
file_cls
);
builtins_module
->
setattr
(
"bool"
,
bool_cls
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"bool"
,
bool_cls
);
builtins_module
->
setattr
(
"dict"
,
dict_cls
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"dict"
,
dict_cls
);
builtins_module
->
setattr
(
"set"
,
set_cls
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"set"
,
set_cls
);
builtins_module
->
setattr
(
"tuple"
,
tuple_cls
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"tuple"
,
tuple_cls
);
builtins_module
->
setattr
(
"instancemethod"
,
instancemethod_cls
,
NULL
,
NULL
);
builtins_module
->
giveAttr
(
"instancemethod"
,
instancemethod_cls
);
}
}
}
}
src/runtime/capi.cpp
View file @
02ff68f2
...
@@ -125,7 +125,7 @@ void setupCAPI() {
...
@@ -125,7 +125,7 @@ void setupCAPI() {
capifunc_cls
->
giveAttr
(
"__repr__"
,
capifunc_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedCApiFunction
::
__repr__
,
NULL
,
1
,
false
)));
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedCApiFunction
::
__repr__
,
NULL
,
1
,
false
)));
capifunc_cls
->
setattr
(
"__str__"
,
capifunc_cls
->
getattr
(
"__repr__"
),
NULL
,
NULL
);
capifunc_cls
->
giveAttr
(
"__str__"
,
capifunc_cls
->
getattr
(
"__repr__"
)
);
capifunc_cls
->
giveAttr
(
"__call__"
,
capifunc_cls
->
giveAttr
(
"__call__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedCApiFunction
::
__call__
,
NULL
,
1
,
true
)));
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedCApiFunction
::
__call__
,
NULL
,
1
,
true
)));
...
...
src/runtime/dict.cpp
View file @
02ff68f2
...
@@ -152,16 +152,16 @@ void setupDict() {
...
@@ -152,16 +152,16 @@ void setupDict() {
// dict_cls->giveAttr("__new__", new BoxedFunction(boxRTFunction((void*)dictNew, NULL, 1, false)));
// dict_cls->giveAttr("__new__", new BoxedFunction(boxRTFunction((void*)dictNew, NULL, 1, false)));
// dict_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)dictInit, NULL, 1, false)));
// dict_cls->giveAttr("__init__", new BoxedFunction(boxRTFunction((void*)dictInit, NULL, 1, false)));
dict_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
dictRepr
,
NULL
,
1
,
false
)));
dict_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
dictRepr
,
NULL
,
1
,
false
)));
dict_cls
->
setattr
(
"__str__"
,
dict_cls
->
getattr
(
"__repr__"
),
NULL
,
NULL
);
dict_cls
->
giveAttr
(
"__str__"
,
dict_cls
->
getattr
(
"__repr__"
)
);
dict_cls
->
giveAttr
(
"items"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
dictItems
,
NULL
,
1
,
false
)));
dict_cls
->
giveAttr
(
"items"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
dictItems
,
NULL
,
1
,
false
)));
dict_cls
->
setattr
(
"iteritems"
,
dict_cls
->
getattr
(
"items"
),
NULL
,
NULL
);
dict_cls
->
giveAttr
(
"iteritems"
,
dict_cls
->
getattr
(
"items"
)
);
dict_cls
->
giveAttr
(
"values"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
dictValues
,
NULL
,
1
,
false
)));
dict_cls
->
giveAttr
(
"values"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
dictValues
,
NULL
,
1
,
false
)));
dict_cls
->
setattr
(
"itervalues"
,
dict_cls
->
getattr
(
"values"
),
NULL
,
NULL
);
dict_cls
->
giveAttr
(
"itervalues"
,
dict_cls
->
getattr
(
"values"
)
);
dict_cls
->
giveAttr
(
"keys"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
dictKeys
,
NULL
,
1
,
false
)));
dict_cls
->
giveAttr
(
"keys"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
dictKeys
,
NULL
,
1
,
false
)));
dict_cls
->
setattr
(
"iterkeys"
,
dict_cls
->
getattr
(
"keys"
),
NULL
,
NULL
);
dict_cls
->
giveAttr
(
"iterkeys"
,
dict_cls
->
getattr
(
"keys"
)
);
CLFunction
*
pop
=
boxRTFunction
((
void
*
)
dictPop2
,
UNKNOWN
,
2
,
false
);
CLFunction
*
pop
=
boxRTFunction
((
void
*
)
dictPop2
,
UNKNOWN
,
2
,
false
);
addRTFunction
(
pop
,
(
void
*
)
dictPop3
,
UNKNOWN
,
3
,
false
);
addRTFunction
(
pop
,
(
void
*
)
dictPop3
,
UNKNOWN
,
3
,
false
);
...
...
src/runtime/file.cpp
View file @
02ff68f2
...
@@ -182,7 +182,7 @@ void setupFile() {
...
@@ -182,7 +182,7 @@ void setupFile() {
file_cls
->
giveAttr
(
"close"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
fileClose
,
NULL
,
1
,
false
)));
file_cls
->
giveAttr
(
"close"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
fileClose
,
NULL
,
1
,
false
)));
file_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
fileRepr
,
NULL
,
1
,
false
)));
file_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
fileRepr
,
NULL
,
1
,
false
)));
file_cls
->
setattr
(
"__str__"
,
file_cls
->
getattr
(
"__repr__"
),
NULL
,
NULL
);
file_cls
->
giveAttr
(
"__str__"
,
file_cls
->
getattr
(
"__repr__"
)
);
file_cls
->
giveAttr
(
"__enter__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
fileEnter
,
NULL
,
1
,
false
)));
file_cls
->
giveAttr
(
"__enter__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
fileEnter
,
NULL
,
1
,
false
)));
file_cls
->
giveAttr
(
"__exit__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
fileExit
,
NULL
,
4
,
false
)));
file_cls
->
giveAttr
(
"__exit__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
fileExit
,
NULL
,
4
,
false
)));
...
...
src/runtime/float.cpp
View file @
02ff68f2
...
@@ -565,7 +565,7 @@ void setupFloat() {
...
@@ -565,7 +565,7 @@ void setupFloat() {
float_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"float"
));
float_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"float"
));
_addFunc
(
"__add__"
,
BOXED_FLOAT
,
(
void
*
)
floatAddFloat
,
(
void
*
)
floatAddInt
,
(
void
*
)
floatAdd
);
_addFunc
(
"__add__"
,
BOXED_FLOAT
,
(
void
*
)
floatAddFloat
,
(
void
*
)
floatAddInt
,
(
void
*
)
floatAdd
);
float_cls
->
setattr
(
"__radd__"
,
float_cls
->
getattr
(
"__add__"
),
NULL
,
NULL
);
float_cls
->
giveAttr
(
"__radd__"
,
float_cls
->
getattr
(
"__add__"
)
);
_addFunc
(
"__div__"
,
BOXED_FLOAT
,
(
void
*
)
floatDivFloat
,
(
void
*
)
floatDivInt
,
(
void
*
)
floatDiv
);
_addFunc
(
"__div__"
,
BOXED_FLOAT
,
(
void
*
)
floatDivFloat
,
(
void
*
)
floatDivInt
,
(
void
*
)
floatDiv
);
_addFunc
(
"__rdiv__"
,
BOXED_FLOAT
,
(
void
*
)
floatRDivFloat
,
(
void
*
)
floatRDivInt
,
(
void
*
)
floatRDiv
);
_addFunc
(
"__rdiv__"
,
BOXED_FLOAT
,
(
void
*
)
floatRDivFloat
,
(
void
*
)
floatRDivInt
,
(
void
*
)
floatRDiv
);
...
@@ -581,7 +581,7 @@ void setupFloat() {
...
@@ -581,7 +581,7 @@ void setupFloat() {
_addFunc
(
"__mod__"
,
BOXED_FLOAT
,
(
void
*
)
floatModFloat
,
(
void
*
)
floatModInt
,
(
void
*
)
floatMod
);
_addFunc
(
"__mod__"
,
BOXED_FLOAT
,
(
void
*
)
floatModFloat
,
(
void
*
)
floatModInt
,
(
void
*
)
floatMod
);
_addFunc
(
"__rmod__"
,
BOXED_FLOAT
,
(
void
*
)
floatRModFloat
,
(
void
*
)
floatRModInt
,
(
void
*
)
floatRMod
);
_addFunc
(
"__rmod__"
,
BOXED_FLOAT
,
(
void
*
)
floatRModFloat
,
(
void
*
)
floatRModInt
,
(
void
*
)
floatRMod
);
_addFunc
(
"__mul__"
,
BOXED_FLOAT
,
(
void
*
)
floatMulFloat
,
(
void
*
)
floatMulInt
,
(
void
*
)
floatMul
);
_addFunc
(
"__mul__"
,
BOXED_FLOAT
,
(
void
*
)
floatMulFloat
,
(
void
*
)
floatMulInt
,
(
void
*
)
floatMul
);
float_cls
->
setattr
(
"__rmul__"
,
float_cls
->
getattr
(
"__mul__"
),
NULL
,
NULL
);
float_cls
->
giveAttr
(
"__rmul__"
,
float_cls
->
getattr
(
"__mul__"
)
);
_addFunc
(
"__pow__"
,
BOXED_FLOAT
,
(
void
*
)
floatPowFloat
,
(
void
*
)
floatPowInt
,
(
void
*
)
floatPow
);
_addFunc
(
"__pow__"
,
BOXED_FLOAT
,
(
void
*
)
floatPowFloat
,
(
void
*
)
floatPowInt
,
(
void
*
)
floatPow
);
_addFunc
(
"__sub__"
,
BOXED_FLOAT
,
(
void
*
)
floatSubFloat
,
(
void
*
)
floatSubInt
,
(
void
*
)
floatSub
);
_addFunc
(
"__sub__"
,
BOXED_FLOAT
,
(
void
*
)
floatSubFloat
,
(
void
*
)
floatSubInt
,
(
void
*
)
floatSub
);
...
...
src/runtime/int.cpp
View file @
02ff68f2
...
@@ -533,7 +533,7 @@ void setupInt() {
...
@@ -533,7 +533,7 @@ void setupInt() {
int_cls
->
giveAttr
(
"__neg__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intNeg
,
BOXED_INT
,
1
,
false
)));
int_cls
->
giveAttr
(
"__neg__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intNeg
,
BOXED_INT
,
1
,
false
)));
int_cls
->
giveAttr
(
"__nonzero__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intNonzero
,
BOXED_BOOL
,
1
,
false
)));
int_cls
->
giveAttr
(
"__nonzero__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intNonzero
,
BOXED_BOOL
,
1
,
false
)));
int_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intRepr
,
STR
,
1
,
false
)));
int_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intRepr
,
STR
,
1
,
false
)));
int_cls
->
setattr
(
"__str__"
,
int_cls
->
getattr
(
"__repr__"
),
NULL
,
NULL
);
int_cls
->
giveAttr
(
"__str__"
,
int_cls
->
getattr
(
"__repr__"
)
);
int_cls
->
giveAttr
(
"__hash__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intHash
,
BOXED_INT
,
1
,
false
)));
int_cls
->
giveAttr
(
"__hash__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intHash
,
BOXED_INT
,
1
,
false
)));
int_cls
->
giveAttr
(
"__divmod__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intDivmod
,
BOXED_TUPLE
,
2
,
false
)));
int_cls
->
giveAttr
(
"__divmod__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intDivmod
,
BOXED_TUPLE
,
2
,
false
)));
...
...
src/runtime/list.cpp
View file @
02ff68f2
...
@@ -449,7 +449,7 @@ void setupList() {
...
@@ -449,7 +449,7 @@ void setupList() {
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listIter
,
typeFromClass
(
list_iterator_cls
),
1
,
false
)));
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listIter
,
typeFromClass
(
list_iterator_cls
),
1
,
false
)));
list_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listRepr
,
STR
,
1
,
false
)));
list_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listRepr
,
STR
,
1
,
false
)));
list_cls
->
setattr
(
"__str__"
,
list_cls
->
getattr
(
"__repr__"
),
NULL
,
NULL
);
list_cls
->
giveAttr
(
"__str__"
,
list_cls
->
getattr
(
"__repr__"
)
);
list_cls
->
giveAttr
(
"__nonzero__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listNonzero
,
BOXED_BOOL
,
1
,
false
)));
list_cls
->
giveAttr
(
"__nonzero__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listNonzero
,
BOXED_BOOL
,
1
,
false
)));
CLFunction
*
pop
=
boxRTFunction
((
void
*
)
listPop1
,
NULL
,
1
,
false
);
CLFunction
*
pop
=
boxRTFunction
((
void
*
)
listPop1
,
NULL
,
1
,
false
);
...
...
src/runtime/objmodel.cpp
View file @
02ff68f2
...
@@ -81,15 +81,6 @@ struct GetattrRewriteArgs2 {
...
@@ -81,15 +81,6 @@ struct GetattrRewriteArgs2 {
out_success
(
false
),
out_rtn
(
RewriterVarUsage2
::
empty
()),
obj_hcls_guarded
(
false
)
{}
out_success
(
false
),
out_rtn
(
RewriterVarUsage2
::
empty
()),
obj_hcls_guarded
(
false
)
{}
};
};
struct
SetattrRewriteArgs
{
Rewriter
*
rewriter
;
RewriterVar
obj
,
attrval
;
bool
out_success
;
SetattrRewriteArgs
(
Rewriter
*
rewriter
,
const
RewriterVar
&
obj
,
const
RewriterVar
&
attrval
)
:
rewriter
(
rewriter
),
obj
(
obj
),
attrval
(
attrval
),
out_success
(
false
)
{}
};
struct
SetattrRewriteArgs2
{
struct
SetattrRewriteArgs2
{
Rewriter2
*
rewriter
;
Rewriter2
*
rewriter
;
RewriterVarUsage2
obj
,
attrval
;
RewriterVarUsage2
obj
,
attrval
;
...
@@ -275,9 +266,10 @@ extern "C" void checkUnpackingLength(i64 expected, i64 given) {
...
@@ -275,9 +266,10 @@ extern "C" void checkUnpackingLength(i64 expected, i64 given) {
BoxedClass
::
BoxedClass
(
int
attrs_offset
,
int
instance_size
,
bool
is_user_defined
)
BoxedClass
::
BoxedClass
(
int
attrs_offset
,
int
instance_size
,
bool
is_user_defined
)
:
Box
(
&
type_flavor
,
type_cls
),
attrs_offset
(
attrs_offset
),
instance_size
(
instance_size
),
is_constant
(
false
),
:
Box
(
&
type_flavor
,
type_cls
),
attrs_offset
(
attrs_offset
),
instance_size
(
instance_size
),
is_constant
(
false
),
is_user_defined
(
is_user_defined
)
{
is_user_defined
(
is_user_defined
)
{
assert
(
instance_size
%
sizeof
(
void
*
)
==
0
);
// Not critical I suppose, but probably signals a bug
if
(
attrs_offset
)
{
if
(
attrs_offset
)
{
assert
(
instance_size
>=
attrs_offset
+
sizeof
(
HCAttrs
));
assert
(
instance_size
>=
attrs_offset
+
sizeof
(
HCAttrs
));
assert
(
attrs_offset
%
sizeof
(
void
*
)
==
0
);
assert
(
attrs_offset
%
sizeof
(
void
*
)
==
0
);
// Not critical I suppose, but probably signals a bug
}
}
}
}
...
@@ -404,8 +396,7 @@ Box* Box::getattr(const std::string& attr, GetattrRewriteArgs* rewrite_args, Get
...
@@ -404,8 +396,7 @@ Box* Box::getattr(const std::string& attr, GetattrRewriteArgs* rewrite_args, Get
return
rtn
;
return
rtn
;
}
}
void
Box
::
setattr
(
const
std
::
string
&
attr
,
Box
*
val
,
SetattrRewriteArgs
*
rewrite_args
,
void
Box
::
setattr
(
const
std
::
string
&
attr
,
Box
*
val
,
SetattrRewriteArgs2
*
rewrite_args2
)
{
SetattrRewriteArgs2
*
rewrite_args2
)
{
assert
(
cls
->
instancesHaveAttrs
());
assert
(
cls
->
instancesHaveAttrs
());
// Have to guard on the memory layout of this object.
// Have to guard on the memory layout of this object.
...
@@ -417,8 +408,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
...
@@ -417,8 +408,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
// Only matters if we end up getting multiple classes with the same
// Only matters if we end up getting multiple classes with the same
// structure (ex user class) and the same hidden classes, because
// structure (ex user class) and the same hidden classes, because
// otherwise the guard will fail anyway.;
// otherwise the guard will fail anyway.;
if
(
rewrite_args
)
rewrite_args
->
obj
.
addAttrGuard
(
BOX_CLS_OFFSET
,
(
intptr_t
)
cls
);
if
(
rewrite_args2
)
if
(
rewrite_args2
)
rewrite_args2
->
obj
.
addAttrGuard
(
BOX_CLS_OFFSET
,
(
intptr_t
)
cls
);
rewrite_args2
->
obj
.
addAttrGuard
(
BOX_CLS_OFFSET
,
(
intptr_t
)
cls
);
...
@@ -431,7 +420,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
...
@@ -431,7 +420,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
if
((
this
->
cls
==
type_cls
)
&&
(
attr
==
getattr_str
||
attr
==
getattribute_str
))
{
if
((
this
->
cls
==
type_cls
)
&&
(
attr
==
getattr_str
||
attr
==
getattribute_str
))
{
// Will have to embed the clear in the IC, so just disable the patching for now:
// Will have to embed the clear in the IC, so just disable the patching for now:
rewrite_args
=
NULL
;
rewrite_args2
=
NULL
;
rewrite_args2
=
NULL
;
// TODO should put this clearing behavior somewhere else, since there are probably more
// TODO should put this clearing behavior somewhere else, since there are probably more
...
@@ -446,11 +434,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
...
@@ -446,11 +434,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
int
offset
=
hcls
->
getOffset
(
attr
);
int
offset
=
hcls
->
getOffset
(
attr
);
if
(
rewrite_args
)
{
rewrite_args
->
obj
.
addAttrGuard
(
cls
->
attrs_offset
+
HCATTRS_HCLS_OFFSET
,
(
intptr_t
)
hcls
);
rewrite_args
->
rewriter
->
addDecision
(
offset
==
-
1
?
1
:
0
);
}
if
(
rewrite_args2
)
{
if
(
rewrite_args2
)
{
rewrite_args2
->
obj
.
addAttrGuard
(
cls
->
attrs_offset
+
HCATTRS_HCLS_OFFSET
,
(
intptr_t
)
hcls
);
rewrite_args2
->
obj
.
addAttrGuard
(
cls
->
attrs_offset
+
HCATTRS_HCLS_OFFSET
,
(
intptr_t
)
hcls
);
...
@@ -464,13 +447,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
...
@@ -464,13 +447,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
Box
*
prev
=
attrs
->
attr_list
->
attrs
[
offset
];
Box
*
prev
=
attrs
->
attr_list
->
attrs
[
offset
];
attrs
->
attr_list
->
attrs
[
offset
]
=
val
;
attrs
->
attr_list
->
attrs
[
offset
]
=
val
;
if
(
rewrite_args
)
{
RewriterVar
r_hattrs
=
rewrite_args
->
obj
.
getAttr
(
cls
->
attrs_offset
+
HCATTRS_ATTRS_OFFSET
,
1
);
r_hattrs
.
setAttr
(
offset
*
sizeof
(
Box
*
)
+
ATTRLIST_ATTRS_OFFSET
,
rewrite_args
->
attrval
);
rewrite_args
->
out_success
=
true
;
}
if
(
rewrite_args2
)
{
if
(
rewrite_args2
)
{
RewriterVarUsage2
r_hattrs
=
rewrite_args2
->
obj
.
getAttr
(
cls
->
attrs_offset
+
HCATTRS_ATTRS_OFFSET
,
RewriterVarUsage2
r_hattrs
=
rewrite_args2
->
obj
.
getAttr
(
cls
->
attrs_offset
+
HCATTRS_ATTRS_OFFSET
,
...
@@ -496,11 +472,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
...
@@ -496,11 +472,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
}
}
#endif
#endif
if
(
rewrite_args
)
{
rewrite_args
->
obj
.
push
();
rewrite_args
->
attrval
.
push
();
}
RewriterVar
r_new_array
;
RewriterVar
r_new_array
;
...
@@ -509,12 +480,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
...
@@ -509,12 +480,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
if
(
numattrs
==
0
)
{
if
(
numattrs
==
0
)
{
attrs
->
attr_list
=
(
HCAttrs
::
AttrList
*
)
rt_alloc
(
new_size
);
attrs
->
attr_list
=
(
HCAttrs
::
AttrList
*
)
rt_alloc
(
new_size
);
attrs
->
attr_list
->
gc_header
.
kind_id
=
untracked_kind
.
kind_id
;
attrs
->
attr_list
->
gc_header
.
kind_id
=
untracked_kind
.
kind_id
;
if
(
rewrite_args
)
{
rewrite_args
->
rewriter
->
loadConst
(
0
,
new_size
);
r_new_array
=
rewrite_args
->
rewriter
->
call
((
void
*
)
rt_alloc
);
RewriterVar
r_flavor
=
rewrite_args
->
rewriter
->
loadConst
(
0
,
(
intptr_t
)
untracked_kind
.
kind_id
);
r_new_array
.
setAttr
(
ATTRLIST_KIND_OFFSET
,
r_flavor
);
}
if
(
rewrite_args2
)
{
if
(
rewrite_args2
)
{
RewriterVarUsage2
r_newsize
=
rewrite_args2
->
rewriter
->
loadConst
(
new_size
,
Location
::
forArg
(
0
));
RewriterVarUsage2
r_newsize
=
rewrite_args2
->
rewriter
->
loadConst
(
new_size
,
Location
::
forArg
(
0
));
r_new_array2
=
rewrite_args2
->
rewriter
->
call
(
false
,
(
void
*
)
rt_alloc
,
std
::
move
(
r_newsize
));
r_new_array2
=
rewrite_args2
->
rewriter
->
call
(
false
,
(
void
*
)
rt_alloc
,
std
::
move
(
r_newsize
));
...
@@ -523,11 +488,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
...
@@ -523,11 +488,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
}
}
}
else
{
}
else
{
attrs
->
attr_list
=
(
HCAttrs
::
AttrList
*
)
rt_realloc
(
attrs
->
attr_list
,
new_size
);
attrs
->
attr_list
=
(
HCAttrs
::
AttrList
*
)
rt_realloc
(
attrs
->
attr_list
,
new_size
);
if
(
rewrite_args
)
{
rewrite_args
->
obj
.
getAttr
(
cls
->
attrs_offset
+
HCATTRS_ATTRS_OFFSET
,
0
);
rewrite_args
->
rewriter
->
loadConst
(
1
,
new_size
);
r_new_array
=
rewrite_args
->
rewriter
->
call
((
void
*
)
rt_realloc
);
}
if
(
rewrite_args2
)
{
if
(
rewrite_args2
)
{
RewriterVarUsage2
r_oldarray
=
rewrite_args2
->
obj
.
getAttr
(
cls
->
attrs_offset
+
HCATTRS_ATTRS_OFFSET
,
RewriterVarUsage2
r_oldarray
=
rewrite_args2
->
obj
.
getAttr
(
cls
->
attrs_offset
+
HCATTRS_ATTRS_OFFSET
,
RewriterVarUsage2
::
NoKill
,
Location
::
forArg
(
0
));
RewriterVarUsage2
::
NoKill
,
Location
::
forArg
(
0
));
...
@@ -541,15 +501,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
...
@@ -541,15 +501,6 @@ void Box::setattr(const std::string& attr, Box* val, SetattrRewriteArgs* rewrite
// see a consistent state between the hcls and the attr_list
// see a consistent state between the hcls and the attr_list
attrs
->
hcls
=
new_hcls
;
attrs
->
hcls
=
new_hcls
;
if
(
rewrite_args
)
{
RewriterVar
attrval
=
rewrite_args
->
rewriter
->
pop
(
0
);
RewriterVar
obj
=
rewrite_args
->
rewriter
->
pop
(
2
);
obj
.
setAttr
(
cls
->
attrs_offset
+
HCATTRS_ATTRS_OFFSET
,
r_new_array
);
r_new_array
.
setAttr
(
numattrs
*
sizeof
(
Box
*
)
+
ATTRLIST_ATTRS_OFFSET
,
attrval
);
RewriterVar
hcls
=
rewrite_args
->
rewriter
->
loadConst
(
1
,
(
intptr_t
)
new_hcls
);
obj
.
setAttr
(
cls
->
attrs_offset
+
HCATTRS_HCLS_OFFSET
,
hcls
);
rewrite_args
->
out_success
=
true
;
}
if
(
rewrite_args2
)
{
if
(
rewrite_args2
)
{
r_new_array2
.
setAttr
(
numattrs
*
sizeof
(
Box
*
)
+
ATTRLIST_ATTRS_OFFSET
,
std
::
move
(
rewrite_args2
->
attrval
));
r_new_array2
.
setAttr
(
numattrs
*
sizeof
(
Box
*
)
+
ATTRLIST_ATTRS_OFFSET
,
std
::
move
(
rewrite_args2
->
attrval
));
rewrite_args2
->
obj
.
setAttr
(
cls
->
attrs_offset
+
HCATTRS_ATTRS_OFFSET
,
std
::
move
(
r_new_array2
));
rewrite_args2
->
obj
.
setAttr
(
cls
->
attrs_offset
+
HCATTRS_ATTRS_OFFSET
,
std
::
move
(
r_new_array2
));
...
@@ -915,7 +866,7 @@ extern "C" void setattr(Box* obj, const char* attr, Box* attr_val) {
...
@@ -915,7 +866,7 @@ extern "C" void setattr(Box* obj, const char* attr, Box* attr_val) {
if
(
rewriter
.
get
())
{
if
(
rewriter
.
get
())
{
// rewriter->trap();
// rewriter->trap();
SetattrRewriteArgs2
rewrite_args
(
rewriter
.
get
(),
rewriter
->
getArg
(
0
),
rewriter
->
getArg
(
2
),
false
);
SetattrRewriteArgs2
rewrite_args
(
rewriter
.
get
(),
rewriter
->
getArg
(
0
),
rewriter
->
getArg
(
2
),
false
);
obj
->
setattr
(
attr
,
attr_val
,
NULL
,
&
rewrite_args
);
obj
->
setattr
(
attr
,
attr_val
,
&
rewrite_args
);
if
(
rewrite_args
.
out_success
)
{
if
(
rewrite_args
.
out_success
)
{
rewriter
->
commit
();
rewriter
->
commit
();
}
else
{
}
else
{
...
@@ -923,7 +874,7 @@ extern "C" void setattr(Box* obj, const char* attr, Box* attr_val) {
...
@@ -923,7 +874,7 @@ extern "C" void setattr(Box* obj, const char* attr, Box* attr_val) {
rewrite_args
.
attrval
.
setDoneUsing
();
rewrite_args
.
attrval
.
setDoneUsing
();
}
}
}
else
{
}
else
{
obj
->
setattr
(
attr
,
attr_val
,
NULL
,
NULL
);
obj
->
setattr
(
attr
,
attr_val
,
NULL
);
}
}
}
}
...
...
src/runtime/tuple.cpp
View file @
02ff68f2
...
@@ -203,7 +203,7 @@ void setupTuple() {
...
@@ -203,7 +203,7 @@ void setupTuple() {
tuple_cls
->
giveAttr
(
"__hash__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
tupleHash
,
BOXED_INT
,
1
,
false
)));
tuple_cls
->
giveAttr
(
"__hash__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
tupleHash
,
BOXED_INT
,
1
,
false
)));
tuple_cls
->
giveAttr
(
"__len__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
tupleLen
,
NULL
,
1
,
false
)));
tuple_cls
->
giveAttr
(
"__len__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
tupleLen
,
NULL
,
1
,
false
)));
tuple_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
tupleRepr
,
NULL
,
1
,
false
)));
tuple_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
tupleRepr
,
NULL
,
1
,
false
)));
tuple_cls
->
setattr
(
"__str__"
,
tuple_cls
->
getattr
(
"__repr__"
),
NULL
,
NULL
);
tuple_cls
->
giveAttr
(
"__str__"
,
tuple_cls
->
getattr
(
"__repr__"
)
);
tuple_cls
->
freeze
();
tuple_cls
->
freeze
();
}
}
...
...
src/runtime/types.cpp
View file @
02ff68f2
...
@@ -417,17 +417,17 @@ void setupRuntime() {
...
@@ -417,17 +417,17 @@ void setupRuntime() {
type_cls
->
giveAttr
(
"__call__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
typeCall
,
NULL
,
1
,
true
)));
type_cls
->
giveAttr
(
"__call__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
typeCall
,
NULL
,
1
,
true
)));
type_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
typeNew
,
NULL
,
2
,
true
)));
type_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
typeNew
,
NULL
,
2
,
true
)));
type_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
typeRepr
,
NULL
,
1
,
true
)));
type_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
typeRepr
,
NULL
,
1
,
true
)));
type_cls
->
setattr
(
"__str__"
,
type_cls
->
getattr
(
"__repr__"
),
NULL
,
NULL
);
type_cls
->
giveAttr
(
"__str__"
,
type_cls
->
getattr
(
"__repr__"
)
);
type_cls
->
freeze
();
type_cls
->
freeze
();
none_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"NoneType"
));
none_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"NoneType"
));
none_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
noneRepr
,
NULL
,
1
,
false
)));
none_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
noneRepr
,
NULL
,
1
,
false
)));
none_cls
->
setattr
(
"__str__"
,
none_cls
->
getattr
(
"__repr__"
),
NULL
,
NULL
);
none_cls
->
giveAttr
(
"__str__"
,
none_cls
->
getattr
(
"__repr__"
)
);
none_cls
->
freeze
();
none_cls
->
freeze
();
module_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"module"
));
module_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"module"
));
module_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
moduleRepr
,
NULL
,
1
,
false
)));
module_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
moduleRepr
,
NULL
,
1
,
false
)));
module_cls
->
setattr
(
"__str__"
,
module_cls
->
getattr
(
"__repr__"
),
NULL
,
NULL
);
module_cls
->
giveAttr
(
"__str__"
,
module_cls
->
getattr
(
"__repr__"
)
);
module_cls
->
freeze
();
module_cls
->
freeze
();
member_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"member"
));
member_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"member"
));
...
@@ -445,7 +445,7 @@ void setupRuntime() {
...
@@ -445,7 +445,7 @@ void setupRuntime() {
function_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"function"
));
function_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"function"
));
function_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
functionRepr
,
NULL
,
1
,
false
)));
function_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
functionRepr
,
NULL
,
1
,
false
)));
function_cls
->
setattr
(
"__str__"
,
function_cls
->
getattr
(
"__repr__"
),
NULL
,
NULL
);
function_cls
->
giveAttr
(
"__str__"
,
function_cls
->
getattr
(
"__repr__"
)
);
function_cls
->
freeze
();
function_cls
->
freeze
();
instancemethod_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"instancemethod"
));
instancemethod_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"instancemethod"
));
...
@@ -459,7 +459,7 @@ void setupRuntime() {
...
@@ -459,7 +459,7 @@ void setupRuntime() {
addRTFunction
(
slice_new
,
(
void
*
)
sliceNew4
,
NULL
,
4
,
false
);
addRTFunction
(
slice_new
,
(
void
*
)
sliceNew4
,
NULL
,
4
,
false
);
slice_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
slice_new
));
slice_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
slice_new
));
slice_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
sliceRepr
,
NULL
,
1
,
true
)));
slice_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
sliceRepr
,
NULL
,
1
,
true
)));
slice_cls
->
setattr
(
"__str__"
,
slice_cls
->
getattr
(
"__repr__"
),
NULL
,
NULL
);
slice_cls
->
giveAttr
(
"__str__"
,
slice_cls
->
getattr
(
"__repr__"
)
);
slice_cls
->
giveAttr
(
"start"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
SLICE_START_OFFSET
));
slice_cls
->
giveAttr
(
"start"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
SLICE_START_OFFSET
));
slice_cls
->
giveAttr
(
"stop"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
SLICE_STOP_OFFSET
));
slice_cls
->
giveAttr
(
"stop"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
SLICE_STOP_OFFSET
));
slice_cls
->
giveAttr
(
"step"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
SLICE_STEP_OFFSET
));
slice_cls
->
giveAttr
(
"step"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
SLICE_STEP_OFFSET
));
...
...
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