[Newcompiler] Compiling the decompilable

Mathieu Suen mathieusuen at yahoo.fr
Sat Oct 14 14:18:09 UTC 2006


Klaus D. Witzel a écrit :
> On Fri, 13 Oct 2006 16:42:03 +0200, Mathieu Suen wrote:
>> Klaus D. Witzel a écrit :
> ...
>>> By reverting the testcases (from bytecode to source code) I plan to
>>> arrive at a specification which covers "all possible" cases for the
>>> decompiler.
>>>
>>
>> Cool thanks
> 
> Attached is SourceCode2BytecodeTest.st which tests bytecode resulting
> from source code.
> 
> With the new compiler there are two cases red (store followed by pop
> does not combine to popAndStore).

I saw one that is normal #testReturnTopFromBlock
you should do:

testReturnTopFromBlock
	| selector methodNode scanner |
	selector := (methodNode := self compile2methodNode: 'returnTopFromBlock ^[ia]') selector.
	scanner := InstructionStream on: methodNode method.

beceause if you do nothing the compiler optimize it as a "quick self return" so you will not see the
block.



> 
> ...
>>> In order to keep me busy I'd like you to email hints on where I should
>>> look for macro transforms (macros as in the terminology of the old
>>> compiler, see MessageNode>>#initialize). I will also write bytecode
>>> assertion tests for the transforms.
>>
>> you mean MessageNode class>>#initialize.
> 
> Sure, thanks (oops :)
> 
>>
>> All is done in the visitor see in Semantics category
> 
> Ah, ASTTranslator of RBProgramNodeVisitor, method #acceptMessageNode:,
> thank you.
> 
> Next is bytecode generated from #emitIfNode: ... #emitCaseNode:
> (formerly macros), then SourceCode2BytecodeTest is about to be complete.

Ok cool

> 
>>>
>>> I'm furthermore interested in suggestions for a shortcut for the
>>> following sequence. The shortcut *must* be compatible with the old and
>>> the new compiler and what I want is that the whole implicit & seemingly
>>> inevitable message organization stuff be eliminated.
>>>
>>>  selector := self class compile:classified: nil withStamp: nil
>>> notifying: nil logSource: false.
>>>  method := self class compiledMethodAt: selector.
>>>  self class removeSelectorSilently: selector.
> 
> Note that SourceCode2BytecodeTest now does ClosureCompiler only, but
> message organization stuff is no longer called.
> 
>>> Thank you in advance, also for any comments/suggestions on my approach.
> 
> /Klaus


	

	
		
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Demandez à ceux qui savent sur Yahoo! Questions/Réponses
http://fr.answers.yahoo.com


More information about the Newcompiler mailing list