Slang translates all methods that have at least one sender to C. But there is a problem. Let's illustrate it in the following scenario:
Slang detects all Pharo methods that have at least one sender. Those methods will be translated to C. (no problem until here)
After, Slangs inlines several methods according to an heuristic.
Now, after the inlining there are methods that no longer have any senders (because they were inlined). Those methods will be generated as well (here is the problem because slang is generating dead code).
Here there is a concrete example:
The Pharo method CogAbstractInstruction>>#availableFloatRegisterOrNoneFor: has only one sender. When Slang start the generation process it inlines this method to its sender. SoCogAbstractInstruction>>#availableFloatRegisterOrNoneFor: gets inlined and then it has NO senders. But, Slang translates that method to C. This is wrong as the method became with no senders.
Possible solution
One solution can be to improve the slang algorithm to detect the methods without senders AFTER the inlining happens, not before.
Slang translates all methods that have at least one sender to C. But there is a problem. Let's illustrate it in the following scenario:
Here there is a concrete example:
The Pharo method
CogAbstractInstruction>>#availableFloatRegisterOrNoneFor:
has only one sender. When Slang start the generation process it inlines this method to its sender. SoCogAbstractInstruction>>#availableFloatRegisterOrNoneFor:
gets inlined and then it has NO senders. But, Slang translates that method to C. This is wrong as the method became with no senders.Possible solution One solution can be to improve the slang algorithm to detect the methods without senders AFTER the inlining happens, not before.
This issue correlates with https://github.com/pharo-project/pharo-vm/issues/784