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

Fix @GC.preserve -> GC.@preserve #1663

Merged
merged 1 commit into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions examples/IsPower.jl
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,11 @@ function Base.getindex(H::Hecke.HenselCtx, s::Symbol, i::Int)
return unsafe_load(H.link, i)
elseif s == :v
f = Hecke.Globals.Zx()
@GC.preserve f H ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{Hecke.fmpz_poly_raw}), f, H.v+(i-1)*sizeof(Hecke.fmpz_poly_raw))
GC.@preserve f H ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{Hecke.fmpz_poly_raw}), f, H.v+(i-1)*sizeof(Hecke.fmpz_poly_raw))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there actually a point in using preserve on a single ccall? (I know its my code, but..)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I think so

return f
elseif s == :w
f = Hecke.Globals.Zx()
@GC.preserve f H ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{Hecke.fmpz_poly_raw}), f, H.w+(i-1)*sizeof(Hecke.fmpz_poly_raw))
GC.@preserve f H ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{Hecke.fmpz_poly_raw}), f, H.w+(i-1)*sizeof(Hecke.fmpz_poly_raw))
return f
end
end
Expand Down
4 changes: 2 additions & 2 deletions src/Misc/Matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ end

# Copy B into A at position (i, j)
function _copy_matrix_into_matrix(A::ZZMatrix, i::Int, j::Int, B::ZZMatrix)
@GC.preserve A B begin
GC.@preserve A B begin
for k in 0:nrows(B) - 1
for l in 0:ncols(B) - 1
d = mat_entry_ptr(B, 1 + k, 1 + l)
Expand All @@ -337,7 +337,7 @@ function _copy_matrix_into_matrix(A::ZZMatrix, i::Int, j::Int, B::ZZMatrix)
end

function _copy_matrix_into_matrix(A::QQMatrix, i::Int, j::Int, B::QQMatrix)
@GC.preserve A B begin
GC.@preserve A B begin
for k in 0:nrows(B) - 1
for l in 0:ncols(B) - 1
d = mat_entry_ptr(B, 1 + k, 1 + l)
Expand Down
28 changes: 14 additions & 14 deletions src/QuadForm/LineOrbits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@

function _normalize!(x::fpMatrix)
R = base_ring(x)
@GC.preserve x begin
GC.@preserve x begin
piv = 0
local ell
for j in 1:ncols(x)
Expand Down Expand Up @@ -474,7 +474,7 @@

function _normalize!(x::MatElem{FpFieldElem})
R = base_ring(x)
@GC.preserve x begin
GC.@preserve x begin

Check warning on line 477 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L477

Added line #L477 was not covered by tests
piv = 0
local ell
for j in 1:ncols(x)
Expand Down Expand Up @@ -533,7 +533,7 @@

function _isequal(x::fqPolyRepMatrix, y::Vector{fqPolyRepFieldElem})
R = base_ring(x)
@GC.preserve x begin
GC.@preserve x begin

Check warning on line 536 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L536

Added line #L536 was not covered by tests
for i in 1:length(y)
el = mat_entry_ptr(x, 1, i)
b = ccall((:fq_nmod_equal, libflint), Cint, (Ref{fqPolyRepFieldElem}, Ptr{fqPolyRepFieldElem}, Ref{fqPolyRepField}), y[i], el, R)
Expand All @@ -548,7 +548,7 @@

function _muleq!(x::fqPolyRepMatrix, y::fqPolyRepFieldElem)
R = base_ring(x)
@GC.preserve x begin
GC.@preserve x begin

Check warning on line 551 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L551

Added line #L551 was not covered by tests
for i in 1:nrows(x)
for j in 1:ncols(x)
el = mat_entry_ptr(x, i, j)
Expand All @@ -561,7 +561,7 @@

function _normalize!(x::fqPolyRepMatrix)
R = base_ring(x)
@GC.preserve x begin
GC.@preserve x begin

