Commits

Remi Meier  committed 4bc912a

rearrange mallocs in strtod to allow inlining of str2charp
add transactionsafe to RPyThreadGetIdent

  • Participants
  • Parent commits fdd44d8
  • Branches stm-thread-2

Comments (0)

Files changed (3)

File pypy/module/thread/ll_thread.py

                                               # importantly, reacquire it
                                               # around the callback
 c_thread_get_ident = llexternal('RPyThreadGetIdent', [], rffi.LONG,
-                                _nowrapper=True)    # always call directly
+                                _nowrapper=True,
+                                transactionsafe=True)    # always call directly
 
 TLOCKP = rffi.COpaquePtr('struct RPyOpaque_ThreadLock',
                           compilation_info=eci)

File pypy/rlib/rdtoa.py

     compilation_info=eci, sandboxsafe=True)
 
 def strtod(input):
-    end_ptr = lltype.malloc(rffi.CCHARPP.TO, 1, flavor='raw')
+    ll_input = rffi.str2charp(input)
     try:
-        ll_input = rffi.str2charp(input)
+        end_ptr = lltype.malloc(rffi.CCHARPP.TO, 1, flavor='raw')
         try:
             result = dg_strtod(ll_input, end_ptr)
 
 
             return result
         finally:
-            rffi.free_charp(ll_input)
+            lltype.free(end_ptr, flavor='raw')
     finally:
-        lltype.free(end_ptr, flavor='raw')
+        rffi.free_charp(ll_input)
+
 
 lower_special_strings = ['inf', '+inf', '-inf', 'nan']
 upper_special_strings = ['INF', '+INF', '-INF', 'NAN']

File pypy/rpython/lltypesystem/rffi.py

             i -= 1
         return array
     str2charp._annenforceargs_ = [strtype]
+    str2charp._always_inline_ = True
 
     def free_charp(cp):
         lltype.free(cp, flavor='raw')