From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105062 invoked by alias); 1 Jan 2019 11:01:16 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 104969 invoked by uid 89); 1 Jan 2019 11:01:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-HELO:sk:mail-pf, collection, HX-Received:Tue, HX-Received:2019 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mail-pf1-f182.google.com Received: from mail-pf1-f182.google.com (HELO mail-pf1-f182.google.com) (209.85.210.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 01 Jan 2019 11:01:11 +0000 Received: by mail-pf1-f182.google.com with SMTP id c73so14011167pfe.13 for ; Tue, 01 Jan 2019 03:01:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=wrkyLkKEwf3MQ1O52tmBuwe8hujPdM/0D+OQe2xcGzY=; b=Sb72U5IhPPd6POez0RXxwINHh4/0ztmPml0zlaizoAVNvcHWQMRZfN3hbp5kPcYl5d r2uyShiDclDumMRpn4wAKh3m98A72TE/5xlGOP5fug+iZ/tH/qmhPi05JUnhKkQbZpPM o2dmR6JbizuHFVRqyuHJ8qU7+Hqi/tMGD9Wx3iJM2s8uIUFZwdGkNIC8ZZHV++1lasIe wUJ2kVVEvBRRRnVK/rdCZgUlqcYyHPjb3SnmscgiVVZBVoY4ceq3gBFvomZ9kidT9ClE NqK/stAAY3gNZbqqxyEhNXHQfmtgZ9JXvpjJ8XEFTO6qg5WuHuTwbRY/ejanEaVDG0Qd rIYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=wrkyLkKEwf3MQ1O52tmBuwe8hujPdM/0D+OQe2xcGzY=; b=qg84uChIDamNsb3iyt6pCV4aJUXUhj5Q1oRWgcg1hjKIy7yNYBcDTp0/h0opsH6jpI trqj7mWSxQBO/BV+aOkwNuQ9Veb+0xoEAnHE3T5Oxsduji/TaYpzKsldfAdnRwkdxLi3 gnpdw/rva3Zdygj1+uj2XTwmAWz1lIok/nt8bZRcGt3pct0xC3OQA8B6EscskaGKzcaO ilXfGRigbcC6EsZaHSytQXUDVOXnm3PPXqsvZuwiEs9zKjIMB7v5fwcvpFJ2Gvh2TO2e 6bQQdtXI+BKmV2d/Ma7bjUwK/4LCaDaaQkcDJH9tk0UhyRYJGN0VZSqv6MiLe22bxgjy cJAg== X-Gm-Message-State: AJcUuke/Z2u8+8YD9tnB7T4wjewNmQWAAkaK+lukSbU4Z8X0YZUsIyuH GiKH9n8zFCJgJ3N9Sl1MdfaYwKa3mTcYgW6DIBoRtUk7 X-Google-Smtp-Source: ALg8bN4f2TnsEQa2jQODQ6aY+L/wqwfApB5GNFOBBLpLWcMZpK0iTXVfW7T+oplxnbHguZqZA/x+X2ww2mj7VRCE6Rc= X-Received: by 2002:a63:ff62:: with SMTP id s34mr10297904pgk.325.1546340469746; Tue, 01 Jan 2019 03:01:09 -0800 (PST) MIME-Version: 1.0 From: =?UTF-8?Q?Marc_Nieper=2DWi=C3=9Fkirchen?= Date: Tue, 01 Jan 2019 00:00:00 -0000 Message-ID: Subject: Conversion of pointers to integers and vice versa; pointer tagging To: jit@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-q1/txt/msg00000.txt.bz2 Implementations of languages with garbage collection and dynamic typing often employ the concept of tagged pointers. Unused bits of a pointer representation are used to distinguish between pointers to different types or between pointers and immediate values. Implementing such a language with libgccjit raises a couple of questions: 1) libgccjit has currently only a limited set of type-casting expressions. In particular, there is no type-casting expression between an integer type (e.g. uintptr_t) and a pointer type defined. Are there technical reasons for that or is that just an area where libgccjit still has to be complemented? I guess, a workaround could be to use union types =C3=A0 la union { uintptr_t i; void *p; } everywhere. 2) For pointer tagging, one needs to know which bits in the integer representation of a pointer are unused. Does GCC make the guarantee that on all supported platforms a pointer aligned on a 2^d-byte boundary has its lower d bits zeroed? Is pointer arithmetic compatible with the arithmetic on the underlying integer type? (I know that ISO C does not make these guarantees, but we are talking about a particular implementation here.) 3) One may want to use bit fields when implementing tags. The documentation for libgccjit seems to be silent on bit fields in structures. Is this feature on the TODO list? Thanks! -- Marc P.S.: A Happy New Year to everyone!