node-aix-ppc64 21.4.0 → 21.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,8 +49,8 @@
49
49
 
50
50
  EXTERN_C_START
51
51
 
52
- NAPI_EXTERN napi_status NAPI_CDECL
53
- napi_get_last_error_info(napi_env env, const napi_extended_error_info** result);
52
+ NAPI_EXTERN napi_status NAPI_CDECL napi_get_last_error_info(
53
+ node_api_nogc_env env, const napi_extended_error_info** result);
54
54
 
55
55
  // Getters for defined singletons
56
56
  NAPI_EXTERN napi_status NAPI_CDECL napi_get_undefined(napi_env env,
@@ -93,11 +93,12 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_create_string_utf16(napi_env env,
93
93
  size_t length,
94
94
  napi_value* result);
95
95
  #ifdef NAPI_EXPERIMENTAL
96
+ #define NODE_API_EXPERIMENTAL_HAS_EXTERNAL_STRINGS
96
97
  NAPI_EXTERN napi_status NAPI_CDECL
97
98
  node_api_create_external_string_latin1(napi_env env,
98
99
  char* str,
99
100
  size_t length,
100
- napi_finalize finalize_callback,
101
+ node_api_nogc_finalize finalize_callback,
101
102
  void* finalize_hint,
102
103
  napi_value* result,
103
104
  bool* copied);
@@ -105,7 +106,7 @@ NAPI_EXTERN napi_status NAPI_CDECL
105
106
  node_api_create_external_string_utf16(napi_env env,
106
107
  char16_t* str,
107
108
  size_t length,
108
- napi_finalize finalize_callback,
109
+ node_api_nogc_finalize finalize_callback,
109
110
  void* finalize_hint,
110
111
  napi_value* result,
111
112
  bool* copied);
@@ -289,7 +290,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_instanceof(napi_env env,
289
290
 
290
291
  // Gets all callback info in a single call. (Ugly, but faster.)
291
292
  NAPI_EXTERN napi_status NAPI_CDECL napi_get_cb_info(
292
- napi_env env, // [in] NAPI environment handle
293
+ napi_env env, // [in] Node-API environment handle
293
294
  napi_callback_info cbinfo, // [in] Opaque callback-info handle
294
295
  size_t* argc, // [in-out] Specifies the size of the provided argv array
295
296
  // and receives the actual count of args.
@@ -313,7 +314,7 @@ napi_define_class(napi_env env,
313
314
  NAPI_EXTERN napi_status NAPI_CDECL napi_wrap(napi_env env,
314
315
  napi_value js_object,
315
316
  void* native_object,
316
- napi_finalize finalize_cb,
317
+ node_api_nogc_finalize finalize_cb,
317
318
  void* finalize_hint,
318
319
  napi_ref* result);
319
320
  NAPI_EXTERN napi_status NAPI_CDECL napi_unwrap(napi_env env,
@@ -325,7 +326,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_remove_wrap(napi_env env,
325
326
  NAPI_EXTERN napi_status NAPI_CDECL
326
327
  napi_create_external(napi_env env,
327
328
  void* data,
328
- napi_finalize finalize_cb,
329
+ node_api_nogc_finalize finalize_cb,
329
330
  void* finalize_hint,
330
331
  napi_value* result);
331
332
  NAPI_EXTERN napi_status NAPI_CDECL napi_get_value_external(napi_env env,
@@ -424,7 +425,7 @@ NAPI_EXTERN napi_status NAPI_CDECL
424
425
  napi_create_external_arraybuffer(napi_env env,
425
426
  void* external_data,
426
427
  size_t byte_length,
427
- napi_finalize finalize_cb,
428
+ node_api_nogc_finalize finalize_cb,
428
429
  void* finalize_hint,
429
430
  napi_value* result);
430
431
  #endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED
@@ -466,7 +467,7 @@ napi_get_dataview_info(napi_env env,
466
467
  size_t* byte_offset);
467
468
 
468
469
  // version management
469
- NAPI_EXTERN napi_status NAPI_CDECL napi_get_version(napi_env env,
470
+ NAPI_EXTERN napi_status NAPI_CDECL napi_get_version(node_api_nogc_env env,
470
471
  uint32_t* result);
471
472
 
472
473
  // Promises
@@ -490,7 +491,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_run_script(napi_env env,
490
491
 
491
492
  // Memory management
492
493
  NAPI_EXTERN napi_status NAPI_CDECL napi_adjust_external_memory(
493
- napi_env env, int64_t change_in_bytes, int64_t* adjusted_value);
494
+ node_api_nogc_env env, int64_t change_in_bytes, int64_t* adjusted_value);
494
495
 
495
496
  #if NAPI_VERSION >= 5
496
497
 
@@ -508,19 +509,21 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_get_date_value(napi_env env,
508
509
  double* result);
509
510
 
510
511
  // Add finalizer for pointer
511
- NAPI_EXTERN napi_status NAPI_CDECL napi_add_finalizer(napi_env env,
512
- napi_value js_object,
513
- void* finalize_data,
514
- napi_finalize finalize_cb,
515
- void* finalize_hint,
516
- napi_ref* result);
512
+ NAPI_EXTERN napi_status NAPI_CDECL
513
+ napi_add_finalizer(napi_env env,
514
+ napi_value js_object,
515
+ void* finalize_data,
516
+ node_api_nogc_finalize finalize_cb,
517
+ void* finalize_hint,
518
+ napi_ref* result);
517
519
 
518
520
  #endif // NAPI_VERSION >= 5
519
521
 
520
522
  #ifdef NAPI_EXPERIMENTAL
523
+ #define NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER
521
524
 
522
525
  NAPI_EXTERN napi_status NAPI_CDECL
523
- node_api_post_finalizer(napi_env env,
526
+ node_api_post_finalizer(node_api_nogc_env env,
524
527
  napi_finalize finalize_cb,
525
528
  void* finalize_data,
526
529
  void* finalize_hint);
@@ -564,10 +567,13 @@ napi_get_all_property_names(napi_env env,
564
567
  napi_value* result);
565
568
 
566
569
  // Instance data
567
- NAPI_EXTERN napi_status NAPI_CDECL napi_set_instance_data(
568
- napi_env env, void* data, napi_finalize finalize_cb, void* finalize_hint);
570
+ NAPI_EXTERN napi_status NAPI_CDECL
571
+ napi_set_instance_data(node_api_nogc_env env,
572
+ void* data,
573
+ napi_finalize finalize_cb,
574
+ void* finalize_hint);
569
575
 
570
- NAPI_EXTERN napi_status NAPI_CDECL napi_get_instance_data(napi_env env,
576
+ NAPI_EXTERN napi_status NAPI_CDECL napi_get_instance_data(node_api_nogc_env env,
571
577
  void** data);
572
578
  #endif // NAPI_VERSION >= 6
573
579
 
@@ -22,6 +22,35 @@ typedef uint16_t char16_t;
22
22
  // JSVM API types are all opaque pointers for ABI stability
23
23
  // typedef undefined structs instead of void* for compile time type safety
24
24
  typedef struct napi_env__* napi_env;
25
+
26
+ // We need to mark APIs which can be called during garbage collection (GC),
27
+ // meaning that they do not affect the state of the JS engine, and can
28
+ // therefore be called synchronously from a finalizer that itself runs
29
+ // synchronously during GC. Such APIs can receive either a `napi_env` or a
30
+ // `node_api_nogc_env` as their first parameter, because we should be able to
31
+ // also call them during normal, non-garbage-collecting operations, whereas
32
+ // APIs that affect the state of the JS engine can only receive a `napi_env` as
33
+ // their first parameter, because we must not call them during GC. In lieu of
34
+ // inheritance, we use the properties of the const qualifier to accomplish
35
+ // this, because both a const and a non-const value can be passed to an API
36
+ // expecting a const value, but only a non-const value can be passed to an API
37
+ // expecting a non-const value.
38
+ //
39
+ // In conjunction with appropriate CFLAGS to warn us if we're passing a const
40
+ // (nogc) environment into an API that expects a non-const environment, and the
41
+ // definition of nogc finalizer function pointer types below, which receive a
42
+ // nogc environment as their first parameter, and can thus only call nogc APIs
43
+ // (unless the user explicitly casts the environment), we achieve the ability
44
+ // to ensure at compile time that we do not call APIs that affect the state of
45
+ // the JS engine from a synchronous (nogc) finalizer.
46
+ #if !defined(NAPI_EXPERIMENTAL) || \
47
+ (defined(NAPI_EXPERIMENTAL) && \
48
+ defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT))
49
+ typedef struct napi_env__* node_api_nogc_env;
50
+ #else
51
+ typedef const struct napi_env__* node_api_nogc_env;
52
+ #endif
53
+
25
54
  typedef struct napi_value__* napi_value;
26
55
  typedef struct napi_ref__* napi_ref;
27
56
  typedef struct napi_handle_scope__* napi_handle_scope;
@@ -116,6 +145,16 @@ typedef void(NAPI_CDECL* napi_finalize)(napi_env env,
116
145
  void* finalize_data,
117
146
  void* finalize_hint);
118
147
 
148
+ #if !defined(NAPI_EXPERIMENTAL) || \
149
+ (defined(NAPI_EXPERIMENTAL) && \
150
+ defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT))
151
+ typedef napi_finalize node_api_nogc_finalize;
152
+ #else
153
+ typedef void(NAPI_CDECL* node_api_nogc_finalize)(node_api_nogc_env env,
154
+ void* finalize_data,
155
+ void* finalize_hint);
156
+ #endif
157
+
119
158
  typedef struct {
120
159
  // One of utf8name or name should be NULL.
121
160
  const char* utf8name;