Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
da690411
Kaydet (Commit)
da690411
authored
Nis 13, 2006
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Force 8-alignment of memory blocks, as needed on
64-bit machines that require pointers to be aligned (e.g. IA64)
üst
f33dea29
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
pyarena.c
Python/pyarena.c
+8
-1
No files found.
Python/pyarena.c
Dosyayı görüntüle @
da690411
...
@@ -12,6 +12,11 @@
...
@@ -12,6 +12,11 @@
*/
*/
#define DEFAULT_BLOCK_SIZE 8192
#define DEFAULT_BLOCK_SIZE 8192
#define ALIGNMENT 8
#define ALIGNMENT_SHIFT 3
#define ALIGNMENT_MASK (ALIGNMENT - 1)
#define ROUNDUP(x) (((x) + ALIGNMENT_MASK) & ~ALIGNMENT_MASK)
typedef
struct
_block
{
typedef
struct
_block
{
/* Total number of bytes owned by this block available to pass out.
/* Total number of bytes owned by this block available to pass out.
* Read-only after initialization. The first such byte starts at
* Read-only after initialization. The first such byte starts at
...
@@ -82,7 +87,8 @@ block_new(size_t size)
...
@@ -82,7 +87,8 @@ block_new(size_t size)
b
->
ab_size
=
size
;
b
->
ab_size
=
size
;
b
->
ab_mem
=
(
void
*
)(
b
+
1
);
b
->
ab_mem
=
(
void
*
)(
b
+
1
);
b
->
ab_next
=
NULL
;
b
->
ab_next
=
NULL
;
b
->
ab_offset
=
0
;
b
->
ab_offset
=
ROUNDUP
((
Py_uintptr_t
)(
b
->
ab_mem
))
-
(
Py_uintptr_t
)(
b
->
ab_mem
);
return
b
;
return
b
;
}
}
...
@@ -100,6 +106,7 @@ block_alloc(block *b, size_t size)
...
@@ -100,6 +106,7 @@ block_alloc(block *b, size_t size)
{
{
void
*
p
;
void
*
p
;
assert
(
b
);
assert
(
b
);
size
=
ROUNDUP
(
size
);
if
(
b
->
ab_offset
+
size
>
b
->
ab_size
)
{
if
(
b
->
ab_offset
+
size
>
b
->
ab_size
)
{
/* If we need to allocate more memory than will fit in
/* If we need to allocate more memory than will fit in
the default block, allocate a one-off block that is
the default block, allocate a one-off block that is
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment