From: Matthew Mondor Date: Sat, 5 Sep 2015 21:50:03 +0000 (-0400) Subject: Use size_t as well as (size_t)ecl_to_ulong() for the heap size X-Git-Url: http://git.pulsar-zone.net/?a=commitdiff_plain;h=0986e8a190cd666b73f532988740715665e4c5a5;p=ecl.git Use size_t as well as (size_t)ecl_to_ulong() for the heap size parameter, since cl_index with ecl_to_size() could not handle expected values for heap-size on 32-bit systems. --- diff --git a/src/c/alloc_2.d b/src/c/alloc_2.d index cba7ba7..f9f98ca 100644 --- a/src/c/alloc_2.d +++ b/src/c/alloc_2.d @@ -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); diff --git a/src/c/stacks.d b/src/c/stacks.d index 37c339c..af42f2a 100644 --- a/src/c/stacks.d +++ b/src/c/stacks.d @@ -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); } diff --git a/src/h/external.h b/src/h/external.h index 6a53588..661b6cf 100755 --- a/src/h/external.h +++ b/src/h/external.h @@ -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; diff --git a/src/h/internal.h b/src/h/internal.h index 793580f..b3bb576 100755 --- a/src/h/internal.h +++ b/src/h/internal.h @@ -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);