# HG changeset patch # User Roland Schatz # Date 1367505104 -7200 # Node ID 688219709f7bea4ca79d815143ad031c0b4a4937 # Parent 2b7857aaa1c044e34c1b0978bc21aad9fecc9cf3 Remove StackSlot and RegisterValue cache. diff -r 2b7857aaa1c0 -r 688219709f7b graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java Thu May 02 16:30:31 2013 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java Thu May 02 16:31:44 2013 +0200 @@ -23,7 +23,6 @@ package com.oracle.graal.api.code; import java.io.*; -import java.util.*; import com.oracle.graal.api.meta.*; @@ -80,12 +79,6 @@ private final RegisterCategory registerCategory; /** - * An array of {@link RegisterValue} objects, for this register, with one entry per {@link Kind} - * , indexed by {@link Kind#ordinal}. - */ - private final HashMap values; - - /** * A platform specific register type that describes which values can be stored in a register. */ public static class RegisterCategory { @@ -115,7 +108,6 @@ this.name = name; this.registerCategory = registerCategory; this.encoding = encoding; - this.values = new HashMap<>(); } public RegisterCategory getRegisterCategory() { @@ -129,13 +121,7 @@ * @return the {@link RegisterValue} */ public RegisterValue asValue(PlatformKind kind) { - if (values.containsKey(kind)) { - return values.get(kind); - } else { - RegisterValue ret = new RegisterValue(kind, this); - values.put(kind, ret); - return ret; - } + return new RegisterValue(kind, this); } /** diff -r 2b7857aaa1c0 -r 688219709f7b graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java Thu May 02 16:30:31 2013 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java Thu May 02 16:31:44 2013 +0200 @@ -22,8 +22,6 @@ */ package com.oracle.graal.api.code; -import java.util.*; - import com.oracle.graal.api.meta.*; /** @@ -48,21 +46,6 @@ */ public static StackSlot get(PlatformKind kind, int offset, boolean addFrameSize) { assert addFrameSize || offset >= 0; - - if (offset % CACHE_GRANULARITY == 0) { - StackSlot slot; - if (!addFrameSize) { - slot = OUT_CACHE.lookup(kind, offset); - } else if (offset >= 0) { - slot = IN_CACHE.lookup(kind, offset); - } else { - slot = SPILL_CACHE.lookup(kind, offset); - } - if (slot != null) { - assert slot.getPlatformKind().equals(kind) && slot.offset == offset && slot.addFrameSize == addFrameSize; - return slot; - } - } return new StackSlot(kind, offset, addFrameSize); } @@ -149,44 +132,4 @@ } return this; } - - private static final int SPILL_CACHE_PER_KIND_SIZE = 100; - private static final int PARAM_CACHE_PER_KIND_SIZE = 10; - private static final int CACHE_GRANULARITY = 8; - - private static class Cache extends HashMap { - - private static final long serialVersionUID = 4424132866289682843L; - - private final int cachePerKindSize; - private final int sign; - private final boolean addFrameSize; - - Cache(int cachePerKindSize, int sign, boolean addFrameSize) { - this.cachePerKindSize = cachePerKindSize; - this.sign = sign; - this.addFrameSize = addFrameSize; - } - - StackSlot lookup(PlatformKind kind, int offset) { - int index = sign * offset / CACHE_GRANULARITY; - StackSlot[] slots = this.get(kind); - if (slots == null) { - slots = new StackSlot[cachePerKindSize]; - for (int i = 0; i < cachePerKindSize; i++) { - slots[i] = new StackSlot(kind, sign * i * CACHE_GRANULARITY, addFrameSize); - } - this.put(kind, slots); - } - if (index < slots.length) { - return slots[index]; - } else { - return null; - } - } - } - - private static final Cache SPILL_CACHE = new Cache(SPILL_CACHE_PER_KIND_SIZE, -1, true); - private static final Cache IN_CACHE = new Cache(PARAM_CACHE_PER_KIND_SIZE, 1, true); - private static final Cache OUT_CACHE = new Cache(PARAM_CACHE_PER_KIND_SIZE, 1, false); }