Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Truffle] Initialize symbols earlier.
  • Loading branch information
eregon committed Feb 6, 2015
1 parent 9ae4641 commit 326fedc
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -324,6 +324,9 @@ public void initialize() {
initializeGlobalVariables();
initializeConstants();
initializeEncodingConstants();

// Common symbols
eachSymbol = getContext().getSymbolTable().getSymbol("each");
}

private void initializeGlobalVariables() {
Expand Down Expand Up @@ -412,10 +415,6 @@ private RubyModule defineModule(RubyModule lexicalParent, String name) {
}

public void initializeAfterMethodsAdded() {
// Common symbols

eachSymbol = getContext().getSymbolTable().getSymbol("each");

// Load Ruby core

if (Options.TRUFFLE_LOAD_CORE.load()) {
Expand Down

2 comments on commit 326fedc

@nirvdrum
Copy link
Contributor

Choose a reason for hiding this comment

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

For non-obvious things, maybe having a second comment explaining why you're making a particular change, and not just what you're changing, would be helpful.

@eregon
Copy link
Member Author

@eregon eregon commented on 326fedc Feb 9, 2015

Choose a reason for hiding this comment

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

In this case it is to initialize earlier, which means getters of eachSymbol have less chance to see it as nil.

Please sign in to comment.