Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 15705 invoked from network); 22 Jan 2007 11:31:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Jan 2007 11:31:20 -0000 Received: (qmail 73403 invoked by uid 500); 22 Jan 2007 11:31:25 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 72843 invoked by uid 500); 22 Jan 2007 11:31:23 -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 72834 invoked by uid 99); 22 Jan 2007 11:31:23 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jan 2007 03:31:23 -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 (herse.apache.org: domain of mike.fursov@gmail.com designates 64.233.184.234 as permitted sender) Received: from [64.233.184.234] (HELO wr-out-0506.google.com) (64.233.184.234) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jan 2007 03:31:15 -0800 Received: by wr-out-0506.google.com with SMTP id i21so620502wra for ; Mon, 22 Jan 2007 03:30:54 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=dNDGd6JEhOv7uzBXylWEE6Tgr6bjv4Lcn4I0mrts3/aznloaPbdprenMqd1n1l2uVdhwZSah76ldtfbs6yfp8wr8pVqXVqalvdJSwicBIB3dEiT61DF3T5fBeX0hI4rPmcwV6tnK1mBvd0/p+3qah5u0xVa0IBawRZneRNUDLWo= Received: by 10.82.162.14 with SMTP id k14mr6478665bue.1169465452413; Mon, 22 Jan 2007 03:30:52 -0800 (PST) Received: by 10.78.179.6 with HTTP; Mon, 22 Jan 2007 03:30:52 -0800 (PST) Message-ID: Date: Mon, 22 Jan 2007 17:30:52 +0600 From: "Mikhail Fursov" To: dev@harmony.apache.org Subject: Re: [drlvm][magic] New Magic features proposal. In-Reply-To: <783bf8b0701220250n4cd3b553kd97a07e72a1ecfa6@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_153827_9315932.1169465452070" References: <783bf8b0701220250n4cd3b553kd97a07e72a1ecfa6@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_153827_9315932.1169465452070 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Pavel, I see the direction of your improvement - optimization of JNI calls. The scenario you proposed is (correct me if I'm wrong) 1) We have a native JNI call from JAVA 2) JIT replaces the call with another call -> call to stub written in Java with a help of VMMagic package and passes original native call's method handle as a parameter to the stub. 3) Stub does the following: a) allocates m2n (stack area in JIT terms) b) asks JIT to store registers c) asks JIT to make call native method without JNI stub d) checks if exception had happened in native code and rethrows it. The M2N: struct M2nFrame { M2nFrame* prev_m2nf; M2nFrame** p_lm2nf; ObjectHandles* local_object_handles; Method_Handle method; frame_type current_frame_type; // type of the current frame also shows is the frame unwindable Registers* pop_regs; // This is only for M2nFrames for suspended managed code (as against ones that call stubs and prepare jvmtiPopFrame) uint32 edi; uint32 esi; uint32 ebx; uint32 ebp; uint32 eip; Registers* regs; // This is only for M2nFrames for suspended managed code (as against ones that call stubs and prepare jvmtiPopFrame) }; Problems: P1) GC in native code -> we need to iterate stack. In this case VM restores registers from M2N frame. So JIT must store registers using the same layout as VM restores them. This is a new contract between VM and JIT. Do you have any proposals how to implement this contract and do not pass any knowledge about VM internals to JIT? P2) M2N frames are linked into a list. Is it right that helper's code is responsible to support the list? P3) What JIT must save to EIP register? P4) How to protect native call's args if GC happens in native code? -- Mikhail Fursov ------=_Part_153827_9315932.1169465452070--