ScopedMemory
From JopWiki
ScopedMemory is an RTSJ memory area that resembles stack allocation in Java.
Contents |
[edit] ScopedMemory on JOP
A very rough implementation of ScopedMemory is available on JOP. However, there are following issues:
- Scopes do not work with the GC
- Copy would need to update the references in the scope
- Write barrier on putfield/putstatic for references does not work with the handle layout in the scope
- Scopes need to be scanned for references into the heap
- Are scopes live when we use the SCJ GC approach?
- Use the flag in GC.java to decide on scope usage
- Illegal assignments are not checked
- A little bit hard to implement especially when it should be WCET predictable and fast
- DANGER: can result in dangling references and a crash of the JVM
[edit] Scratchpad memory
On-chip memory can be used as fast scratchpad memory to reduce the bandwidth pressure on a JOP CMP system.
[edit] Shared Scopes on JOP
- Implement with a configurable dual port on-chip memory
- Maximum number of threads is 2
- Scope has to be pinned
[edit] Enable Scratchpad Scopes
A first version of a scratchpad scope is implemented in javax.realtime.ScratchpadScope. The HW objects are used to map the on-chip memory to a Java array that is used as backing memory. For a test change the JOP sources with following steps:
Disable the GC with
final static boolean USE_SCOPES = true;
Set the scope size (e.g. 1 KB) in a top-level VHDL file
entity jop is
generic (
...
block_bits : integer := 4; -- 2*block_bits is number of cache blocks
spm_width : integer := 8 -- size of scratchpad RAM (in number of address bits for 32-bit words)
);
Recompile JOP and run an example with
make japp -e P1=rtapi P2=examples/scopes P3=LocalScope
