js-js/js.js

Const-JS stubs

indutny opened this issue · 0 comments

Stubs should be written in JS without var and let statements (only with const statement). This does not mean that they should have JS semantics, we just need a transpiler from const-JS to CFG, so that it would create unique ids itself:

const x = 1 + 2 * 3
stubCall(stub('hello'), x)
block B1
  t0 = literal %2
  t1 = literal %3
  t2 = smiMul t0, t1
  t3 = literal %1
  x = smiAdd t3, t2
  t4 = stub %"hello"
  pushArg x
  stubCall t4, %1