1 /* This file has been automatically generated from "global_alloc.list" */
2 
3 /*
4 ----------------------------------------------------------------------
5 _svmh_gzalloc_env_no_exception
6 ----------------------------------------------------------------------
7 */
8 
9 svm_static jint
_svmh_gzalloc_env_no_exception(_svmt_JNIEnv ** ptr)10 _svmh_gzalloc_env_no_exception (_svmt_JNIEnv ** ptr)
11 {
12   _svmt_JNIEnv *tmp;
13 
14   tmp = _svmf_calloc (1, sizeof (_svmt_JNIEnv));
15 
16   if (tmp == NULL)
17     {
18       return JNI_ERR;
19     }
20 
21   *ptr = tmp;
22   return JNI_OK;
23 }
24 
25 /*
26 ----------------------------------------------------------------------
27 _svmh_gzfree_env_no_exception
28 ----------------------------------------------------------------------
29 */
30 
31 svm_static void SVM_UNUSED
_svmh_gzfree_env_no_exception(_svmt_JNIEnv ** ptr)32 _svmh_gzfree_env_no_exception (_svmt_JNIEnv ** ptr)
33 {
34 #ifndef NDEBUG
35 
36   if (*ptr == NULL)
37     {
38       _svmm_fatal_error ("attempt to free a NULL pointer");
39     }
40 
41 #endif /* not NDEBUG */
42 
43   _svmf_free (*ptr);
44   *ptr = NULL;
45 }
46 
47 
48 /*
49 ----------------------------------------------------------------------
50 _svmh_gzalloc_fat_lock_no_exception
51 ----------------------------------------------------------------------
52 */
53 
54 svm_static jint
_svmh_gzalloc_fat_lock_no_exception(_svmt_fat_lock ** ptr)55 _svmh_gzalloc_fat_lock_no_exception (_svmt_fat_lock ** ptr)
56 {
57   _svmt_fat_lock *tmp;
58 
59   tmp = _svmf_calloc (1, sizeof (_svmt_fat_lock));
60 
61   if (tmp == NULL)
62     {
63       return JNI_ERR;
64     }
65 
66   *ptr = tmp;
67   return JNI_OK;
68 }
69 
70 /*
71 ----------------------------------------------------------------------
72 _svmh_gzfree_fat_lock_no_exception
73 ----------------------------------------------------------------------
74 */
75 
76 svm_static void SVM_UNUSED
_svmh_gzfree_fat_lock_no_exception(_svmt_fat_lock ** ptr)77 _svmh_gzfree_fat_lock_no_exception (_svmt_fat_lock ** ptr)
78 {
79 #ifndef NDEBUG
80 
81   if (*ptr == NULL)
82     {
83       _svmm_fatal_error ("attempt to free a NULL pointer");
84     }
85 
86 #endif /* not NDEBUG */
87 
88   _svmf_free (*ptr);
89   *ptr = NULL;
90 }
91 
92 
93 /*
94 ----------------------------------------------------------------------
95 _svmh_gzalloc_initialization_no_exception
96 ----------------------------------------------------------------------
97 */
98 
99 svm_static jint
_svmh_gzalloc_initialization_no_exception(_svmt_initialization ** ptr)100 _svmh_gzalloc_initialization_no_exception (_svmt_initialization ** ptr)
101 {
102   _svmt_initialization *tmp;
103 
104   tmp = _svmf_calloc (1, sizeof (_svmt_initialization));
105 
106   if (tmp == NULL)
107     {
108       return JNI_ERR;
109     }
110 
111   *ptr = tmp;
112   return JNI_OK;
113 }
114 
115 /*
116 ----------------------------------------------------------------------
117 _svmh_gzfree_initialization_no_exception
118 ----------------------------------------------------------------------
119 */
120 
121 svm_static void SVM_UNUSED
_svmh_gzfree_initialization_no_exception(_svmt_initialization ** ptr)122 _svmh_gzfree_initialization_no_exception (_svmt_initialization ** ptr)
123 {
124 #ifndef NDEBUG
125 
126   if (*ptr == NULL)
127     {
128       _svmm_fatal_error ("attempt to free a NULL pointer");
129     }
130 
131 #endif /* not NDEBUG */
132 
133   _svmf_free (*ptr);
134   *ptr = NULL;
135 }
136 
137 
138 /*
139 ----------------------------------------------------------------------
140 _svmh_gzalloc_native_ref_no_exception
141 ----------------------------------------------------------------------
142 */
143 
144 svm_static jint
_svmh_gzalloc_native_ref_no_exception(_svmt_native_ref ** ptr)145 _svmh_gzalloc_native_ref_no_exception (_svmt_native_ref ** ptr)
146 {
147   _svmt_native_ref *tmp;
148 
149   tmp = _svmf_calloc (1, sizeof (_svmt_native_ref));
150 
151   if (tmp == NULL)
152     {
153       return JNI_ERR;
154     }
155 
156   *ptr = tmp;
157   return JNI_OK;
158 }
159 
160 /*
161 ----------------------------------------------------------------------
162 _svmh_gzfree_native_ref_no_exception
163 ----------------------------------------------------------------------
164 */
165 
166 svm_static void SVM_UNUSED
_svmh_gzfree_native_ref_no_exception(_svmt_native_ref ** ptr)167 _svmh_gzfree_native_ref_no_exception (_svmt_native_ref ** ptr)
168 {
169 #ifndef NDEBUG
170 
171   if (*ptr == NULL)
172     {
173       _svmm_fatal_error ("attempt to free a NULL pointer");
174     }
175 
176 #endif /* not NDEBUG */
177 
178   _svmf_free (*ptr);
179   *ptr = NULL;
180 }
181 
182 
183 /*
184 ----------------------------------------------------------------------
185 _svmh_gzalloc_vm_no_exception
186 ----------------------------------------------------------------------
187 */
188 
189 svm_static jint
_svmh_gzalloc_vm_no_exception(_svmt_JavaVM ** ptr)190 _svmh_gzalloc_vm_no_exception (_svmt_JavaVM ** ptr)
191 {
192   _svmt_JavaVM *tmp;
193 
194   tmp = _svmf_calloc (1, sizeof (_svmt_JavaVM));
195 
196   if (tmp == NULL)
197     {
198       return JNI_ERR;
199     }
200 
201   *ptr = tmp;
202   return JNI_OK;
203 }
204 
205 /*
206 ----------------------------------------------------------------------
207 _svmh_gzfree_vm_no_exception
208 ----------------------------------------------------------------------
209 */
210 
211 svm_static void SVM_UNUSED
_svmh_gzfree_vm_no_exception(_svmt_JavaVM ** ptr)212 _svmh_gzfree_vm_no_exception (_svmt_JavaVM ** ptr)
213 {
214 #ifndef NDEBUG
215 
216   if (*ptr == NULL)
217     {
218       _svmm_fatal_error ("attempt to free a NULL pointer");
219     }
220 
221 #endif /* not NDEBUG */
222 
223   _svmf_free (*ptr);
224   *ptr = NULL;
225 }
226 
227 
228 /*
229 ----------------------------------------------------------------------
230 _svmh_gzmalloc_cchars_no_exception
231 ----------------------------------------------------------------------
232 */
233 
234 svm_static jint
_svmh_gzmalloc_cchars_no_exception(size_t nmemb,char ** ptr)235 _svmh_gzmalloc_cchars_no_exception (size_t nmemb, char ** ptr)
236 {
237   char *tmp;
238   size_t size = nmemb * sizeof (char);
239 
240   if (size < nmemb)
241     return JNI_ERR;
242 
243   tmp = _svmf_calloc (1, size);
244 
245   if (tmp == NULL)
246     {
247       return JNI_ERR;
248     }
249 
250   *ptr = tmp;
251   return JNI_OK;
252 }
253 
254 /*
255 ----------------------------------------------------------------------
256 _svmh_gzmfree_cchars_no_exception
257 ----------------------------------------------------------------------
258 */
259 
260 svm_static void SVM_UNUSED
_svmh_gzmfree_cchars_no_exception(char ** ptr)261 _svmh_gzmfree_cchars_no_exception (char ** ptr)
262 {
263 #ifndef NDEBUG
264 
265   if (*ptr == NULL)
266     {
267       _svmm_fatal_error ("attempt to free a NULL pointer");
268     }
269 
270 #endif /* not NDEBUG */
271 
272   _svmf_free (*ptr);
273   *ptr = NULL;
274 }
275 
276 
277 /*
278 ----------------------------------------------------------------------
279 _svmh_gzalloc_class_loader_info
280 ----------------------------------------------------------------------
281 */
282 
283 svm_static jint
_svmh_gzalloc_class_loader_info(_svmt_JNIEnv * env,_svmt_class_loader_info ** ptr)284 _svmh_gzalloc_class_loader_info (_svmt_JNIEnv *env, _svmt_class_loader_info ** ptr)
285 {
286   _svmt_class_loader_info *tmp;
287 
288   tmp = _svmf_calloc (1, sizeof (_svmt_class_loader_info));
289 
290   if (tmp == NULL)
291     {
292       _svmf_error_OutOfMemoryError (env);
293       return JNI_ERR;
294     }
295 
296   *ptr = tmp;
297   return JNI_OK;
298 }
299 
300 /*
301 ----------------------------------------------------------------------
302 _svmh_gzfree_class_loader_info
303 ----------------------------------------------------------------------
304 */
305 
306 svm_static void SVM_UNUSED
_svmh_gzfree_class_loader_info(_svmt_class_loader_info ** ptr)307 _svmh_gzfree_class_loader_info (_svmt_class_loader_info ** ptr)
308 {
309 #ifndef NDEBUG
310 
311   if (*ptr == NULL)
312     {
313       _svmm_fatal_error ("attempt to free a NULL pointer");
314     }
315 
316 #endif /* not NDEBUG */
317 
318   _svmf_free (*ptr);
319   *ptr = NULL;
320 }
321 
322 
323 /*
324 ----------------------------------------------------------------------
325 _svmh_gzalloc_gc_map_node
326 ----------------------------------------------------------------------
327 */
328 
329 svm_static jint
_svmh_gzalloc_gc_map_node(_svmt_JNIEnv * env,_svmt_gc_map_node ** ptr)330 _svmh_gzalloc_gc_map_node (_svmt_JNIEnv *env, _svmt_gc_map_node ** ptr)
331 {
332   _svmt_gc_map_node *tmp;
333 
334   tmp = _svmf_calloc (1, sizeof (_svmt_gc_map_node));
335 
336   if (tmp == NULL)
337     {
338       _svmf_error_OutOfMemoryError (env);
339       return JNI_ERR;
340     }
341 
342   *ptr = tmp;
343   return JNI_OK;
344 }
345 
346 /*
347 ----------------------------------------------------------------------
348 _svmh_gzfree_gc_map_node
349 ----------------------------------------------------------------------
350 */
351 
352 svm_static void SVM_UNUSED
_svmh_gzfree_gc_map_node(_svmt_gc_map_node ** ptr)353 _svmh_gzfree_gc_map_node (_svmt_gc_map_node ** ptr)
354 {
355 #ifndef NDEBUG
356 
357   if (*ptr == NULL)
358     {
359       _svmm_fatal_error ("attempt to free a NULL pointer");
360     }
361 
362 #endif /* not NDEBUG */
363 
364   _svmf_free (*ptr);
365   *ptr = NULL;
366 }
367 
368 
369 /*
370 ----------------------------------------------------------------------
371 _svmh_gzalloc_imethod_signature_node
372 ----------------------------------------------------------------------
373 */
374 
375 svm_static jint
_svmh_gzalloc_imethod_signature_node(_svmt_JNIEnv * env,_svmt_imethod_signature_node ** ptr)376 _svmh_gzalloc_imethod_signature_node (_svmt_JNIEnv *env, _svmt_imethod_signature_node ** ptr)
377 {
378   _svmt_imethod_signature_node *tmp;
379 
380   tmp = _svmf_calloc (1, sizeof (_svmt_imethod_signature_node));
381 
382   if (tmp == NULL)
383     {
384       _svmf_error_OutOfMemoryError (env);
385       return JNI_ERR;
386     }
387 
388   *ptr = tmp;
389   return JNI_OK;
390 }
391 
392 /*
393 ----------------------------------------------------------------------
394 _svmh_gzfree_imethod_signature_node
395 ----------------------------------------------------------------------
396 */
397 
398 svm_static void SVM_UNUSED
_svmh_gzfree_imethod_signature_node(_svmt_imethod_signature_node ** ptr)399 _svmh_gzfree_imethod_signature_node (_svmt_imethod_signature_node ** ptr)
400 {
401 #ifndef NDEBUG
402 
403   if (*ptr == NULL)
404     {
405       _svmm_fatal_error ("attempt to free a NULL pointer");
406     }
407 
408 #endif /* not NDEBUG */
409 
410   _svmf_free (*ptr);
411   *ptr = NULL;
412 }
413 
414 
415 /*
416 ----------------------------------------------------------------------
417 _svmh_gzalloc_memory_block
418 ----------------------------------------------------------------------
419 */
420 
421 svm_static jint
_svmh_gzalloc_memory_block(_svmt_JNIEnv * env,_svmt_memory_block ** ptr)422 _svmh_gzalloc_memory_block (_svmt_JNIEnv *env, _svmt_memory_block ** ptr)
423 {
424   _svmt_memory_block *tmp;
425 
426   tmp = _svmf_calloc (1, sizeof (_svmt_memory_block));
427 
428   if (tmp == NULL)
429     {
430       _svmf_error_OutOfMemoryError (env);
431       return JNI_ERR;
432     }
433 
434   *ptr = tmp;
435   return JNI_OK;
436 }
437 
438 /*
439 ----------------------------------------------------------------------
440 _svmh_gzfree_memory_block
441 ----------------------------------------------------------------------
442 */
443 
444 svm_static void SVM_UNUSED
_svmh_gzfree_memory_block(_svmt_memory_block ** ptr)445 _svmh_gzfree_memory_block (_svmt_memory_block ** ptr)
446 {
447 #ifndef NDEBUG
448 
449   if (*ptr == NULL)
450     {
451       _svmm_fatal_error ("attempt to free a NULL pointer");
452     }
453 
454 #endif /* not NDEBUG */
455 
456   _svmf_free (*ptr);
457   *ptr = NULL;
458 }
459 
460 
461 /*
462 ----------------------------------------------------------------------
463 _svmh_gzalloc_type_node
464 ----------------------------------------------------------------------
465 */
466 
467 svm_static jint
_svmh_gzalloc_type_node(_svmt_JNIEnv * env,_svmt_type_node ** ptr)468 _svmh_gzalloc_type_node (_svmt_JNIEnv *env, _svmt_type_node ** ptr)
469 {
470   _svmt_type_node *tmp;
471 
472   tmp = _svmf_calloc (1, sizeof (_svmt_type_node));
473 
474   if (tmp == NULL)
475     {
476       _svmf_error_OutOfMemoryError (env);
477       return JNI_ERR;
478     }
479 
480   *ptr = tmp;
481   return JNI_OK;
482 }
483 
484 /*
485 ----------------------------------------------------------------------
486 _svmh_gzfree_type_node
487 ----------------------------------------------------------------------
488 */
489 
490 svm_static void SVM_UNUSED
_svmh_gzfree_type_node(_svmt_type_node ** ptr)491 _svmh_gzfree_type_node (_svmt_type_node ** ptr)
492 {
493 #ifndef NDEBUG
494 
495   if (*ptr == NULL)
496     {
497       _svmm_fatal_error ("attempt to free a NULL pointer");
498     }
499 
500 #endif /* not NDEBUG */
501 
502   _svmf_free (*ptr);
503   *ptr = NULL;
504 }
505 
506 
507 /*
508 ----------------------------------------------------------------------
509 _svmh_gzalloc_internal_method_node
510 ----------------------------------------------------------------------
511 */
512 
513 svm_static jint
_svmh_gzalloc_internal_method_node(_svmt_JNIEnv * env,_svmt_internal_method_node ** ptr)514 _svmh_gzalloc_internal_method_node (_svmt_JNIEnv *env, _svmt_internal_method_node ** ptr)
515 {
516   _svmt_internal_method_node *tmp;
517 
518   tmp = _svmf_calloc (1, sizeof (_svmt_internal_method_node));
519 
520   if (tmp == NULL)
521     {
522       _svmf_error_OutOfMemoryError (env);
523       return JNI_ERR;
524     }
525 
526   *ptr = tmp;
527   return JNI_OK;
528 }
529 
530 /*
531 ----------------------------------------------------------------------
532 _svmh_gzfree_internal_method_node
533 ----------------------------------------------------------------------
534 */
535 
536 svm_static void SVM_UNUSED
_svmh_gzfree_internal_method_node(_svmt_internal_method_node ** ptr)537 _svmh_gzfree_internal_method_node (_svmt_internal_method_node ** ptr)
538 {
539 #ifndef NDEBUG
540 
541   if (*ptr == NULL)
542     {
543       _svmm_fatal_error ("attempt to free a NULL pointer");
544     }
545 
546 #endif /* not NDEBUG */
547 
548   _svmf_free (*ptr);
549   *ptr = NULL;
550 }
551 
552 
553 /*
554 ----------------------------------------------------------------------
555 _svmh_gzalloc_zip_file
556 ----------------------------------------------------------------------
557 */
558 
559 svm_static jint
_svmh_gzalloc_zip_file(_svmt_JNIEnv * env,_svmt_zip_file ** ptr)560 _svmh_gzalloc_zip_file (_svmt_JNIEnv *env, _svmt_zip_file ** ptr)
561 {
562   _svmt_zip_file *tmp;
563 
564   tmp = _svmf_calloc (1, sizeof (_svmt_zip_file));
565 
566   if (tmp == NULL)
567     {
568       _svmf_error_OutOfMemoryError (env);
569       return JNI_ERR;
570     }
571 
572   *ptr = tmp;
573   return JNI_OK;
574 }
575 
576 /*
577 ----------------------------------------------------------------------
578 _svmh_gzfree_zip_file
579 ----------------------------------------------------------------------
580 */
581 
582 svm_static void SVM_UNUSED
_svmh_gzfree_zip_file(_svmt_zip_file ** ptr)583 _svmh_gzfree_zip_file (_svmt_zip_file ** ptr)
584 {
585 #ifndef NDEBUG
586 
587   if (*ptr == NULL)
588     {
589       _svmm_fatal_error ("attempt to free a NULL pointer");
590     }
591 
592 #endif /* not NDEBUG */
593 
594   _svmf_free (*ptr);
595   *ptr = NULL;
596 }
597 
598 
599 #if defined (_SABLEVM_INLINED_THREADED_INTERPRETER)
600 
601 /*
602 ----------------------------------------------------------------------
603 _svmh_gzalloc_sequence_node
604 ----------------------------------------------------------------------
605 */
606 
607 svm_static jint
_svmh_gzalloc_sequence_node(_svmt_JNIEnv * env,_svmt_sequence_node ** ptr)608 _svmh_gzalloc_sequence_node (_svmt_JNIEnv *env, _svmt_sequence_node ** ptr)
609 {
610   _svmt_sequence_node *tmp;
611 
612   tmp = _svmf_calloc (1, sizeof (_svmt_sequence_node));
613 
614   if (tmp == NULL)
615     {
616       _svmf_error_OutOfMemoryError (env);
617       return JNI_ERR;
618     }
619 
620   *ptr = tmp;
621   return JNI_OK;
622 }
623 
624 /*
625 ----------------------------------------------------------------------
626 _svmh_gzfree_sequence_node
627 ----------------------------------------------------------------------
628 */
629 
630 svm_static void SVM_UNUSED
_svmh_gzfree_sequence_node(_svmt_sequence_node ** ptr)631 _svmh_gzfree_sequence_node (_svmt_sequence_node ** ptr)
632 {
633 #ifndef NDEBUG
634 
635   if (*ptr == NULL)
636     {
637       _svmm_fatal_error ("attempt to free a NULL pointer");
638     }
639 
640 #endif /* not NDEBUG */
641 
642   _svmf_free (*ptr);
643   *ptr = NULL;
644 }
645 
646 
647 #endif /* _SABLEVM_INLINED_THREADED_INTERPRETER */
648 
649 /*
650 ----------------------------------------------------------------------
651 _svmh_gmalloc_cchars
652 ----------------------------------------------------------------------
653 */
654 
655 svm_static jint
_svmh_gmalloc_cchars(_svmt_JNIEnv * env,size_t nmemb,char ** ptr)656 _svmh_gmalloc_cchars (_svmt_JNIEnv *env, size_t nmemb, char ** ptr)
657 {
658   char *tmp;
659   size_t size = nmemb * sizeof (char);
660 
661   if (size < nmemb)
662     {
663       _svmf_error_OutOfMemoryError (env);
664       return JNI_ERR;
665     }
666 
667   tmp = _svmf_malloc (size);
668 
669   if (tmp == NULL)
670     {
671       _svmf_error_OutOfMemoryError (env);
672       return JNI_ERR;
673     }
674 
675   *ptr = tmp;
676   return JNI_OK;
677 }
678 
679 /*
680 ----------------------------------------------------------------------
681 _svmh_gmfree_cchars
682 ----------------------------------------------------------------------
683 */
684 
685 svm_static void
_svmh_gmfree_cchars(char ** ptr)686 _svmh_gmfree_cchars (char ** ptr)
687 {
688 #ifndef NDEBUG
689 
690   if (*ptr == NULL)
691     {
692       _svmm_fatal_error ("attempt to free a NULL pointer");
693     }
694 
695 #endif /* not NDEBUG */
696 
697   _svmf_free (*ptr);
698   *ptr = NULL;
699 }
700 
701 
702 /*
703 ----------------------------------------------------------------------
704 _svmh_gmalloc_ints
705 ----------------------------------------------------------------------
706 */
707 
708 svm_static jint
_svmh_gmalloc_ints(_svmt_JNIEnv * env,size_t nmemb,jint ** ptr)709 _svmh_gmalloc_ints (_svmt_JNIEnv *env, size_t nmemb, jint ** ptr)
710 {
711   jint *tmp;
712   size_t size = nmemb * sizeof (jint);
713 
714   if (size < nmemb)
715     {
716       _svmf_error_OutOfMemoryError (env);
717       return JNI_ERR;
718     }
719 
720   tmp = _svmf_malloc (size);
721 
722   if (tmp == NULL)
723     {
724       _svmf_error_OutOfMemoryError (env);
725       return JNI_ERR;
726     }
727 
728   *ptr = tmp;
729   return JNI_OK;
730 }
731 
732 /*
733 ----------------------------------------------------------------------
734 _svmh_gmfree_ints
735 ----------------------------------------------------------------------
736 */
737 
738 svm_static void
_svmh_gmfree_ints(jint ** ptr)739 _svmh_gmfree_ints (jint ** ptr)
740 {
741 #ifndef NDEBUG
742 
743   if (*ptr == NULL)
744     {
745       _svmm_fatal_error ("attempt to free a NULL pointer");
746     }
747 
748 #endif /* not NDEBUG */
749 
750   _svmf_free (*ptr);
751   *ptr = NULL;
752 }
753 
754 
755 /*
756 ----------------------------------------------------------------------
757 _svmh_gmalloc_ubytes
758 ----------------------------------------------------------------------
759 */
760 
761 svm_static jint
_svmh_gmalloc_ubytes(_svmt_JNIEnv * env,size_t nmemb,_svmt_u8 ** ptr)762 _svmh_gmalloc_ubytes (_svmt_JNIEnv *env, size_t nmemb, _svmt_u8 ** ptr)
763 {
764   _svmt_u8 *tmp;
765   size_t size = nmemb * sizeof (_svmt_u8);
766 
767   if (size < nmemb)
768     {
769       _svmf_error_OutOfMemoryError (env);
770       return JNI_ERR;
771     }
772 
773   tmp = _svmf_malloc (size);
774 
775   if (tmp == NULL)
776     {
777       _svmf_error_OutOfMemoryError (env);
778       return JNI_ERR;
779     }
780 
781   *ptr = tmp;
782   return JNI_OK;
783 }
784 
785 /*
786 ----------------------------------------------------------------------
787 _svmh_gmfree_ubytes
788 ----------------------------------------------------------------------
789 */
790 
791 svm_static void
_svmh_gmfree_ubytes(_svmt_u8 ** ptr)792 _svmh_gmfree_ubytes (_svmt_u8 ** ptr)
793 {
794 #ifndef NDEBUG
795 
796   if (*ptr == NULL)
797     {
798       _svmm_fatal_error ("attempt to free a NULL pointer");
799     }
800 
801 #endif /* not NDEBUG */
802 
803   _svmf_free (*ptr);
804   *ptr = NULL;
805 }
806 
807 
808 /*
809 ----------------------------------------------------------------------
810 _svmh_gmalloc_chars
811 ----------------------------------------------------------------------
812 */
813 
814 svm_static jint
_svmh_gmalloc_chars(_svmt_JNIEnv * env,size_t nmemb,jchar ** ptr)815 _svmh_gmalloc_chars (_svmt_JNIEnv *env, size_t nmemb, jchar ** ptr)
816 {
817   jchar *tmp;
818   size_t size = nmemb * sizeof (jchar);
819 
820   if (size < nmemb)
821     {
822       _svmf_error_OutOfMemoryError (env);
823       return JNI_ERR;
824     }
825 
826   tmp = _svmf_malloc (size);
827 
828   if (tmp == NULL)
829     {
830       _svmf_error_OutOfMemoryError (env);
831       return JNI_ERR;
832     }
833 
834   *ptr = tmp;
835   return JNI_OK;
836 }
837 
838 /*
839 ----------------------------------------------------------------------
840 _svmh_gmfree_chars
841 ----------------------------------------------------------------------
842 */
843 
844 svm_static void
_svmh_gmfree_chars(jchar ** ptr)845 _svmh_gmfree_chars (jchar ** ptr)
846 {
847 #ifndef NDEBUG
848 
849   if (*ptr == NULL)
850     {
851       _svmm_fatal_error ("attempt to free a NULL pointer");
852     }
853 
854 #endif /* not NDEBUG */
855 
856   _svmf_free (*ptr);
857   *ptr = NULL;
858 }
859 
860 
861 /*
862 ----------------------------------------------------------------------
863 _svmh_gzmalloc_env_array
864 ----------------------------------------------------------------------
865 */
866 
867 svm_static jint
_svmh_gzmalloc_env_array(_svmt_JNIEnv * env,size_t nmemb,_svmt_JNIEnv *** ptr)868 _svmh_gzmalloc_env_array (_svmt_JNIEnv *env, size_t nmemb, _svmt_JNIEnv * ** ptr)
869 {
870   _svmt_JNIEnv * *tmp;
871   size_t size = nmemb * sizeof (_svmt_JNIEnv *);
872 
873   if (size < nmemb)
874     {
875       _svmf_error_OutOfMemoryError (env);
876       return JNI_ERR;
877     }
878 
879   tmp = _svmf_calloc (1, size);
880 
881   if (tmp == NULL)
882     {
883       _svmf_error_OutOfMemoryError (env);
884       return JNI_ERR;
885     }
886 
887   *ptr = tmp;
888   return JNI_OK;
889 }
890 
891 /*
892 ----------------------------------------------------------------------
893 _svmh_gzmfree_env_array
894 ----------------------------------------------------------------------
895 */
896 
897 svm_static void SVM_UNUSED
_svmh_gzmfree_env_array(_svmt_JNIEnv *** ptr)898 _svmh_gzmfree_env_array (_svmt_JNIEnv * ** ptr)
899 {
900 #ifndef NDEBUG
901 
902   if (*ptr == NULL)
903     {
904       _svmm_fatal_error ("attempt to free a NULL pointer");
905     }
906 
907 #endif /* not NDEBUG */
908 
909   _svmf_free (*ptr);
910   *ptr = NULL;
911 }
912 
913 
914 /*
915 ----------------------------------------------------------------------
916 _svmh_gzmalloc_fat_lock_array
917 ----------------------------------------------------------------------
918 */
919 
920 svm_static jint
_svmh_gzmalloc_fat_lock_array(_svmt_JNIEnv * env,size_t nmemb,_svmt_fat_lock *** ptr)921 _svmh_gzmalloc_fat_lock_array (_svmt_JNIEnv *env, size_t nmemb, _svmt_fat_lock * ** ptr)
922 {
923   _svmt_fat_lock * *tmp;
924   size_t size = nmemb * sizeof (_svmt_fat_lock *);
925 
926   if (size < nmemb)
927     {
928       _svmf_error_OutOfMemoryError (env);
929       return JNI_ERR;
930     }
931 
932   tmp = _svmf_calloc (1, size);
933 
934   if (tmp == NULL)
935     {
936       _svmf_error_OutOfMemoryError (env);
937       return JNI_ERR;
938     }
939 
940   *ptr = tmp;
941   return JNI_OK;
942 }
943 
944 /*
945 ----------------------------------------------------------------------
946 _svmh_gzmfree_fat_lock_array
947 ----------------------------------------------------------------------
948 */
949 
950 svm_static void SVM_UNUSED
_svmh_gzmfree_fat_lock_array(_svmt_fat_lock *** ptr)951 _svmh_gzmfree_fat_lock_array (_svmt_fat_lock * ** ptr)
952 {
953 #ifndef NDEBUG
954 
955   if (*ptr == NULL)
956     {
957       _svmm_fatal_error ("attempt to free a NULL pointer");
958     }
959 
960 #endif /* not NDEBUG */
961 
962   _svmf_free (*ptr);
963   *ptr = NULL;
964 }
965 
966 
967 /*
968 ----------------------------------------------------------------------
969 _svmh_gzmalloc_instruction_info
970 ----------------------------------------------------------------------
971 */
972 
973 svm_static jint
_svmh_gzmalloc_instruction_info(_svmt_JNIEnv * env,size_t nmemb,_svmt_instruction_info ** ptr)974 _svmh_gzmalloc_instruction_info (_svmt_JNIEnv *env, size_t nmemb, _svmt_instruction_info ** ptr)
975 {
976   _svmt_instruction_info *tmp;
977   size_t size = nmemb * sizeof (_svmt_instruction_info);
978 
979   if (size < nmemb)
980     {
981       _svmf_error_OutOfMemoryError (env);
982       return JNI_ERR;
983     }
984 
985   tmp = _svmf_calloc (1, size);
986 
987   if (tmp == NULL)
988     {
989       _svmf_error_OutOfMemoryError (env);
990       return JNI_ERR;
991     }
992 
993   *ptr = tmp;
994   return JNI_OK;
995 }
996 
997 /*
998 ----------------------------------------------------------------------
999 _svmh_gzmfree_instruction_info
1000 ----------------------------------------------------------------------
1001 */
1002 
1003 svm_static void SVM_UNUSED
_svmh_gzmfree_instruction_info(_svmt_instruction_info ** ptr)1004 _svmh_gzmfree_instruction_info (_svmt_instruction_info ** ptr)
1005 {
1006 #ifndef NDEBUG
1007 
1008   if (*ptr == NULL)
1009     {
1010       _svmm_fatal_error ("attempt to free a NULL pointer");
1011     }
1012 
1013 #endif /* not NDEBUG */
1014 
1015   _svmf_free (*ptr);
1016   *ptr = NULL;
1017 }
1018 
1019 
1020 /*
1021 ----------------------------------------------------------------------
1022 _svmh_gzmalloc_instruction_preparation
1023 ----------------------------------------------------------------------
1024 */
1025 
1026 svm_static jint
_svmh_gzmalloc_instruction_preparation(_svmt_JNIEnv * env,size_t nmemb,_svmt_instruction_preparation ** ptr)1027 _svmh_gzmalloc_instruction_preparation (_svmt_JNIEnv *env, size_t nmemb, _svmt_instruction_preparation ** ptr)
1028 {
1029   _svmt_instruction_preparation *tmp;
1030   size_t size = nmemb * sizeof (_svmt_instruction_preparation);
1031 
1032   if (size < nmemb)
1033     {
1034       _svmf_error_OutOfMemoryError (env);
1035       return JNI_ERR;
1036     }
1037 
1038   tmp = _svmf_calloc (1, size);
1039 
1040   if (tmp == NULL)
1041     {
1042       _svmf_error_OutOfMemoryError (env);
1043       return JNI_ERR;
1044     }
1045 
1046   *ptr = tmp;
1047   return JNI_OK;
1048 }
1049 
1050 /*
1051 ----------------------------------------------------------------------
1052 _svmh_gzmfree_instruction_preparation
1053 ----------------------------------------------------------------------
1054 */
1055 
1056 svm_static void SVM_UNUSED
_svmh_gzmfree_instruction_preparation(_svmt_instruction_preparation ** ptr)1057 _svmh_gzmfree_instruction_preparation (_svmt_instruction_preparation ** ptr)
1058 {
1059 #ifndef NDEBUG
1060 
1061   if (*ptr == NULL)
1062     {
1063       _svmm_fatal_error ("attempt to free a NULL pointer");
1064     }
1065 
1066 #endif /* not NDEBUG */
1067 
1068   _svmf_free (*ptr);
1069   *ptr = NULL;
1070 }
1071 
1072 
1073 /*
1074 ----------------------------------------------------------------------
1075 _svmh_gzmalloc_local_preparation
1076 ----------------------------------------------------------------------
1077 */
1078 
1079 svm_static jint
_svmh_gzmalloc_local_preparation(_svmt_JNIEnv * env,size_t nmemb,_svmt_local_preparation ** ptr)1080 _svmh_gzmalloc_local_preparation (_svmt_JNIEnv *env, size_t nmemb, _svmt_local_preparation ** ptr)
1081 {
1082   _svmt_local_preparation *tmp;
1083   size_t size = nmemb * sizeof (_svmt_local_preparation);
1084 
1085   if (size < nmemb)
1086     {
1087       _svmf_error_OutOfMemoryError (env);
1088       return JNI_ERR;
1089     }
1090 
1091   tmp = _svmf_calloc (1, size);
1092 
1093   if (tmp == NULL)
1094     {
1095       _svmf_error_OutOfMemoryError (env);
1096       return JNI_ERR;
1097     }
1098 
1099   *ptr = tmp;
1100   return JNI_OK;
1101 }
1102 
1103 /*
1104 ----------------------------------------------------------------------
1105 _svmh_gzmfree_local_preparation
1106 ----------------------------------------------------------------------
1107 */
1108 
1109 svm_static void SVM_UNUSED
_svmh_gzmfree_local_preparation(_svmt_local_preparation ** ptr)1110 _svmh_gzmfree_local_preparation (_svmt_local_preparation ** ptr)
1111 {
1112 #ifndef NDEBUG
1113 
1114   if (*ptr == NULL)
1115     {
1116       _svmm_fatal_error ("attempt to free a NULL pointer");
1117     }
1118 
1119 #endif /* not NDEBUG */
1120 
1121   _svmf_free (*ptr);
1122   *ptr = NULL;
1123 }
1124 
1125 
1126 /*
1127 ----------------------------------------------------------------------
1128 _svmh_gzmalloc_ubytes
1129 ----------------------------------------------------------------------
1130 */
1131 
1132 svm_static jint
_svmh_gzmalloc_ubytes(_svmt_JNIEnv * env,size_t nmemb,_svmt_u8 ** ptr)1133 _svmh_gzmalloc_ubytes (_svmt_JNIEnv *env, size_t nmemb, _svmt_u8 ** ptr)
1134 {
1135   _svmt_u8 *tmp;
1136   size_t size = nmemb * sizeof (_svmt_u8);
1137 
1138   if (size < nmemb)
1139     {
1140       _svmf_error_OutOfMemoryError (env);
1141       return JNI_ERR;
1142     }
1143 
1144   tmp = _svmf_calloc (1, size);
1145 
1146   if (tmp == NULL)
1147     {
1148       _svmf_error_OutOfMemoryError (env);
1149       return JNI_ERR;
1150     }
1151 
1152   *ptr = tmp;
1153   return JNI_OK;
1154 }
1155 
1156 /*
1157 ----------------------------------------------------------------------
1158 _svmh_gzmfree_ubytes
1159 ----------------------------------------------------------------------
1160 */
1161 
1162 svm_static void SVM_UNUSED
_svmh_gzmfree_ubytes(_svmt_u8 ** ptr)1163 _svmh_gzmfree_ubytes (_svmt_u8 ** ptr)
1164 {
1165 #ifndef NDEBUG
1166 
1167   if (*ptr == NULL)
1168     {
1169       _svmm_fatal_error ("attempt to free a NULL pointer");
1170     }
1171 
1172 #endif /* not NDEBUG */
1173 
1174   _svmf_free (*ptr);
1175   *ptr = NULL;
1176 }
1177 
1178 
1179 /*
1180 ----------------------------------------------------------------------
1181 _svmh_gzmalloc_boot_class_path_entry
1182 ----------------------------------------------------------------------
1183 */
1184 
1185 svm_static jint
_svmh_gzmalloc_boot_class_path_entry(_svmt_JNIEnv * env,size_t nmemb,_svmt_boot_class_path_entry ** ptr)1186 _svmh_gzmalloc_boot_class_path_entry (_svmt_JNIEnv *env, size_t nmemb, _svmt_boot_class_path_entry ** ptr)
1187 {
1188   _svmt_boot_class_path_entry *tmp;
1189   size_t size = nmemb * sizeof (_svmt_boot_class_path_entry);
1190 
1191   if (size < nmemb)
1192     {
1193       _svmf_error_OutOfMemoryError (env);
1194       return JNI_ERR;
1195     }
1196 
1197   tmp = _svmf_calloc (1, size);
1198 
1199   if (tmp == NULL)
1200     {
1201       _svmf_error_OutOfMemoryError (env);
1202       return JNI_ERR;
1203     }
1204 
1205   *ptr = tmp;
1206   return JNI_OK;
1207 }
1208 
1209 /*
1210 ----------------------------------------------------------------------
1211 _svmh_gzmfree_boot_class_path_entry
1212 ----------------------------------------------------------------------
1213 */
1214 
1215 svm_static void SVM_UNUSED
_svmh_gzmfree_boot_class_path_entry(_svmt_boot_class_path_entry ** ptr)1216 _svmh_gzmfree_boot_class_path_entry (_svmt_boot_class_path_entry ** ptr)
1217 {
1218 #ifndef NDEBUG
1219 
1220   if (*ptr == NULL)
1221     {
1222       _svmm_fatal_error ("attempt to free a NULL pointer");
1223     }
1224 
1225 #endif /* not NDEBUG */
1226 
1227   _svmf_free (*ptr);
1228   *ptr = NULL;
1229 }
1230 
1231 
1232 /*
1233 ----------------------------------------------------------------------
1234 _svmh_gzmalloc_zip_file_entry
1235 ----------------------------------------------------------------------
1236 */
1237 
1238 svm_static jint
_svmh_gzmalloc_zip_file_entry(_svmt_JNIEnv * env,size_t nmemb,_svmt_zip_file_entry ** ptr)1239 _svmh_gzmalloc_zip_file_entry (_svmt_JNIEnv *env, size_t nmemb, _svmt_zip_file_entry ** ptr)
1240 {
1241   _svmt_zip_file_entry *tmp;
1242   size_t size = nmemb * sizeof (_svmt_zip_file_entry);
1243 
1244   if (size < nmemb)
1245     {
1246       _svmf_error_OutOfMemoryError (env);
1247       return JNI_ERR;
1248     }
1249 
1250   tmp = _svmf_calloc (1, size);
1251 
1252   if (tmp == NULL)
1253     {
1254       _svmf_error_OutOfMemoryError (env);
1255       return JNI_ERR;
1256     }
1257 
1258   *ptr = tmp;
1259   return JNI_OK;
1260 }
1261 
1262 /*
1263 ----------------------------------------------------------------------
1264 _svmh_gzmfree_zip_file_entry
1265 ----------------------------------------------------------------------
1266 */
1267 
1268 svm_static void SVM_UNUSED
_svmh_gzmfree_zip_file_entry(_svmt_zip_file_entry ** ptr)1269 _svmh_gzmfree_zip_file_entry (_svmt_zip_file_entry ** ptr)
1270 {
1271 #ifndef NDEBUG
1272 
1273   if (*ptr == NULL)
1274     {
1275       _svmm_fatal_error ("attempt to free a NULL pointer");
1276     }
1277 
1278 #endif /* not NDEBUG */
1279 
1280   _svmf_free (*ptr);
1281   *ptr = NULL;
1282 }
1283 
1284