comparison src/share/vm/utilities/utf8.hpp @ 6972:bd7a7ce2e264

6830717: replay of compilations would help with debugging Summary: When java process crashed in compiler thread, repeat the compilation process will help finding root cause. This is done with using SA dump application class data and replay data from core dump, then use debug version of jvm to recompile the problematic java method. Reviewed-by: kvn, twisti, sspitsyn Contributed-by: yumin.qi@oracle.com
author minqi
date Mon, 12 Nov 2012 14:03:53 -0800
parents 1d1603768966
children 8c03fc47511d
comparison
equal deleted inserted replaced
6965:3be318ecfae5 6972:bd7a7ce2e264
1 /* 1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
30 30
31 // Low-level interface for UTF8 strings 31 // Low-level interface for UTF8 strings
32 32
33 class UTF8 : AllStatic { 33 class UTF8 : AllStatic {
34 public: 34 public:
35 // returns the unicode length of a 0-terminated uft8 string 35 // returns the unicode length of a 0-terminated utf8 string
36 static int unicode_length(const char* uft8_str); 36 static int unicode_length(const char* utf8_str);
37 37
38 // returns the unicode length of a non-0-terminated uft8 string 38 // returns the unicode length of a non-0-terminated utf8 string
39 static int unicode_length(const char* uft8_str, int len); 39 static int unicode_length(const char* utf8_str, int len);
40 40
41 // converts a uft8 string to a unicode string 41 // converts a utf8 string to a unicode string
42 static void convert_to_unicode(const char* utf8_str, jchar* unicode_buffer, int unicode_length); 42 static void convert_to_unicode(const char* utf8_str, jchar* unicode_buffer, int unicode_length);
43 43
44 // returns the quoted ascii length of a utf8 string
45 static int quoted_ascii_length(const char* utf8_str, int utf8_length);
46
47 // converts a utf8 string to quoted ascii
48 static void as_quoted_ascii(const char* utf8_str, char* buf, int buflen);
49
50 // converts a quoted ascii string to utf8 string. returns the original
51 // string unchanged if nothing needs to be done.
52 static const char* from_quoted_ascii(const char* quoted_ascii_string);
53
44 // decodes the current utf8 character, stores the result in value, 54 // decodes the current utf8 character, stores the result in value,
45 // and returns the end of the current uft8 chararacter. 55 // and returns the end of the current utf8 chararacter.
46 static char* next(const char* str, jchar* value); 56 static char* next(const char* str, jchar* value);
47 57
48 // decodes the current utf8 character, gets the supplementary character instead of 58 // decodes the current utf8 character, gets the supplementary character instead of
49 // the surrogate pair when seeing a supplementary character in string, 59 // the surrogate pair when seeing a supplementary character in string,
50 // stores the result in value, and returns the end of the current uft8 chararacter. 60 // stores the result in value, and returns the end of the current utf8 chararacter.
51 static char* next_character(const char* str, jint* value); 61 static char* next_character(const char* str, jint* value);
52 62
53 // Utility methods 63 // Utility methods
54 static const jbyte* strrchr(const jbyte* base, int length, jbyte c); 64 static const jbyte* strrchr(const jbyte* base, int length, jbyte c);
55 static bool equal(const jbyte* base1, int length1, const jbyte* base2,int length2); 65 static bool equal(const jbyte* base1, int length1, const jbyte* base2,int length2);
77 87
78 // converts a unicode string to a utf8 string; result is allocated 88 // converts a unicode string to a utf8 string; result is allocated
79 // in resource area unless a buffer is provided. 89 // in resource area unless a buffer is provided.
80 static char* as_utf8(jchar* base, int length); 90 static char* as_utf8(jchar* base, int length);
81 static char* as_utf8(jchar* base, int length, char* buf, int buflen); 91 static char* as_utf8(jchar* base, int length, char* buf, int buflen);
92
93 // returns the quoted ascii length of a unicode string
94 static int quoted_ascii_length(jchar* base, int length);
95
96 // converts a utf8 string to quoted ascii
97 static void as_quoted_ascii(const jchar* base, int length, char* buf, int buflen);
82 }; 98 };
83 99
84 #endif // SHARE_VM_UTILITIES_UTF8_HPP 100 #endif // SHARE_VM_UTILITIES_UTF8_HPP