Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 25, 2016

Conversation

eregon
Copy link
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
@@ -258,6 +258,7 @@
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
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
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
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.

None yet

4 participants