-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
Description
The EV3 VM can only run one copy of each bytecode object (vmthread/block/subcall) because of the way the local variables are allocated. However, you can emit multiple object headers that point to the same instructions to duplicate an object.
Currently, there is a compiler "optimization" that detects duplicate objects. However, it would be nice to be able to write an object once in the assembly code instead of multiple times.
We will need to come up with a syntax for this. For example, we could use the common array notation:
// declare a subroutine with two instances
subcall MySub[2] {
// do suff
}
vmthread Thread1 {
// call the first instance
CALL(MySub[0])
}
vmthread Thread2 {
// call the second instance
CALL(MySub[1])
}
vmthread Thread2 {
// compiler error: missing index
CALL(MySub)
}
vmthread Thread2 {
// compiler error: index out of range
CALL(MySub[3])
}