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
c4ebf05f
Commit
c4ebf05f
authored
Jun 24, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a tpp_call slot, and add initial version of typeTppCall
parent
19360fa2
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
397 additions
and
314 deletions
+397
-314
from_cpython/Include/object.h
from_cpython/Include/object.h
+1
-0
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+15
-312
src/runtime/objmodel.h
src/runtime/objmodel.h
+4
-2
src/runtime/rewrite_args.h
src/runtime/rewrite_args.h
+9
-0
src/runtime/types.cpp
src/runtime/types.cpp
+353
-0
src/runtime/types.h
src/runtime/types.h
+15
-0
No files found.
from_cpython/Include/object.h
View file @
c4ebf05f
...
...
@@ -461,6 +461,7 @@ struct _typeobject {
bool
_flags
[
3
];
void
*
_tpp_descr_get
;
void
*
_tpp_hasnext
;
void
*
_tpp_call
;
};
/* The *real* layout of a type object when allocated on the heap */
...
...
src/runtime/objmodel.cpp
View file @
c4ebf05f
This diff is collapsed.
Click to expand it.
src/runtime/objmodel.h
View file @
c4ebf05f
...
...
@@ -112,8 +112,6 @@ Box* runtimeCallInternal(Box* obj, CallRewriteArgs* rewrite_args, ArgPassSpec ar
Box
*
lenCallInternal
(
BoxedFunctionBase
*
f
,
CallRewriteArgs
*
rewrite_args
,
ArgPassSpec
argspec
,
Box
*
arg1
,
Box
*
arg2
,
Box
*
arg3
,
Box
**
args
,
const
std
::
vector
<
BoxedString
*>*
keyword_names
);
Box
*
typeCallInternal
(
BoxedFunctionBase
*
f
,
CallRewriteArgs
*
rewrite_args
,
ArgPassSpec
argspec
,
Box
*
arg1
,
Box
*
arg2
,
Box
*
arg3
,
Box
**
args
,
const
std
::
vector
<
BoxedString
*>*
keyword_names
);
Box
*
callFunc
(
BoxedFunctionBase
*
func
,
CallRewriteArgs
*
rewrite_args
,
ArgPassSpec
argspec
,
Box
*
arg1
,
Box
*
arg2
,
Box
*
arg3
,
Box
**
args
,
const
std
::
vector
<
BoxedString
*>*
keyword_names
);
...
...
@@ -153,7 +151,11 @@ Box* typeCall(Box*, BoxedTuple*, BoxedDict*);
Box
*
typeNew
(
Box
*
cls
,
Box
*
arg1
,
Box
*
arg2
,
Box
**
_args
);
bool
isUserDefined
(
BoxedClass
*
cls
);
// These process a potential descriptor, differing in their behavior if the object was not a descriptor.
// the OrNull variant returns NULL to signify it wasn't a descriptor, and the processDescriptor version
// returns obj.
Box
*
processDescriptor
(
Box
*
obj
,
Box
*
inst
,
Box
*
owner
);
Box
*
processDescriptorOrNull
(
Box
*
obj
,
Box
*
inst
,
Box
*
owner
);
Box
*
callCLFunc
(
CLFunction
*
f
,
CallRewriteArgs
*
rewrite_args
,
int
num_output_args
,
BoxedClosure
*
closure
,
BoxedGenerator
*
generator
,
Box
*
globals
,
Box
*
oarg1
,
Box
*
oarg2
,
Box
*
oarg3
,
Box
**
oargs
);
...
...
src/runtime/rewrite_args.h
View file @
c4ebf05f
...
...
@@ -121,6 +121,15 @@ struct CompareRewriteArgs {
:
rewriter
(
rewriter
),
lhs
(
lhs
),
rhs
(
rhs
),
destination
(
destination
),
out_success
(
false
),
out_rtn
(
NULL
)
{}
};
// Passes the output arguments back through oarg. Passes the rewrite success by setting rewrite_success.
// Directly modifies rewrite_args args in place, but only if rewrite_success got set.
// oargs needs to be pre-allocated by the caller, since it's assumed that they will want to use alloca.
// TODO Fix this function's signature. should we pass back out through args? the common case is that they
// match anyway. Or maybe it should call a callback function, which could save on the common case.
void
rearrangeArguments
(
ParamReceiveSpec
paramspec
,
const
ParamNames
*
param_names
,
const
char
*
func_name
,
Box
**
defaults
,
CallRewriteArgs
*
rewrite_args
,
bool
&
rewrite_success
,
ArgPassSpec
argspec
,
Box
*
arg1
,
Box
*
arg2
,
Box
*
arg3
,
Box
**
args
,
const
std
::
vector
<
BoxedString
*>*
keyword_names
,
Box
*&
oarg1
,
Box
*&
oarg2
,
Box
*&
oarg3
,
Box
**
oargs
);
}
// namespace pyston
#endif
src/runtime/types.cpp
View file @
c4ebf05f
This diff is collapsed.
Click to expand it.
src/runtime/types.h
View file @
c4ebf05f
...
...
@@ -201,6 +201,10 @@ public:
pyston_inquiry
tpp_hasnext
;
typedef
Box
*
(
*
pyston_call
)(
Box
*
,
CallRewriteArgs
*
,
ArgPassSpec
,
Box
*
,
Box
*
,
Box
*
,
Box
**
,
const
std
::
vector
<
BoxedString
*>*
);
pyston_call
tpp_call
;
bool
hasGenericGetattr
()
{
return
tp_getattr
==
NULL
;
}
void
freeze
();
...
...
@@ -1003,6 +1007,17 @@ extern "C" inline Box* boxInt(int64_t n) {
}
return
new
BoxedInt
(
n
);
}
// Helper function: fetch an arg from our calling convention
inline
Box
*&
getArg
(
int
idx
,
Box
*&
arg1
,
Box
*&
arg2
,
Box
*&
arg3
,
Box
**
args
)
{
if
(
idx
==
0
)
return
arg1
;
if
(
idx
==
1
)
return
arg2
;
if
(
idx
==
2
)
return
arg3
;
return
args
[
idx
-
3
];
}
}
#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