          (stack-cap (pop! pkg))
          (doc-string (pop! pkg)))
     (make-byte-code args-desc
-                    (goism--ir-to-bytecode pkg)
+                    (goism--ir-to-bytecode pkg cvec)
                     cvec
                     stack-cap
                     doc-string)))

    (_
     (error "Unexpected op kind for `%s'" op))))

(defun goism--ir-tag-ref (tags id)
  (or (gethash id tags)
      (puthash id (list 'TAG (hash-table-count tags)) tags)))

;; {{ end }}

(defsubst goism--ir-make-info (kind data) (cons kind data))
(defsubst goism--ir-info-kind (info) (car info))
(defsubst goism--ir-info-data (info) (cdr info))

(defsubst goism--ir-make-env (cvec)
  (vector (make-hash-table :test #'eq)
          (make-hash-table :test #'eq)
          (let ((refs (make-vector (length cvec) nil)))
            (dotimes (i (length cvec))
              (aset refs i (cons (aref cvec i) i)))
            refs)
          cvec))
(defsubst goism--ir-env-tags (env) (aref env 0))
(defsubst goism--ir-env-vars (env) (aref env 1))
(defsubst goism--ir-env-consts (env) (aref env 2))
(defsubst goism--ir-env-cvec (env) (aref env 3))
(defun goism--ir-env-tag-ref (env id)
  (let ((tags (goism--ir-env-tags env)))
    (or (gethash id tags)
        (puthash id (list 'TAG (hash-table-count tags)) tags))))
(defun goism--ir-env-var-ref (env id)
  (let ((vars (goism--ir-env-vars env)))
    (or (gethash id vars)
        (puthash id
                 (cons (aref (goism--ir-env-cvec env) id) id)
                 vars))))
(defsubst goism--ir-env-const-ref (env id)
  (aref (goism--ir-env-consts env) id))

(defconst goism--ir-table
  (let ((table (make-hash-table :test #'eq)))
    (dolist (x '(;; - Special instructions -
                 (label label ir-label)
                 (var-ref var-ref byte-varref)
                 (var-set var-set byte-varset)
                 (constant constant byte-constant)
                 ;; - Combined instructions -
                 (stack-ref stack-ref)
                 (discard discard)
