Rewrite jsglue so that it does not suffer from abi incompatibilities