Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/vmStructs.cpp @ 10130:6f817ce50129
8010992: Remove calls to global ::operator new[] and new
Summary: disable use of global operator new and new[] which could cause unexpected exception and escape from NMT tracking.
Reviewed-by: coleenp, dholmes, zgu
Contributed-by: yumin.qi@oracle.com
author | minqi |
---|---|
date | Fri, 19 Apr 2013 11:08:52 -0700 |
parents | 8617e38bb4cb |
children | 5b6512efcdc4 5a9fa2ba85f0 |
comparison
equal
deleted
inserted
replaced
10129:7815eaceaa8c | 10130:6f817ce50129 |
---|---|
3114 } | 3114 } |
3115 } | 3115 } |
3116 // Search for the base type by peeling off const and * | 3116 // Search for the base type by peeling off const and * |
3117 size_t len = strlen(typeName); | 3117 size_t len = strlen(typeName); |
3118 if (typeName[len-1] == '*') { | 3118 if (typeName[len-1] == '*') { |
3119 char * s = new char[len]; | 3119 char * s = NEW_C_HEAP_ARRAY(char, len, mtInternal); |
3120 strncpy(s, typeName, len - 1); | 3120 strncpy(s, typeName, len - 1); |
3121 s[len-1] = '\0'; | 3121 s[len-1] = '\0'; |
3122 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); | 3122 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); |
3123 if (recursiveFindType(origtypes, s, true) == 1) { | 3123 if (recursiveFindType(origtypes, s, true) == 1) { |
3124 delete [] s; | 3124 FREE_C_HEAP_ARRAY(char, s, mtInternal); |
3125 return 1; | 3125 return 1; |
3126 } | 3126 } |
3127 delete [] s; | 3127 FREE_C_HEAP_ARRAY(char, s, mtInternal); |
3128 } | 3128 } |
3129 const char* start = NULL; | 3129 const char* start = NULL; |
3130 if (strstr(typeName, "GrowableArray<") == typeName) { | 3130 if (strstr(typeName, "GrowableArray<") == typeName) { |
3131 start = typeName + strlen("GrowableArray<"); | 3131 start = typeName + strlen("GrowableArray<"); |
3132 } else if (strstr(typeName, "Array<") == typeName) { | 3132 } else if (strstr(typeName, "Array<") == typeName) { |
3133 start = typeName + strlen("Array<"); | 3133 start = typeName + strlen("Array<"); |
3134 } | 3134 } |
3135 if (start != NULL) { | 3135 if (start != NULL) { |
3136 const char * end = strrchr(typeName, '>'); | 3136 const char * end = strrchr(typeName, '>'); |
3137 int len = end - start + 1; | 3137 int len = end - start + 1; |
3138 char * s = new char[len]; | 3138 char * s = NEW_C_HEAP_ARRAY(char, len, mtInternal); |
3139 strncpy(s, start, len - 1); | 3139 strncpy(s, start, len - 1); |
3140 s[len-1] = '\0'; | 3140 s[len-1] = '\0'; |
3141 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); | 3141 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); |
3142 if (recursiveFindType(origtypes, s, true) == 1) { | 3142 if (recursiveFindType(origtypes, s, true) == 1) { |
3143 delete [] s; | 3143 FREE_C_HEAP_ARRAY(char, s, mtInternal); |
3144 return 1; | 3144 return 1; |
3145 } | 3145 } |
3146 delete [] s; | 3146 FREE_C_HEAP_ARRAY(char, s, mtInternal); |
3147 } | 3147 } |
3148 if (strstr(typeName, "const ") == typeName) { | 3148 if (strstr(typeName, "const ") == typeName) { |
3149 const char * s = typeName + strlen("const "); | 3149 const char * s = typeName + strlen("const "); |
3150 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); | 3150 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); |
3151 if (recursiveFindType(origtypes, s, true) == 1) { | 3151 if (recursiveFindType(origtypes, s, true) == 1) { |