Skip to content

[Truffle] Make global variables constants if they are rarely changed#3977

Merged
eregon merged 1 commit intomasterfrom
truffle_constant_globals
Jun 25, 2016
Merged

[Truffle] Make global variables constants if they are rarely changed#3977
eregon merged 1 commit intomasterfrom
truffle_constant_globals

Conversation

@eregon
Copy link
Copy Markdown
Member

@eregon eregon commented Jun 24, 2016

@jruby/truffle @thedarkone So here is my attempt to make global variables constants if they are not changed too often. The logic is unfortunately more complex than I expected, so I would appreciate a review 😃

@eregon eregon added the truffle label Jun 24, 2016
@eregon eregon added this to the truffle-dev milestone Jun 24, 2016
public static final Option<Integer> TRUFFLE_BIND_CACHE = integer(TRUFFLE, "truffle.bind.cache", TRUFFLE_DEFAULT_CACHE.load(), "Cache size of test for being able to bind a method to a module.");
public static final Option<Integer> TRUFFLE_CONSTANT_CACHE = integer(TRUFFLE, "truffle.constant.cache", TRUFFLE_DEFAULT_CACHE.load(), "Constant cache size.");
public static final Option<Integer> TRUFFLE_INSTANCE_VARIABLE_CACHE = integer(TRUFFLE, "truffle.instance_variable.cache", TRUFFLE_DEFAULT_CACHE.load(), "Instance variable cache size.");
public static final Option<Integer> TRUFFLE_GLOBAL_VARIABLE_CACHE = integer(TRUFFLE, "truffle.global_variable.cache", 10, "Maximum number of times a global variable can be changed to be considered constant.");
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JRuby classic uses 100 here (see above), but that seems potentially too many deopts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should perhaps be called _INVALIDATIONS and .invalidations as it isn't the size of a cache, like the other _CACHE variable are.

@eregon eregon force-pushed the truffle_constant_globals branch from 83d301d to 6bfe25e Compare June 24, 2016 17:42
@thedarkone
Copy link
Copy Markdown
Contributor

lgtm.

@eregon eregon force-pushed the truffle_constant_globals branch from 6bfe25e to e04278d Compare June 25, 2016 09:28
@eregon eregon merged commit 389690f into master Jun 25, 2016
@eregon eregon deleted the truffle_constant_globals branch June 25, 2016 10:02
@enebo enebo added this to the Non-Release milestone Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants