Skip to content

Commit

Permalink
Add an envvar to turn PEA on/off
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Nov 13, 2018
1 parent 0f51f33 commit 8e85c39
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/core/instance.h
Expand Up @@ -258,6 +258,7 @@ struct MVMInstance {
MVMint8 spesh_inline_enabled;
MVMint8 spesh_inline_log;
MVMint8 spesh_osr_enabled;
MVMint8 spesh_pea_enabled;
MVMint8 spesh_nodelay;
MVMint8 spesh_blocking;

Expand Down
1 change: 1 addition & 0 deletions src/main.c
Expand Up @@ -85,6 +85,7 @@ The following environment variables are respected:\n\
MVM_SPESH_DISABLE Disables all dynamic optimization\n\
MVM_SPESH_INLINE_DISABLE Disables inlining\n\
MVM_SPESH_OSR_DISABLE Disables on-stack replacement\n\
MVM_SPESH_PEA_DISABLE Disables partial escape analysis and related optimizations\n\
MVM_SPESH_BLOCKING Blocks log-sending thread while specializer runs\n\
MVM_SPESH_LOG Specifies a dynamic optimizer log file\n\
MVM_SPESH_NODELAY Run dynamic optimization even for cold frames\n\
Expand Down
6 changes: 5 additions & 1 deletion src/moar.c
Expand Up @@ -76,7 +76,8 @@ MVMInstance * MVM_vm_create_instance(void) {
MVMInstance *instance;

char *spesh_log, *spesh_nodelay, *spesh_disable, *spesh_inline_disable,
*spesh_osr_disable, *spesh_limit, *spesh_blocking, *spesh_inline_log;
*spesh_osr_disable, *spesh_limit, *spesh_blocking, *spesh_inline_log,
*spesh_pea_disable;
char *jit_expr_disable, *jit_disable, *jit_last_frame, *jit_last_bb;
char *dynvar_log;
int init_stat;
Expand Down Expand Up @@ -219,6 +220,9 @@ MVMInstance * MVM_vm_create_instance(void) {
spesh_osr_disable = getenv("MVM_SPESH_OSR_DISABLE");
if (!spesh_osr_disable || !spesh_osr_disable[0])
instance->spesh_osr_enabled = 1;
spesh_pea_disable = getenv("MVM_SPESH_PEA_DISABLE");
if (!spesh_pea_disable || !spesh_pea_disable[0])
instance->spesh_pea_enabled = 1;
}

init_mutex(instance->mutex_parameterization_add, "parameterization");
Expand Down
3 changes: 2 additions & 1 deletion src/spesh/optimize.c
Expand Up @@ -3315,7 +3315,8 @@ void MVM_spesh_optimize(MVMThreadContext *tc, MVMSpeshGraph *g, MVMSpeshPlanned
/* Perform partial escape analysis at this point, which may make more
* information available, or give more `set` instructions for the `set`
* elimination in the post-inline pass to get rid of. */
MVM_spesh_pea(tc, g);
if (tc->instance->spesh_pea_enabled)
MVM_spesh_pea(tc, g);

/* Make a post-inline pass through the graph doing things that are better
* done after inlinings have taken place. Note that these things must not
Expand Down

0 comments on commit 8e85c39

Please sign in to comment.