What about a preprocessor like the Java preprocessors ? The Truffle project relies heavily on that for high performance Java and it's quite nice. It's difficult to do that in Smalltalk right now.
I think if you want to do what are asking for you just need to write a bytecode compiler extension.
I did something similar in the past to have precomputed constants through AST manipulation at compilation time. You can find it here with examples:
http://smalltalkhub.com/#!/~ClementBera/NeoCompiler. Once the code is loaded you need to recompile the examples (
NeoCompilerExample withAllSubclassesDo: #compileAll.). With it you can write code such as:
[ Smalltalk vm class ] Cvalue
And depending if the compiler allowsPrecompilation or not, the bytecode compiler generates:
Smalltalk vm class
Or just a push literal with the precomputed value (the class VirtualMachine).