From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by sourceware.org (Postfix) with ESMTPS id CE9A1385841B for ; Sat, 10 Jun 2023 16:26:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE9A1385841B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yb1-xb2e.google.com with SMTP id 3f1490d57ef6-bc492cb6475so371488276.2 for ; Sat, 10 Jun 2023 09:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686414396; x=1689006396; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=TT81p6QXZ8I60yEOuZ775Zb5xsJtlT37v2dsKWUry1Y=; b=lt4st18sj7DFCBmngyH5BSmpM/D9Qbv1HqscopnGplMVVfhVf5FQf8jzWNK60oqtg6 v0B9LMZ+U7dISmgQCc1XuBtMYRnApI+qeOvOAdee5wdyiGU8zFINOV+lL6zmQe8Gl1Fi +HzO0eP+lf2kQy9Xo3EBL2LrPEW7nqG6ZHGmhmqVV1dqtrvY2/5lKYLcjBpwAzFDG439 j5ER4B9M+TotRQ/1nDGMW0sbOMLVpUvcEeKcBkWn4wZE5fUtuTR9d1XjObR5v3JomKaU Y3i+pJZ+pkasQ7nAvyq8Gn/rRWtvDsNeVClBLsb5/WL7uYQzq/jIQKgYbhwwem5FRcaH NdhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686414396; x=1689006396; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TT81p6QXZ8I60yEOuZ775Zb5xsJtlT37v2dsKWUry1Y=; b=Il6PbwohvBBYmX0i/QQHlOtje/oBtcSnRknkQpMI2P5dGbiqz8mj0ThrPu6vNv6/Qv 9d8pFFHCq86K4mnSGMpJuxRQ4oCrrYd6p5GuYF1jAKIeIqyahSff1mULFfp3bZCdSXpp N4zcnSXHhFiBkjAuFTp7Imvd48gh5HE0yz5AFdpkrubtYYaq4BfZBSSce5htyHE5rZVJ lhcGO+SL0lry3atZ4Rwqavn4kwC6AseTMDogI8FUEyFA9qxNnQvEK0DAe4CJ/7pfosBK 0uQpbwOiiQqyGGxyhsw2GlOsi1Xc6Fwzl2q7xoGGd7eVCaFOD7SXgc907ai/u3XxpZI7 lWwA== X-Gm-Message-State: AC+VfDwnqPflwZ50dhiWnQSiRNGhfrdiS6H2g8ixMDHb/yZxdVwFtdP4 K/9EEjtGxHkXnDzDMJX37Bl+LeBRgt6lInXzw8adE1B+qlk= X-Google-Smtp-Source: ACHHUZ5jx/+T/tzqkehcbgBOT08r2+eKE6AO0sH0c7EG8/XwGxZwWazvKDmEZAtnKK1Vd3i3OD/GEPqycIm0q3b2u/k= X-Received: by 2002:a25:6c5:0:b0:bb4:7101:d7ce with SMTP id 188-20020a2506c5000000b00bb47101d7cemr3536009ybg.14.1686414395886; Sat, 10 Jun 2023 09:26:35 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Joshua Saxby Date: Sat, 10 Jun 2023 17:26:23 +0100 Message-ID: Subject: Digging a bit deeper into JIT's compile internals To: jit@gcc.gnu.org Content-Type: multipart/alternative; boundary="00000000000002d22f05fdc8f398" X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --00000000000002d22f05fdc8f398 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable After following files jit-recording.cc and jit-playback.cc, I think I've found out where I need to patch JIT to do what I want it to do. Looks like both compiling to file and memory ultimately rely upon playback::context::compile() to do the bulk of their work and then override a postprocess() method to do additional handling pertaining to their specific task. If I can find a way to cache or store the intermediate result generated by compile(), I should then be able to restructure this to have the follow-up tasks required by both different forms of compilation to be done starting with this intermediate result. Anyone see a problem with my approach? I'm hoping it will be possible to re=C3=BCse compilation results produced by compile() in this way without it causing any conflicts... Regards, *J.S.* *My PGP Public Key Identity* pub 4096R/*B7A947E4* 2016-11-16 [expires: 2025-12-31] Key fingerprint =3D *E2C4 514F F0FA 52D1 896A B1D6 3D42 BFD9 B7A9 47= E4* uid Joshua Saxby uid Joshua Saxby (saxbophone) sub 4096R/0A445946 2016-11-16 [expires: 2025-12-31] On Sat, 10 Jun 2023 at 13:00, wrote: > Send Jit mailing list submissions to > jit@gcc.gnu.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://gcc.gnu.org/mailman/listinfo/jit > or, via email, send a message with subject or body 'help' to > jit-request@gcc.gnu.org > > You can reach the person managing the list at > jit-owner@gcc.gnu.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Jit digest..." > Today's Topics: > > 1. Modifying the jit compiler API? (Joshua Saxby) > > > > ---------- Forwarded message ---------- > From: Joshua Saxby > To: jit@gcc.gnu.org > Cc: > Bcc: > Date: Sat, 10 Jun 2023 00:04:43 +0100 > Subject: Modifying the jit compiler API? > Currently the JIT has two functions allowing you to compile a context > either to memory or to file. > > But what if you want to compile to both? There doesn't seem to be any way > to do this except by calling both functions separately which I believe wi= ll > effectively be two separate compilations... > > Presumably, it should be possible to modify this part of the API to compi= le > to some form of intermediate representation of the work that is common to > both kinds of compilation, and then turn that into code in memory and in > file, respectively. > > Anyone got any pointers for me on where in the code would be the best pla= ce > for me to modify to dupport this? I did take a look in the implementation > code of JIT sone weeks ago and remember seeing lots of complicated stuff > regarding recordings and replays that looked relevant... > > A slighty simpler alteration I am also interested in making is allowing > compile to file to compile to a buffer in memory as well as a file (I > suppose it could be termed "compile to binary"). Maybe I should start with > that... > > --00000000000002d22f05fdc8f398--