code: def _run_straightline(ops, backend, env_dict, mask):
      """Imperatively run a list of straight-line ops, return updated `env_dict`."""
      env = inst.Environment(env_dict, backend)
      for op in ops:
          if isinstance(op, inst.PrimOp):
              if inst.pc_var in inst.pattern_flatten(
                  op.vars_in
              ) or inst.pc_var in inst.pattern_flatten(op.vars_out):
                  raise ValueError(
                      "PrimOp reads or writes program counter: {}".format(
                          op
                      )
                  )
              inputs = [
                  inst.pattern_map(env.read, var_pat)
                  for var_pat in op.vars_in
              ]
              with _stackless_running():
                  outputs = op.function(*inputs)
              new_vars = [
                  (varname, env.push(varname, output, mask))
                  for varname, output in inst.pattern_zip(
                      op.vars_out, outputs
                  )
              ]
          elif isinstance(op, inst.PopOp):
              new_vars = [
                  (varname, env.pop(varname, mask))
                  for varname in op.vars
              ]
          else:
              raise ValueError(
                  "Invalid instruction in straightline segment: {}".format(
                      type(op)
                  )
              )
          env = inst.Environment(
              env.env_dict, env.backend, update=new_vars
          )
      return env.env_dict
  
file_path: probability/tensorflow_probability/python/experimental/auto_batching/stackless.py
imports: import contextlib
  import functools
  import heapq
  from absl import logging
  import six
  from tensorflow_probability.python.experimental.auto_batching import instructions
label_desc: Use image node_id 3 for calling a global function with example usage: _run_straightline(ops, backend, env_dict, mask) and returns: env