Add multimethod implementations for primitive-type
This should improve performance
This commit is contained in:
parent
7f62e72d67
commit
8f5f4a2cc4
1 changed files with 38 additions and 3 deletions
|
|
@ -230,15 +230,50 @@
|
||||||
Returns nil for any type which does not have a primitive representation."
|
Returns nil for any type which does not have a primitive representation."
|
||||||
type-dispatch)
|
type-dispatch)
|
||||||
|
|
||||||
;; TODO(Joshua): For performance, turn this into a bunch of specific defmethods
|
|
||||||
(defmethod primitive-type :default
|
(defmethod primitive-type :default
|
||||||
[type]
|
[_type]
|
||||||
(primitive-types type))
|
nil)
|
||||||
|
|
||||||
|
(defmethod primitive-type ::byte
|
||||||
|
[_type]
|
||||||
|
::byte)
|
||||||
|
|
||||||
|
(defmethod primitive-type ::short
|
||||||
|
[_type]
|
||||||
|
::short)
|
||||||
|
|
||||||
|
(defmethod primitive-type ::int
|
||||||
|
[_type]
|
||||||
|
::int)
|
||||||
|
|
||||||
|
(defmethod primitive-type ::long
|
||||||
|
[_type]
|
||||||
|
::long)
|
||||||
|
|
||||||
|
(defmethod primitive-type ::long-long
|
||||||
|
[_type]
|
||||||
|
::long-long)
|
||||||
|
|
||||||
|
(defmethod primitive-type ::char
|
||||||
|
[_type]
|
||||||
|
::char)
|
||||||
|
|
||||||
|
(defmethod primitive-type ::float
|
||||||
|
[_type]
|
||||||
|
::float)
|
||||||
|
|
||||||
|
(defmethod primitive-type ::double
|
||||||
|
[_type]
|
||||||
|
::double)
|
||||||
|
|
||||||
(defmethod primitive-type ::pointer
|
(defmethod primitive-type ::pointer
|
||||||
[_type]
|
[_type]
|
||||||
::pointer)
|
::pointer)
|
||||||
|
|
||||||
|
(defmethod primitive-type ::void
|
||||||
|
[_type]
|
||||||
|
::void)
|
||||||
|
|
||||||
(def c-prim-layout
|
(def c-prim-layout
|
||||||
"Map of primitive type names to the [[CLinker]] types for a method handle."
|
"Map of primitive type names to the [[CLinker]] types for a method handle."
|
||||||
{::byte CLinker/C_CHAR
|
{::byte CLinker/C_CHAR
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue