From: Gergely K. <ger...@ma...> - 2010-03-04 17:29:38
|
Hi Peter, 2010/3/4 Peter Carpenter <pet...@sk...> > Hi guys, > > > > Our company is looking at using xmlvm to cross-compile some java code to > objective c for use on the iphone. Our project is comms based and so using > lots of sockets, threads, parsing & others. I have to say, this looks like > a VERY useful product, however had some initial questions which I hope some > friendly people would be happy to answer to help guide our future path. > > > > 1/ On my initial conversion, I’ve discovered that a few interfaces like > “Cloneable”, “Enumerator”, and also the “Hashtable” class don’t seem to be > included in xmlvm. Is it simply a matter of generating obj-c code for these > classes or is it deeper than this & we’re better off modifying our java code > to not require these? > If you look at the patch we submitted: http://xmlvm-reviews.appspot.com/18002/show It implements a large part of Hashtable, java.util.Enumeration... etc. It also implements locking, and at least the HTTPConnection part of the network stack. We are in the process of updating this patch / breaking it up to ease the inclusion into XMLVM trunk. If there are standard Java APIs that you need, but are not implemented yet, you need to create the necessary classes in xmvlm2objc/compat-lib/objc. We currently don't use automatically cross-compiled implementations of the standard Java classes, although technically it should be feasible. In fact, the Android compatibility layer is cross-compiled from Java to ObjC. The reason we currently use hand-written ObjC classes is that we use ObjC categories to add the required Java compatibility layer to the regular Objective-C classes. This has the effect that a java_lang_String is just an NSString, with only a single method call indirection overhead for the Java methods. Object instances can be passed back and forth between the Java and ObjC worlds without any conversion. Also, for the collection framework we were able to just reuse NSArray, NSSet, NSDictionary for the different Java classes in a very similar manner. It did come up on the list before multiple times (e.g. the latest was last weekend) that XMLVM could support cross-compiled Java APIs, e.g. from Apache Harmony, at least until optimized versions are available. I did some experiments with it back in December, but at that time I decided that the amount of work to get it running was higher than the expected gain -- at least for our project. > 2/ Is there any further documentation/websites on getting up to speed with > the xmlvm code other than the manual? I’ve had a poke around and haven’t > found a great deal. > I don't know about too much documentation beside that. > 3/ How reliable/stable have people found cross-compilations from > java->objective c? Is it wise to proceed down this path for a commercial > application? > You should not expect this to be a seamless process. Most likely you will find that some machine instructions are missing, which you will have to add to the XSL (pretty straightforward to do). Then you will most likely run into missing methods in the Java libraries. In many cases there exists a native IPhone implementation for the same method/class, so one only needs to wrap it accordingly. And then of course there are bugs in the Java API implementations, which are of course fixed continuously, but still, don't expect the same stability as you are acustomed to in other Java platform. However, we are nearing the phase in our project, when we can submit it to the App Store for inclusion, so it is certainly usable, but you will most probably need to maintain a private branch with fixes and improvements to ensure the necessary stability. One issue is the commercial licensing / Linking Exception, which you will need to discuss with the XMLVM Core Team (they are listed on the website). Best Regards, Gergely > > > Regards, > > > > > > *Peter Carpenter* > > *Senior Developer* > > > > [image: cid:image001.gif@01CA6135.90C08EE0] > > > > (T) +61 3 9558 6088 > > (F) +61 3 9562 8886 > > *pet...@sk...* > > > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > xmlvm-users mailing list > xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlvm-users > > -- Kis Gergely MattaKis Consulting Email: ger...@ma... Web: http://www.mattakis.com Phone: +36 70 408 1723 Fax: +36 27 998 622 |
From: Tor L. <tm...@ik...> - 2010-03-05 23:40:23
|
> It did come up on the list before multiple times (e.g. the latest was last weekend) that XMLVM could support cross-compiled > Java APIs, e.g. from Apache Harmony, Yeah, or if it wouldn't be XMLVM that would "support" it, one could just do that on one's own on top of what XMLVM provides. But... > I did some experiments with it back in December, but at that time I decided that the amount of work to get it running > was higher than the expected gain -- at least for our project. I have also done some experimentation trying to come up with a minimal subset of classes from Harmony that would be enough to cover what the Java code that I am pondering using needs (an existing Open Source bunch of code, written for a normal Java environment). I have attempted to "stub out" stuff as necessary to avoid dependency explosion. But... it seems that it's a never ending struggle. There is always something missing, then you have a look at those sources in Harmony, you think "that doesn't look so bad, let's pull that in too", then you notice it pulls in something new that is missing, you add that, which then pulls in something else from a totally different part of Harmony, etc, etc. It's quite hard to find the right places to make the "cuts", what to "stub out". Or maybe I just don't have a good enough view of the whole. Sigh, maybe I should just give up trying to use the code in question, this is just for my own free time hacking pleasure anyway, failure *is* an option... --tml |
From: Gergely K. <ger...@ma...> - 2010-03-06 08:24:08
|
Hi, You just summarized my experience with Harmony as well. Of course, Harmony was created to provide a Java API implementation on top of a simple Libc, with some JVM specific stubs. I think that it is possible to use parts of Harmony, where it does not use native calls. However, then you will have to implement _everything_ that uses native calls, including the private implementations (org.apache.harmony namespace), which is a lot of work. And it is still not clear how well the cross-compiled code will perform, or it will be too slow for any serious use. Best Regards, Gergely 2010/3/6 Tor Lillqvist <tm...@ik...> > > I did some experiments with it back in December, but at that time I > decided that the amount of work to get it running > > was higher than the expected gain -- at least for our project. > > I have also done some experimentation trying to come up with a minimal > subset of classes from Harmony that would be enough to cover what the > Java code that I am pondering using needs (an existing Open Source > bunch of code, written for a normal Java environment). > > I have attempted to "stub out" stuff as necessary to avoid dependency > explosion. > > But... it seems that it's a never ending struggle. There is always > something missing, then you have a look at those sources in Harmony, > you think "that doesn't look so bad, let's pull that in too", then you > notice it pulls in something new that is missing, you add that, which > then pulls in something else from a totally different part of Harmony, > etc, etc. It's quite hard to find the right places to make the "cuts", > what to "stub out". Or maybe I just don't have a good enough view of > the whole. > > Sigh, maybe I should just give up trying to use the code in question, > this is just for my own free time hacking pleasure anyway, failure > *is* an option... > > --tml > > -- Kis Gergely MattaKis Consulting Email: ger...@ma... Web: http://www.mattakis.com Phone: +36 70 408 1723 Fax: +36 27 998 622 |
From: Tor L. <tm...@ik...> - 2010-03-06 09:14:46
|
> I think that it is possible to use parts of Harmony, where it does not use > native calls. Well, native calls as such are not a problem, as I showed, with a small patch to the xsl file they translate nicely to calls to external C (or Objective-C) functions. So native calls actually can make it less tedious to implement some class for Java->ObjC, as parts of it can be kept in Java, and just a minimal part needs to be in C/ObjC. > And it is still not clear how well the cross-compiled code will perform, > or it will be too slow for any serious use. True. My initial impression from looking at the Fireworks demo was very positive, it is speedy enough, but of course that is just a demo written specifically for xmlvm, isn't it? --tml |
From: Sascha H. <sa...@xm...> - 2010-03-06 10:43:35
|
Hi Tor, as Wolfgang said, the fireworks demo has no XMLVM specific optimizations. It's actually quite the opposite: We use this demo to check the performance of XMLVM and show that XMLVM is fast enough for applications like this. // Sascha On Sat, Mar 6, 2010 at 10:14 AM, Tor Lillqvist <tm...@ik...> wrote: > > I think that it is possible to use parts of Harmony, where it does not > use > > native calls. > > Well, native calls as such are not a problem, as I showed, with a > small patch to the xsl file they translate nicely to calls to external > C (or Objective-C) functions. So native calls actually can make it > less tedious to implement some class for Java->ObjC, as parts of it > can be kept in Java, and just a minimal part needs to be in C/ObjC. > > > And it is still not clear how well the cross-compiled code will perform, > > or it will be too slow for any serious use. > > True. My initial impression from looking at the Fireworks demo was > very positive, it is speedy enough, but of course that is just a demo > written specifically for xmlvm, isn't it? > > --tml > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > xmlvm-users mailing list > xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlvm-users > |
From: Tor L. <tm...@ik...> - 2010-03-06 19:11:04
|
> I believe a patch like this will be very useful. Have you submitted such a patch? It was inline my follow-up to Gergely's mail, not as a formal patch at the xmlvm-reviews site, sorry. http://sourceforge.net/mailarchive/message.php?msg_name=c9b6d9a51002281327x7e469266s57fc777351f3105b%40mail.gmail.com > My idea was that you define an Objective-C category in > order to implement the native method on the Objective-C side (thereby > 'overlaying' the error handler). OK, that is probably a better and more elegant idea as it enables you to leave native methods unimplemented until you actually are sure they will be needed, doesn't it? --tml |