Use size_t as well as (size_t)ecl_to_ulong() for the heap size
authorMatthew Mondor <mmondor@pulsar-zone.net>
Sat, 5 Sep 2015 21:50:03 +0000 (17:50 -0400)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Sat, 5 Sep 2015 21:50:03 +0000 (17:50 -0400)
parameter, since cl_index with ecl_to_size() could not handle
expected values for heap-size on 32-bit systems.

src/c/alloc_2.d
src/c/stacks.d
src/h/external.h
src/h/internal.h

index cba7ba7..f9f98ca 100644 (file)
@@ -72,7 +72,7 @@ extern void GC_init_explicit_typing(void);
  **********************************************************/
 
 void
-_ecl_set_max_heap_size(cl_index new_size)
+_ecl_set_max_heap_size(size_t new_size)
 {
         const cl_env_ptr the_env = ecl_process_env();
         ecl_disable_interrupts_env(the_env);
index 37c339c..af42f2a 100644 (file)
@@ -621,21 +621,26 @@ cl_object
 si_set_limit(cl_object type, cl_object limit)
 {
         cl_env_ptr env = ecl_process_env();
-        cl_index the_size = ecl_to_size(limit);
         cl_index margin;
         if (type == @'ext::frame-stack') {
+                cl_index the_size = ecl_to_size(limit);
                 margin = ecl_option_values[ECL_OPT_FRAME_STACK_SAFETY_AREA];
                 frs_set_size(env, the_size + 2*margin);
         } else if (type == @'ext::binding-stack') {
+                cl_index the_size = ecl_to_size(limit);
                 margin = ecl_option_values[ECL_OPT_BIND_STACK_SAFETY_AREA];
                 ecl_bds_set_size(env, the_size + 2*margin);
         } else if (type == @'ext::c-stack') {
+                cl_index the_size = ecl_to_size(limit);
                 margin = ecl_option_values[ECL_OPT_C_STACK_SAFETY_AREA];
                 cs_set_size(env, the_size + 2*margin);
-        } else if (type == @'ext::lisp-stack')
+        } else if (type == @'ext::lisp-stack') {
+                cl_index the_size = ecl_to_size(limit);
                 ecl_stack_set_size(env, the_size);
-        else
+        } else {
+                size_t the_size = (size_t)ecl_to_ulong(limit);
                 _ecl_set_max_heap_size(fix_heap_size(the_size));
+        }
 
         return si_get_limit(type);
 }
index 6a53588..661b6cf 100755 (executable)
@@ -232,7 +232,7 @@ struct cl_core_struct {
 #endif
         cl_object libraries;
 
-        cl_index max_heap_size;
+        size_t max_heap_size;
         cl_object bytes_consed;
         cl_object gc_counter;
         bool gc_stats;
index 793580f..b3bb576 100755 (executable)
@@ -60,7 +60,7 @@ extern void _ecl_dealloc_env(cl_env_ptr);
 #ifdef GBC_BOEHM
 #define ECL_COMPACT_OBJECT_EXTRA(x) ((void*)((x)->array.displaced))
 #endif
-extern void _ecl_set_max_heap_size(cl_index new_size);
+extern void _ecl_set_max_heap_size(size_t new_size);
 extern cl_object ecl_alloc_bytecodes(cl_index data_size, cl_index code_size);
 extern cl_index ecl_object_byte_size(cl_type t);