Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid GC problem in PowPerm2Int/PowPerm4Int #2320

Merged
merged 1 commit into from
Mar 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/permutat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,8 @@ Obj PowPerm2Int (

/* compute the power by raising the cycles individually for large exps */
else if ( TNUM_OBJ(opR) == T_INTNEG ) {
/* do negation first as it can cause a garbage collection */
opR = AInvInt(opR);

/* make sure that the buffer bag is large enough */
UseTmpPerm(SIZE_OBJ(opL));
Expand All @@ -1145,7 +1147,6 @@ Obj PowPerm2Int (
ptKnown[p] = 0;

/* get pointer to the permutation and the power */
opR = AInvInt(opR);
ptL = CONST_ADDR_PERM2(opL);
ptP = ADDR_PERM2(pow);

Expand Down Expand Up @@ -1397,6 +1398,8 @@ Obj PowPerm4Int (

/* compute the power by raising the cycles individually for large exps */
else if ( TNUM_OBJ(opR) == T_INTNEG ) {
/* do negation first as it can cause a garbage collection */
opR = AInvInt(opR);

/* make sure that the buffer bag is large enough */
UseTmpPerm(SIZE_OBJ(opL));
Expand All @@ -1407,7 +1410,6 @@ Obj PowPerm4Int (
ptKnown[p] = 0;

/* get pointer to the permutation and the power */
opR = AInvInt(opR);
ptL = CONST_ADDR_PERM4(opL);
ptP = ADDR_PERM4(pow);

Expand Down