G1 non-full collections use a compact representation of a partial objarray scan, so that normal object scan tasks (oop* and narrowOop*) and partial objarray scan tasks can co-exist in the same taskqueue. (This is similar to ParallelGC young collections, but differs from G1 full collections, ParallelGC, and SerialGC, which all use ObjArrayTasks segregated into separate queues from the reference tasks.)
The way this is presently implemented involves some nasty type manipulations, using casting between oop and oop* and using misalinged oop* values. This is so the queues can use the existing StarTask element type, with the oop* from there doing double duty as either an actual oop* or as a partial array scan, depending on an additional low tag bit. (Which assumes knowledge of the low tag bit used in StarTask.)
We can do better, making the code easier to understand and improving type safety, without affecting performance. To do so,
(1) add a new class for the partial array tasks,
(2) add a new class for the union of oop*, narrowOop*, and partial array tasks, discriminated based on a 2bit low tag,
(3) and use the new task union class as the element type for the queues.