Skip to contentSkip to conversation

tools: libxl: CODING_STYLE: GC* cannot be used with NOGC

PATCH In review Ian Campbell 3 participants 6 messages Oct 16, 2015 – Oct 22, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: libxl: CODING_STYLE: GC* cannot be used with NOGC

GC* assume an existing gc in scope, which means they can't be passed NOGC. Instead recommend the use of the underlying functions with NOGC, noting that this is excepitonal.

---
 tools/libxl/CODING_STYLE | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/libxl/CODING_STYLE +2 -1
index a65efb3..545dc77 100644
@@ -57,13 +57,14 @@ whenever they are applicable.  For example:
   libxl__log[v]           LOG, LOGE, LOGEV
   libxl__sprintf          GCSPRINTF
   libxl__*alloc et al.    GCNEW, GCNEW_ARRAY, GCREALLOC_ARRAY
-  malloc et al.           GCNEW, GCNEW_ARRAY, GCREALLOC_ARRAY with NOGC
   isalnum etc. directly   CTYPE
   libxl__ctx_[un]lock     CTX_LOCK, CTX_UNLOCK
   gc=...; ao=...;         EGC_GC, AO_GC, STATE_AO_GC
   explicit gc creation    GC_INIT, GC_FREE
   memset(..,0,sizeof..)   FILLZERO
 
+Instead of malloc et al one should (as an exception to the above) use
+libxl__{zalloc,alloc,realloc} etc but passing NOGC.
 
 ERROR HANDLING
 --------------
Signature · 1 line
2.5.3
#1 lore raw
Quoted 17 lines · Ian Campbell

GC* assume an existing gc in scope, which means they can't be passed NOGC. Instead recommend the use of the underlying functions with NOGC, noting that this is excepitonal.

---
 tools/libxl/CODING_STYLE | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/libxl/CODING_STYLE +0 -0
index a65efb3..545dc77 100644
@@ -57,13 +57,14 @@ whenever they are applicable.  For example:
   libxl__log[v]           LOG, LOGE, LOGEV
   libxl__sprintf          GCSPRINTF
   libxl__*alloc et al.    GCNEW, GCNEW_ARRAY, GCREALLOC_ARRAY

tools/libxl/CODING_STYLE whenever they are applicable. For example: · line 68

Quoted 10 lines
tools/libxl/CODING_STYLE +2 -1
-  malloc et al.           GCNEW, GCNEW_ARRAY, GCREALLOC_ARRAY with NOGC
   isalnum etc. directly   CTYPE
   libxl__ctx_[un]lock     CTX_LOCK, CTX_UNLOCK
   gc=...; ao=...;         EGC_GC, AO_GC, STATE_AO_GC
   explicit gc creation    GC_INIT, GC_FREE
   memset(..,0,sizeof..)   FILLZERO
 
+Instead of malloc et al one should (as an exception to the above) use
+libxl__{zalloc,alloc,realloc} etc but passing NOGC.
 

There is no libxl__alloc. DYM libxl__malloc?

Wei.

Quoted 4 lines
tools/libxl/CODING_STYLE +0 -0
 ERROR HANDLING
 --------------
Signature · 1 line
2.5.3
#2 lore raw
Quoted 26 lines · Wei Liu
Quoted 25 lines · Ian Campbell

GC* assume an existing gc in scope, which means they can't be passed NOGC. Instead recommend the use of the underlying functions with NOGC, noting that this is excepitonal.

---
 tools/libxl/CODING_STYLE | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/libxl/CODING_STYLE +0 -1
index a65efb3..545dc77 100644
@@ -57,13 +57,14 @@ whenever they are applicable.  For example:
   libxl__log[v]           LOG, LOGE, LOGEV
   libxl__sprintf          GCSPRINTF
   libxl__*alloc et al.    GCNEW, GCNEW_ARRAY, GCREALLOC_ARRAY
-  malloc et al.           GCNEW, GCNEW_ARRAY, GCREALLOC_ARRAY with

NOGC

   isalnum etc. directly   CTYPE
   libxl__ctx_[un]lock     CTX_LOCK, CTX_UNLOCK
   gc=...; ao=...;         EGC_GC, AO_GC, STATE_AO_GC
   explicit gc creation    GC_INIT, GC_FREE
   memset(..,0,sizeof..)   FILLZERO
Quoted 5 lines

tools/libxl/CODING_STYLE whenever they are applicable. For example: · line 67

Quoted 3 lines
tools/libxl/CODING_STYLE +2 -0
+Instead of malloc et al one should (as an exception to the above) use
+libxl__{zalloc,alloc,realloc} etc but passing NOGC.

There is no libxl__alloc. DYM libxl__malloc?

I meant libxl__calloc.

Ian.

Acked-by
#3 lore raw
Quoted 27 lines · Ian Campbell
Quoted 26 lines · Wei Liu
Quoted 25 lines · Ian Campbell

GC* assume an existing gc in scope, which means they can't be passed NOGC. Instead recommend the use of the underlying functions with NOGC, noting that this is excepitonal.

---
 tools/libxl/CODING_STYLE | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/libxl/CODING_STYLE +0 -1
index a65efb3..545dc77 100644
@@ -57,13 +57,14 @@ whenever they are applicable.  For example:
   libxl__log[v]           LOG, LOGE, LOGEV
   libxl__sprintf          GCSPRINTF
   libxl__*alloc et al.    GCNEW, GCNEW_ARRAY, GCREALLOC_ARRAY
-  malloc et al.           GCNEW, GCNEW_ARRAY, GCREALLOC_ARRAY with

NOGC

   isalnum etc. directly   CTYPE
   libxl__ctx_[un]lock     CTX_LOCK, CTX_UNLOCK
   gc=...; ao=...;         EGC_GC, AO_GC, STATE_AO_GC
   explicit gc creation    GC_INIT, GC_FREE
   memset(..,0,sizeof..)   FILLZERO
Quoted 8 lines
Quoted 5 lines

tools/libxl/CODING_STYLE whenever they are applicable. For example: · line 67

Quoted 3 lines
tools/libxl/CODING_STYLE +2 -0
+Instead of malloc et al one should (as an exception to the above) use
+libxl__{zalloc,alloc,realloc} etc but passing NOGC.

There is no libxl__alloc. DYM libxl__malloc?

I meant libxl__calloc.

In any case I think the basic idea gets across by "etc". So whether you enumerate every function or not:

Quoted 1 line

Ian.

Acked-by
#4 lore raw

Wei Liu writes ("Re: [PATCH] tools: libxl: CODING_STYLE: GC* cannot be used with NOGC"):

Quoted 5 lines · Ian Campbell
Quoted 4 lines · Wei Liu
Quoted 1 line

There is no libxl__alloc. DYM libxl__malloc?

I meant libxl__calloc.

Right, I guess you will fix that.

Quoted 4 lines

In any case I think the basic idea gets across by "etc". So whether you enumerate every function or not:

Likewise,

author Applied
#5 lore raw
Quoted 9 lines · Ian Jackson

Wei Liu writes ("Re: [PATCH] tools: libxl: CODING_STYLE: GC* cannot be used with NOGC"):

Quoted 5 lines · Ian Campbell
Quoted 4 lines · Wei Liu
Quoted 1 line

There is no libxl__alloc. DYM libxl__malloc?

I meant libxl__calloc.

Right, I guess you will fix that.

Yes, I did.

Quoted 8 lines
Quoted 4 lines

In any case I think the basic idea gets across by "etc". So whether you enumerate every function or not:

Likewise,

applied, thanks.