From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=AWL,SPF_FAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 81F80BC37 for ; Sun, 3 May 2009 01:15:18 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AokBAA9x/ElQW+UCe2dsb2JhbACWaQEBFiIEtUSCMAmBRAWIKA X-IronPort-AV: E=Sophos;i="4.40,283,1238968800"; d="scan'208";a="39359644" Received: from main.gmane.org (HELO ciao.gmane.org) ([80.91.229.2]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/AES256-SHA; 03 May 2009 01:15:17 +0200 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1M0OQM-0000PI-K8 for caml-list@inria.fr; Sat, 02 May 2009 23:15:14 +0000 Received: from 97-113-251-224.tukw.qwest.net ([97.113.251.224]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 02 May 2009 23:15:14 +0000 Received: from dynasticon by 97-113-251-224.tukw.qwest.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 02 May 2009 23:15:14 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Jeffrey Scofield Subject: OCaml on iPhone (was: arm backend) Date: Sat, 02 May 2009 16:15:00 -0700 Message-ID: References: <170624B9-E8DE-4E94-BAA5-2CAF928CE54B@gmail.com> <49F9E7F7.7060705@glondu.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 97-113-251-224.tukw.qwest.net User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (darwin) Cancel-Lock: sha1:C5YKfcb2KaVbSO5h9T5QY0YS8GA= Sender: news X-Spam: no; 0.00; ocaml:01 ocamlopt:01 gcc:01 gdb:01 globl:01 ocaml:01 model:01 ocamlopt:01 unboxed:01 u-tokyo:01 cocoa:98 cocoa:98 compile:01 functions:01 writes:01 Nathaniel Gray writes: > Ok, I'm glad I left this to people who are familiar with ARM > assembly programming. :-) We've done a lot of assembly programming, but none of us is an ARM expert. We looked at ARM documents and the assembly (.s) files generated by ocamlopt and gcc, and spent some long sessions with gdb. > Awesome, but now I'm confused because the arm.S you included > has lots of .global pseudo-ops. Do you not compile it with > Apple's as? At around line 36, you'll see: #define global globl As I said in private mail, you could call this a hack, but it's a way to avoid making lots of small changes everywhere in the file. > What's your app? We're working on a collection of card games for casual play. > How are you managing the interface between Cocoa and OCaml? This is a big topic. The summary is that we model Cocoa objects as OCaml objects. We have a layer that wraps OCaml objects in smallish ObjC objects for use on the ObjC side, and wraps ObjC objects in smallish OCaml objects for use on the OCaml side. The layer then translates between these representations as required for calls into iPhoneOS and Cocoa Touch from OCaml (asking for iPhone OS services) and into OCaml from iPhoneOS (for event handling). > > We also made a small fix to the ARM code generator > > I am very interested in any and all information needed to get a > correct OCaml port suitable for use in App Store applications. > Please share! OK, I'll gather up our patch and send it to the list. I want to separate out our changes from those of Toshiyuki Maeda [1]. As I said, our patch fixes calls to external C float functions such as floor(), sin(), and so on. There is special handling in ocamlopt to allow them to be unboxed, but the ABI of the existing ARM code generator doesn't match the iPhone ABI. Regards, Jeff Scofield Seattle [1] http://web.yl.is.s.u-tokyo.ac.jp/~tosh/ocaml-on-iphone/