Check warning on line 564 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L564

Added line #L564 was not covered by tests
piv = 0
local ell
for j in 1:ncols(x)
Expand Down Expand Up @@ -629,7 +629,7 @@
function _isless(x::Vector{fqPolyRepFieldElem}, y::fqPolyRepMatrix)
d = length(x)
R = base_ring(y)
@GC.preserve y begin
GC.@preserve y begin

Check warning on line 632 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L632

Added line #L632 was not covered by tests
for i in 1:d
xi = x[i]
el = mat_entry_ptr(y, 1, i)
Expand All @@ -655,7 +655,7 @@

function _isequal(x::FqPolyRepMatrix, y::Vector{FqPolyRepFieldElem})
R = base_ring(x)
@GC.preserve x begin
GC.@preserve x begin

Check warning on line 658 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L658

Added line #L658 was not covered by tests
for i in 1:length(y)
el = mat_entry_ptr(x, 1, i)
b = ccall((:fq_equal, libflint), Cint,
Expand All @@ -671,7 +671,7 @@

function _muleq!(x::FqPolyRepMatrix, y::FqPolyRepFieldElem)
R = base_ring(x)
@GC.preserve x begin
GC.@preserve x begin

Check warning on line 674 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L674

Added line #L674 was not covered by tests
for i in 1:nrows(x)
for j in 1:ncols(x)
el = mat_entry_ptr(x, i, j)
Expand All @@ -685,7 +685,7 @@

function _normalize!(x::FqPolyRepMatrix)
R = base_ring(x)
@GC.preserve x begin
GC.@preserve x begin

Check warning on line 688 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L688

Added line #L688 was not covered by tests
piv = 0
local ell
for j in 1:ncols(x)
Expand Down Expand Up @@ -758,7 +758,7 @@
function _isless(x::Vector{FqPolyRepFieldElem}, y::FqPolyRepMatrix, tx::ZZRingElem = ZZRingElem(), ty::ZZRingElem = ZZRingElem())
d = length(x)
R = base_ring(y)
@GC.preserve y begin
GC.@preserve y begin

Check warning on line 761 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L761

Added line #L761 was not covered by tests
for i in 1:d
xi = x[i]
el = mat_entry_ptr(y, 1, i)
Expand Down Expand Up @@ -791,7 +791,7 @@

function _isequal(x::FqMatrix, y::Vector{FqFieldElem})
R = base_ring(x)
@GC.preserve x begin
GC.@preserve x begin

Check warning on line 794 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L794

Added line #L794 was not covered by tests
for i in 1:length(y)
el = mat_entry_ptr(x, 1, i)
b = ccall((:fq_default_equal, libflint), Cint,
Expand All @@ -807,7 +807,7 @@

function _muleq!(x::FqMatrix, y::FqFieldElem)
R = base_ring(x)
@GC.preserve x begin
GC.@preserve x begin

Check warning on line 810 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L810

Added line #L810 was not covered by tests
for i in 1:nrows(x)
for j in 1:ncols(x)
el = Nemo.fq_default_mat_entry_ptr(x, i, j)
Expand All @@ -823,7 +823,7 @@
R = base_ring(x)
piv = 0
local ell
@GC.preserve x begin
GC.@preserve x begin
for j in 1:ncols(x)
el = Nemo.fq_default_mat_entry_ptr(x, 1, j)
b = ccall((:fq_default_is_zero, libflint), Cint,
Expand Down Expand Up @@ -895,7 +895,7 @@
function _isless(x::Vector{FqFieldElem}, y::FqMatrix, tx::ZZRingElem = ZZRingElem(), ty::ZZRingElem = ZZRingElem())
d = length(x)
R = base_ring(y)
@GC.preserve y begin
GC.@preserve y begin
for i in 1:d
xi = x[i]
el = Nemo.fq_default_mat_entry_ptr(y, 1, i)
Expand Down
Loading