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
71049dad
Commit
71049dad
authored
May 15, 2015
by
Rudi Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generalize the field offset calculation macro using the standard C++ one.
parent
b9daab7a
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
65 deletions
+50
-65
src/core/common.h
src/core/common.h
+0
-2
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+47
-56
src/runtime/types.cpp
src/runtime/types.cpp
+3
-7
No files found.
src/core/common.h
View file @
71049dad
...
...
@@ -67,8 +67,6 @@
#define UNIMPLEMENTED() RELEASE_ASSERT(0, "unimplemented")
#define OFFSET(cls, attr) ((char*)&(((cls*)0x01)->attr) - (char*)0x1)
// Allow using std::pair as keys in hashtables:
namespace
std
{
template
<
typename
T1
,
typename
T2
>
struct
hash
<
pair
<
T1
,
T2
>>
{
...
...
src/runtime/objmodel.cpp
View file @
71049dad
This diff is collapsed.
Click to expand it.
src/runtime/types.cpp
View file @
71049dad
...
...
@@ -94,10 +94,6 @@ void setupGC();
bool
IN_SHUTDOWN
=
false
;
#define SLICE_START_OFFSET ((char*)&(((BoxedSlice*)0x01)->start) - (char*)0x1)
#define SLICE_STOP_OFFSET ((char*)&(((BoxedSlice*)0x01)->stop) - (char*)0x1)
#define SLICE_STEP_OFFSET ((char*)&(((BoxedSlice*)0x01)->step) - (char*)0x1)
void
FrameInfo
::
gcVisit
(
GCVisitor
*
visitor
)
{
visitor
->
visit
(
boxedLocals
);
visitor
->
visit
(
exc
.
traceback
);
...
...
@@ -3297,9 +3293,9 @@ void setupRuntime() {
slice_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
sliceNew
,
UNKNOWN
,
4
,
2
,
false
,
false
),
{
NULL
,
None
}));
slice_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
sliceRepr
,
STR
,
1
)));
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
(
"step"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
SLICE_STEP_OFFSET
));
slice_cls
->
giveAttr
(
"start"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedSlice
,
start
)
));
slice_cls
->
giveAttr
(
"stop"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedSlice
,
stop
)
));
slice_cls
->
giveAttr
(
"step"
,
new
BoxedMemberDescriptor
(
BoxedMemberDescriptor
::
OBJECT
,
offsetof
(
BoxedSlice
,
step
)
));
slice_cls
->
freeze
();
attrwrapper_cls
->
giveAttr
(
"__setitem__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
AttrWrapper
::
setitem
,
UNKNOWN
,
3
)));
...
...
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