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
5676aaa2
Commit
5676aaa2
authored
Jul 23, 2015
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bjit: inline trivial helper functions
parent
8728a053
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
29 deletions
+23
-29
src/codegen/ast_interpreter.cpp
src/codegen/ast_interpreter.cpp
+12
-21
src/codegen/ast_interpreter.h
src/codegen/ast_interpreter.h
+3
-4
src/codegen/baseline_jit.cpp
src/codegen/baseline_jit.cpp
+8
-4
No files found.
src/codegen/ast_interpreter.cpp
View file @
5676aaa2
...
...
@@ -1570,6 +1570,10 @@ Value ASTInterpreter::visit_attribute(AST_Attribute* node) {
}
int
ASTInterpreterJitInterface
::
getBoxedLocalsOffset
()
{
return
offsetof
(
ASTInterpreter
,
frame_info
.
boxedLocals
);
}
int
ASTInterpreterJitInterface
::
getCurrentBlockOffset
()
{
return
offsetof
(
ASTInterpreter
,
current_block
);
}
...
...
@@ -1578,6 +1582,14 @@ int ASTInterpreterJitInterface::getCurrentInstOffset() {
return
offsetof
(
ASTInterpreter
,
current_inst
);
}
int
ASTInterpreterJitInterface
::
getGeneratorOffset
()
{
return
offsetof
(
ASTInterpreter
,
generator
);
}
int
ASTInterpreterJitInterface
::
getGlobalsOffset
()
{
return
offsetof
(
ASTInterpreter
,
globals
);
}
Box
*
ASTInterpreterJitInterface
::
derefHelper
(
void
*
_interpreter
,
InternedString
s
)
{
ASTInterpreter
*
interpreter
=
(
ASTInterpreter
*
)
_interpreter
;
DerefInfo
deref_info
=
interpreter
->
scope_info
->
getDerefInfo
(
s
);
...
...
@@ -1601,16 +1613,6 @@ Box* ASTInterpreterJitInterface::doOSRHelper(void* _interpreter, AST_Jump* node)
return
NULL
;
}
Box
*
ASTInterpreterJitInterface
::
getBoxedLocalHelper
(
void
*
_interpreter
,
BoxedString
*
s
)
{
ASTInterpreter
*
interpreter
=
(
ASTInterpreter
*
)
_interpreter
;
return
boxedLocalsGet
(
interpreter
->
frame_info
.
boxedLocals
,
s
,
interpreter
->
globals
);
}
Box
*
ASTInterpreterJitInterface
::
getBoxedLocalsHelper
(
void
*
_interpreter
)
{
ASTInterpreter
*
interpreter
=
(
ASTInterpreter
*
)
_interpreter
;
return
interpreter
->
frame_info
.
boxedLocals
;
}
Box
*
ASTInterpreterJitInterface
::
getLocalHelper
(
void
*
_interpreter
,
InternedString
id
)
{
ASTInterpreter
*
interpreter
=
(
ASTInterpreter
*
)
_interpreter
;
...
...
@@ -1648,17 +1650,6 @@ Box* ASTInterpreterJitInterface::uncacheExcInfoHelper(void* _interpreter) {
return
None
;
}
Box
*
ASTInterpreterJitInterface
::
yieldHelper
(
void
*
_interpreter
,
Box
*
val
)
{
ASTInterpreter
*
interpreter
=
(
ASTInterpreter
*
)
_interpreter
;
return
yield
(
interpreter
->
generator
,
val
);
}
void
ASTInterpreterJitInterface
::
setItemNameHelper
(
void
*
_interpreter
,
Box
*
str
,
Box
*
val
)
{
ASTInterpreter
*
interpreter
=
(
ASTInterpreter
*
)
_interpreter
;
assert
(
interpreter
->
frame_info
.
boxedLocals
!=
NULL
);
setitem
(
interpreter
->
frame_info
.
boxedLocals
,
str
,
val
);
}
void
ASTInterpreterJitInterface
::
setLocalClosureHelper
(
void
*
_interpreter
,
InternedString
id
,
Box
*
v
)
{
ASTInterpreter
*
interpreter
=
(
ASTInterpreter
*
)
_interpreter
;
...
...
src/codegen/ast_interpreter.h
View file @
5676aaa2
...
...
@@ -35,19 +35,18 @@ struct LineInfo;
extern
const
void
*
interpreter_instr_addr
;
struct
ASTInterpreterJitInterface
{
static
int
getBoxedLocalsOffset
();
static
int
getCurrentBlockOffset
();
static
int
getCurrentInstOffset
();
static
int
getGeneratorOffset
();
static
int
getGlobalsOffset
();
static
Box
*
derefHelper
(
void
*
interp
,
InternedString
s
);
static
Box
*
doOSRHelper
(
void
*
interp
,
AST_Jump
*
node
);
static
Box
*
getBoxedLocalHelper
(
void
*
interp
,
BoxedString
*
s
);
static
Box
*
getBoxedLocalsHelper
(
void
*
interp
);
static
Box
*
getLocalHelper
(
void
*
interp
,
InternedString
id
);
static
Box
*
landingpadHelper
(
void
*
interp
);
static
Box
*
setExcInfoHelper
(
void
*
interp
,
Box
*
type
,
Box
*
value
,
Box
*
traceback
);
static
Box
*
uncacheExcInfoHelper
(
void
*
interp
);
static
Box
*
yieldHelper
(
void
*
interp
,
Box
*
val
);
static
void
setItemNameHelper
(
void
*
interp
,
Box
*
str
,
Box
*
val
);
static
void
setLocalClosureHelper
(
void
*
interp
,
InternedString
id
,
Box
*
v
);
static
void
setLocalHelper
(
void
*
interp
,
InternedString
id
,
Box
*
v
);
};
...
...
src/codegen/baseline_jit.cpp
View file @
5676aaa2
...
...
@@ -21,6 +21,7 @@
#include "codegen/memmgr.h"
#include "codegen/type_recording.h"
#include "core/cfg.h"
#include "runtime/generator.h"
#include "runtime/inline/list.h"
#include "runtime/objmodel.h"
#include "runtime/set.h"
...
...
@@ -286,11 +287,13 @@ RewriterVar* JitFragmentWriter::emitGetBlockLocal(InternedString s) {
}
RewriterVar
*
JitFragmentWriter
::
emitGetBoxedLocal
(
BoxedString
*
s
)
{
return
call
(
false
,
(
void
*
)
ASTInterpreterJitInterface
::
getBoxedLocalHelper
,
getInterp
(),
imm
(
s
));
RewriterVar
*
boxed_locals
=
emitGetBoxedLocals
();
RewriterVar
*
globals
=
getInterp
()
->
getAttr
(
ASTInterpreterJitInterface
::
getGlobalsOffset
());
return
call
(
false
,
(
void
*
)
boxedLocalsGet
,
boxed_locals
,
imm
(
s
),
globals
);
}
RewriterVar
*
JitFragmentWriter
::
emitGetBoxedLocals
()
{
return
call
(
false
,
(
void
*
)
ASTInterpreterJitInterface
::
getBoxedLocalsHelper
,
getInterp
());
return
getInterp
()
->
getAttr
(
ASTInterpreterJitInterface
::
getBoxedLocalsOffset
());
}
RewriterVar
*
JitFragmentWriter
::
emitGetClsAttr
(
RewriterVar
*
obj
,
BoxedString
*
s
)
{
...
...
@@ -396,7 +399,8 @@ RewriterVar* JitFragmentWriter::emitUnpackIntoArray(RewriterVar* v, uint64_t num
}
RewriterVar
*
JitFragmentWriter
::
emitYield
(
RewriterVar
*
v
)
{
return
call
(
false
,
(
void
*
)
ASTInterpreterJitInterface
::
yieldHelper
,
getInterp
(),
v
);
RewriterVar
*
generator
=
getInterp
()
->
getAttr
(
ASTInterpreterJitInterface
::
getGeneratorOffset
());
return
call
(
false
,
(
void
*
)
yield
,
generator
,
v
);
}
...
...
@@ -464,7 +468,7 @@ void JitFragmentWriter::emitSetItem(RewriterVar* target, RewriterVar* slice, Rew
}
void
JitFragmentWriter
::
emitSetItemName
(
BoxedString
*
s
,
RewriterVar
*
v
)
{
call
(
false
,
(
void
*
)
ASTInterpreterJitInterface
::
setItemNameHelper
,
getInterp
(),
imm
(
s
),
v
);
emitSetItem
(
emitGetBoxedLocals
(),
imm
(
s
),
v
);
}
void
JitFragmentWriter
::
emitSetLocal
(
InternedString
s
,
bool
set_closure
,
RewriterVar
*
v
)
{
...
...
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