Skip to content

Conversation

spacepluk
Copy link

@spacepluk spacepluk commented Feb 13, 2017

This PR tracks the changes needed clojure-clr in order to add IL2CPP support on Arcadia. In-depth explanation coming-soon™.

nasser and others added 30 commits April 12, 2014 16:44
Unity sets System.AppDomain.CurrentDomain.BaseDirectory to null which causes
all kinds of problems.
Raises NotImplemented exceptions in Unity otherwise. Refs and MultiFns
are broken as a result.
Unity sets System.AppDomain.CurrentDomain.BaseDirectory to null which causes
all kinds of problems.
Raises NotImplemented exceptions in Unity otherwise. Refs and MultiFns
are broken as a result.
Use superclass in place of stub class for type hinting
This is a port of @ztellman's pending patch
http://dev.clojure.org/jira/browse/CLJ-1529

This patch avoids unnecessary lookups on symbols that are known to be
lexically bound, resulting in significant speedup in many cases. Details
are on the Jira page.
Namespace qualified types skip the slow string comparison code path.
This commit also documents when each lookup path can be expected to
succeed.
nasser and others added 5 commits March 11, 2017 08:26
Lookups for unqualified, unimported types will throw an exception (as
they should). This patch removes lookup logic that was in place due to a
mono bug where types with slashes in their names could not be found. The
compiler no longer emits such types, so the slow path is no longer
needed.
:else (BigDecimal/Create x))) ;;; (BigDecimal. x)))
(instance? BigInteger x) (clojure.lang.BigDecimal/Create ^BigInteger x) ;;; (BigDecimal. ^BigInteger x)
(number? x) (clojure.lang.BigDecimal/Create (long x)) ;;; (BigDecimal/valueOf (long x))
:else (throw (InvalidCastException. (str "Cannot cast " (type x) " to BigDecimal.")))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this one

(mm %)))
dval #((.dispatchFn ^clojure.lang.MultiFn @mmvar) %)
dval #(@mmvar %)
tag (if (keyword? retag)
#(assoc %1 retag %2)
retag)]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This chunk above, looks fine to me but I feel like I'm missing something.

@txus
Copy link

txus commented Aug 13, 2017

Hi @spacepluk, I've had a look at this but I wasn't very successful. I'd love to pick it up if you'd maybe explain a couple of things to me?

@spacepluk
Copy link
Author

Hey @txus,
Sure, I've been going through a bit of a transition in the last few months but hopefully I'll be able to get back to help soon. Just ask and I'll do my best.

The last thing I can remember is that most dynamic call sites were already removed and it seemed to work fine on iOS if you avoided the cases that were still generating dynamic call sites. I think there were two cases that weren't easy to fix.

The one I remember more clearly was that for some reason the defrecord implementation drops the metadata of the fields. And that voids any prior type hinting and ends up generating dynamic call sites for all the defrecord constructors. I tried to figure out why they do that (they also do it in the JVM) but then I got sidetracked.

The second "big" problem was that we're hitting some dark corners of il2cpp with our bytecode, and sometimes it will get stuck in an endless loop while transpiling. That's not imposible to work around but definitely not fun without the source. This happened mostly with webgl/android builds but also occasionally on iOS.

So, my conclusion about this is that @ra and @timsgardner were right from the beginning and the way to go is implementing a new compiler. But hey, I had to try! :)

There's still potential of getting something usable out of this if we manage to find a solution for those two issues, but I don't think it's going to be an easy hack like I expected at the beginning. And I think spending our efforts on magic will be more useful/fun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants