Debug information in ST compiler

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Debug information in ST compiler

Gwenaël Casaccio
Hi,

here is the patch that add debug information in the st compiler,
I've added a test case (DebugInformationTests.st) and a debug
information setter in method information. The withNewMethodClass:
method is optimized is the class is the same as the method class.

Cheers,
Gwen


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Add-debug-information-in-STCompiler.patch (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Debug information in ST compiler

Holger Freyther
On Tue, Jun 11, 2013 at 10:57:05AM +0200, Gwenaël Casaccio wrote:

> Debug informations were added in the VM compiler, now they are
> added in the STCompiler with a test case in the file
> DebugInformationTests.st

"now the generation of them is added..."?


>   <category: 'accessing'>
> +        self methodClass == class ifTrue: [ ^ self ].
>   ^self methodClass isNil
>      ifTrue:
>   [self


how often is >>#withNewMetodClass: called? Is this extra code
making a performance difference? Do you have a number?

> +
> +Object subclass: Foo [
> +]

maybe you want to re-use the setUp/tearDown as done in the other
testcase?


> +TestCase subclass: TestDebugInformation [

        setUp [
                self assert: Behavior compilerClass == STInST.STCompiler?

                (or as part of the testcase?)
        ]

> +    testDebugInformation [
> +        <category: 'testing'>
> +
> +        | mth |
> +        Foo compile: 'a_1: i_1 a_2: i_2 [

mth := Foo compile: ...?

> +    | i j k |
> +
> +    ^ [ :a :b :c | | d e f | ]
> +]'.
> +
> +        mth := Foo>>#'a_1:a_2:'.
> +        self assert: (mth arguments = #(#'i_1' #'i_2')).
> +        self assert: (mth temporaries =  #(#'i' #'j' #'k')).
> +        self assert: ((mth blockAt: 1) arguments = #(#'a' #'b' #'c')).
> +        self assert: ((mth blockAt: 1) temporaries =  #(#'d' #'e' #'f')).

nice.


> +
> +
> +    createDebugInformationFor: aCompiledCode from: aNode [
> + <category: 'debug informations'>
> +
> +        debugInfo at: aCompiledCode put: (DebugInformation variables: ((aNode argumentNames collect: [ :each | each asSymbol]),  (aNode body temporaryNames collect: [ :each | each asSymbol])) asArray).


okay.

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Debug information in ST compiler

Gwenaël Casaccio
On 23/06/2013 19:52, Holger Hans Peter Freyther wrote:

> On Tue, Jun 11, 2013 at 10:57:05AM +0200, Gwenaël Casaccio wrote:
>
>> Debug informations were added in the VM compiler, now they are
>> added in the STCompiler with a test case in the file
>> DebugInformationTests.st
> "now the generation of them is added..."?
>
>
>>   <category: 'accessing'>
>> +        self methodClass == class ifTrue: [ ^ self ].
>>   ^self methodClass isNil
>>      ifTrue:
>>   [self
>
> how often is >>#withNewMetodClass: called? Is this extra code
> making a performance difference? Do you have a number?

This is called in STCompiler when it installs the method, the code didn't
work because the compiled method is copied so the debug information
dictionary
couldn't be used to lookup the new compiled method (it stores the
reference of the old
compiled method,  cf the deep copy patch). Here I simply fix it by
avoiding a copy when the
method class are the sames (also I avoid a copy)


>
>> +
>> +Object subclass: Foo [
>> +]
> maybe you want to re-use the setUp/tearDown as done in the other
> testcase?

Yep

>
>
>> +TestCase subclass: TestDebugInformation [
> setUp [
> self assert: Behavior compilerClass == STInST.STCompiler?
>
> (or as part of the testcase?)
> ]

I don't like it, I think it should be a test for the package
installation but not there.

>> +    testDebugInformation [
>> +        <category: 'testing'>
>> +
>> +        | mth |
>> +        Foo compile: 'a_1: i_1 a_2: i_2 [
> mth := Foo compile: ...?

Yes

>> +    | i j k |
>> +
>> +    ^ [ :a :b :c | | d e f | ]
>> +]'.
>> +
>> +        mth := Foo>>#'a_1:a_2:'.
>> +        self assert: (mth arguments = #(#'i_1' #'i_2')).
>> +        self assert: (mth temporaries =  #(#'i' #'j' #'k')).
>> +        self assert: ((mth blockAt: 1) arguments = #(#'a' #'b' #'c')).
>> +        self assert: ((mth blockAt: 1) temporaries =  #(#'d' #'e' #'f')).
> nice.
>
>
>> +
>> +
>> +    createDebugInformationFor: aCompiledCode from: aNode [
>> + <category: 'debug informations'>
>> +
>> +        debugInfo at: aCompiledCode put: (DebugInformation variables: ((aNode argumentNames collect: [ :each | each asSymbol]),  (aNode body temporaryNames collect: [ :each | each asSymbol])) asArray).
>
> okay.

Thanks


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Debug information in ST compiler

Paolo Bonzini-2
In reply to this post by Holger Freyther
Il 23/06/2013 19:52, Holger Hans Peter Freyther ha scritto:
>> > +
>> > +        debugInfo at: aCompiledCode put: (DebugInformation variables: ((aNode argumentNames collect: [ :each | each asSymbol]),  (aNode body temporaryNames collect: [ :each | each asSymbol])) asArray).

Slighly long line. :)

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Debug information in ST compiler

Gwenaël Casaccio
On 27/06/2013 10:13, Paolo Bonzini wrote:
> Il 23/06/2013 19:52, Holger Hans Peter Freyther ha scritto:
>>>> +
>>>> +        debugInfo at: aCompiledCode put: (DebugInformation variables: ((aNode argumentNames collect: [ :each | each asSymbol]),  (aNode body temporaryNames collect: [ :each | each asSymbol])) asArray).
> Slighly long line. :)
>
> Paolo

Here is the last version I don't create a new Foo class instead I create
a behavior
and the line is shorter.

Gwen


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

0001-Debug-informations-were-added-in-the-VM-compiler-now.patch (7K) Download Attachment