1 11 package org.eclipse.jdt.internal.compiler.codegen; 12 13 public class CaseLabel extends BranchLabel { 14 15 public int instructionPosition = POS_NOT_SET; 16 17 21 public CaseLabel(CodeStream codeStream) { 22 super(codeStream); 23 } 24 25 29 void branch() { 30 if (position == POS_NOT_SET) { 31 addForwardReference(codeStream.position); 32 codeStream.position += 4; 34 codeStream.classFileOffset += 4; 35 } else { 39 this.codeStream.writeSignedWord(this.position - this.instructionPosition); 40 } 41 } 42 43 46 void branchWide() { 47 this.branch(); } 49 50 public boolean isCaseLabel() { 51 return true; 52 } 53 public boolean isStandardLabel(){ 54 return false; 55 } 56 59 public void place() { 60 if ((this.tagBits & USED) != 0) { 61 position = codeStream.getPosition(); 62 } else { 63 position = codeStream.position; 64 } 65 if (instructionPosition != POS_NOT_SET) { 66 int offset = position - instructionPosition; 67 int[] forwardRefs = forwardReferences(); 68 for (int i = 0, length = forwardReferenceCount(); i < length; i++) { 69 codeStream.writeSignedWord(forwardRefs[i], offset); 70 } 71 codeStream.addLabel(this); 73 } 74 } 75 76 79 void placeInstruction() { 80 if (instructionPosition == POS_NOT_SET) { 81 instructionPosition = codeStream.position; 82 } 83 } 84 } 85 | Popular Tags |