295 const u1* utf8_buffer = cfs->current();
296 assert(utf8_buffer != NULL, "null utf8 buffer");
297 // Got utf8 string, guarantee utf8_length+1 bytes, set stream position forward.
298 cfs->guarantee_more(utf8_length+1, CHECK); // utf8 string, tag/access_flags
299 cfs->skip_u1_fast(utf8_length);
300
301 // Before storing the symbol, make sure it's legal
302 if (_need_verify) {
303 verify_legal_utf8(utf8_buffer, utf8_length, CHECK);
304 }
305
306 if (has_cp_patch_at(index)) {
307 Handle patch = clear_cp_patch_at(index);
308 guarantee_property(java_lang_String::is_instance(patch()),
309 "Illegal utf8 patch at %d in class file %s",
310 index,
311 CHECK);
312 const char* const str = java_lang_String::as_utf8_string(patch());
313 // (could use java_lang_String::as_symbol instead, but might as well batch them)
314 utf8_buffer = (const u1*) str;
315 utf8_length = (int) strlen(str);
316 }
317
318 unsigned int hash;
319 Symbol* const result = SymbolTable::lookup_only((const char*)utf8_buffer,
320 utf8_length,
321 hash);
322 if (result == NULL) {
323 names[names_count] = (const char*)utf8_buffer;
324 lengths[names_count] = utf8_length;
325 indices[names_count] = index;
326 hashValues[names_count++] = hash;
327 if (names_count == SymbolTable::symbol_alloc_batch_size) {
328 SymbolTable::new_symbols(_loader_data,
329 cp,
330 names_count,
331 names,
332 lengths,
333 indices,
334 hashValues,
335 CHECK);
|
295 const u1* utf8_buffer = cfs->current();
296 assert(utf8_buffer != NULL, "null utf8 buffer");
297 // Got utf8 string, guarantee utf8_length+1 bytes, set stream position forward.
298 cfs->guarantee_more(utf8_length+1, CHECK); // utf8 string, tag/access_flags
299 cfs->skip_u1_fast(utf8_length);
300
301 // Before storing the symbol, make sure it's legal
302 if (_need_verify) {
303 verify_legal_utf8(utf8_buffer, utf8_length, CHECK);
304 }
305
306 if (has_cp_patch_at(index)) {
307 Handle patch = clear_cp_patch_at(index);
308 guarantee_property(java_lang_String::is_instance(patch()),
309 "Illegal utf8 patch at %d in class file %s",
310 index,
311 CHECK);
312 const char* const str = java_lang_String::as_utf8_string(patch());
313 // (could use java_lang_String::as_symbol instead, but might as well batch them)
314 utf8_buffer = (const u1*) str;
315 utf8_length = (u2) strlen(str);
316 }
317
318 unsigned int hash;
319 Symbol* const result = SymbolTable::lookup_only((const char*)utf8_buffer,
320 utf8_length,
321 hash);
322 if (result == NULL) {
323 names[names_count] = (const char*)utf8_buffer;
324 lengths[names_count] = utf8_length;
325 indices[names_count] = index;
326 hashValues[names_count++] = hash;
327 if (names_count == SymbolTable::symbol_alloc_batch_size) {
328 SymbolTable::new_symbols(_loader_data,
329 cp,
330 names_count,
331 names,
332 lengths,
333 indices,
334 hashValues,
335 CHECK);
|