Generate a shallowly embedded ACL2 call of a Java primitive conversion.
(atj-gen-shallow-jprim-conv-call fn arg-block arg-expr src-types dst-types) → (mv block expr)
This is called only if
We generate a cast to the target type: for widening conversions, this is unnecessary, but for now we use this simple scheme that may also emphasize clarity in the code; we may revisit this decision in the future.
Function:
(defun atj-gen-shallow-jprim-conv-call (fn arg-block arg-expr src-types dst-types) (declare (xargs :guard (and (atj-jprim-conv-fn-p fn) (jblockp arg-block) (jexprp arg-expr) (atj-type-listp src-types) (atj-type-listp dst-types)))) (declare (xargs :guard (and (consp src-types) (consp dst-types)))) (let ((__function__ 'atj-gen-shallow-jprim-conv-call)) (declare (ignorable __function__)) (b* ((jtype (atj-jprim-conv-fn-to-jtype fn)) (expr (jexpr-cast jtype arg-expr))) (mv (jblock-fix arg-block) (atj-adapt-expr-to-type expr (atj-type-list-to-type src-types) (atj-type-list-to-type dst-types) t)))))
Theorem:
(defthm jblockp-of-atj-gen-shallow-jprim-conv-call.block (b* (((mv common-lisp::?block ?expr) (atj-gen-shallow-jprim-conv-call fn arg-block arg-expr src-types dst-types))) (jblockp block)) :rule-classes :rewrite)
Theorem:
(defthm jexprp-of-atj-gen-shallow-jprim-conv-call.expr (b* (((mv common-lisp::?block ?expr) (atj-gen-shallow-jprim-conv-call fn arg-block arg-expr src-types dst-types))) (jexprp expr)) :rule-classes :rewrite)