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
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk