invokePrim seems to be the most common alternative calling convention.

I've worked around this myself for core.typed, basically generating a
deftype with the correct primitive invoke interfaces based on the :arglists
of the current var we're instrumenting.

I can prepare a patch if this approach isn't too hacky for core.

https://gist.github.com/frenchy64/7eb65d244a4edbb3a10dd4d9f889a3bd

Thanks,
Ambrose

On Thursday, September 1, 2016 at 3:54:39 PM UTC-4, red...@gmail.com wrote:
>
> instrument is going to have issues with any calling convention outisde 
> of the normal deref var + invoking path. 
> http://dev.clojure.org/jira/browse/CLJ-1941 is a similar case with some 
> discussion in the comments. 
>
> On 09/01/2016 11:33 AM, Ambrose Bonnaire-Sergeant wrote: 
> > Hi, 
> > 
> > There seems to be some issues instrumenting functions that 
> > compile to .invokePrim calls. 
> > 
> > user=> (s/fdef blah :args (s/cat :foo int?) :ret any?) 
> > user/blah 
> > user=> (defn blah [^long a]) 
> > #'user/blah 
> > user=> (st/instrument) 
> > [clojure.core/symbol user/blah] 
> > user=> (blah 1) 
> > 
> > ClassCastException clojure.spec.test$spec_checking_fn$fn__13057 cannot 
> > be cast to clojure.lang.IFn$LO  user/eval70134 
> > (form-init2184258571072833082.clj:1) 
> > user=> 
> > 
> > I'm about to tackle this problem in core.typed, so I should have some 
> useful 
> > utilities to fix this soon (if interested). 
> > 
> > Thanks, 
> > Ambrose 
> > 
> > On Friday, August 19, 2016 at 2:15:06 PM UTC-4, Alex Miller wrote: 
> > 
> >     Clojure 1.9.0-alpha11 is now available. 
> > 
> >     Try it via 
> > 
> >     - Download: 
> >     https://repo1.maven.org/maven2/org/clojure/clojure/1.9.0-alpha11 
> >     <https://repo1.maven.org/maven2/org/clojure/clojure/1.9.0-alpha11> 
> >     - Leiningen: [org.clojure/clojure "1.9.0-alpha11"] 
> > 
> >     1.9.0-alpha11 includes the following changes since 1.9.0-alpha10: 
> > 
> >     Clojure now has specs for the following clojure.core macros: let, 
> >     if-let, when-let, defn, defn-, fn, and ns. Because macro specs are 
> >     checked during macroexpansion invalid syntax in these macros will 
> >     now fail at compile time whereas some errors were caught at runtime 
> >     and some were not caught at all. 
> > 
> >     - CLJ-1914 - Fixed race condition in concurrent range realization 
> >     - CLJ-1870 - Fixed reloading a defmulti removes metadata on the var 
> >     - CLJ-1744 - Clear unused locals, which can prevent memory leaks in 
> >     some cases 
> >     - CLJ-1423 - Allow vars to be invoked with infinite arglists (also, 
> >     faster) 
> >     - CLJ-1993 - Added *print-namespace-maps* dynamic var that controls 
> >     whether to use namespace map syntax for maps with keys from the same 
> >     namespace. The default is false, but standard REPL bindings set this 
> >     to true. 
> >     - CLJ-1985 - Fixed with-gen of conformer losing unform fn 
> >     - Fixed clojure.spec.test/check to skip spec'ed macros 
> >     - Fixed regression from 1.9.0-alpha8 where type hints within 
> >     destructuring were lost 
> >     - Fixed clojure.spec/merge docstring to note merge doesn't flow 
> >     conformed values 
> >     - Fixed regex ops to use gen overrides if they are used 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@googlegroups.com 
> <javascript:> 
> > Note that posts from new members are moderated - please be patient with 
> > your first post. 
> > To unsubscribe from this group, send email to 
> > clojure+u...@googlegroups.com <javascript:> 
> > For more options, visit this group at 
> > http://groups.google.com/group/clojure?hl=en 
> > --- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to clojure+u...@googlegroups.com <javascript:> 
> > <mailto:clojure+u...@googlegroups.com <javascript:>>. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
> -- 
> And what is good, Phaedrus, 
> And what is not good— 
> Need we ask anyone to tell us these things? 
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to