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
8feae20e
Commit
8feae20e
authored
Feb 13, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nuke the old "block guards" and the rest of the old deopt system
Long live new-deopt!
parent
ea673dfd
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
309 deletions
+16
-309
src/codegen/irgen.cpp
src/codegen/irgen.cpp
+11
-240
src/codegen/irgen/irgenerator.cpp
src/codegen/irgen/irgenerator.cpp
+4
-18
src/codegen/irgen/irgenerator.h
src/codegen/irgen/irgenerator.h
+1
-51
No files found.
src/codegen/irgen.cpp
View file @
8feae20e
This diff is collapsed.
Click to expand it.
src/codegen/irgen/irgenerator.cpp
View file @
8feae20e
...
...
@@ -105,15 +105,6 @@ ScopeInfo* IRGenState::getScopeInfoForNode(AST* node) {
return
source
->
scoping
->
getScopeInfoForNode
(
node
);
}
GuardList
::
BlockEntryGuard
::
BlockEntryGuard
(
CFGBlock
*
cfg_block
,
llvm
::
BranchInst
*
branch
,
const
SymbolTable
&
symbol_table
)
:
cfg_block
(
cfg_block
),
branch
(
branch
)
{
DupCache
cache
;
for
(
const
auto
&
p
:
symbol_table
)
{
this
->
symbol_table
[
p
.
first
]
=
p
.
second
->
dup
(
cache
);
}
}
class
IREmitterImpl
:
public
IREmitter
{
private:
IRGenState
*
irstate
;
...
...
@@ -297,8 +288,6 @@ private:
std
::
unordered_map
<
CFGBlock
*
,
llvm
::
BasicBlock
*>&
entry_blocks
;
CFGBlock
*
myblock
;
TypeAnalysis
*
types
;
GuardList
&
out_guards
;
const
GuardList
&
in_guards
;
enum
State
{
PARTIAL
,
// running through a partial block, waiting to hit the first in_guard
...
...
@@ -309,11 +298,9 @@ private:
public:
IRGeneratorImpl
(
IRGenState
*
irstate
,
std
::
unordered_map
<
CFGBlock
*
,
llvm
::
BasicBlock
*>&
entry_blocks
,
CFGBlock
*
myblock
,
TypeAnalysis
*
types
,
GuardList
&
out_guards
,
const
GuardList
&
in_guards
,
bool
is_partial
)
CFGBlock
*
myblock
,
TypeAnalysis
*
types
,
bool
is_partial
)
:
irstate
(
irstate
),
curblock
(
entry_blocks
[
myblock
]),
emitter
(
irstate
,
curblock
,
this
),
entry_blocks
(
entry_blocks
),
myblock
(
myblock
),
types
(
types
),
out_guards
(
out_guards
),
in_guards
(
in_guards
),
state
(
is_partial
?
PARTIAL
:
RUNNING
)
{}
entry_blocks
(
entry_blocks
),
myblock
(
myblock
),
types
(
types
),
state
(
is_partial
?
PARTIAL
:
RUNNING
)
{}
~
IRGeneratorImpl
()
{
delete
emitter
.
getBuilder
();
}
...
...
@@ -2426,9 +2413,8 @@ public:
};
IRGenerator
*
createIRGenerator
(
IRGenState
*
irstate
,
std
::
unordered_map
<
CFGBlock
*
,
llvm
::
BasicBlock
*>&
entry_blocks
,
CFGBlock
*
myblock
,
TypeAnalysis
*
types
,
GuardList
&
out_guards
,
const
GuardList
&
in_guards
,
bool
is_partial
)
{
return
new
IRGeneratorImpl
(
irstate
,
entry_blocks
,
myblock
,
types
,
out_guards
,
in_guards
,
is_partial
);
CFGBlock
*
myblock
,
TypeAnalysis
*
types
,
bool
is_partial
)
{
return
new
IRGeneratorImpl
(
irstate
,
entry_blocks
,
myblock
,
types
,
is_partial
);
}
CLFunction
*
wrapFunction
(
AST
*
node
,
AST_arguments
*
args
,
const
std
::
vector
<
AST_stmt
*>&
body
,
SourceInfo
*
source
)
{
...
...
src/codegen/irgen/irgenerator.h
View file @
8feae20e
...
...
@@ -98,55 +98,6 @@ public:
ParamNames
*
getParamNames
()
{
return
param_names
;
}
};
class
GuardList
{
public:
struct
BlockEntryGuard
{
CFGBlock
*
cfg_block
;
llvm
::
BranchInst
*
branch
;
SymbolTable
symbol_table
;
BlockEntryGuard
(
CFGBlock
*
cfg_block
,
llvm
::
BranchInst
*
branch
,
const
SymbolTable
&
symbol_table
);
};
private:
std
::
unordered_map
<
CFGBlock
*
,
std
::
vector
<
BlockEntryGuard
*>>
block_begin_guards
;
public:
void
getBlocksWithGuards
(
std
::
unordered_set
<
CFGBlock
*>&
add_to
)
{
for
(
const
auto
&
p
:
block_begin_guards
)
{
add_to
.
insert
(
p
.
first
);
}
}
void
assertGotPatched
()
{
#ifndef NDEBUG
for
(
const
auto
&
p
:
block_begin_guards
)
{
for
(
const
auto
g
:
p
.
second
)
{
assert
(
g
->
branch
->
getSuccessor
(
0
)
!=
g
->
branch
->
getSuccessor
(
1
));
}
}
#endif
}
bool
isEmpty
()
const
{
return
block_begin_guards
.
size
()
==
0
;
}
// void registerGuardForBlockEntry(CFGBlock* cfg_block, llvm::BranchInst* branch, const SymbolTable& st) {
//// printf("Adding guard for block %p, in %p\n", cfg_block, this);
// std::vector<BlockEntryGuard*>& v = block_begin_guards[cfg_block];
// v.push_back(new BlockEntryGuard(cfg_block, branch, st));
//}
const
std
::
vector
<
BlockEntryGuard
*>&
getGuardsForBlock
(
CFGBlock
*
block
)
const
{
std
::
unordered_map
<
CFGBlock
*
,
std
::
vector
<
BlockEntryGuard
*>>::
const_iterator
it
=
block_begin_guards
.
find
(
block
);
if
(
it
!=
block_begin_guards
.
end
())
return
it
->
second
;
static
std
::
vector
<
BlockEntryGuard
*>
empty_list
;
return
empty_list
;
}
};
class
IRGenerator
{
private:
public:
...
...
@@ -175,8 +126,7 @@ public:
class
IREmitter
;
IREmitter
*
createIREmitter
(
IRGenState
*
irstate
,
llvm
::
BasicBlock
*&
curblock
,
IRGenerator
*
irgenerator
=
NULL
);
IRGenerator
*
createIRGenerator
(
IRGenState
*
irstate
,
std
::
unordered_map
<
CFGBlock
*
,
llvm
::
BasicBlock
*>&
entry_blocks
,
CFGBlock
*
myblock
,
TypeAnalysis
*
types
,
GuardList
&
out_guards
,
const
GuardList
&
in_guards
,
bool
is_partial
);
CFGBlock
*
myblock
,
TypeAnalysis
*
types
,
bool
is_partial
);
CLFunction
*
wrapFunction
(
AST
*
node
,
AST_arguments
*
args
,
const
std
::
vector
<
AST_stmt
*>&
body
,
SourceInfo
*
source
);
}
...
...
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