In non-strict functional languages, recursive calls with same-valued arguments can create thunks containing invariants repeatedly. In G-machine, an efficient implementation of non-strict languages, those invariants can be shared instead of repeatedly created. It is called root optimization which reduces the heap space during recursion. But root optimization needs additional runtime due to slow sharing process.
By introducing new types of nodes $AP_{m,n}$, new G-machine instruction $MKAPROOT_{m,n}$, and additional compilation rules, this thesis proposes the improved method of root optimization which accesses the sharable position directly. The runtime overhead can be reduced because of fast unwinding and direct sharing. This idea is implemented in HBC, and the expriment shows the feasibility of the proposed solution.