#14304: New implementation of unramified p-adics using FLINT and templates
-------------------------------------+-------------------------------------
       Reporter:  roed               |        Owner:  roed
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.1
      Component:  padics             |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Julian Rueth,      |    Reviewers:  David Roe, Julian
  David Roe                          |  Rueth
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/roed/ticket/14304                |  60975a4eed6b9bc665219709e337f801eb2b264d
   Dependencies:  #12555, #12173     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by vbraun):

 Agree with the volatile being necessary so that the optimizer doesn't
 combine the increments into a single += n. But afaik it would still be
 legal for the optimizer to reorder statements as
 {{{#!python
     self.__allocated++
     self.__allocated++
     ...
     self.__allocated++
     fmpz_init(self.fmpz_ccmp)
     fmpz_init(self.fmpz_cval)
     ...
     fmpz_poly_init(self.poly_ctm)
 }}}
 So either mark everything that needs to be accessed in-order as volatile.
 Or use the usual pattern
 {{{#!python
 def __cinit__(self, ...):
     self.fmpz_ccmp = NULL
     self.fmpz_cval = NULL
     sig_on()
     fmpz_init(self.fmpz_ccmp)
     fmpz_init(self.fmpz_cval)
     sig_off()

 def __dealloc__(self, ...):
     if self.fmpz_ccmp != NULL:
         fmpz_clear(self.fmpz_ccmp)
     if self.fmpz_ccval != NULL:
         fmpz_clear(self.fmpz_ccval)
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/14304#comment:44>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to