Open jorendorff opened 4 years ago
Also, the current emitter is a bit messy, and if we don't get organized it is only going to get worse.
I split some parts of this out into #230 and #231.
In this bug, I'll address the general problem of how to deal with unchecked emitter methods that could produce invalid bytecode.
jsparagus is all safe code, but that is super misleading because at the end we hand off a bag of bytes to the JS engine, which does no validation at all. If our output is incorrect, SM will crash.
Writing incorrect bytecode is unsafe.
We should build safe abstractions, at least when it is easy.
I have some ideas and a partial patch.