pharo-project / pharo-vm

This is the VM used by Pharo
http://pharo.org
Other
115 stars 71 forks source link

normalize C variables #875

Open RenaudFondeur opened 11 hours ago

RenaudFondeur commented 11 hours ago

Normalize the variables in the C code to avoid conflict existing between locals, globals and methods. A pull request to make me familiar with Pharo/Slang again, took some times because of it and some rare cases in the VM code.

Renaming happens between type inferences and inlining. Rename the variables that are locals, the other ones with a reserved semantic doesn't change.

Reserved names :

We update the occurences of changed variables in type declarations, return type (see genCallPICEnilopmartNumArgs:) and cCode: selectors if needed (see addressIsInFixups:).

We also update for each elements in the AST that needs it the locals and variables list.

Tests have been checked with MuTalk.

Other small changes :

Change in the name of an extern variable (imageName) defined in the C code which is not generated to align with.

Simplify nil gestion by updating the few variables nodes with the name 'nil' in Slang to the equivalent of constants node with the value nil.