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
ce69b813
Commit
ce69b813
authored
May 26, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bjit: change PP sizes and some misc minor improvements
parent
5ae5bf2c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
18 deletions
+26
-18
src/codegen/ast_interpreter.cpp
src/codegen/ast_interpreter.cpp
+2
-2
src/codegen/baseline_jit.cpp
src/codegen/baseline_jit.cpp
+19
-14
src/codegen/baseline_jit.h
src/codegen/baseline_jit.h
+2
-2
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+3
-0
No files found.
src/codegen/ast_interpreter.cpp
View file @
ce69b813
...
...
@@ -458,7 +458,7 @@ void ASTInterpreter::doStore(AST_Name* node, STOLEN(Value) value) {
ScopeInfo
::
VarScopeType
vst
=
node
->
lookup_type
;
if
(
vst
==
ScopeInfo
::
VarScopeType
::
GLOBAL
)
{
if
(
jit
)
jit
->
emitSetGlobal
(
frame_info
.
globals
,
name
.
getBox
(),
value
);
jit
->
emitSetGlobal
(
name
.
getBox
(),
value
,
getMD
()
->
source
->
scoping
->
areGlobalsFromModule
()
);
setGlobal
(
frame_info
.
globals
,
name
.
getBox
(),
value
.
o
);
}
else
if
(
vst
==
ScopeInfo
::
VarScopeType
::
NAME
)
{
if
(
jit
)
...
...
@@ -1661,7 +1661,7 @@ Value ASTInterpreter::visit_name(AST_Name* node) {
assert
(
!
node
->
is_kill
);
Value
v
;
if
(
jit
)
v
.
var
=
jit
->
emitGetGlobal
(
frame_info
.
globals
,
node
->
id
.
getBox
());
v
.
var
=
jit
->
emitGetGlobal
(
node
->
id
.
getBox
());
v
.
o
=
getGlobal
(
frame_info
.
globals
,
node
->
id
.
getBox
());
return
v
;
...
...
src/codegen/baseline_jit.cpp
View file @
ce69b813
...
...
@@ -361,7 +361,7 @@ RewriterVar* JitFragmentWriter::emitExceptionMatches(RewriterVar* v, RewriterVar
}
RewriterVar
*
JitFragmentWriter
::
emitGetAttr
(
RewriterVar
*
obj
,
BoxedString
*
s
,
AST_expr
*
node
)
{
return
emitPPCall
((
void
*
)
getattr
,
{
obj
,
imm
(
s
)
},
2
,
512
,
node
,
getTypeRecorderForNode
(
node
))
return
emitPPCall
((
void
*
)
getattr
,
{
obj
,
imm
(
s
)
},
2
,
256
,
node
,
getTypeRecorderForNode
(
node
))
.
first
->
setType
(
RefType
::
OWNED
);
}
...
...
@@ -393,23 +393,21 @@ RewriterVar* JitFragmentWriter::emitGetBoxedLocals() {
}
RewriterVar
*
JitFragmentWriter
::
emitGetClsAttr
(
RewriterVar
*
obj
,
BoxedString
*
s
)
{
return
emitPPCall
((
void
*
)
getclsattr
,
{
obj
,
imm
(
s
)
},
2
,
512
).
first
->
setType
(
RefType
::
OWNED
);
return
emitPPCall
((
void
*
)
getclsattr
,
{
obj
,
imm
(
s
)
},
2
,
256
).
first
->
setType
(
RefType
::
OWNED
);
}
RewriterVar
*
JitFragmentWriter
::
emitGetGlobal
(
Box
*
global
,
Box
edString
*
s
)
{
RewriterVar
*
JitFragmentWriter
::
emitGetGlobal
(
BoxedString
*
s
)
{
if
(
s
->
s
()
==
"None"
)
{
RewriterVar
*
r
=
imm
(
None
)
->
setType
(
RefType
::
BORROWED
);
return
r
;
}
RewriterVar
*
args
[]
=
{
NULL
,
NULL
};
args
[
0
]
=
imm
(
global
);
args
[
1
]
=
imm
(
s
);
return
emitPPCall
((
void
*
)
getGlobal
,
args
,
2
,
512
).
first
->
setType
(
RefType
::
OWNED
);
RewriterVar
*
globals
=
getInterp
()
->
getAttr
(
ASTInterpreterJitInterface
::
getGlobalsOffset
());
return
emitPPCall
((
void
*
)
getGlobal
,
{
globals
,
imm
(
s
)
},
1
,
128
).
first
->
setType
(
RefType
::
OWNED
);
}
RewriterVar
*
JitFragmentWriter
::
emitGetItem
(
AST_expr
*
node
,
RewriterVar
*
value
,
RewriterVar
*
slice
)
{
return
emitPPCall
((
void
*
)
getitem
,
{
value
,
slice
},
2
,
512
,
node
).
first
->
setType
(
RefType
::
OWNED
);
return
emitPPCall
((
void
*
)
getitem
,
{
value
,
slice
},
1
,
256
,
node
).
first
->
setType
(
RefType
::
OWNED
);
}
RewriterVar
*
JitFragmentWriter
::
emitGetLocal
(
InternedString
s
,
int
vreg
)
{
...
...
@@ -541,16 +539,18 @@ RewriterVar* JitFragmentWriter::emitYield(RewriterVar* v) {
}
void
JitFragmentWriter
::
emitDelAttr
(
RewriterVar
*
target
,
BoxedString
*
attr
)
{
emitPPCall
((
void
*
)
delattr
,
{
target
,
imm
(
attr
)
},
1
,
512
).
first
;
emitPPCall
((
void
*
)
delattr
,
{
target
,
imm
(
attr
)
},
1
,
144
).
first
;
}
void
JitFragmentWriter
::
emitDelGlobal
(
BoxedString
*
name
)
{
RewriterVar
*
globals
=
getInterp
()
->
getAttr
(
ASTInterpreterJitInterface
::
getGlobalsOffset
());
emitPPCall
((
void
*
)
delGlobal
,
{
globals
,
imm
(
name
)
},
1
,
512
).
first
;
// does not get rewriten yet
// emitPPCall((void*)delGlobal, { globals, imm(name) }, 1, 512).first;
call
(
false
,
(
void
*
)
delGlobal
,
globals
,
imm
(
name
));
}
void
JitFragmentWriter
::
emitDelItem
(
RewriterVar
*
target
,
RewriterVar
*
slice
)
{
emitPPCall
((
void
*
)
delitem
,
{
target
,
slice
},
1
,
512
).
first
;
emitPPCall
((
void
*
)
delitem
,
{
target
,
slice
},
1
,
256
).
first
;
}
void
JitFragmentWriter
::
emitDelName
(
InternedString
name
)
{
...
...
@@ -623,7 +623,7 @@ void JitFragmentWriter::emitReturn(RewriterVar* v) {
}
void
JitFragmentWriter
::
emitSetAttr
(
AST_expr
*
node
,
RewriterVar
*
obj
,
BoxedString
*
s
,
STOLEN
(
RewriterVar
*
)
attr
)
{
auto
rtn
=
emitPPCall
((
void
*
)
setattr
,
{
obj
,
imm
(
s
),
attr
},
2
,
512
,
node
);
auto
rtn
=
emitPPCall
((
void
*
)
setattr
,
{
obj
,
imm
(
s
),
attr
},
2
,
256
,
node
);
attr
->
refConsumed
(
rtn
.
second
);
}
...
...
@@ -647,8 +647,13 @@ void JitFragmentWriter::emitSetExcInfo(RewriterVar* type, RewriterVar* value, Re
traceback
->
refConsumed
();
}
void
JitFragmentWriter
::
emitSetGlobal
(
Box
*
global
,
BoxedString
*
s
,
STOLEN
(
RewriterVar
*
)
v
)
{
auto
rtn
=
emitPPCall
((
void
*
)
setGlobal
,
{
imm
(
global
),
imm
(
s
),
v
},
2
,
512
);
void
JitFragmentWriter
::
emitSetGlobal
(
BoxedString
*
s
,
STOLEN
(
RewriterVar
*
)
v
,
bool
are_globals_from_module
)
{
RewriterVar
*
globals
=
getInterp
()
->
getAttr
(
ASTInterpreterJitInterface
::
getGlobalsOffset
());
std
::
pair
<
RewriterVar
*
,
RewriterAction
*>
rtn
;
if
(
are_globals_from_module
)
rtn
=
emitPPCall
((
void
*
)
setattr
,
{
globals
,
imm
(
s
),
v
},
1
,
256
);
else
rtn
=
emitPPCall
((
void
*
)
setGlobal
,
{
globals
,
imm
(
s
),
v
},
1
,
256
);
v
->
refConsumed
(
rtn
.
second
);
}
...
...
src/codegen/baseline_jit.h
View file @
ce69b813
...
...
@@ -234,7 +234,7 @@ public:
RewriterVar
*
emitGetBoxedLocal
(
BoxedString
*
s
);
RewriterVar
*
emitGetBoxedLocals
();
RewriterVar
*
emitGetClsAttr
(
RewriterVar
*
obj
,
BoxedString
*
s
);
RewriterVar
*
emitGetGlobal
(
Box
*
global
,
Box
edString
*
s
);
RewriterVar
*
emitGetGlobal
(
BoxedString
*
s
);
RewriterVar
*
emitGetItem
(
AST_expr
*
node
,
RewriterVar
*
value
,
RewriterVar
*
slice
);
RewriterVar
*
emitGetLocal
(
InternedString
s
,
int
vreg
);
RewriterVar
*
emitGetPystonIter
(
RewriterVar
*
v
);
...
...
@@ -268,7 +268,7 @@ public:
void
emitSetBlockLocal
(
InternedString
s
,
STOLEN
(
RewriterVar
*
)
v
);
void
emitSetCurrentInst
(
AST_stmt
*
node
);
void
emitSetExcInfo
(
RewriterVar
*
type
,
RewriterVar
*
value
,
RewriterVar
*
traceback
);
void
emitSetGlobal
(
Box
*
global
,
BoxedString
*
s
,
STOLEN
(
RewriterVar
*
)
v
);
void
emitSetGlobal
(
Box
edString
*
s
,
STOLEN
(
RewriterVar
*
)
v
,
bool
are_globals_from_module
);
void
emitSetItemName
(
BoxedString
*
s
,
RewriterVar
*
v
);
void
emitSetItem
(
RewriterVar
*
target
,
RewriterVar
*
slice
,
RewriterVar
*
value
);
void
emitSetLocal
(
InternedString
s
,
int
vreg
,
bool
set_closure
,
STOLEN
(
RewriterVar
*
)
v
);
...
...
src/runtime/objmodel.cpp
View file @
ce69b813
...
...
@@ -7302,6 +7302,9 @@ extern "C" Box* getGlobal(Box* globals, BoxedString* name) {
}
extern
"C"
void
setGlobal
(
Box
*
globals
,
BoxedString
*
name
,
STOLEN
(
Box
*
)
value
)
{
static
StatCounter
slowpath_setglobal
(
"slowpath_setglobal"
);
slowpath_setglobal
.
log
();
if
(
globals
->
cls
==
attrwrapper_cls
)
{
globals
=
unwrapAttrWrapper
(
globals
);
RELEASE_ASSERT
(
globals
->
cls
==
module_cls
,
"%s"
,
globals
->
cls
->
tp_name
);
...
...
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