Bug 33183 - Ajc generates unreachable code, as reported by gcj
Summary: Ajc generates unreachable code, as reported by gcj
Status: RESOLVED WORKSFORME
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-25 19:50 EST by Ravi Pratap CLA
Modified: 2003-03-06 14:21 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ravi Pratap CLA 2003-02-25 19:50:04 EST
When I try to compile code which has been touched by AspectJ, either through
pre-process or actual compilation by AspectJ itself, I see unreachable code
being generated. 

This complaining about unreachable code comes from gcj and is :

    edu/wustl/doc/facet/EventComm/_PushConsumerStub.java: In method
`edu.wustl.doc.facet.EventComm._PushConsumerStub.push(edu.wustl.doc.facet.EventComm.Event)':
    edu/wustl/doc/facet/EventComm/_PushConsumerStub.java:46: bad pc in
exception_table

   when AJC is used in pre-process mode. The code in question is :

public void push(Event param0) {
    while (true){
      if (!this._is_local()) {
        org.omg.CORBA.portable.InputStream _is = null;
        try {
          org.omg.CORBA.portable.OutputStream _os = this._request("push", true);
          EventHelper.write(_os, param0);
          _is = this._invoke(_os);
          return;
        } catch (org.omg.CORBA.portable.RemarshalException _rx) {
        } catch (org.omg.CORBA.portable.ApplicationException _ax) {
          String _id = _ax.getId();
          throw new RuntimeException("Unexpected exception " + _id);
        } finally {
          this._releaseReply(_is);
        }
      } else {
        org.omg.CORBA.portable.ServantObject _so = this._servant_preinvoke("push",
            _PushConsumerStub._opsClass);
        if (_so == null) throw new org.omg.CORBA.UNKNOWN("local invocations not
supported!");        PushConsumerOperations _localServant =
(PushConsumerOperations)_so.servant;
        try {
          _localServant.push(param0);
        } finally {
          this._servant_postinvoke(_so);
        }
        return;
      }
    }
  }


  When AspectJ is asked to directly generate the code, gcj complains of
unreachable bytecodes. An analysis of the .class file reveals that the same
problem manifests itself.


 Please let me know if you need any more information.
Comment 1 Jim Hugunin CLA 2003-02-26 13:34:28 EST
What version of the compiler are you using?  It sounds like you're using the 
1.0.6 release of ajc -- which has a -preprocess mode.

Please try the latest 1.1beta4 release to see if you still have this problem.  
There are currently no resources to support the 1.0.6 release of ajc, but the 
source code is available if you want to look into the problem further.

BTW - This also sounds like a bug in gcj to me.  The JVM spec doesn't prohibit 
unreachable bytecodes so any tool designed to operate on bytecode needs to be 
able to handle that gracefully.
Comment 2 Jim Hugunin CLA 2003-03-06 14:21:36 EST
Based on a lack of feedback from the submitter, I'm classifying this as a bug 
in 1.0.6 and not in the 1.1 branch.  This test case should be reopened if 
this "bug" is found in 1.1b4 or later.