Skip to content

Commit

Permalink
GP-4705: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmkurtz committed Aug 6, 2024
1 parent de99473 commit df9f27e
Showing 1 changed file with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,49 +234,41 @@ else if (opObj instanceof Register) {
return actionOK;
}

private Address buildDestinationAddress(AddressSpace addrSpace,
Address sourceAddress, long offset) {
private Address buildDestinationAddress(AddressSpace addrSpace, Address sourceAddress,
long offset) {
try {
if ((addrSpace instanceof SegmentedAddressSpace) &&
(sourceAddress instanceof SegmentedAddress)) {
return ((SegmentedAddressSpace) addrSpace).getAddress(
((SegmentedAddress) sourceAddress).getSegment(),
if ((addrSpace instanceof SegmentedAddressSpace segmentedSpace) &&
(sourceAddress instanceof SegmentedAddress segmentedAddr)) {
return segmentedSpace.getAddress(segmentedAddr.getSegment(),
(int) (offset & 0xFFFF));
}

return addrSpace.getAddress(offset, true);
return addrSpace.getAddress(offset, true);
}
catch (AddressOutOfBoundsException ei) {
catch (AddressOutOfBoundsException e) {
return null;
}

return null;
}

private boolean initMemoryAddress(AddressFactory addrFactory, long offset) {
// Use the context's address space.


// First try the context's address space
AddressSpace contextAddrSpace = context.getAddress().getAddressSpace();
Address address = buildDestinationAddress(contextAddrSpace,
context.getAddress(), offset);
Address address = buildDestinationAddress(contextAddrSpace, context.getAddress(), offset);
if (address != null) {
memAddr = address;
return true;
}

// Try the default space.


// Now try the default space
AddressSpace defaultSpace = addrFactory.getDefaultAddressSpace();
if (contextAddrSpace != defaultSpace) {
address = buildDestinationAddress(defaultSpace, context.getAddress(),
offset);
address = buildDestinationAddress(defaultSpace, context.getAddress(), offset);
}
if (address != null) {
memAddr = address;
return true;
}

// Ignore.


return false;
}

Expand Down

0 comments on commit df9f27e

Please sign in to comment.