Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333829

Summary: TransformsBlock has different byte codes with new compiler
Product: [WebTools] WTP Source Editing Reporter: David Williams <david_williams>
Component: wst.xslAssignee: David Carver <d_a_carver>
Status: RESOLVED FIXED QA Contact: David Carver <d_a_carver>
Severity: normal    
Priority: P3 CC: thatnitind
Version: unspecified   
Target Milestone: 3.3 M5   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 333678    

Description David Williams CLA 2011-01-10 01:04:16 EST
similar to other bugs related to 333678 the subject class produces different byte codes with latest JDT compiler. 

The reason is apparently that the compiler handles the empty switch statement in 

protected void setSortColumn(int column) 

method differently. 

Presumably more efficiently? 

For the source of 

	@Override
	protected void setSortColumn(int column) {
		switch (column) {
		// case 1:
		// sortByName();
		// break;
		// case 2:
		// sortByType();
		// break;
		}
		super.setSortColumn(column);
	}


The 3.6 compiler produced: 

  // Method descriptor #4 (I)V
  // Stack: 2, Locals: 2
  protected void setSortColumn(int column);
    0  aload_0 [this]
    1  iload_1 [column]
    2  invokespecial org.eclipse.wst.xsl.internal.debug.ui.AbstractTableBlock.setSortColumn(int) : void [261]
    5  return
      Line numbers:
        [pc: 0, line: 179]
        [pc: 5, line: 180]
      Local variable table:
        [pc: 0, pc: 6] local: this index: 0 type: org.eclipse.wst.xsl.internal.debug.ui.tabs.main.TransformsBlock
        [pc: 0, pc: 6] local: column index: 1 type: int



The new 3.7 M4 compiler produces

  // Method descriptor #4 (I)V
  // Stack: 2, Locals: 2
  protected void setSortColumn(int column);
    0  iload_1 [column]
    1  pop
    2  aload_0 [this]
    3  iload_1 [column]
    4  invokespecial org.eclipse.wst.xsl.internal.debug.ui.AbstractTableBlock.setSortColumn(int) : void [261]
    7  return
      Line numbers:
        [pc: 0, line: 171]
        [pc: 2, line: 179]
        [pc: 7, line: 180]
      Local variable table:
        [pc: 0, pc: 8] local: this index: 0 type: org.eclipse.wst.xsl.internal.debug.ui.tabs.main.TransformsBlock
        [pc: 0, pc: 8] local: column index: 1 type: int


While I can't "read" byte code instructions, the empty switch statement does look a bit odd, and I'd not be surprised if it couldn't be "compiled out" of byte codes. 

My main concern is that the bits now differ, even though version/qualifier is the same ... so ... I'd suggest simply incrementing service field by +100 re-releasing.
Comment 1 David Carver CLA 2011-01-28 00:24:10 EST
Tentatively targeting for 3.3M6.
Comment 2 David Carver CLA 2011-01-28 13:16:21 EST
Incremented the service field by +100 per suggestion.  No code changes otherwise.