OSL code refactors for emission

- Move ShaderGroups from Assembly to BaseGroup.
- Optimize shaders as soon as possible, so that ShaderGroup info can be used in the light sampler.
- Don't re-optimize the shaders unnecessarily.
- Enable OSL stats always.
- Remove unused things.
- Formatting and small improvements.