From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id E960BBDE9 for ; Thu, 1 Sep 2005 10:07:47 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j8187lLB005497 for ; Thu, 1 Sep 2005 10:07:47 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA18200 for ; Thu, 1 Sep 2005 10:07:46 +0200 (MET DST) Received: from justus.rz.uni-saarland.de (justus.rz.uni-saarland.de [134.96.7.31]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j8187kri005494 for ; Thu, 1 Sep 2005 10:07:46 +0200 Received: from uni-sb.de (uni-sb.de [134.96.7.230]) by justus.rz.uni-saarland.de (8.12.10/8.12.10) with ESMTP id j8187jQp10166084 for ; Thu, 1 Sep 2005 10:07:45 +0200 (CEST) Received: from cs.uni-sb.de (cs.uni-sb.de [134.96.252.31]) by uni-sb.de (8.13.4/2005060800) with ESMTP id j8187fHM008167; Thu, 1 Sep 2005 10:07:41 +0200 (CEST) Received: from mail.cs.uni-sb.de (mail.cs.uni-sb.de [134.96.254.200]) by cs.uni-sb.de (8.13.4/2005033000) with ESMTP id j8187eJe015129; Thu, 1 Sep 2005 10:07:40 +0200 (CEST) Received: from mail.st.cs.uni-sb.de (goscinny.cs.uni-sb.de [134.96.235.32]) by mail.cs.uni-sb.de (8.13.4/2005060800) with ESMTP id j8187eYx003596; Thu, 1 Sep 2005 10:07:40 +0200 (CEST) X-Authentication-Warning: mail.cs.uni-sb.de: Host goscinny.cs.uni-sb.de [134.96.235.32] claimed to be mail.st.cs.uni-sb.de Received: from [134.96.235.101] (jonagold.cs.uni-sb.de [134.96.235.101]) by mail.st.cs.uni-sb.de (Postfix) with ESMTP id CD7B01BE1F; Thu, 1 Sep 2005 10:07:39 +0200 (CEST) In-Reply-To: <20050830111624.GC5470@three-tuns.net> References: <34f22df101c14e15560de909ace48d3a@cs.uni-sb.de> <20050826113400.GB5470@three-tuns.net> <6a0d230d1d1dd537d5c33ff693437c84@cs.uni-sb.de> <20050830111624.GC5470@three-tuns.net> Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <28b5733129446c3d12d090f5f66c1e3e@cs.uni-sb.de> Content-Transfer-Encoding: 7bit Cc: Caml List From: Christian Lindig Subject: Re: [Caml-list] how to enlarge header of blocks? Date: Thu, 1 Sep 2005 10:07:37 +0200 To: Mark Shinwell X-Mailer: Apple Mail (2.622) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.5.1 (justus.rz.uni-saarland.de [134.96.7.31]); Thu, 01 Sep 2005 10:07:45 +0200 (CEST) X-AntiVirus: checked by AntiVir Milter 1.0.6; AVE 6.31.1.0; VDF 6.31.1.204 X-Miltered: at concorde with ID 4316B6D3.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4316B6D2.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lindig:01 lindig:01 caml-list:01 shinwell:01 interfacing:01 bytecode:01 runtime:01 ocaml:01 camlprim:01 val:01 wosize:01 val:01 arrays:01 2005,:98 ...:98 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Aug 30, 2005, at 1:16 PM, Mark Shinwell wrote: > If the extra field obeys the GC structure constraints (see the Caml > documentation on interfacing to C) then you shouldn't have any > problem... Maybe we have different things in mind, so I'll elaborate my idea briefly and why it was too simple: I changed the allocation routine in the bytecode runtime to allocate one extra word where I intended to store some information as an Ocaml value. However, I overlooked that Array.length and String.length use the block size denoted by the header to determine the length. Hence, code looping over an array or string would run into my value - and crash. For example, here is the code for Array.get: CAMLprim value caml_array_get_addr(value array, value index) { long idx = Long_val(index); if (idx < 0 || idx >= Wosize_val(array)) caml_array_bound_error(); return Field(array, idx); } To make this work I either must refrain from tucking an extra word to strings and arrays or change the implementations for the length functions and code that checks array and string bounds. -- Christian