[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp b4ee13c 9/9: * Memoize `comp-subtype-p'
From: |
Andrea Corallo |
Subject: |
feature/native-comp b4ee13c 9/9: * Memoize `comp-subtype-p' |
Date: |
Thu, 24 Dec 2020 09:49:32 -0500 (EST) |
branch: feature/native-comp
commit b4ee13c94218062baa4d9d15176eee4aaf582d57
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* Memoize `comp-subtype-p'
* lisp/emacs-lisp/comp-cstr.el (comp-subtype-p): Memoize.
(comp-cstr-ctxt): Add `subtype-p-mem' slot.
---
lisp/emacs-lisp/comp-cstr.el | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 1990595..32989f2 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -86,6 +86,9 @@ Integer values are handled in the `range' slot.")
(common-supertype-mem (make-hash-table :test #'equal) :type hash-table
:documentation "Serve memoization for
`comp-common-supertype'.")
+ (subtype-p-mem (make-hash-table :test #'equal) :type hash-table
+ :documentation "Serve memoization for
+`comp-subtype-p-mem'.")
(union-1-mem-no-range (make-hash-table :test #'equal) :type hash-table
:documentation "Serve memoization for
`comp-cstr-union-1'.")
@@ -215,7 +218,11 @@ Return them as multiple value."
(defsubst comp-subtype-p (type1 type2)
"Return t if TYPE1 is a subtype of TYPE2 or nil otherwise."
- (eq (comp-common-supertype-2 type1 type2) type2))
+ (let ((types (cons type1 type2)))
+ (or (gethash types (comp-cstr-ctxt-subtype-p-mem comp-ctxt))
+ (puthash types
+ (eq (comp-common-supertype-2 type1 type2) type2)
+ (comp-cstr-ctxt-subtype-p-mem comp-ctxt)))))
(defun comp-union-typesets (&rest typesets)
"Union types present into TYPESETS."
- feature/native-comp updated (b99a474 -> b4ee13c), Andrea Corallo, 2020/12/24
- feature/native-comp 4deeb2f 1/9: Invert basic block argument order in LIMPLE cond-jump, Andrea Corallo, 2020/12/24
- feature/native-comp c07c9f6 2/9: Extend cstrs pass to match `when' like code, Andrea Corallo, 2020/12/24
- feature/native-comp 538f598 4/9: Extend cstrs pass to match `unless' like code, Andrea Corallo, 2020/12/24
- feature/native-comp 672988e 5/9: Symplify (not t) => nil and (not nil) => t, Andrea Corallo, 2020/12/24
- feature/native-comp 96d4c70 6/9: * Fix logic for constraining block with multiple predecessors, Andrea Corallo, 2020/12/24
- feature/native-comp 715cac1 3/9: * lisp/emacs-lisp/comp.el (comp-limplify-lap-inst): Opencode byte-not., Andrea Corallo, 2020/12/24
- feature/native-comp 2327a98 8/9: * Constrain only mvars that are actually used, Andrea Corallo, 2020/12/24
- feature/native-comp b4ee13c 9/9: * Memoize `comp-subtype-p',
Andrea Corallo <=
- feature/native-comp 2a6c6bf 7/9: * Use `comp-assign-op-p' into dead code elimination pass, Andrea Corallo, 2020/12/24