Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/arguments.cpp @ 10238:1d0fba8a2a6d
8013574: PrintMalloc conflicts with the command line parsing
Summary: Make sure that _num_jvm_args is not updated until the new entry to _jvm_args_array has been added
Reviewed-by: johnc, tamao, tschatzl
author | brutisso |
---|---|
date | Thu, 02 May 2013 22:35:15 +0200 |
parents | 63e31ce40bdb |
children | 30860066ae8f |
comparison
equal
deleted
inserted
replaced
10192:9075044ed66b | 10238:1d0fba8a2a6d |
---|---|
745 | 745 |
746 if (arg == NULL) { | 746 if (arg == NULL) { |
747 return; | 747 return; |
748 } | 748 } |
749 | 749 |
750 int index = *count; | 750 int new_count = *count + 1; |
751 | 751 |
752 // expand the array and add arg to the last element | 752 // expand the array and add arg to the last element |
753 (*count)++; | |
754 if (*bldarray == NULL) { | 753 if (*bldarray == NULL) { |
755 *bldarray = NEW_C_HEAP_ARRAY(char*, *count, mtInternal); | 754 *bldarray = NEW_C_HEAP_ARRAY(char*, new_count, mtInternal); |
756 } else { | 755 } else { |
757 *bldarray = REALLOC_C_HEAP_ARRAY(char*, *bldarray, *count, mtInternal); | 756 *bldarray = REALLOC_C_HEAP_ARRAY(char*, *bldarray, new_count, mtInternal); |
758 } | 757 } |
759 (*bldarray)[index] = strdup(arg); | 758 (*bldarray)[*count] = strdup(arg); |
759 *count = new_count; | |
760 } | 760 } |
761 | 761 |
762 void Arguments::build_jvm_args(const char* arg) { | 762 void Arguments::build_jvm_args(const char* arg) { |
763 add_string(&_jvm_args_array, &_num_jvm_args, arg); | 763 add_string(&_jvm_args_array, &_num_jvm_args, arg); |
764 } | 764 } |