From 65e41b24903337e01d721b1b3083211faf7cee20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Sun, 20 Sep 2020 13:58:06 +0200 Subject: [PATCH] Removed dead code. --- .../circuity/api/vm/device/Interrupter.java | 44 ------------------- .../R5PlatformLevelInterruptController.java | 21 +-------- 2 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 src/main/java/li/cil/circuity/api/vm/device/Interrupter.java diff --git a/src/main/java/li/cil/circuity/api/vm/device/Interrupter.java b/src/main/java/li/cil/circuity/api/vm/device/Interrupter.java deleted file mode 100644 index e22ecb2d..00000000 --- a/src/main/java/li/cil/circuity/api/vm/device/Interrupter.java +++ /dev/null @@ -1,44 +0,0 @@ -package li.cil.circuity.api.vm.device; - -/** - * An interrupter is an interrupt controller that will raise some interrupt based on interrupts - * it received. - *

- * Implementations track a list of registered interrupts to allow devices being connected to the - * controller without these devices having to know of each other. Additionally, this list - * of registered interrupt ids shall be persisted to allow devices to reclaim their interrupt - * ids after a load. Implementations may decide to only retain ids for reclaiming for one - * load iteration, i.e. any ids that have not been reclaimed after a load when the next save - * occurs may be freed for regular registration again. - */ -public interface Interrupter extends InterruptController { - /** - * Register a new interrupt. - *

- * Use this to reserve a new interrupt with an arbitrary id. - * - * @return the id of the registered interrupt; -1 if no more interrupts can be registered. - */ - int registerInterrupt(); - - /** - * Register an interrupt with a specific id. - *

- * Use this to reclaim an interrupt ID after state has been restored for example, i.e. a savegame has been loaded. - * - * @param id the id to reclaim. - * @return true if this id had not yet been claimed; false otherwise. - */ - boolean registerInterrupt(final int id); - - /** - * Release an interrupt id. - *

- * This can be used to return the lease on an interrupt id to the controller so it can be handed out in future - * {@link #registerInterrupt()} calls. Typically this should be called by devices that have been disconnected - * from the controller for any reason. - * - * @param id the id to return to the pool of available ids. - */ - void releaseInterrupt(final int id); -} diff --git a/src/main/java/li/cil/circuity/vm/riscv/device/R5PlatformLevelInterruptController.java b/src/main/java/li/cil/circuity/vm/riscv/device/R5PlatformLevelInterruptController.java index 7e49ebbd..cea9c1a1 100644 --- a/src/main/java/li/cil/circuity/vm/riscv/device/R5PlatformLevelInterruptController.java +++ b/src/main/java/li/cil/circuity/vm/riscv/device/R5PlatformLevelInterruptController.java @@ -3,9 +3,7 @@ package li.cil.circuity.vm.riscv.device; import li.cil.circuity.api.vm.Interrupt; import li.cil.circuity.api.vm.device.InterruptController; import li.cil.circuity.api.vm.device.InterruptSource; -import li.cil.circuity.api.vm.device.Interrupter; import li.cil.circuity.api.vm.device.memory.MemoryMappedDevice; -import li.cil.circuity.vm.components.InterruptSourceRegistry; import li.cil.circuity.vm.riscv.R5; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -20,7 +18,7 @@ import java.util.concurrent.atomic.AtomicInteger; * See: https://github.com/riscv/riscv-plic-spec/blob/master/riscv-plic.adoc * See: https://github.com/riscv/opensbi/blob/master/lib/utils/irqchip/plic.c */ -public class R5PlatformLevelInterruptController implements MemoryMappedDevice, Interrupter, InterruptSource { +public class R5PlatformLevelInterruptController implements MemoryMappedDevice, InterruptController, InterruptSource { private static final Logger LOGGER = LogManager.getLogger(); private static final int PLIC_PRIORITY_BASE = 0x000004; @@ -35,8 +33,6 @@ public class R5PlatformLevelInterruptController implements MemoryMappedDevice, I private static final int PLIC_CONTEXT_COUNT = 2; // MEIP and SEIP for one hart. private static final int PLIC_MAX_PRIORITY = 7; // Number of priority level supported. Must have all bits set. - private final InterruptSourceRegistry interrupts = new InterruptSourceRegistry(); - private final Interrupt meip = new Interrupt(R5.MEIP_SHIFT); private final Interrupt seip = new Interrupt(R5.SEIP_SHIFT); @@ -245,21 +241,6 @@ public class R5PlatformLevelInterruptController implements MemoryMappedDevice, I return Arrays.asList(interruptByContext); } - @Override - public int registerInterrupt() { - return interrupts.registerInterrupt(); - } - - @Override - public boolean registerInterrupt(final int id) { - return interrupts.registerInterrupt(id); - } - - @Override - public void releaseInterrupt(final int id) { - interrupts.releaseInterrupt(id); - } - private boolean hasPending(final int context) { for (int i = 0; i < sourceWords; i++) { final int unclaimed = (pending[i].get() & ~claimed[i].get()) & enabled[context * sourceWords + i];