When importing other modules we define full definitions (i.e., function bodies) where declarations would have been sufficient. In fact these definitions are marked inline so we end up having to compile the same body again and again. We do this transitively for all imported modules, so the issue gets worse the longer the import chain and the more types become visible.
# @TEST-EXEC-FAIL: TMPDIR=$PWD spicyc -dj x?.spicy -T # Fail to keep generated files around.
# @TEST-START-FILE x1.spicy
module x1;
public type X1 = unit {
x1: uint8;
};
# @TEST-END-FILE
# @TEST-START-FILE x2.spicy
module x2;
import x1;
public type X2 = unit {
x2: uint8;
};
# @TEST-END-FILE
The C++ files emitted for each module contain
full constructors for every defined type, e.g., in x2_*.cc
When importing other modules we define full definitions (i.e., function bodies) where declarations would have been sufficient. In fact these definitions are marked
inline
so we end up having to compile the same body again and again. We do this transitively for all imported modules, so the issue gets worse the longer the import chain and the more types become visible.The C++ files emitted for each module contain
full constructors for every defined type, e.g., in
x2_*.cc
full streaming operators for each type, e.g., in
x2_*.cc
there are also a lot of declarations of types, but these might typically also be found in a header file and seem like a separate issue
It should be possible to drop these definitions for the declarations we already emit.