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
2391467b
Commit
2391467b
authored
Jan 18, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable PyStringObject: we use now the same layout as cpython
parent
ad0315d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
from_cpython/Include/stringobject.h
from_cpython/Include/stringobject.h
+0
-5
src/runtime/types.h
src/runtime/types.h
+7
-3
No files found.
from_cpython/Include/stringobject.h
View file @
2391467b
...
...
@@ -33,8 +33,6 @@ functions should be applied to nil objects.
interning of any string.
Together, these sped the interpreter by up to 20%. */
// Pyston change: comment this out since this is not the format we're using
#if 0
typedef
struct
{
PyObject_VAR_HEAD
long
ob_shash
;
...
...
@@ -50,9 +48,6 @@ typedef struct {
* from 'interned' to this object are *not counted* in ob_refcnt.
*/
}
PyStringObject
;
#endif
struct
_PyStringObject
;
typedef
struct
_PyStringObject
PyStringObject
;
#define SSTATE_NOT_INTERNED 0
#define SSTATE_INTERNED_MORTAL 1
...
...
src/runtime/types.h
View file @
2391467b
...
...
@@ -408,7 +408,8 @@ public:
llvm
::
StringRef
s
()
const
{
return
llvm
::
StringRef
(
s_data
,
ob_size
);
};
long
hash
;
// -1 means not yet computed
char
interned_state
;
int
interned_state
;
char
s_data
[
0
];
char
*
data
()
{
return
s_data
;
}
const
char
*
c_str
()
{
...
...
@@ -463,10 +464,13 @@ private:
BoxedString
(
size_t
n
);
// non-initializing constructor
char
s_data
[
0
];
friend
void
setupRuntime
();
};
static_assert
(
sizeof
(
BoxedString
)
==
sizeof
(
PyStringObject
),
""
);
static_assert
(
offsetof
(
BoxedString
,
ob_size
)
==
offsetof
(
PyStringObject
,
ob_size
),
""
);
static_assert
(
offsetof
(
BoxedString
,
hash
)
==
offsetof
(
PyStringObject
,
ob_shash
),
""
);
static_assert
(
offsetof
(
BoxedString
,
interned_state
)
==
offsetof
(
PyStringObject
,
ob_sstate
),
""
);
static_assert
(
offsetof
(
BoxedString
,
s_data
)
==
offsetof
(
PyStringObject
,
ob_sval
),
""
);
extern
"C"
size_t
strHashUnboxed
(
BoxedString
*
self
);
extern
"C"
int64_t
hashUnboxed
(
Box
*
obj
);
...
...
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