Represent labels as integers for easier offset calculation.
This commit changes the representation of labels from strings to
integers to simplify pass/drop offset calculations. Labels less than -1
represent internal program labels used for offset calculations, while
labels greater than or equal to 0 represent pass/drop labels with an
offset calculated by adding the label value to the program size.
Test: TH
Change-Id: I5e23b0c3d73044fdaf515f673d3766826b4db419
diff --git a/src/android/net/apf/ApfFilter.java b/src/android/net/apf/ApfFilter.java
index 6d54a75..3931aa2 100644
--- a/src/android/net/apf/ApfFilter.java
+++ b/src/android/net/apf/ApfFilter.java
@@ -1354,7 +1354,7 @@
// Jump to the next filter if packet doesn't match this RA.
void generateFilter(ApfV4GeneratorBase<?> gen, int timeSeconds)
throws IllegalInstructionException {
- String nextFilterLabel = gen.getUniqueLabel();
+ int nextFilterLabel = gen.getUniqueLabel();
// Skip if packet is not the right size
gen.addLoadFromMemory(R0, MemorySlot.PACKET_SIZE);
gen.addJumpIfR0NotEquals(mPacket.capacity(), nextFilterLabel);
@@ -1419,7 +1419,7 @@
gen.addJumpIfR0Equals(0, nextFilterLabel);
gen.addJumpIfR0GreaterThan(section.lifetime, nextFilterLabel);
} else {
- final String continueLabel = gen.getUniqueLabel();
+ final int continueLabel = gen.getUniqueLabel();
// Case 4a) otherwise
//
// if lft == 0 -> PASS
@@ -1496,7 +1496,7 @@
@Override
void generateFilter(ApfV4GeneratorBase<?> gen) throws IllegalInstructionException {
- final String nextFilterLabel = gen.getUniqueLabel();
+ final int nextFilterLabel = gen.getUniqueLabel();
gen.addLoadImmediate(R0, ETH_HEADER_LEN + IPV4_SRC_ADDR_OFFSET);
gen.addJumpIfBytesAtR0NotEqual(mSrcDstAddr, nextFilterLabel);
@@ -1612,7 +1612,7 @@
@Override
void generateFilter(ApfV4GeneratorBase<?> gen) throws IllegalInstructionException {
- final String nextFilterLabel = gen.getUniqueLabel();
+ final int nextFilterLabel = gen.getUniqueLabel();
gen.addLoadImmediate(R0, ETH_HEADER_LEN + IPV4_SRC_ADDR_OFFSET);
gen.addJumpIfBytesAtR0NotEqual(mSrcDstAddr, nextFilterLabel);
@@ -1741,7 +1741,7 @@
gen.addLoadImmediate(R0, ARP_HEADER_OFFSET);
gen.addCountAndDropIfBytesAtR0NotEqual(ARP_IPV4_HEADER, DROPPED_ARP_NON_IPV4);
- final String checkArpRequest = gen.getUniqueLabel();
+ final int checkArpRequest = gen.getUniqueLabel();
gen.addLoad16(R0, ARP_OPCODE_OFFSET);
gen.addJumpIfR0Equals(ARP_OPCODE_REQUEST, checkArpRequest); // Skip to arp request check.
@@ -1813,7 +1813,7 @@
private void generateUnicastIpv4PingOffload(ApfV6GeneratorBase<?> gen)
throws IllegalInstructionException {
- final String skipIpv4PingFilter = gen.getUniqueLabel();
+ final int skipIpv4PingFilter = gen.getUniqueLabel();
// Check 1) it's not a fragment. 2) it's ICMP.
// If condition not match then skip the ping filter logic
gen.addJumpIfNotUnfragmentedIPv4Protocol(IPPROTO_ICMP, skipIpv4PingFilter);
@@ -1886,9 +1886,9 @@
* @param labelCheckMdnsQueryPayload the label to jump to for checking the mDNS query payload
*/
private void generateIPv4MdnsFilter(ApfV6GeneratorBase<?> gen,
- String labelCheckMdnsQueryPayload)
+ int labelCheckMdnsQueryPayload)
throws IllegalInstructionException {
- final String skipMdnsFilter = gen.getUniqueLabel();
+ final int skipMdnsFilter = gen.getUniqueLabel();
// If the packet is too short to be a valid IPv4 mDNS packet, the filter is skipped.
// For APF performance reasons, we check udp destination port before confirming it is
@@ -1957,7 +1957,7 @@
* @param gen the APF generator to generate the filter code
* @param labelCheckMdnsQueryPayload the label to jump to for checking the mDNS query payload
*/
- private void generateIPv4Filter(ApfV4GeneratorBase<?> gen, String labelCheckMdnsQueryPayload)
+ private void generateIPv4Filter(ApfV4GeneratorBase<?> gen, int labelCheckMdnsQueryPayload)
throws IllegalInstructionException {
// Here's a basic summary of what the IPv4 filter program does:
//
@@ -2054,7 +2054,7 @@
}
if (mMulticastFilter) {
- final String skipDhcpv4Filter = gen.getUniqueLabel();
+ final int skipDhcpv4Filter = gen.getUniqueLabel();
// Pass DHCP addressed to us.
// Check 1) it's not a fragment. 2) it's UDP.
@@ -2114,7 +2114,7 @@
}
private void generateKeepaliveFilters(ApfV4GeneratorBase<?> gen, Class<?> filterType, int proto,
- int offset, String label) throws IllegalInstructionException {
+ int offset, int label) throws IllegalInstructionException {
final boolean haveKeepaliveResponses = CollectionUtils.any(mKeepalivePackets,
filterType::isInstance);
@@ -2253,8 +2253,8 @@
// Dst IPv6 address check:
final List<byte[]> allSuffixes = getSolicitedNodeMcastAddressSuffix(allIPv6Addrs);
- final String notIpV6SolicitedNodeMcast = v6Gen.getUniqueLabel();
- final String endOfIpV6DstCheck = v6Gen.getUniqueLabel();
+ final int notIpV6SolicitedNodeMcast = v6Gen.getUniqueLabel();
+ final int endOfIpV6DstCheck = v6Gen.getUniqueLabel();
v6Gen.addLoadImmediate(R0, IPV6_DEST_ADDR_OFFSET)
.addJumpIfBytesAtR0NotEqual(IPV6_SOLICITED_NODES_PREFIX, notIpV6SolicitedNodeMcast)
.addAdd(13)
@@ -2345,8 +2345,8 @@
* @param labelCheckMdnsQueryPayload the label to jump to for checking the mDNS query payload
*/
private void generateIPv6MdnsFilter(ApfV6GeneratorBase<?> gen,
- String labelCheckMdnsQueryPayload) throws IllegalInstructionException {
- final String skipMdnsFilter = gen.getUniqueLabel();
+ int labelCheckMdnsQueryPayload) throws IllegalInstructionException {
+ final int skipMdnsFilter = gen.getUniqueLabel();
// If the packet is too short to be a valid IPv6 mDNS packet, the filter is skipped.
// For APF performance reasons, we check udp destination port before confirming it is IPv6
@@ -2413,7 +2413,7 @@
private void generateUnicastIpv6PingOffload(ApfV6GeneratorBase<?> gen)
throws IllegalInstructionException {
- final String skipPing6Offload = gen.getUniqueLabel();
+ final int skipPing6Offload = gen.getUniqueLabel();
gen.addJumpIfR0NotEquals(ICMPV6_ECHO_REQUEST_TYPE, skipPing6Offload);
// Only offload unicast ping6.
@@ -2482,7 +2482,7 @@
* @param gen the APF generator to generate the filter code
* @param labelCheckMdnsQueryPayload the label to jump to for checking the mDNS query payload
*/
- private void generateIPv6Filter(ApfV4GeneratorBase<?> gen, String labelCheckMdnsQueryPayload)
+ private void generateIPv6Filter(ApfV4GeneratorBase<?> gen, int labelCheckMdnsQueryPayload)
throws IllegalInstructionException {
// Here's a basic summary of what the IPv6 filter program does:
//
@@ -2565,8 +2565,8 @@
// Drop multicast if the multicast filter is enabled.
if (mMulticastFilter) {
- final String skipIPv6MulticastFilterLabel = gen.getUniqueLabel();
- final String dropAllIPv6MulticastsLabel = gen.getUniqueLabel();
+ final int skipIPv6MulticastFilterLabel = gen.getUniqueLabel();
+ final int dropAllIPv6MulticastsLabel = gen.getUniqueLabel();
// While in doze mode, drop ICMPv6 multicast pings, let the others pass.
// While awake, let all ICMPv6 multicasts through.
@@ -2601,7 +2601,7 @@
// Not ICMPv6 NS -> skip.
gen.addLoad8(R0, ICMP6_TYPE_OFFSET); // warning: also used further below.
if (enableNdOffload()) {
- final String skipNsPacketFilter = gen.getUniqueLabel();
+ final int skipNsPacketFilter = gen.getUniqueLabel();
gen.addJumpIfR0NotEquals(ICMPV6_NEIGHBOR_SOLICITATION, skipNsPacketFilter);
generateNsFilter((ApfV6GeneratorBase<?>) gen);
// End of NS filter. generateNsFilter() method is terminal, so NS packet will be
@@ -2614,7 +2614,7 @@
}
// Add unsolicited multicast neighbor announcements filter
- String skipUnsolicitedMulticastNALabel = gen.getUniqueLabel();
+ int skipUnsolicitedMulticastNALabel = gen.getUniqueLabel();
// Drop all router solicitations (b/32833400)
gen.addCountAndDropIfR0Equals(ICMPV6_ROUTER_SOLICITATION, DROPPED_IPV6_ROUTER_SOLICITATION);
// If not neighbor announcements, skip filter.
@@ -2801,8 +2801,8 @@
*/
private void generateIgmpFilter(ApfV6GeneratorBase<?> v6Gen)
throws IllegalInstructionException {
- final String skipIgmpFilter = v6Gen.getUniqueLabel();
- final String checkIgmpV1orV2 = v6Gen.getUniqueLabel();
+ final int skipIgmpFilter = v6Gen.getUniqueLabel();
+ final int checkIgmpV1orV2 = v6Gen.getUniqueLabel();
// Check 1) it's not a fragment. 2) it's IGMP.
v6Gen.addJumpIfNotUnfragmentedIPv4Protocol(IPV4_PROTOCOL_IGMP, skipIgmpFilter);
@@ -2884,7 +2884,7 @@
*/
private void generateV4TcpPort7Filter(ApfV4GeneratorBase<?> gen)
throws IllegalInstructionException {
- final String skipPort7V4Filter = gen.getUniqueLabel();
+ final int skipPort7V4Filter = gen.getUniqueLabel();
// Check it's TCP.
gen.addLoad8(R0, IPV4_PROTOCOL_OFFSET);
@@ -3000,9 +3000,9 @@
final byte[] mdns6NextHdrToUdpDport = createMdns6PktFromIPv6NextHdrToUdpDport(enableMdns6);
for (MdnsOffloadRule rule : mOffloadRules) {
- final String ruleNotMatch = gen.getUniqueLabel();
- final String ruleMatch = gen.getUniqueLabel();
- final String offloadIPv6Mdns = gen.getUniqueLabel();
+ final int ruleNotMatch = gen.getUniqueLabel();
+ final int ruleMatch = gen.getUniqueLabel();
+ final int offloadIPv6Mdns = gen.getUniqueLabel();
for (MdnsOffloadRule.Matcher matcher : rule.mMatchers) {
gen.addJumpIfPktAtR0ContainDnsQ(matcher.mQnames, matcher.mQtype, ruleMatch);
@@ -3110,7 +3110,7 @@
mInstallableProgramSizeClamp);
}
- final String labelCheckMdnsQueryPayload = gen.getUniqueLabel();
+ final int labelCheckMdnsQueryPayload = gen.getUniqueLabel();
if (hasDataAccess(mApfVersionSupported)) {
if (gen instanceof ApfV4Generator) {
@@ -3178,7 +3178,7 @@
}
// Add ARP filters:
- String skipArpFiltersLabel = gen.getUniqueLabel();
+ int skipArpFiltersLabel = gen.getUniqueLabel();
gen.addJumpIfR0NotEquals(ETH_P_ARP, skipArpFiltersLabel);
generateArpFilter(gen);
gen.defineLabel(skipArpFiltersLabel);
@@ -3186,7 +3186,7 @@
gen.addLoad16(R0, ETH_ETHERTYPE_OFFSET);
// Add IPv4 filters:
- String skipIPv4FiltersLabel = gen.getUniqueLabel();
+ int skipIPv4FiltersLabel = gen.getUniqueLabel();
gen.addJumpIfR0NotEquals(ETH_P_IP, skipIPv4FiltersLabel);
generateIPv4Filter(gen, labelCheckMdnsQueryPayload);
gen.defineLabel(skipIPv4FiltersLabel);
@@ -3195,7 +3195,7 @@
// NOTE: Relies on R0 containing ethertype. This is safe because if we got here, we did
// not execute the IPv4 filter, since this filter do not fall through, but either drop or
// pass.
- String ipv6FilterLabel = gen.getUniqueLabel();
+ int ipv6FilterLabel = gen.getUniqueLabel();
gen.addJumpIfR0Equals(ETH_P_IPV6, ipv6FilterLabel);
// Drop non-IP non-ARP broadcasts, pass the rest
@@ -3209,7 +3209,7 @@
// Add mDNS query payload check.
if (enableMdns4Offload() || enableMdns6Offload()) {
- final String skipMdnsQueryPayloadCheck = gen.getUniqueLabel();
+ final int skipMdnsQueryPayloadCheck = gen.getUniqueLabel();
gen.addJump(skipMdnsQueryPayloadCheck);
gen.defineLabel(labelCheckMdnsQueryPayload);
generateMdnsQueryOffload((ApfV6GeneratorBase<?>) gen);
diff --git a/src/android/net/apf/ApfV4Generator.java b/src/android/net/apf/ApfV4Generator.java
index f9918b2..2c4b806 100644
--- a/src/android/net/apf/ApfV4Generator.java
+++ b/src/android/net/apf/ApfV4Generator.java
@@ -37,16 +37,16 @@
* Jump to this label to terminate the program, increment the counter and indicate the packet
* should be passed to the AP.
*/
- private static final String COUNT_AND_PASS_LABEL = "__COUNT_AND_PASS__";
+ private final int mCountAndDropLabelV4;
/**
* Jump to this label to terminate the program, increment counter, and indicate the packet
* should be dropped.
*/
- private static final String COUNT_AND_DROP_LABEL = "__COUNT_AND_DROP__";
+ private final int mCountAndPassLabelV4;
- public final String mCountAndDropLabel;
- public final String mCountAndPassLabel;
+ public final int mCountAndDropLabel;
+ public final int mCountAndPassLabel;
/**
* Returns true if we support the specified {@code version}, otherwise false.
@@ -65,8 +65,10 @@
throws IllegalInstructionException {
// make sure mVersion is not greater than 4 when using this class
super(version > 4 ? 4 : version, ramSize, clampSize, disableCounterRangeCheck);
- mCountAndDropLabel = version > 2 ? COUNT_AND_DROP_LABEL : DROP_LABEL;
- mCountAndPassLabel = version > 2 ? COUNT_AND_PASS_LABEL : PASS_LABEL;
+ mCountAndDropLabelV4 = getUniqueLabel();
+ mCountAndPassLabelV4 = getUniqueLabel();
+ mCountAndDropLabel = version > 2 ? mCountAndDropLabelV4 : DROP_LABEL;
+ mCountAndPassLabel = version > 2 ? mCountAndPassLabelV4 : PASS_LABEL;
}
/**
@@ -236,7 +238,7 @@
if (values.isEmpty()) {
throw new IllegalArgumentException("values cannot be empty");
}
- String tgt = getUniqueLabel();
+ int tgt = getUniqueLabel();
for (Long v : values) {
addJumpIfR0Equals(v, tgt);
}
@@ -251,7 +253,7 @@
if (values.isEmpty()) {
throw new IllegalArgumentException("values cannot be empty");
}
- String tgt = getUniqueLabel();
+ int tgt = getUniqueLabel();
for (Long v : values) {
addJumpIfR0Equals(v, tgt);
}
@@ -265,10 +267,10 @@
throws IllegalInstructionException {
final List<byte[]> deduplicatedList = validateDeduplicateBytesList(bytesList);
maybeAddLoadCounterOffset(R1, cnt);
- String matchLabel = getUniqueLabel();
- String allNoMatchLabel = getUniqueLabel();
+ int matchLabel = getUniqueLabel();
+ int allNoMatchLabel = getUniqueLabel();
for (byte[] v : deduplicatedList) {
- String notMatchLabel = getUniqueLabel();
+ int notMatchLabel = getUniqueLabel();
addJumpIfBytesAtR0NotEqual(v, notMatchLabel);
addJump(matchLabel);
defineLabel(notMatchLabel);
@@ -367,12 +369,12 @@
@Override
public ApfV4Generator addCountTrampoline() throws IllegalInstructionException {
if (mVersion <= 2) return self();
- return defineLabel(COUNT_AND_PASS_LABEL)
+ return defineLabel(mCountAndPassLabelV4)
.addLoadData(R0, 0) // R0 = *(R1 + 0)
.addAdd(1) // R0++
.addStoreData(R0, 0) // *(R1 + 0) = R0
.addJump(PASS_LABEL)
- .defineLabel(COUNT_AND_DROP_LABEL)
+ .defineLabel(mCountAndDropLabelV4)
.addLoadData(R0, 0) // R0 = *(R1 + 0)
.addAdd(1) // R0++
.addStoreData(R0, 0) // *(R1 + 0) = R0
diff --git a/src/android/net/apf/ApfV4GeneratorBase.java b/src/android/net/apf/ApfV4GeneratorBase.java
index 8e5fe4c..5913c85 100644
--- a/src/android/net/apf/ApfV4GeneratorBase.java
+++ b/src/android/net/apf/ApfV4GeneratorBase.java
@@ -88,14 +88,14 @@
* </pre>
* In this case "next_filter" may not have any generated code associated with it.
*/
- public final Type defineLabel(String name) throws IllegalInstructionException {
+ public final Type defineLabel(int name) throws IllegalInstructionException {
return append(new Instruction(Opcodes.LABEL).setLabel(name));
}
/**
* Add an unconditional jump instruction to the end of the program.
*/
- public final Type addJump(String target) {
+ public final Type addJump(int target) {
return append(new Instruction(Opcodes.JMP).setTargetLabel(target));
}
@@ -287,7 +287,7 @@
* Add an instruction to the end of the program to jump to {@code target} if register R0's
* value equals {@code value}.
*/
- public final Type addJumpIfR0Equals(long val, String tgt) {
+ public final Type addJumpIfR0Equals(long val, int tgt) {
return append(new Instruction(Opcodes.JEQ).addTwosCompUnsigned(val).setTargetLabel(tgt));
}
@@ -311,7 +311,7 @@
* Add an instruction to the end of the program to jump to {@code target} if register R0's
* value does not equal {@code value}.
*/
- public final Type addJumpIfR0NotEquals(long val, String tgt) {
+ public final Type addJumpIfR0NotEquals(long val, int tgt) {
return append(new Instruction(Opcodes.JNE).addTwosCompUnsigned(val).setTargetLabel(tgt));
}
@@ -335,7 +335,7 @@
* Add an instruction to the end of the program to jump to {@code target} if register R0's
* value is greater than {@code value}.
*/
- public final Type addJumpIfR0GreaterThan(long val, String tgt) {
+ public final Type addJumpIfR0GreaterThan(long val, int tgt) {
return append(new Instruction(Opcodes.JGT).addUnsigned(val).setTargetLabel(tgt));
}
@@ -359,7 +359,7 @@
* Add an instruction to the end of the program to jump to {@code target} if register R0's
* value is less than {@code value}.
*/
- public final Type addJumpIfR0LessThan(long val, String tgt) {
+ public final Type addJumpIfR0LessThan(long val, int tgt) {
return append(new Instruction(Opcodes.JLT).addUnsigned(val).setTargetLabel(tgt));
}
@@ -383,7 +383,7 @@
* Add an instruction to the end of the program to jump to {@code target} if register R0's
* value has any bits set that are also set in {@code value}.
*/
- public final Type addJumpIfR0AnyBitsSet(long val, String tgt) {
+ public final Type addJumpIfR0AnyBitsSet(long val, int tgt) {
return append(new Instruction(Opcodes.JSET).addTwosCompUnsigned(val).setTargetLabel(tgt));
}
@@ -439,7 +439,7 @@
* Add an instruction to the end of the program to jump to {@code target} if register R0's
* value equals register R1's value.
*/
- public final Type addJumpIfR0EqualsR1(String tgt) {
+ public final Type addJumpIfR0EqualsR1(int tgt) {
return append(new Instruction(Opcodes.JEQ, R1).setTargetLabel(tgt));
}
@@ -447,7 +447,7 @@
* Add an instruction to the end of the program to jump to {@code target} if register R0's
* value does not equal register R1's value.
*/
- public final Type addJumpIfR0NotEqualsR1(String tgt) {
+ public final Type addJumpIfR0NotEqualsR1(int tgt) {
return append(new Instruction(Opcodes.JNE, R1).setTargetLabel(tgt));
}
@@ -455,7 +455,7 @@
* Add an instruction to the end of the program to jump to {@code target} if register R0's
* value is greater than register R1's value.
*/
- public final Type addJumpIfR0GreaterThanR1(String tgt) {
+ public final Type addJumpIfR0GreaterThanR1(int tgt) {
return append(new Instruction(Opcodes.JGT, R1).setTargetLabel(tgt));
}
@@ -463,7 +463,7 @@
* Add an instruction to the end of the program to jump to {@code target} if register R0's
* value is less than register R1's value.
*/
- public final Type addJumpIfR0LessThanR1(String target) {
+ public final Type addJumpIfR0LessThanR1(int target) {
return append(new Instruction(Opcodes.JLT, R1).setTargetLabel(target));
}
@@ -471,7 +471,7 @@
* Add an instruction to the end of the program to jump to {@code target} if register R0's
* value has any bits set that are also set in R1's value.
*/
- public final Type addJumpIfR0AnyBitsSetR1(String tgt) {
+ public final Type addJumpIfR0AnyBitsSetR1(int tgt) {
return append(new Instruction(Opcodes.JSET, R1).setTargetLabel(tgt));
}
@@ -480,7 +480,7 @@
* packet at an offset specified by register0 don't match {@code bytes}.
* R=0 means check for not equal.
*/
- public final Type addJumpIfBytesAtR0NotEqual(@NonNull byte[] bytes, String tgt) {
+ public final Type addJumpIfBytesAtR0NotEqual(@NonNull byte[] bytes, int tgt) {
validateBytes(bytes);
return append(new Instruction(Opcodes.JBSMATCH).addUnsigned(
bytes.length).setTargetLabel(tgt).setBytesImm(bytes));
@@ -509,7 +509,7 @@
*/
public final Type addCountAndDropIfBytesAtR0Equal(byte[] bytes,
ApfCounterTracker.Counter cnt) throws IllegalInstructionException {
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfBytesAtR0NotEqual(bytes, tgt).addCountAndDrop(cnt).defineLabel(tgt);
}
@@ -521,7 +521,7 @@
*/
public final Type addCountAndPassIfBytesAtR0Equal(byte[] bytes,
ApfCounterTracker.Counter cnt) throws IllegalInstructionException {
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfBytesAtR0NotEqual(bytes, tgt).addCountAndPass(cnt).defineLabel(tgt);
}
@@ -580,7 +580,7 @@
* IPv4 packet with the specified protocol, and jump to the target if it is not.
* WARNING: this helper method will modify R0
*/
- public Type addJumpIfNotUnfragmentedIPv4Protocol(long protocol, @NonNull String tgt) {
+ public Type addJumpIfNotUnfragmentedIPv4Protocol(long protocol, int tgt) {
// Mask out all but the reserved and don't fragment bits, plus the TTL field.
// Because:
// IPV4_FRAGMENT_OFFSET_MASK = 0x1fff
diff --git a/src/android/net/apf/ApfV6GeneratorBase.java b/src/android/net/apf/ApfV6GeneratorBase.java
index 7c7ff0b..899e659 100644
--- a/src/android/net/apf/ApfV6GeneratorBase.java
+++ b/src/android/net/apf/ApfV6GeneratorBase.java
@@ -342,7 +342,7 @@
* Drops packets if packets are corrupted.
*/
public final Type addJumpIfPktAtR0DoesNotContainDnsQ(@NonNull byte[] qnames, int qtype,
- @NonNull String tgt) {
+ int tgt) {
validateNames(qnames);
return append(new Instruction(ExtendedOpcodes.JDNSQMATCH, Rbit0).setTargetLabel(tgt).addU8(
qtype).setBytesImm(qnames));
@@ -353,7 +353,7 @@
* corrupted.
*/
public final Type addJumpIfPktAtR0DoesNotContainDnsQSafe(@NonNull byte[] qnames, int qtype,
- @NonNull String tgt) {
+ int tgt) {
validateNames(qnames);
return append(new Instruction(ExtendedOpcodes.JDNSQMATCHSAFE, Rbit0).setTargetLabel(
tgt).addU8(qtype).setBytesImm(qnames));
@@ -366,8 +366,7 @@
* R = 1 means check for "contain".
* Drops packets if packets are corrupted.
*/
- public final Type addJumpIfPktAtR0ContainDnsQ(@NonNull byte[] qnames, int qtype,
- @NonNull String tgt) {
+ public final Type addJumpIfPktAtR0ContainDnsQ(@NonNull byte[] qnames, int qtype, int tgt) {
validateNames(qnames);
return append(new Instruction(ExtendedOpcodes.JDNSQMATCH, Rbit1).setTargetLabel(tgt).addU8(
qtype).setBytesImm(qnames));
@@ -377,8 +376,7 @@
* Same as {@link #addJumpIfPktAtR0ContainDnsQ} except passes packets if packets are
* corrupted.
*/
- public final Type addJumpIfPktAtR0ContainDnsQSafe(@NonNull byte[] qnames, int qtype,
- @NonNull String tgt) {
+ public final Type addJumpIfPktAtR0ContainDnsQSafe(@NonNull byte[] qnames, int qtype, int tgt) {
validateNames(qnames);
return append(new Instruction(ExtendedOpcodes.JDNSQMATCHSAFE, Rbit1).setTargetLabel(
tgt).addU8(qtype).setBytesImm(qnames));
@@ -391,8 +389,7 @@
* R = 0 means check for "does not contain".
* Drops packets if packets are corrupted.
*/
- public final Type addJumpIfPktAtR0DoesNotContainDnsA(@NonNull byte[] names,
- @NonNull String tgt) {
+ public final Type addJumpIfPktAtR0DoesNotContainDnsA(@NonNull byte[] names, int tgt) {
validateNames(names);
return append(new Instruction(ExtendedOpcodes.JDNSAMATCH, Rbit0).setTargetLabel(tgt)
.setBytesImm(names));
@@ -402,8 +399,7 @@
* Same as {@link #addJumpIfPktAtR0DoesNotContainDnsA} except passes packets if packets are
* corrupted.
*/
- public final Type addJumpIfPktAtR0DoesNotContainDnsASafe(@NonNull byte[] names,
- @NonNull String tgt) {
+ public final Type addJumpIfPktAtR0DoesNotContainDnsASafe(@NonNull byte[] names, int tgt) {
validateNames(names);
return append(new Instruction(ExtendedOpcodes.JDNSAMATCHSAFE, Rbit0).setTargetLabel(tgt)
.setBytesImm(names));
@@ -416,8 +412,7 @@
* R = 1 means check for "contain".
* Drops packets if packets are corrupted.
*/
- public final Type addJumpIfPktAtR0ContainDnsA(@NonNull byte[] names,
- @NonNull String tgt) {
+ public final Type addJumpIfPktAtR0ContainDnsA(@NonNull byte[] names, int tgt) {
validateNames(names);
return append(new Instruction(ExtendedOpcodes.JDNSAMATCH, Rbit1).setTargetLabel(
tgt).setBytesImm(names));
@@ -427,8 +422,7 @@
* Same as {@link #addJumpIfPktAtR0ContainDnsA} except passes packets if packets are
* corrupted.
*/
- public final Type addJumpIfPktAtR0ContainDnsASafe(@NonNull byte[] names,
- @NonNull String tgt) {
+ public final Type addJumpIfPktAtR0ContainDnsASafe(@NonNull byte[] names, int tgt) {
validateNames(names);
return append(new Instruction(ExtendedOpcodes.JDNSAMATCHSAFE, Rbit1).setTargetLabel(
tgt).setBytesImm(names));
@@ -439,14 +433,14 @@
* packet at an offset specified by register0 match {@code bytes}.
* R=1 means check for equal.
*/
- public final Type addJumpIfBytesAtR0Equal(@NonNull byte[] bytes, String tgt)
+ public final Type addJumpIfBytesAtR0Equal(@NonNull byte[] bytes, int tgt)
throws IllegalInstructionException {
validateBytes(bytes);
return append(new Instruction(Opcodes.JBSMATCH, R1).addUnsigned(
bytes.length).setTargetLabel(tgt).setBytesImm(bytes));
}
- private Type addJumpIfBytesAtR0EqualsHelper(@NonNull List<byte[]> bytesList, String tgt,
+ private Type addJumpIfBytesAtR0EqualsHelper(@NonNull List<byte[]> bytesList, int tgt,
boolean jumpOnMatch) {
final List<byte[]> deduplicatedList = validateDeduplicateBytesList(bytesList);
final int elementSize = deduplicatedList.get(0).length;
@@ -469,7 +463,7 @@
* packet at an offset specified by register0 match any of the elements in {@code bytesSet}.
* R=1 means check for equal.
*/
- public final Type addJumpIfBytesAtR0EqualsAnyOf(@NonNull List<byte[]> bytesList, String tgt) {
+ public final Type addJumpIfBytesAtR0EqualsAnyOf(@NonNull List<byte[]> bytesList, int tgt) {
return addJumpIfBytesAtR0EqualsHelper(bytesList, tgt, true /* jumpOnMatch */);
}
@@ -478,7 +472,7 @@
* packet at an offset specified by register0 match none of the elements in {@code bytesSet}.
* R=0 means check for not equal.
*/
- public final Type addJumpIfBytesAtR0EqualNoneOf(@NonNull List<byte[]> bytesList, String tgt) {
+ public final Type addJumpIfBytesAtR0EqualNoneOf(@NonNull List<byte[]> bytesList, int tgt) {
return addJumpIfBytesAtR0EqualsHelper(bytesList, tgt, false /* jumpOnMatch */);
}
@@ -525,7 +519,7 @@
}
private Type addJumpIfOneOfHelper(Register reg, @NonNull Set<Long> values,
- boolean jumpOnMatch, @NonNull String tgt) {
+ boolean jumpOnMatch, int tgt) {
if (values == null || values.size() < 2 || values.size() > 33) {
throw new IllegalArgumentException(
"size of values set must be >= 2 and <= 33, current size: " + values.size());
@@ -568,8 +562,7 @@
* Add an instruction to the end of the program to jump to {@code tgt} if {@code reg} is
* one of the {@code values}.
*/
- public final Type addJumpIfOneOf(Register reg, @NonNull Set<Long> values,
- @NonNull String tgt) {
+ public final Type addJumpIfOneOf(Register reg, @NonNull Set<Long> values, int tgt) {
return addJumpIfOneOfHelper(reg, values, true /* jumpOnMatch */, tgt);
}
@@ -577,8 +570,7 @@
* Add an instruction to the end of the program to jump to {@code tgt} if {@code reg} is
* not one of the {@code values}.
*/
- public final Type addJumpIfNoneOf(Register reg, @NonNull Set<Long> values,
- @NonNull String tgt) {
+ public final Type addJumpIfNoneOf(Register reg, @NonNull Set<Long> values, int tgt) {
return addJumpIfOneOfHelper(reg, values, false /* jumpOnMatch */, tgt);
}
@@ -614,36 +606,36 @@
@Override
public final Type addCountAndDropIfR0Equals(long val, ApfCounterTracker.Counter cnt)
throws IllegalInstructionException {
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfR0NotEquals(val, tgt).addCountAndDrop(cnt).defineLabel(tgt);
}
@Override
public final Type addCountAndPassIfR0Equals(long val, ApfCounterTracker.Counter cnt)
throws IllegalInstructionException {
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfR0NotEquals(val, tgt).addCountAndPass(cnt).defineLabel(tgt);
}
@Override
public final Type addCountAndDropIfR0NotEquals(long val, ApfCounterTracker.Counter cnt)
throws IllegalInstructionException {
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfR0Equals(val, tgt).addCountAndDrop(cnt).defineLabel(tgt);
}
@Override
public final Type addCountAndPassIfR0NotEquals(long val, ApfCounterTracker.Counter cnt)
throws IllegalInstructionException {
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfR0Equals(val, tgt).addCountAndPass(cnt).defineLabel(tgt);
}
@Override
public Type addCountAndDropIfR0AnyBitsSet(long val, ApfCounterTracker.Counter cnt)
throws IllegalInstructionException {
- final String countAndDropLabel = getUniqueLabel();
- final String skipLabel = getUniqueLabel();
+ final int countAndDropLabel = getUniqueLabel();
+ final int skipLabel = getUniqueLabel();
return addJumpIfR0AnyBitsSet(val, countAndDropLabel)
.addJump(skipLabel)
.defineLabel(countAndDropLabel)
@@ -654,8 +646,8 @@
@Override
public Type addCountAndPassIfR0AnyBitsSet(long val, ApfCounterTracker.Counter cnt)
throws IllegalInstructionException {
- final String countAndPassLabel = getUniqueLabel();
- final String skipLabel = getUniqueLabel();
+ final int countAndPassLabel = getUniqueLabel();
+ final int skipLabel = getUniqueLabel();
return addJumpIfR0AnyBitsSet(val, countAndPassLabel)
.addJump(skipLabel)
.defineLabel(countAndPassLabel)
@@ -669,7 +661,7 @@
if (val <= 0) {
throw new IllegalArgumentException("val must > 0, current val: " + val);
}
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfR0GreaterThan(val - 1, tgt).addCountAndDrop(cnt).defineLabel(tgt);
}
@@ -679,7 +671,7 @@
if (val <= 0) {
throw new IllegalArgumentException("val must > 0, current val: " + val);
}
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfR0GreaterThan(val - 1, tgt).addCountAndPass(cnt).defineLabel(tgt);
}
@@ -689,7 +681,7 @@
if (val < 0 || val >= 4294967295L) {
throw new IllegalArgumentException("val must >= 0 and < 2^32-1, current val: " + val);
}
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfR0LessThan(val + 1, tgt).addCountAndDrop(cnt).defineLabel(tgt);
}
@@ -699,21 +691,21 @@
if (val < 0 || val >= 4294967295L) {
throw new IllegalArgumentException("val must >= 0 and < 2^32-1, current val: " + val);
}
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfR0LessThan(val + 1, tgt).addCountAndPass(cnt).defineLabel(tgt);
}
@Override
public final Type addCountAndDropIfBytesAtR0NotEqual(byte[] bytes,
ApfCounterTracker.Counter cnt) throws IllegalInstructionException {
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfBytesAtR0Equal(bytes, tgt).addCountAndDrop(cnt).defineLabel(tgt);
}
@Override
public final Type addCountAndPassIfBytesAtR0NotEqual(byte[] bytes,
ApfCounterTracker.Counter cnt) throws IllegalInstructionException {
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfBytesAtR0Equal(bytes, tgt).addCountAndPass(cnt).defineLabel(tgt);
}
@@ -726,7 +718,7 @@
if (values.size() == 1) {
return addCountAndPassIfR0Equals(values.iterator().next(), cnt);
}
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfNoneOf(R0, values, tgt).addCountAndPass(cnt).defineLabel(tgt);
}
@@ -739,7 +731,7 @@
if (values.size() == 1) {
return addCountAndDropIfR0Equals(values.iterator().next(), cnt);
}
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfNoneOf(R0, values, tgt).addCountAndDrop(cnt).defineLabel(tgt);
}
@@ -752,7 +744,7 @@
if (values.size() == 1) {
return addCountAndPassIfR0NotEquals(values.iterator().next(), cnt);
}
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfOneOf(R0, values, tgt).addCountAndPass(cnt).defineLabel(tgt);
}
@@ -760,7 +752,7 @@
public Type addCountAndDropIfBytesAtR0EqualsAnyOf(@NonNull List<byte[]> bytesList,
ApfCounterTracker.Counter cnt)
throws IllegalInstructionException {
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfBytesAtR0EqualNoneOf(bytesList, tgt).addCountAndDrop(cnt).defineLabel(tgt);
}
@@ -768,7 +760,7 @@
public Type addCountAndPassIfBytesAtR0EqualsAnyOf(@NonNull List<byte[]> bytesList,
ApfCounterTracker.Counter cnt)
throws IllegalInstructionException {
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfBytesAtR0EqualNoneOf(bytesList, tgt).addCountAndPass(cnt).defineLabel(tgt);
}
@@ -776,7 +768,7 @@
public Type addCountAndDropIfBytesAtR0EqualsNoneOf(@NonNull List<byte[]> bytesList,
ApfCounterTracker.Counter cnt)
throws IllegalInstructionException {
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfBytesAtR0EqualsAnyOf(bytesList, tgt).addCountAndDrop(cnt).defineLabel(tgt);
}
@@ -784,7 +776,7 @@
public Type addCountAndPassIfBytesAtR0EqualsNoneOf(@NonNull List<byte[]> bytesList,
ApfCounterTracker.Counter cnt)
throws IllegalInstructionException {
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfBytesAtR0EqualsAnyOf(bytesList, tgt).addCountAndPass(cnt).defineLabel(tgt);
}
@@ -797,7 +789,7 @@
if (values.size() == 1) {
return addCountAndDropIfR0NotEquals(values.iterator().next(), cnt);
}
- final String tgt = getUniqueLabel();
+ final int tgt = getUniqueLabel();
return addJumpIfOneOf(R0, values, tgt).addCountAndDrop(cnt).defineLabel(tgt);
}
diff --git a/src/android/net/apf/BaseApfGenerator.java b/src/android/net/apf/BaseApfGenerator.java
index e5249e8..d381cab 100644
--- a/src/android/net/apf/BaseApfGenerator.java
+++ b/src/android/net/apf/BaseApfGenerator.java
@@ -350,7 +350,10 @@
// When mOpcode is a jump:
private int mTargetLabelSize;
private int mImmSizeOverride = -1;
- private String mTargetLabel;
+ // mTargetLabel == -1 indicates it is uninitialized. mTargetLabel < -1 indicates a label
+ // within the program used for offset calculation. mTargetLabel >= 0 indicates a pass/drop
+ // label, its offset is mTargetLabel + program size.
+ private int mTargetLabel = -1;
public byte[] mBytesImm;
// Offset in bytes from the beginning of this program.
// Set by {@link BaseApfGenerator#generate}.
@@ -452,7 +455,7 @@
return this;
}
- Instruction setLabel(String label) throws IllegalInstructionException {
+ Instruction setLabel(int label) throws IllegalInstructionException {
if (mLabels.containsKey(label)) {
throw new IllegalInstructionException("duplicate label " + label);
}
@@ -463,7 +466,7 @@
return this;
}
- Instruction setTargetLabel(String label) {
+ Instruction setTargetLabel(int label) {
mTargetLabel = label;
mTargetLabelSize = 4; // May shrink later on in generate().
return this;
@@ -572,7 +575,7 @@
for (IntImmediate imm : mIntImms) {
size += imm.getEncodingSize(indeterminateSize);
}
- if (mTargetLabel != null) {
+ if (mTargetLabel != -1) {
size += indeterminateSize;
}
if (mBytesImm != null) {
@@ -587,7 +590,7 @@
* @return {@code true} if shrunk.
*/
boolean shrink() throws IllegalInstructionException {
- if (mTargetLabel == null) {
+ if (mTargetLabel == -1) {
return false;
}
int oldTargetLabelSize = mTargetLabelSize;
@@ -647,7 +650,7 @@
writingOffset = mIntImms.get(startOffset++).writeValue(bytecode, writingOffset,
indeterminateSize);
}
- if (mTargetLabel != null) {
+ if (mTargetLabel != -1) {
writingOffset = writeValue(calculateTargetLabelOffset(), bytecode, writingOffset,
indeterminateSize);
}
@@ -696,20 +699,18 @@
}
private int calculateTargetLabelOffset() throws IllegalInstructionException {
- Instruction targetLabelInstruction;
- if (mTargetLabel == DROP_LABEL) {
- targetLabelInstruction = mDropLabel;
- } else if (mTargetLabel == PASS_LABEL) {
- targetLabelInstruction = mPassLabel;
+ int targetOffset;
+ if (mTargetLabel >= 0) {
+ targetOffset = mTotalSize + mTargetLabel;
} else {
- targetLabelInstruction = mLabels.get(mTargetLabel);
+ final Instruction targetLabelInstruction = mLabels.get(mTargetLabel);
+ if (targetLabelInstruction == null) {
+ throw new IllegalInstructionException("label not found: " + mTargetLabel);
+ }
+ targetOffset = targetLabelInstruction.offset;
}
- if (targetLabelInstruction == null) {
- throw new IllegalInstructionException("label not found: " + mTargetLabel);
- }
- // Calculate distance from end of this instruction to instruction.offset.
- final int targetLabelOffset = targetLabelInstruction.offset - (offset + size());
- return targetLabelOffset;
+ // Calculate distance from end of this instruction to targetOffset.
+ return targetOffset - (offset + size());
}
}
@@ -812,9 +813,6 @@
int iterations_remaining = 10;
do {
mTotalSize = updateInstructionOffsets();
- // Update drop and pass label offsets.
- mDropLabel.offset = mTotalSize + 1;
- mPassLabel.offset = mTotalSize;
// Limit run-time in aberant circumstances.
if (iterations_remaining-- == 0) break;
// Attempt to shrink instructions.
@@ -885,21 +883,21 @@
/**
* Return a unique label string.
*/
- public String getUniqueLabel() {
- return "LABEL_" + mLabelCount++;
+ public int getUniqueLabel() {
+ return -(2 + mLabelCount++);
}
/**
* Jump to this label to terminate the program and indicate the packet
* should be dropped.
*/
- public static final String DROP_LABEL = "__DROP__";
+ public static final int DROP_LABEL = 1;
/**
* Jump to this label to terminate the program and indicate the packet
* should be passed to the AP.
*/
- public static final String PASS_LABEL = "__PASS__";
+ public static final int PASS_LABEL = 0;
/**
* Number of memory slots available for access via APF stores to memory and loads from memory.
@@ -984,9 +982,7 @@
final ArrayList<Instruction> mInstructions = new ArrayList<Instruction>();
- private final HashMap<String, Instruction> mLabels = new HashMap<String, Instruction>();
- private final Instruction mDropLabel = new Instruction(Opcodes.LABEL);
- private final Instruction mPassLabel = new Instruction(Opcodes.LABEL);
+ private final HashMap<Integer, Instruction> mLabels = new HashMap<>();
public final int mVersion;
public final int mRamSize;
public final int mClampSize;
diff --git a/tests/unit/src/android/net/apf/ApfTest.java b/tests/unit/src/android/net/apf/ApfTest.java
index cd06ee0..37d8918 100644
--- a/tests/unit/src/android/net/apf/ApfTest.java
+++ b/tests/unit/src/android/net/apf/ApfTest.java
@@ -2873,139 +2873,139 @@
gen.addStoreData(R0, 0);
gen.addLoad16(R0, 12);
gen.addLoadImmediate(R1, -108);
- gen.addJumpIfR0LessThan(0x600, "LABEL_504");
+ gen.addJumpIfR0LessThan(0x600, -504);
gen.addLoadImmediate(R1, -112);
- gen.addJumpIfR0Equals(0x88a2, "LABEL_504");
- gen.addJumpIfR0Equals(0x88a4, "LABEL_504");
- gen.addJumpIfR0Equals(0x88b8, "LABEL_504");
- gen.addJumpIfR0Equals(0x88cd, "LABEL_504");
- gen.addJumpIfR0Equals(0x88e1, "LABEL_504");
- gen.addJumpIfR0Equals(0x88e3, "LABEL_504");
- gen.addJumpIfR0NotEquals(0x806, "LABEL_116");
+ gen.addJumpIfR0Equals(0x88a2, -504);
+ gen.addJumpIfR0Equals(0x88a4, -504);
+ gen.addJumpIfR0Equals(0x88b8, -504);
+ gen.addJumpIfR0Equals(0x88cd, -504);
+ gen.addJumpIfR0Equals(0x88e1, -504);
+ gen.addJumpIfR0Equals(0x88e3, -504);
+ gen.addJumpIfR0NotEquals(0x806, -116);
gen.addLoadImmediate(R0, 14);
gen.addLoadImmediate(R1, -36);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("000108000604"), "LABEL_498");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("000108000604"), -498);
gen.addLoad16(R0, 20);
- gen.addJumpIfR0Equals(0x1, "LABEL_102");
+ gen.addJumpIfR0Equals(0x1, -102);
gen.addLoadImmediate(R1, -40);
- gen.addJumpIfR0NotEquals(0x2, "LABEL_498");
+ gen.addJumpIfR0NotEquals(0x2, -498);
gen.addLoad32(R0, 28);
gen.addLoadImmediate(R1, -116);
- gen.addJumpIfR0Equals(0x0, "LABEL_504");
+ gen.addJumpIfR0Equals(0x0, -504);
gen.addLoadImmediate(R0, 0);
gen.addLoadImmediate(R1, -44);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), "LABEL_498");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), -498);
- gen.defineLabel("LABEL_102");
+ gen.defineLabel(-102);
gen.addLoad32(R0, 38);
gen.addLoadImmediate(R1, -64);
- gen.addJumpIfR0Equals(0x0, "LABEL_504");
+ gen.addJumpIfR0Equals(0x0, -504);
gen.addLoadImmediate(R1, -8);
- gen.addJump("LABEL_498");
+ gen.addJump(-498);
- gen.defineLabel("LABEL_116");
+ gen.defineLabel(-116);
gen.addLoad16(R0, 12);
- gen.addJumpIfR0NotEquals(0x800, "LABEL_207");
+ gen.addJumpIfR0NotEquals(0x800, -207);
gen.addLoad8(R0, 23);
- gen.addJumpIfR0NotEquals(0x11, "LABEL_159");
+ gen.addJumpIfR0NotEquals(0x11, -159);
gen.addLoad16(R0, 20);
- gen.addJumpIfR0AnyBitsSet(0x1fff, "LABEL_159");
+ gen.addJumpIfR0AnyBitsSet(0x1fff, -159);
gen.addLoadFromMemory(R1, MemorySlot.IPV4_HEADER_SIZE);
gen.addLoad16Indexed(R0, 16);
- gen.addJumpIfR0NotEquals(0x44, "LABEL_159");
+ gen.addJumpIfR0NotEquals(0x44, -159);
gen.addLoadImmediate(R0, 50);
gen.addAddR1ToR0();
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("e212507c6345"), "LABEL_159");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("e212507c6345"), -159);
gen.addLoadImmediate(R1, -12);
- gen.addJump("LABEL_498");
+ gen.addJump(-498);
- gen.defineLabel("LABEL_159");
+ gen.defineLabel(-159);
gen.addLoad8(R0, 30);
gen.addAnd(240);
gen.addLoadImmediate(R1, -84);
- gen.addJumpIfR0Equals(0xe0, "LABEL_504");
+ gen.addJumpIfR0Equals(0xe0, -504);
gen.addLoadImmediate(R1, -76);
gen.addLoad32(R0, 30);
- gen.addJumpIfR0Equals(0xffffffff, "LABEL_504");
+ gen.addJumpIfR0Equals(0xffffffff, -504);
gen.addLoadImmediate(R1, -24);
gen.addLoadImmediate(R0, 0);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), "LABEL_498");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), -498);
gen.addLoadImmediate(R1, -72);
- gen.addJump("LABEL_504");
+ gen.addJump(-504);
gen.addLoadImmediate(R1, -16);
- gen.addJump("LABEL_498");
+ gen.addJump(-498);
- gen.defineLabel("LABEL_207");
- gen.addJumpIfR0Equals(0x86dd, "LABEL_231");
+ gen.defineLabel(-207);
+ gen.addJumpIfR0Equals(0x86dd, -231);
gen.addLoadImmediate(R0, 0);
gen.addLoadImmediate(R1, -48);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), "LABEL_498");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), -498);
gen.addLoadImmediate(R1, -56);
- gen.addJump("LABEL_504");
+ gen.addJump(-504);
- gen.defineLabel("LABEL_231");
+ gen.defineLabel(-231);
gen.addLoad8(R0, 20);
- gen.addJumpIfR0Equals(0x3a, "LABEL_249");
+ gen.addJumpIfR0Equals(0x3a, -249);
gen.addLoadImmediate(R1, -104);
gen.addLoad8(R0, 38);
- gen.addJumpIfR0Equals(0xff, "LABEL_504");
+ gen.addJumpIfR0Equals(0xff, -504);
gen.addLoadImmediate(R1, -32);
- gen.addJump("LABEL_498");
+ gen.addJump(-498);
- gen.defineLabel("LABEL_249");
+ gen.defineLabel(-249);
gen.addLoad8(R0, 54);
gen.addLoadImmediate(R1, -88);
- gen.addJumpIfR0Equals(0x85, "LABEL_504");
- gen.addJumpIfR0NotEquals(0x88, "LABEL_283");
+ gen.addJumpIfR0Equals(0x85, -504);
+ gen.addJumpIfR0NotEquals(0x88, -283);
gen.addLoadImmediate(R0, 38);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ff0200000000000000000000000000"), "LABEL_283");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ff0200000000000000000000000000"), -283);
gen.addLoadImmediate(R1, -92);
- gen.addJump("LABEL_504");
+ gen.addJump(-504);
- gen.defineLabel("LABEL_283");
+ gen.defineLabel(-283);
gen.addLoadFromMemory(R0, MemorySlot.PACKET_SIZE);
- gen.addJumpIfR0NotEquals(0xa6, "LABEL_496");
+ gen.addJumpIfR0NotEquals(0xa6, -496);
gen.addLoadFromMemory(R0, MemorySlot.FILTER_AGE_SECONDS);
- gen.addJumpIfR0GreaterThan(0x254, "LABEL_496");
+ gen.addJumpIfR0GreaterThan(0x254, -496);
gen.addLoadImmediate(R0, 0);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("e212507c6345648788fd6df086dd68"), "LABEL_496");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("e212507c6345648788fd6df086dd68"), -496);
gen.addLoadImmediate(R0, 18);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("00703afffe800000000000002a0079e10abc1539fe80000000000000e01250fffe7c63458600"), "LABEL_496");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("00703afffe800000000000002a0079e10abc1539fe80000000000000e01250fffe7c63458600"), -496);
gen.addLoadImmediate(R0, 58);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("4000"), "LABEL_496");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("4000"), -496);
gen.addLoad16(R0, 60);
- gen.addJumpIfR0LessThan(0x254, "LABEL_496");
+ gen.addJumpIfR0LessThan(0x254, -496);
gen.addLoadImmediate(R0, 62);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("0000000000000000"), "LABEL_496");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("0000000000000000"), -496);
gen.addLoadImmediate(R0, 78);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("19050000"), "LABEL_496");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("19050000"), -496);
gen.addLoad32(R0, 82);
- gen.addJumpIfR0LessThan(0x254, "LABEL_496");
+ gen.addJumpIfR0LessThan(0x254, -496);
gen.addLoadImmediate(R0, 86);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("2001486048600000000000000000646420014860486000000000000000000064"), "LABEL_496");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("2001486048600000000000000000646420014860486000000000000000000064"), -496);
gen.addLoadImmediate(R0, 118);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("030440c0"), "LABEL_496");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("030440c0"), -496);
gen.addLoad32(R0, 122);
- gen.addJumpIfR0LessThan(0x254, "LABEL_496");
+ gen.addJumpIfR0LessThan(0x254, -496);
gen.addLoad32(R0, 126);
- gen.addJumpIfR0LessThan(0x254, "LABEL_496");
+ gen.addJumpIfR0LessThan(0x254, -496);
gen.addLoadImmediate(R0, 130);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("00000000"), "LABEL_496");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("00000000"), -496);
gen.addLoadImmediate(R0, 134);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("2a0079e10abc15390000000000000000"), "LABEL_496");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("2a0079e10abc15390000000000000000"), -496);
gen.addLoadImmediate(R1, -60);
- gen.addJump("LABEL_504");
+ gen.addJump(-504);
- gen.defineLabel("LABEL_496");
+ gen.defineLabel(-496);
gen.addLoadImmediate(R1, -28);
- gen.defineLabel("LABEL_498");
+ gen.defineLabel(-498);
gen.addLoadData(R0, 0);
gen.addAdd(1);
gen.addStoreData(R0, 0);
gen.addJump(PASS_LABEL);
- gen.defineLabel("LABEL_504");
+ gen.defineLabel(-504);
gen.addLoadData(R0, 0);
gen.addAdd(1);
gen.addStoreData(R0, 0);
@@ -3027,107 +3027,107 @@
gen.addStoreData(R0, 0);
gen.addLoad16(R0, 12);
gen.addLoadImmediate(R1, -108);
- gen.addJumpIfR0LessThan(0x600, "LABEL_283");
+ gen.addJumpIfR0LessThan(0x600, -283);
gen.addLoadImmediate(R1, -112);
- gen.addJumpIfR0Equals(0x88a2, "LABEL_283");
- gen.addJumpIfR0Equals(0x88a4, "LABEL_283");
- gen.addJumpIfR0Equals(0x88b8, "LABEL_283");
- gen.addJumpIfR0Equals(0x88cd, "LABEL_283");
- gen.addJumpIfR0Equals(0x88e1, "LABEL_283");
- gen.addJumpIfR0Equals(0x88e3, "LABEL_283");
- gen.addJumpIfR0NotEquals(0x806, "LABEL_109");
+ gen.addJumpIfR0Equals(0x88a2, -283);
+ gen.addJumpIfR0Equals(0x88a4, -283);
+ gen.addJumpIfR0Equals(0x88b8, -283);
+ gen.addJumpIfR0Equals(0x88cd, -283);
+ gen.addJumpIfR0Equals(0x88e1, -283);
+ gen.addJumpIfR0Equals(0x88e3, -283);
+ gen.addJumpIfR0NotEquals(0x806, -109);
gen.addLoadImmediate(R0, 14);
gen.addLoadImmediate(R1, -36);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("000108000604"), "LABEL_277");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("000108000604"), -277);
gen.addLoad16(R0, 20);
- gen.addJumpIfR0Equals(0x1, "LABEL_94");
+ gen.addJumpIfR0Equals(0x1, -94);
gen.addLoadImmediate(R1, -40);
- gen.addJumpIfR0NotEquals(0x2, "LABEL_277");
+ gen.addJumpIfR0NotEquals(0x2, -277);
gen.addLoad32(R0, 28);
gen.addLoadImmediate(R1, -116);
- gen.addJumpIfR0Equals(0x0, "LABEL_283");
+ gen.addJumpIfR0Equals(0x0, -283);
gen.addLoadImmediate(R0, 0);
gen.addLoadImmediate(R1, -44);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), "LABEL_277");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), -277);
- gen.defineLabel("LABEL_94");
+ gen.defineLabel(-94);
gen.addLoadImmediate(R0, 38);
gen.addLoadImmediate(R1, -68);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("c0a801b3"), "LABEL_283");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("c0a801b3"), -283);
gen.addLoadImmediate(R1, -8);
- gen.addJump("LABEL_277");
+ gen.addJump(-277);
- gen.defineLabel("LABEL_109");
+ gen.defineLabel(-109);
gen.addLoad16(R0, 12);
- gen.addJumpIfR0NotEquals(0x800, "LABEL_204");
+ gen.addJumpIfR0NotEquals(0x800, -204);
gen.addLoad8(R0, 23);
- gen.addJumpIfR0NotEquals(0x11, "LABEL_151");
+ gen.addJumpIfR0NotEquals(0x11, -151);
gen.addLoad16(R0, 20);
- gen.addJumpIfR0AnyBitsSet(0x1fff, "LABEL_151");
+ gen.addJumpIfR0AnyBitsSet(0x1fff, -151);
gen.addLoadFromMemory(R1, MemorySlot.IPV4_HEADER_SIZE);
gen.addLoad16Indexed(R0, 16);
- gen.addJumpIfR0NotEquals(0x44, "LABEL_151");
+ gen.addJumpIfR0NotEquals(0x44, -151);
gen.addLoadImmediate(R0, 50);
gen.addAddR1ToR0();
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("f683d58f832b"), "LABEL_151");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("f683d58f832b"), -151);
gen.addLoadImmediate(R1, -12);
- gen.addJump("LABEL_277");
+ gen.addJump(-277);
- gen.defineLabel("LABEL_151");
+ gen.defineLabel(-151);
gen.addLoad8(R0, 30);
gen.addAnd(240);
gen.addLoadImmediate(R1, -84);
- gen.addJumpIfR0Equals(0xe0, "LABEL_283");
+ gen.addJumpIfR0Equals(0xe0, -283);
gen.addLoadImmediate(R1, -76);
gen.addLoad32(R0, 30);
- gen.addJumpIfR0Equals(0xffffffff, "LABEL_283");
+ gen.addJumpIfR0Equals(0xffffffff, -283);
gen.addLoadImmediate(R1, -80);
- gen.addJumpIfR0Equals(0xc0a801ff, "LABEL_283");
+ gen.addJumpIfR0Equals(0xc0a801ff, -283);
gen.addLoadImmediate(R1, -24);
gen.addLoadImmediate(R0, 0);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), "LABEL_277");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), -277);
gen.addLoadImmediate(R1, -72);
- gen.addJump("LABEL_283");
+ gen.addJump(-283);
gen.addLoadImmediate(R1, -16);
- gen.addJump("LABEL_277");
+ gen.addJump(-277);
- gen.defineLabel("LABEL_204");
- gen.addJumpIfR0Equals(0x86dd, "LABEL_225");
+ gen.defineLabel(-204);
+ gen.addJumpIfR0Equals(0x86dd, -225);
gen.addLoadImmediate(R0, 0);
gen.addLoadImmediate(R1, -48);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), "LABEL_277");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), -277);
gen.addLoadImmediate(R1, -56);
- gen.addJump("LABEL_283");
+ gen.addJump(-283);
- gen.defineLabel("LABEL_225");
+ gen.defineLabel(-225);
gen.addLoad8(R0, 20);
- gen.addJumpIfR0Equals(0x3a, "LABEL_241");
+ gen.addJumpIfR0Equals(0x3a, -241);
gen.addLoadImmediate(R1, -104);
gen.addLoad8(R0, 38);
- gen.addJumpIfR0Equals(0xff, "LABEL_283");
+ gen.addJumpIfR0Equals(0xff, -283);
gen.addLoadImmediate(R1, -32);
- gen.addJump("LABEL_277");
+ gen.addJump(-277);
- gen.defineLabel("LABEL_241");
+ gen.defineLabel(-241);
gen.addLoad8(R0, 54);
gen.addLoadImmediate(R1, -88);
- gen.addJumpIfR0Equals(0x85, "LABEL_283");
- gen.addJumpIfR0NotEquals(0x88, "LABEL_275");
+ gen.addJumpIfR0Equals(0x85, -283);
+ gen.addJumpIfR0NotEquals(0x88, -275);
gen.addLoadImmediate(R0, 38);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ff0200000000000000000000000000"), "LABEL_275");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ff0200000000000000000000000000"), -275);
gen.addLoadImmediate(R1, -92);
- gen.addJump("LABEL_283");
+ gen.addJump(-283);
- gen.defineLabel("LABEL_275");
+ gen.defineLabel(-275);
gen.addLoadImmediate(R1, -28);
- gen.defineLabel("LABEL_277");
+ gen.defineLabel(-277);
gen.addLoadData(R0, 0);
gen.addAdd(1);
gen.addStoreData(R0, 0);
gen.addJump(PASS_LABEL);
- gen.defineLabel("LABEL_283");
+ gen.defineLabel(-283);
gen.addLoadData(R0, 0);
gen.addAdd(1);
gen.addStoreData(R0, 0);
@@ -3155,38 +3155,38 @@
gen.addJumpIfR0Equals(0x88cd, gen.mCountAndDropLabel);
gen.addJumpIfR0Equals(0x88e1, gen.mCountAndDropLabel);
gen.addJumpIfR0Equals(0x88e3, gen.mCountAndDropLabel);
- gen.addJumpIfR0NotEquals(0x806, "LABEL_115");
+ gen.addJumpIfR0NotEquals(0x806, -115);
gen.addLoadImmediate(R0, 14);
gen.addCountAndPassIfBytesAtR0NotEqual(hexStringToByteArray("000108000604"), getCounterEnumFromOffset(-36));
gen.addLoad16(R0, 20);
- gen.addJumpIfR0Equals(0x1, "LABEL_100");
+ gen.addJumpIfR0Equals(0x1, -100);
gen.addCountAndPassIfR0NotEquals(0x2, getCounterEnumFromOffset(-40));
gen.addLoad32(R0, 28);
gen.addCountAndDropIfR0Equals(0x0, getCounterEnumFromOffset(-116));
gen.addLoadImmediate(R0, 0);
gen.addCountAndPassIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), getCounterEnumFromOffset(-44));
- gen.defineLabel("LABEL_100");
+ gen.defineLabel(-100);
gen.addLoadImmediate(R0, 38);
gen.addCountAndDropIfBytesAtR0NotEqual(hexStringToByteArray("c0a801be"), getCounterEnumFromOffset(-68));
gen.addCountAndPass(getCounterEnumFromOffset(-8));
- gen.defineLabel("LABEL_115");
+ gen.defineLabel(-115);
gen.addLoad16(R0, 12);
- gen.addJumpIfR0NotEquals(0x800, "LABEL_263");
+ gen.addJumpIfR0NotEquals(0x800, -263);
gen.addLoad8(R0, 23);
- gen.addJumpIfR0NotEquals(0x11, "LABEL_157");
+ gen.addJumpIfR0NotEquals(0x11, -157);
gen.addLoad16(R0, 20);
- gen.addJumpIfR0AnyBitsSet(0x1fff, "LABEL_157");
+ gen.addJumpIfR0AnyBitsSet(0x1fff, -157);
gen.addLoadFromMemory(R1, MemorySlot.IPV4_HEADER_SIZE);
gen.addLoad16Indexed(R0, 16);
- gen.addJumpIfR0NotEquals(0x44, "LABEL_157");
+ gen.addJumpIfR0NotEquals(0x44, -157);
gen.addLoadImmediate(R0, 50);
gen.addAddR1ToR0();
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ea42226789c0"), "LABEL_157");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ea42226789c0"), -157);
gen.addCountAndPass(getCounterEnumFromOffset(-12));
- gen.defineLabel("LABEL_157");
+ gen.defineLabel(-157);
gen.addLoad8(R0, 30);
gen.addAnd(240);
gen.addCountAndDropIfR0Equals(0xe0, getCounterEnumFromOffset(-84));
@@ -3195,55 +3195,55 @@
gen.addJumpIfR0Equals(0xffffffff, gen.mCountAndDropLabel);
gen.addCountAndDropIfR0Equals(0xc0a801ff, getCounterEnumFromOffset(-80));
gen.addLoad8(R0, 23);
- gen.addJumpIfR0NotEquals(0x11, "LABEL_243");
+ gen.addJumpIfR0NotEquals(0x11, -243);
gen.addLoadImmediate(R0, 26);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("6b7a1f1fc0a801be"), "LABEL_243");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("6b7a1f1fc0a801be"), -243);
gen.addLoadFromMemory(R0, MemorySlot.IPV4_HEADER_SIZE);
gen.addAdd(8);
gen.addSwap();
gen.addLoad16(R0, 16);
gen.addNeg(R1);
gen.addAddR1ToR0();
- gen.addJumpIfR0NotEquals(0x1, "LABEL_243");
+ gen.addJumpIfR0NotEquals(0x1, -243);
gen.addLoadFromMemory(R0, MemorySlot.IPV4_HEADER_SIZE);
gen.addAdd(14);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("1194ceca"), "LABEL_243");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("1194ceca"), -243);
gen.addAdd(8);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ff"), "LABEL_243");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ff"), -243);
gen.addCountAndDrop(getCounterEnumFromOffset(-128));
- gen.defineLabel("LABEL_243");
+ gen.defineLabel(-243);
gen.addLoadImmediate(R1, -24);
gen.addLoadImmediate(R0, 0);
gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), gen.mCountAndPassLabel);
gen.addCountAndDrop(getCounterEnumFromOffset(-72));
gen.addCountAndPass(getCounterEnumFromOffset(-16));
- gen.defineLabel("LABEL_263");
- gen.addJumpIfR0Equals(0x86dd, "LABEL_284");
+ gen.defineLabel(-263);
+ gen.addJumpIfR0Equals(0x86dd, -284);
gen.addLoadImmediate(R0, 0);
gen.addCountAndPassIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), getCounterEnumFromOffset(-48));
gen.addCountAndDrop(getCounterEnumFromOffset(-56));
- gen.defineLabel("LABEL_284");
+ gen.defineLabel(-284);
gen.addLoad8(R0, 20);
gen.addJumpIfR0Equals(0x0, gen.mCountAndPassLabel);
- gen.addJumpIfR0Equals(0x3a, "LABEL_303");
+ gen.addJumpIfR0Equals(0x3a, -303);
gen.addLoadImmediate(R1, -104);
gen.addLoad8(R0, 38);
gen.addJumpIfR0Equals(0xff, gen.mCountAndDropLabel);
gen.addCountAndPass(getCounterEnumFromOffset(-32));
- gen.defineLabel("LABEL_303");
+ gen.defineLabel(-303);
gen.addLoad8(R0, 54);
gen.addLoadImmediate(R1, -88);
gen.addJumpIfR0Equals(0x85, gen.mCountAndDropLabel);
- gen.addJumpIfR0NotEquals(0x88, "LABEL_337");
+ gen.addJumpIfR0NotEquals(0x88, -337);
gen.addLoadImmediate(R0, 38);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ff0200000000000000000000000000"), "LABEL_337");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ff0200000000000000000000000000"), -337);
gen.addCountAndDrop(getCounterEnumFromOffset(-92));
- gen.defineLabel("LABEL_337");
+ gen.defineLabel(-337);
gen.addLoadImmediate(R1, -28);
gen.addCountTrampoline();
@@ -3270,38 +3270,38 @@
gen.addJumpIfR0Equals(0x88cd, gen.mCountAndDropLabel);
gen.addJumpIfR0Equals(0x88e1, gen.mCountAndDropLabel);
gen.addJumpIfR0Equals(0x88e3, gen.mCountAndDropLabel);
- gen.addJumpIfR0NotEquals(0x806, "LABEL_122");
+ gen.addJumpIfR0NotEquals(0x806, -122);
gen.addLoadImmediate(R0, 14);
gen.addCountAndDropIfBytesAtR0NotEqual(hexStringToByteArray("000108000604"), getCounterEnumFromOffset(-152));
gen.addLoad16(R0, 20);
- gen.addJumpIfR0Equals(0x1, "LABEL_104");
+ gen.addJumpIfR0Equals(0x1, -104);
gen.addCountAndDropIfR0NotEquals(0x2, getCounterEnumFromOffset(-156));
gen.addLoad32(R0, 28);
gen.addCountAndDropIfR0Equals(0x0, getCounterEnumFromOffset(-128));
gen.addLoadImmediate(R0, 0);
gen.addCountAndPassIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), getCounterEnumFromOffset(-56));
- gen.defineLabel("LABEL_104");
+ gen.defineLabel(-104);
gen.addLoadImmediate(R0, 38);
gen.addCountAndDropIfBytesAtR0NotEqual(hexStringToByteArray("c0a801ec"), getCounterEnumFromOffset(-80));
gen.addCountAndPass(getCounterEnumFromOffset(-20));
- gen.defineLabel("LABEL_122");
+ gen.defineLabel(-122);
gen.addLoad16(R0, 12);
- gen.addJumpIfR0NotEquals(0x800, "LABEL_249");
+ gen.addJumpIfR0NotEquals(0x800, -249);
gen.addLoad8(R0, 23);
- gen.addJumpIfR0NotEquals(0x11, "LABEL_165");
+ gen.addJumpIfR0NotEquals(0x11, -165);
gen.addLoad16(R0, 20);
- gen.addJumpIfR0AnyBitsSet(0x1fff, "LABEL_165");
+ gen.addJumpIfR0AnyBitsSet(0x1fff, -165);
gen.addLoadFromMemory(R1, MemorySlot.IPV4_HEADER_SIZE);
gen.addLoad16Indexed(R0, 16);
- gen.addJumpIfR0NotEquals(0x44, "LABEL_165");
+ gen.addJumpIfR0NotEquals(0x44, -165);
gen.addLoadImmediate(R0, 50);
gen.addAddR1ToR0();
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("7e9046bc7008"), "LABEL_165");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("7e9046bc7008"), -165);
gen.addCountAndPass(getCounterEnumFromOffset(-24));
- gen.defineLabel("LABEL_165");
+ gen.defineLabel(-165);
gen.addLoad8(R0, 30);
gen.addAnd(240);
gen.addCountAndDropIfR0Equals(0xe0, getCounterEnumFromOffset(-96));
@@ -3310,90 +3310,90 @@
gen.addJumpIfR0Equals(0xffffffff, gen.mCountAndDropLabel);
gen.addCountAndDropIfR0Equals(0xc0a801ff, getCounterEnumFromOffset(-92));
gen.addLoad8(R0, 23);
- gen.addJumpIfR0NotEquals(0x6, "LABEL_225");
+ gen.addJumpIfR0NotEquals(0x6, -225);
gen.addLoad16(R0, 20);
- gen.addJumpIfR0AnyBitsSet(0x1fff, "LABEL_225");
+ gen.addJumpIfR0AnyBitsSet(0x1fff, -225);
gen.addLoadFromMemory(R1, MemorySlot.IPV4_HEADER_SIZE);
gen.addLoad16Indexed(R0, 16);
- gen.addJumpIfR0NotEquals(0x7, "LABEL_225");
+ gen.addJumpIfR0NotEquals(0x7, -225);
gen.addCountAndDrop(getCounterEnumFromOffset(-148));
- gen.defineLabel("LABEL_225");
+ gen.defineLabel(-225);
gen.addLoadImmediate(R1, -36);
gen.addLoadImmediate(R0, 0);
gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), gen.mCountAndPassLabel);
gen.addCountAndDrop(getCounterEnumFromOffset(-84));
gen.addCountAndPass(getCounterEnumFromOffset(-28));
- gen.defineLabel("LABEL_249");
- gen.addJumpIfR0Equals(0x86dd, "LABEL_273");
+ gen.defineLabel(-249);
+ gen.addJumpIfR0Equals(0x86dd, -273);
gen.addLoadImmediate(R0, 0);
gen.addCountAndPassIfBytesAtR0NotEqual(hexStringToByteArray("ffffffffffff"), getCounterEnumFromOffset(-60));
gen.addCountAndDrop(getCounterEnumFromOffset(-68));
- gen.defineLabel("LABEL_273");
+ gen.defineLabel(-273);
gen.addLoad8(R0, 20);
gen.addJumpIfR0Equals(0x0, gen.mCountAndPassLabel);
- gen.addJumpIfR0Equals(0x3a, "LABEL_297");
+ gen.addJumpIfR0Equals(0x3a, -297);
gen.addLoadImmediate(R1, -116);
gen.addLoad8(R0, 38);
gen.addJumpIfR0Equals(0xff, gen.mCountAndDropLabel);
gen.addCountAndPass(getCounterEnumFromOffset(-44));
- gen.defineLabel("LABEL_297");
+ gen.defineLabel(-297);
gen.addLoad8(R0, 54);
gen.addCountAndDropIfR0Equals(0x85, getCounterEnumFromOffset(-100));
- gen.addJumpIfR0NotEquals(0x88, "LABEL_333");
+ gen.addJumpIfR0NotEquals(0x88, -333);
gen.addLoadImmediate(R0, 38);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ff0200000000000000000000000000"), "LABEL_333");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("ff0200000000000000000000000000"), -333);
gen.addCountAndDrop(getCounterEnumFromOffset(-104));
- gen.defineLabel("LABEL_333");
+ gen.defineLabel(-333);
gen.addLoadFromMemory(R0, MemorySlot.PACKET_SIZE);
- gen.addJumpIfR0NotEquals(0x96, "LABEL_574");
+ gen.addJumpIfR0NotEquals(0x96, -574);
gen.addLoadFromMemory(R0, MemorySlot.FILTER_AGE_SECONDS);
- gen.addJumpIfR0GreaterThan(0x48e, "LABEL_574");
+ gen.addJumpIfR0GreaterThan(0x48e, -574);
gen.addLoadImmediate(R0, 0);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("7e9046bc700828c68e23672c86dd60"), "LABEL_574");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("7e9046bc700828c68e23672c86dd60"), -574);
gen.addLoadImmediate(R0, 18);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("00603afffe800000000000002ac68efffe23672c"), "LABEL_574");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("00603afffe800000000000002ac68efffe23672c"), -574);
gen.addLoadImmediate(R0, 54);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("8600"), "LABEL_574");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("8600"), -574);
gen.addLoadImmediate(R0, 58);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("40c0"), "LABEL_574");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("40c0"), -574);
gen.addLoad16(R0, 60);
- gen.addJumpIfR0Equals(0x0, "LABEL_574");
- gen.addJumpIfR0LessThan(0xb4, "LABEL_421");
- gen.addJumpIfR0LessThan(0x91e, "LABEL_574");
- gen.addJumpIfR0GreaterThan(0x1b58, "LABEL_574");
+ gen.addJumpIfR0Equals(0x0, -574);
+ gen.addJumpIfR0LessThan(0xb4, -421);
+ gen.addJumpIfR0LessThan(0x91e, -574);
+ gen.addJumpIfR0GreaterThan(0x1b58, -574);
- gen.defineLabel("LABEL_421");
+ gen.defineLabel(-421);
gen.addLoadImmediate(R0, 62);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("0000000000000000010128c68e23672c05010000000005dc030440c0"), "LABEL_574");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("0000000000000000010128c68e23672c05010000000005dc030440c0"), -574);
gen.addLoad32(R0, 90);
- gen.addJumpIfR0Equals(0x0, "LABEL_574");
- gen.addJumpIfR0LessThan(0xb4, "LABEL_480");
- gen.addJumpIfR0LessThan(0x55555555, "LABEL_574");
- gen.addJumpIfR0GreaterThan(0xffffffffL, "LABEL_574");
+ gen.addJumpIfR0Equals(0x0, -574);
+ gen.addJumpIfR0LessThan(0xb4, -480);
+ gen.addJumpIfR0LessThan(0x55555555, -574);
+ gen.addJumpIfR0GreaterThan(0xffffffffL, -574);
- gen.defineLabel("LABEL_480");
+ gen.defineLabel(-480);
gen.addLoad32(R0, 94);
- gen.addJumpIfR0LessThan(0x55555555, "LABEL_574");
- gen.addJumpIfR0GreaterThan(0xffffffffL, "LABEL_574");
+ gen.addJumpIfR0LessThan(0x55555555, -574);
+ gen.addJumpIfR0GreaterThan(0xffffffffL, -574);
gen.addLoadImmediate(R0, 98);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("000000002401fa000480f000000000000000000019030000"), "LABEL_574");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("000000002401fa000480f000000000000000000019030000"), -574);
gen.addLoad32(R0, 122);
- gen.addJumpIfR0Equals(0x0, "LABEL_574");
- gen.addJumpIfR0LessThan(0x78, "LABEL_547");
- gen.addJumpIfR0LessThan(0x91e, "LABEL_574");
- gen.addJumpIfR0GreaterThan(0x1b58, "LABEL_574");
+ gen.addJumpIfR0Equals(0x0, -574);
+ gen.addJumpIfR0LessThan(0x78, -547);
+ gen.addJumpIfR0LessThan(0x91e, -574);
+ gen.addJumpIfR0GreaterThan(0x1b58, -574);
- gen.defineLabel("LABEL_547");
+ gen.defineLabel(-547);
gen.addLoadImmediate(R0, 126);
- gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("2401fa000480f00000000000000000010701"), "LABEL_574");
+ gen.addJumpIfBytesAtR0NotEqual(hexStringToByteArray("2401fa000480f00000000000000000010701"), -574);
gen.addCountAndDrop(getCounterEnumFromOffset(-72));
- gen.defineLabel("LABEL_574");
+ gen.defineLabel(-574);
gen.addLoadImmediate(R1, -40);
gen.addCountTrampoline();