Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Known regression: top-level assignments with value's on RHS have unnecessary instrumentation #374

Open
arjunguha opened this issue Jun 1, 2018 · 1 comment

Comments

@arjunguha
Copy link
Member

No description provided.

@rachitnigam
Copy link
Collaborator

Doesn't seem to happen for this file:

var x = 1;
var y = 2;
var z = foo();

==>

var $__T = stopify;
var $__R = $__T.newRTS("lazy");
var $S = stopify.init($__R);
var captureCC = $__R.captureCC.bind($__R);
var suspendCC = $__R.suspendCC;


function $top() {
  var target = null;
  $__R.remainingStack--;

  if (!$__R.mode) {
    const $frame = $__R.stack.pop();
    target = $frame.index;
    [foo, x, y, z] = $frame.locals;
  }

  function captureLocals(frame) {
    frame.locals = [foo, x, y, z];
  }

  var restoreNextFrame = () => {
    return $top.call(this);
  };

  var foo, x, y, z;

  if ($__R.mode) {
    x = 1;
    y = 2;
  }

  try {
    if ($__R.mode) {
      z = foo();
    } else if (target === 4) z = $__R.stack[$__R.stack.length - 1].f();
  } catch (exn1) {
    if (exn1 instanceof $__T.Capture) {
      exn1.stack.push({
        kind: "rest",
        f: restoreNextFrame,
        index: 4
      });
      captureLocals(exn1.stack[exn1.stack.length - 1]);
    }

    throw exn1;
  }

  $__R.remainingStack++;
}

$__R.runtime($top, result => {
  $S.onEnd(result);
});

Can you provide a test case with expected/actual output?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants