Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 45898 invoked from network); 15 May 2007 07:26:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 May 2007 07:26:12 -0000 Received: (qmail 15866 invoked by uid 500); 15 May 2007 07:26:17 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 15832 invoked by uid 500); 15 May 2007 07:26:17 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 15823 invoked by uid 99); 15 May 2007 07:26:17 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 May 2007 00:26:17 -0700 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 msatoor@gmail.com designates 209.85.132.240 as permitted sender) Received: from [209.85.132.240] (HELO an-out-0708.google.com) (209.85.132.240) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 May 2007 00:26:10 -0700 Received: by an-out-0708.google.com with SMTP id d40so569071and for ; Tue, 15 May 2007 00:25:49 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=Mb+xLDR6zkM88gE8OQu1q3uoXEouh30jUrkCCaKFIRLcY6Ho/sph5lpZazCPHCN0kCNEhiALuHo3KDdiSEdVLDvs2exATeJ9m/xEI+2WTNPaLk6EC3AA3CkTaKv8hYwU+06iGVfzu30PaiBUpzS1kPjkgCGGg9WgSH1fcOWkuK4= 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=ZHsFdDRGi2XF6j6SSsZS/AwLlnWxa+FkmLoLVzFYUwOp412YmueXLaMiEXP6st7N2mevoyMwiWEyWWdVgDVj7Dh5zz8Sp7nZk/Orz79QZdRNDwOLoaMiYH0SRJkBXfJMy2omC5Elob9g0mvjkQx7u0z+a1xzdXJHXzNwdUro5lw= Received: by 10.100.93.5 with SMTP id q5mr5145890anb.1179213949764; Tue, 15 May 2007 00:25:49 -0700 (PDT) Received: by 10.100.5.12 with HTTP; Tue, 15 May 2007 00:25:49 -0700 (PDT) Message-ID: Date: Tue, 15 May 2007 00:25:49 -0700 From: "Mamta Satoor" To: derby-dev@db.apache.org Subject: Re: DERBY-1478 subtask DERBY-2583 - need help in debugging stack trace thrown during code generation In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_20958_3578845.1179213949621" References: <4648DC54.2080000@apache.org> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_20958_3578845.1179213949621 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I forgot to mention that another reason for including a pushDataValueFactory in BaseTypeCompiler is ExpressionClassBuilder class is protected and hence it is not visible outside of impl.sql.compile package and base of CharTypeCompiler, CLOBTypeCompiler which is TypeCompiler is defined in iapi.sql.compile package and hence it can't see ExpressionClassBuilder with it's current protected definition. TypeCompiler needs access to ExpressionClassBuilder if we want to pass ExpressionClassBuilder as parameter to generateDataValue and generateNull so that they can utilize pushDataValueFactory defined on ExpressionClassBuilder. I remember changing the definition of ExpressionClassBuilder to public. I can spend more time on more/exact details to explain why I defined pushDataValueFactory in BaseTypeCompiler. Mamta On 5/14/07, Mamta Satoor wrote: > > Dan, you are ofcourse right about problem being BaseTypeCompiler holding > onto a reference to a declared method beyond one generated class. Once I > removed caching of that reference, I don't get the stack trace for my simple > test case anymore. Thank you. > > As for why I added the pushDataValueFactory() to BaseTypeCompiler, let me > try to dig my memory. ExpressionClassBuilder is not passed to generateNull > and generateDataValue. In my local codeline, I had made changes so that > ExpressionClassBuilder gets passed to these 2 methods. (This had required > quite a few changes for different callers to now pass > ExpressionClassBuilder). But the main problem had something to do with > getBaseClassName() in ExpressionClassBuilder.pushDataValueFactory at line > 639 not returning the correct value. I wish I could recall exactly why > I decided to create a new method rather than use what is in > ExpressionClassBuilder. I can try to backtrace my steps to find out the > exact reason if you would like. > > Mamta > > > On 5/14/07, Daniel John Debrunner wrote: > > > > Mamta Satoor wrote: > > > Hi, > > > > > > I checked in code on April 24th revision 532082 for DERBY-2583 "At > > code > > > generation time, look at collation type to determine what kind of DVD > > > should get generated for character types." > > > > > > The intention of the commit was to generate following > > > StringDataValueObject.getValue (DataValueFactory.getCharacterCollator > > (collationType)); > > > > > > > > > This code generation change went in > > > BaseTypeCompiler.generateCollationSensitiveDataValue and it looked as > > > follows > > > protected void generateCollationSensitiveDataValue(MethodBuilder mb, > > > int collationType, String className){ > > > if (collationType == StringDataValue.COLLATION_TYPE_UCS_BASIC) > > > return; > > > //In case of character DVDs, for territory based collation, we need > > to > > > //generate DVDs with territory based RuleBasedCollator and hence we > > > //need to generate CollatorSQLChar/CollatorSQLVarchar/ > > > //CollatorSQLLongvarchar/CollatorSQLClob > > > pushDataValueFactory(mb, className); > > > > > > > Looking at stack trace, it looks like something is wrong in maybe my > > > code generation changes and wondered if someone familiar with code > > > generation can tell me what I am doing wrong. I will keep debugging > > but > > > any help will be greatly appreciated. > > > > The issue may be to do with the method you added to BaseTypeCompiler > > > > private void pushDataValueFactory(MethodBuilder mb, String className) > > > > ExpressionClassBuilder already has a pushDataValueFactory(), was there a > > > > need to create another one? > > > > The problem may be that ExpressionClassBuilder's lifetime is a single > > class generation, thus it's fine for its pushDataValueFactory to hold a > > reference to a declared method from MethodBuilder.describeMethod(). But > > the lifetime of the BaseTypeCompiler objects may be longer, thus it may > > be trying to use a reference to one method in one generated class in > > another generated class. > > > > Dan. > > > > > ------=_Part_20958_3578845.1179213949621 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
I forgot to mention that another reason for including a pushDataValueFactory in BaseTypeCompiler is ExpressionClassBuilder class is protected and hence it is not visible outside of impl.sql.compile package and base of CharTypeCompiler, CLOBTypeCompiler which is TypeCompiler is defined in iapi.sql.compile package and hence it can't see ExpressionClassBuilder with it's current protected definition. TypeCompiler needs access to ExpressionClassBuilder  if we want to pass ExpressionClassBuilder as parameter to generateDataValue and generateNull so that they can utilize pushDataValueFactory defined on ExpressionClassBuilder. I remember changing the definition of ExpressionClassBuilder to public. I can spend more time on more/exact details to explain why I defined pushDataValueFactory in BaseTypeCompiler.
 
Mamta

 
On 5/14/07, Mamta Satoor <msatoor@gmail.com> wrote:
Dan, you are ofcourse right about problem being BaseTypeCompiler holding onto a reference to a declared method beyond one generated class. Once I removed caching of that reference, I don't get the stack trace for my simple test case anymore. Thank you.
 
As for why I added the pushDataValueFactory() to BaseTypeCompiler, let me try to dig my memory. ExpressionClassBuilder is not passed to generateNull and generateDataValue. In my local codeline, I had made changes so that ExpressionClassBuilder gets passed to these 2 methods. (This had required quite a few changes for different callers to now pass ExpressionClassBuilder). But the main problem had something to do with getBaseClassName() in ExpressionClassBuilder.pushDataValueFactory at line 639 not returning the correct value. I wish I could recall exactly why I decided to create a new method rather than use what is in ExpressionClassBuilder. I can try to backtrace my steps to find out the exact reason if you would like. 
 
Mamta

 
On 5/14/07, Daniel John Debrunner <djd@apache.org > wrote:
Mamta Satoor wrote:
> Hi,
>
> I checked in code on April 24th revision 532082 for DERBY-2583 "At code
> generation time, look at collation type to determine what kind of DVD
> should get generated for character types."
>
> The intention of the commit was to generate following
> StringDataValueObject.getValue (DataValueFactory.getCharacterCollator(collationType));
>
>
> This code generation change went in
> BaseTypeCompiler.generateCollationSensitiveDataValue and it looked as
> follows
>  protected void generateCollationSensitiveDataValue(MethodBuilder mb,
>    int collationType, String className){
>   if (collationType == StringDataValue.COLLATION_TYPE_UCS_BASIC)
>    return;
>   //In case of character DVDs, for territory based collation, we need to
>   //generate DVDs with territory based RuleBasedCollator and hence we
>   //need to generate CollatorSQLChar/CollatorSQLVarchar/
>   //CollatorSQLLongvarchar/CollatorSQLClob
>   pushDataValueFactory(mb, className);


> Looking at stack trace, it looks like something is wrong in maybe my
> code generation changes and wondered if someone familiar with code
> generation can tell me what I am doing wrong. I will keep debugging but
> any help will be greatly appreciated.

The issue may be to do with the method you added to BaseTypeCompiler

private void pushDataValueFactory(MethodBuilder mb, String className)

ExpressionClassBuilder already has a pushDataValueFactory(), was there a
need to create another one?

The problem may be that ExpressionClassBuilder's lifetime is a single
class generation, thus it's fine for its pushDataValueFactory to hold a
reference to a declared method from MethodBuilder.describeMethod(). But
the lifetime of the BaseTypeCompiler objects may be longer, thus it may
be trying to use a reference to one method in one generated class in
another generated class.

Dan.



------=_Part_20958_3578845.1179213949621--