Fortran stores matrix in Column-Major ordering, while normal backends stores matrix in Row-Major ordering, which will brings trouble.
I will use matrix transpose as an example to explain.
1 Problem
Consider following example:
In Fortran, we create a matrix A, print it, stores in memory and returns a pointer pF.
Pass pF to a different backend, suppose C++, do a transpose and stores the result in pc
Back to Fortran, recover data from pC, print it.
Question: will step 3 print the correct result as we expected?
This blog is aiming to sort out some parsing concepts, especially, by walking through a simple CFG example.
Most concepts are from Stanford CS143 Compilers, and Compilers: Principles, Techniques, & Tools (A.K.A the Dragon Book).
This blog is just reflecting and trying to deepen my own understanding of the topic,
you should refer to the course and the book for stricter definitions.
CFG Example
E→E+E∣id(CFG-1)
LR(0) DFA
States of the DFA
I0:
E′→.E
E→.E+E (ϵ transition from above transition, similar below)
The problem of VIPT(Virtual Indexed Physical Tagged) cache is that multiple virtual addresses can be mapped to the same physical address. This is not a problem for physical indexed and physical tagged cache (AKA, the standard practice), but for VIPT, the virtual address can fetch memory blocks to different caches, once a cache has been written, there’s a problem of inconsistency, whcih is so-called “aliasing”.
To prevent it, we can make those virtual addresses mapped to the same cache. Let’s check a virtual address: