Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 96276 invoked from network); 4 Mar 2008 08:15:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Mar 2008 08:15:00 -0000 Received: (qmail 49294 invoked by uid 500); 4 Mar 2008 08:14:54 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 49263 invoked by uid 500); 4 Mar 2008 08:14:54 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 49254 invoked by uid 99); 4 Mar 2008 08:14:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Mar 2008 00:14:54 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of simon.harmony@gmail.com designates 209.85.146.177 as permitted sender) Received: from [209.85.146.177] (HELO wa-out-1112.google.com) (209.85.146.177) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Mar 2008 08:14:19 +0000 Received: by wa-out-1112.google.com with SMTP id k22so736728waf.18 for ; Tue, 04 Mar 2008 00:14:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=Z3qAwqdaC8x5nmzEwM43EvbHhJUawvG504gx2vBQeRo=; b=ETRqaEMREJ0jEGMz0xKPky3nQwj9R0Leq+vNb+4lcVNNusqWkkBz5A1iae/6Iq1U6l/kbzNVgzxH3tQh/sjabQAzWJA8xUkpciVkrkwsQIKXUNUuepIaOC7EZhJjTHRDQmYK00kfvVd1IYr5JI+23EoReMvkYU8obwoacPSaABc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=STdx7/SOG6uzM1apuA1dk09VeHtnPh2R9DWfMIRXunRRotacDyfidZB/KqnjnptP8etEQj+h+gLI5tFhBKaCCuxOwyCuvLtD46a2wO+P6o2H2Gsbc+PNhKaHR+RPi6BDQeoeh1MtHFfa1ZElmSlhHN2gGFgMdz8IjNaipkHK6gE= Received: by 10.114.209.1 with SMTP id h1mr1551583wag.130.1204618469242; Tue, 04 Mar 2008 00:14:29 -0800 (PST) Received: by 10.114.161.10 with HTTP; Tue, 4 Mar 2008 00:14:29 -0800 (PST) Message-ID: <3db9f87f0803040014t3b042044he928d4332a1890d6@mail.gmail.com> Date: Tue, 4 Mar 2008 16:14:29 +0800 From: "Simon Chow" To: dev@harmony.apache.org Subject: Re: [general][jitrino] How does JIT deal with CALL inst when generating native code? In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3917_15003075.1204618469208" References: <3db9f87f0803032210w1dac59a2o3374e65e67599b19@mail.gmail.com> <3db9f87f0803032244sc227e5fj1cbf9ec471a08f02@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_3917_15003075.1204618469208 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Pavel, Thank you for the explanation. So the compilation unit in JIT is always a single method, is that true? And what is the compilation result of "calling B()", is it a native instruction or a stub? On 04/03/2008, Pavel Pervov wrote: > > Simon, > > Why recursively? > > First, A() gets compiled and executed, then, as soon as execution runs > to calling B(), B() is compiled and executed. > > The trick is A() is not "called" first time after it gets compiled > (from "compile-me" stub), execution jumps to an entry point of A() > leaving correct return address on the stack. All subsequent calls land > directly into A(). It is achieved through patching "call site" for A() > - the place in JITted code, where A() is called from. > > > Pavel. > > On 3/4/08, Simon Chow wrote: > > Pavel, > > Does this mean that the "compile_me" will be call recursively when > callee's > > callee hasn't been compiled yet. > > > > For instance, > > void A() { > > B(); > > } > > where A and B are both not compiled. > > Does the calling of A() invoke the "compile_me" for both A() and B()? > > > > Thank! > > > > > > On 04/03/2008, Pavel Pervov wrote: > > > > > > Simon, > > > > > > Each time JIT plans to call a method, it does the following: > > > 1) if method is not resolved, JIT inserts a call to resolution stub; > > > 2) if method is available, JIT asks for > > > MethodDesc::getCodeBlockAddress(0) on this method. If method is not > > > compiled yet, VM has generated special "compile_me" for this method on > > > class preparation, and its address will be returned in a call to > > > getCodeBlockAddress. > > > > > > WBR, > > > Pavel. > > > > > > > > > On 3/4/08, Simon Chow wrote: > > > > Att. > > > > If the callee is not compiled, how does JIT prepare the entry > location > > > of > > > > callee? > > > > > > > > -- > > > > From : Simon.Chow@Software School of Fudan University > > > > > > > > > > > > > > > > -- > > > Pavel Pervov, > > > Intel Enterprise Solutions Software Division > > > > > > > > > > > -- > > From : Simon.Chow@Software School of Fudan University > > > > > > -- > > Pavel Pervov, > Intel Enterprise Solutions Software Division > -- >From : Simon.Chow@Software School of Fudan University ------=_Part_3917_15003075.1204618469208--