jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • groovy
  • GROOVY-3330

Stub compilation causes harmful AST changes

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Critical Critical
  • Resolution: Unresolved
  • Affects Version/s: 1.6-rc-2
  • Fix Version/s: 1.7.x
  • Component/s: Compiler
  • Labels:
    None

Description

JavaStubGenerator causes verification to occur in phase conversion instead of phase class generation. Unfortunately, verification modifies the AST and even drops some information (e.g. labels on implicit returns), leading to troubles for transforms down the line. (In order to write correct transforms, one has to have knowledge about which AST modifications have (not yet) occurred.)

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
blackdrag blackdrag added a comment - 02/Feb/09 7:47 AM

labels on implicit returns? I guess you mean that returns are added. As they don't exist before, they can't have a label. Of course if the last statement is labeled, then the return needs to get that label.

Show
blackdrag blackdrag added a comment - 02/Feb/09 7:47 AM labels on implicit returns? I guess you mean that returns are added. As they don't exist before, they can't have a label. Of course if the last statement is labeled, then the return needs to get that label.
Hide
Permalink
blackdrag blackdrag added a comment - 02/Feb/09 7:48 AM

I think switching the addition of implicit returns off is a good idea

Show
blackdrag blackdrag added a comment - 02/Feb/09 7:48 AM I think switching the addition of implicit returns off is a good idea
Hide
Permalink
Peter Niederwieser added a comment - 02/Feb/09 9:00 AM

I mean that Verifier doesn't copy the label when it inserts an implicit return. This might not be a problem if Verifier runs in phase class generation, but it is a problem (at least for my transforms) if Verifier runs in phase conversion.

Show
Peter Niederwieser added a comment - 02/Feb/09 9:00 AM I mean that Verifier doesn't copy the label when it inserts an implicit return. This might not be a problem if Verifier runs in phase class generation, but it is a problem (at least for my transforms) if Verifier runs in phase conversion.
Hide
Permalink
Peter Niederwieser added a comment - 02/Feb/09 9:02 AM

Yes, it would be a good idea to switch off everything that modifies the AST.

Show
Peter Niederwieser added a comment - 02/Feb/09 9:02 AM Yes, it would be a good idea to switch off everything that modifies the AST.
Hide
Permalink
blackdrag blackdrag added a comment - 02/Feb/09 9:16 AM

it does not copy the label... hmm.. that is possibly a bug... As for not modifying the AST, that is a bit difficult. You see if the AST is not modified, then Verifier would not have to be run. What verifier needs to do is adding the methods for GroovyObject, adding methods for properties and such stuff. Normally it would also add covariants, but that is disabled.

But maybe it is time to split out the things we want verifier do for stubs into another class and then call that one from Verifier and from the stub generator instead.

Show
blackdrag blackdrag added a comment - 02/Feb/09 9:16 AM it does not copy the label... hmm.. that is possibly a bug... As for not modifying the AST, that is a bit difficult. You see if the AST is not modified, then Verifier would not have to be run. What verifier needs to do is adding the methods for GroovyObject, adding methods for properties and such stuff. Normally it would also add covariants, but that is disabled. But maybe it is time to split out the things we want verifier do for stubs into another class and then call that one from Verifier and from the stub generator instead.
Hide
Permalink
Peter Niederwieser added a comment - 29/May/09 6:01 PM

Rev. 16562/63 provides a partial fix - Verifier now retains a label when promoting an ExpressionStatement to an implicit ReturnStatement. However, the general problem that several AST changes (e.g. addition of implicit returns) occur in phase conversion instead of class generation if joint compilation is on, remains unsolved. This can make it difficult to write reliable AST transformations.

Show
Peter Niederwieser added a comment - 29/May/09 6:01 PM Rev. 16562/63 provides a partial fix - Verifier now retains a label when promoting an ExpressionStatement to an implicit ReturnStatement. However, the general problem that several AST changes (e.g. addition of implicit returns) occur in phase conversion instead of class generation if joint compilation is on, remains unsolved. This can make it difficult to write reliable AST transformations.
Hide
Permalink
Peter Niederwieser added a comment - 30/May/09 10:51 AM

Rev. 16587/88 provides another partial fix - implicit returns are no longer added during stub generation in phase conversion, but always in phase class generation. Several other AST modifications are still done during stub generation although they wouldn't have to be done at such an early stage.

Show
Peter Niederwieser added a comment - 30/May/09 10:51 AM Rev. 16587/88 provides another partial fix - implicit returns are no longer added during stub generation in phase conversion, but always in phase class generation. Several other AST modifications are still done during stub generation although they wouldn't have to be done at such an early stage.

People

  • Assignee:
    Unassigned
    Reporter:
    Peter Niederwieser
Vote (0)
Watch (1)

Dates

  • Created:
    01/Feb/09 8:09 PM
    Updated:
    31/Jul/09 12:10 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.