Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 37542 invoked from network); 30 Nov 2007 12:10:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Nov 2007 12:10:12 -0000 Received: (qmail 90380 invoked by uid 500); 30 Nov 2007 12:09:55 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 90358 invoked by uid 500); 30 Nov 2007 12:09:55 -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 90241 invoked by uid 99); 30 Nov 2007 12:09:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2007 04:09: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.198.191 as permitted sender) Received: from [209.85.198.191] (HELO rv-out-0910.google.com) (209.85.198.191) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2007 12:09:35 +0000 Received: by rv-out-0910.google.com with SMTP id k20so2031318rvb for ; Fri, 30 Nov 2007 04:09:37 -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=s+gNd/LRBpN/aKhemoWv74PhBNpY45vHl0FPRgouB6U=; b=KLjpiIxRCLNi329R7hz3dmzyA+sM+XhhI+UCHzMVE+o3DSppLRz7WSG48kZNB3KxALYVMynZ7b0ogH5WxkLA0QllDckw5pIStyWS1QpfajHw/Z9nfGM2DnO78YgaaqzVMPoa11mokv160T1BMMflSRIZ5usp1ivPIXO5dBDXMz4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=MnHkTwC5cWSHiX6Hq7eEpuei+y/FVmUDRo4jMaJSMTmkn+LJiCIJatQhqYZJ4wTf+yDZqN7Ux+JdZO6DU5MNsgVK8yFwTz6YiC4xcwRhIk9sOfl+7zO35L6NtFMbaSTFiFrQQMqRc+cmc4azW4AhxpBaAqNj+5edKD04WmQSZFg= Received: by 10.140.125.21 with SMTP id x21mr1026080rvc.1196424577764; Fri, 30 Nov 2007 04:09:37 -0800 (PST) Received: by 10.141.201.16 with HTTP; Fri, 30 Nov 2007 04:09:37 -0800 (PST) Message-ID: <3db9f87f0711300409o7c760c53r7f1b5a5ec66ba8e8@mail.gmail.com> Date: Fri, 30 Nov 2007 20:09:37 +0800 From: "Simon Chow" To: dev@harmony.apache.org Subject: Re: [drlvm][gc] initialization of global var: tm_self_tls In-Reply-To: <0vqprxs2gkl.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_334_14215976.1196424577768" References: <3db9f87f0711292321y4217b4dbh38865c41d5a4f717@mail.gmail.com> <0vqprxs2gkl.fsf@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_334_14215976.1196424577768 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks for that, I considered it as a global variable as well but when I step into hy_inline hythread_t VMCALL hythread_self() { return tm_self_tls; } I found this gc_get_tls () at /home/zhouxun/workspace/Harmony/trunk/working_vm/vm/gc_gen/src/thread/gc_thread.h:35 35 void* tls_base = vm_thread_local(); (gdb) s vm_thread_local () at /home/zhouxun/workspace/Harmony/trunk/working_vm/vm/gc_gen/src/thread/../common/gc_platform.h:107 107 { return hythread_self(); } (gdb) s hythread_self () at /home/zhouxun/workspace/Harmony/trunk/working_vm/vm/include/open/hythread.h:515 515 return tm_self_tls; (gdb) display /i $pc // I do not know where the asm codes below come from 1: x/i $pc 0xb679a513 : lea 0xffffff80(,%ebx,1),%eax (gdb) si 0xb679a51a 515 return tm_self_tls; 1: x/i $pc 0xb679a51a : call 0xb677985c <___tls_get_addr@plt> (gdb) 0xb677985c in ___tls_get_addr@plt () from /home/zhouxun/workspace/Harmony/trunk/working_vm/build/deploy/jdk/jre/bin/default/libgc_gen.so 1: x/i $pc 0xb677985c <___tls_get_addr@plt>: jmp *0xb0(%ebx) (gdb) 0xb7fb1e50 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e50 <___tls_get_addr>: push %ebp (gdb) 0xb7fb1e51 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e51 <___tls_get_addr+1>: mov %esp,%ebp (gdb) 0xb7fb1e53 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e53 <___tls_get_addr+3>: sub $0x28,%esp (gdb) 0xb7fb1e56 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e56 <___tls_get_addr+6>: mov %ebx,0xfffffff4(%ebp) (gdb) 0xb7fb1e59 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e59 <___tls_get_addr+9>: mov %esi,0xfffffff8(%ebp) (gdb) 0xb7fb1e5c in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e5c <___tls_get_addr+12>: mov %edi,0xfffffffc(%ebp) (gdb) 0xb7fb1e5f in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e5f <___tls_get_addr+15>: call 0xb7fb6cfb (gdb) 0xb7fb6cfb in ?? () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb6cfb : mov (%esp),%ebx (gdb) 0xb7fb6cfe in ?? () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb6cfe : ret (gdb) 0xb7fb1e64 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e64 <___tls_get_addr+20>: add $0xa190,%ebx (gdb) 0xb7fb1e6a in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e6a <___tls_get_addr+26>: mov %eax,0xffffffe4(%ebp) (gdb) 0xb7fb1e6d in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e6d <___tls_get_addr+29>: mov %gs:0x4,%esi (gdb) 0xb7fb1e74 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e74 <___tls_get_addr+36>: mov (%esi),%eax (gdb) 0xb7fb1e76 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e76 <___tls_get_addr+38>: cmp 0x628(%ebx),%eax (gdb) 0xb7fb1e7c in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e7c <___tls_get_addr+44>: movl $0x0,0xffffffec(%ebp) (gdb) 0xb7fb1e83 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e83 <___tls_get_addr+51>: jne 0xb7fb1eac <___tls_get_addr+92> (gdb) 0xb7fb1e85 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e85 <___tls_get_addr+53>: mov 0xffffffe4(%ebp),%eax (gdb) 0xb7fb1e88 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e88 <___tls_get_addr+56>: mov (%eax),%edx (gdb) 0xb7fb1e8a in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e8a <___tls_get_addr+58>: lea (%esi,%edx,8),%eax (gdb) 0xb7fb1e8d in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e8d <___tls_get_addr+61>: mov %eax,0xffffffe8(%ebp) (gdb) 0xb7fb1e90 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e90 <___tls_get_addr+64>: mov (%eax),%edi (gdb) 0xb7fb1e92 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e92 <___tls_get_addr+66>: cmp $0xffffffff,%edi (gdb) 0xb7fb1e95 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e95 <___tls_get_addr+69>: je 0xb7fb1ebe <___tls_get_addr+110> (gdb) 0xb7fb1e97 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e97 <___tls_get_addr+71>: mov 0xffffffe4(%ebp),%eax (gdb) 0xb7fb1e9a in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e9a <___tls_get_addr+74>: mov 0xfffffff4(%ebp),%ebx (gdb) 0xb7fb1e9d in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1e9d <___tls_get_addr+77>: mov 0xfffffff8(%ebp),%esi (gdb) 0xb7fb1ea0 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1ea0 <___tls_get_addr+80>: add 0x4(%eax),%edi (gdb) 0xb7fb1ea3 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1ea3 <___tls_get_addr+83>: mov %edi,%eax (gdb) 0xb7fb1ea5 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1ea5 <___tls_get_addr+85>: mov 0xfffffffc(%ebp),%edi (gdb) 0xb7fb1ea8 in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1ea8 <___tls_get_addr+88>: mov %ebp,%esp (gdb) 0xb7fb1eaa in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1eaa <___tls_get_addr+90>: pop %ebp (gdb) 0xb7fb1eab in ___tls_get_addr () from /lib/ld-linux.so.2 1: x/i $pc 0xb7fb1eab <___tls_get_addr+91>: ret //until here, the function hythread_self() in vm/include/open/hythread.h finishes (gdb) 0xb679a51f in hythread_self () at /home/zhouxun/workspace/Harmony/trunk/working_vm/vm/include/open/hythread.h:515 515 return tm_self_tls; 1: x/i $pc 0xb679a51f : mov (%eax),%eax (gdb) On 30 Nov 2007 13:06:18 +0300, Egor Pasko wrote: > > On the 0x39E day of Apache Harmony Simon Chow wrote: > > I am studying Harmony DRLVM code as a beginner. > > When I was debugging the gc module, > > This method: > > hy_inline hythread_t VMCALL hythread_self() { > > return tm_self_tls; > > } > > in hythread.h:515 is called frequenctly > > > > But I am not sure whether tm_self_tls is a global var or a macro defined > in > > other file. > > I see only one file, where tm_self_tls is defined -- > vm/include/open/hythread.h And it is defined to be a variable that > resides in Thread Local Storage. AFAIR, it stores a pointer to a > structure HyThread_public that stores thread state. > > > I tried to use "si" of gdb before this method returned, but it seem go > to > > some asm code without source information. > > > > I am confused here. > > > > -- > > From : Simon.Chow@Software School of Fudan University > > -- > Egor Pasko > > -- >From : Simon.Chow@Software School of Fudan University ------=_Part_334_14215976.1196424577768--