[OpenJDK Rasterizer] Prototype of cache classes

Jim Graham james.graham at oracle.com
Wed Jul 1 00:52:09 UTC 2015


Hi Laurent,

I made an initial stab at a prototype of some cache management classes 
that I think might aid in maintenance:

http://cr.openjdk.java.net/~flar/MarlinArrayCaches/webrev.00/

Some notes:

- All classes live in the default package as I prototyped them in isolation.

- NetBeans claims they will compile, but I haven't actually compiled 
them or tested them as this is just a proof of concept template so far.

- No use of Refs anywhere, TBD

- No attempts to share the base array buckets between multiple caches.

- DO_CLEAN_DIRTY and STATS are both handled via delegating wrappers 
which means they can be present in production code and enabled by a 
command line variable at runtime with absolutely no performance impact 
if they aren't used.

- The widen/put interface is common between the Clean and Dirty caches - 
I did that for simplicity, but in reality you pass in more information 
to the "Clean" version of those methods in your static methods so we 
should fix that up.  It will likely require different method signatures, 
and therefore less implementation sharing, between the Clean/Dirty 
caches, but that is fine if it saves having to clear data unnecessarily. 
  This would also mean that the wrappers for STATS and DO_CLEAN_DIRTY 
will also need to be duplicated for both variants as well.

- The Int/Float versions of the classes can be auto-generated from the 
Byte versions with a sed script (included).

I'm envisioning these getting used something like:

MarlinConst:
public CacheGrowthStrategy defaultStrategy = new 
ExponentialGrowthStrategy(...);

Renderer:
private IntArrayGrowthSource edgeCache =
     IntArrayGrowthCache.getDirtyInstance(defaultStrategy, "Edge Array");
...
// No STAT or CLEAN_DIRTY code needed
edges = edgeCache.getDefaultArray();
...
// No STAT or CLEAN_DIRTY code needed
edges = edgeCache.widen(edges, numused, newsize);
...
// No STAT or CLEAN_DIRTY code needed
edgeCache.putArray(edges);
edges = null;

			...jim


More information about the graphics-rasterizer-dev mailing list