| 1 |
/* |
| 2 |
* JBoss, Home of Professional Open Source. |
| 3 |
* |
| 4 |
* Copyright 2012 Red Hat, Inc. |
| 5 |
* |
| 6 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 |
* you may not use this file except in compliance with the License. |
| 8 |
* You may obtain a copy of the License at |
| 9 |
* |
| 10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 11 |
* |
| 12 |
* Unless required by applicable law or agreed to in writing, software |
| 13 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 14 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 |
* See the License for the specific language governing permissions and |
| 16 |
* limitations under the License. |
| 17 |
*/ |
| 18 |
package org.jboss.classfilewriter.code; |
| 19 |
|
| 20 |
/** |
| 21 |
* Marker that is used to create the end of a branch instruction. |
| 22 |
* |
| 23 |
* @author Stuart Douglas |
| 24 |
* |
| 25 |
*/ |
| 26 |
public class BranchEnd { |
| 27 |
|
| 28 |
private final int branchLocation; |
| 29 |
private final int offsetLocation; |
| 30 |
|
| 31 |
private final StackFrame stackFrame; |
| 32 |
|
| 33 |
private final boolean jump32Bit; |
| 34 |
|
| 35 |
BranchEnd(int branchLocation, StackFrame stackFrame, final int offsetLocation) { |
| 36 |
this.branchLocation = branchLocation; |
| 37 |
this.offsetLocation = offsetLocation; |
| 38 |
this.stackFrame = stackFrame.createFull(); |
| 39 |
this.jump32Bit = false; |
| 40 |
} |
| 41 |
|
| 42 |
public BranchEnd(final int branchLocation, final StackFrame stackFrame, final boolean jump32Bit, final int offsetLocation) { |
| 43 |
this.branchLocation = branchLocation; |
| 44 |
this.stackFrame = stackFrame.createFull(); |
| 45 |
this.jump32Bit = jump32Bit; |
| 46 |
this.offsetLocation = offsetLocation; |
| 47 |
} |
| 48 |
|
| 49 |
int getBranchLocation() { |
| 50 |
return branchLocation; |
| 51 |
} |
| 52 |
|
| 53 |
StackFrame getStackFrame() { |
| 54 |
return stackFrame; |
| 55 |
} |
| 56 |
|
| 57 |
boolean isJump32Bit() { |
| 58 |
return jump32Bit; |
| 59 |
} |
| 60 |
|
| 61 |
int getOffsetLocation() { |
| 62 |
return offsetLocation; |
| 63 |
} |
| 64 |
} |