Mercurial > hg > truffle
comparison src/share/vm/ci/ciSymbol.hpp @ 1138:dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
Summary: C2 needs some additional optimizations to be able to handle MethodHandle invokes and invokedynamic instructions at the best performance.
Reviewed-by: kvn, never
author | twisti |
---|---|
date | Tue, 05 Jan 2010 15:21:25 +0100 |
parents | a61af66fc99e |
children | 1ecc8f0aad00 cd5dbf694d45 |
comparison
equal
deleted
inserted
replaced
1137:97125851f396 | 1138:dd57230ba8fe |
---|---|
1 /* | 1 /* |
2 * Copyright 1999-2001 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 1999-2009 Sun Microsystems, Inc. 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. |
26 // | 26 // |
27 // This class represents a symbolOop in the HotSpot virtual | 27 // This class represents a symbolOop in the HotSpot virtual |
28 // machine. | 28 // machine. |
29 class ciSymbol : public ciObject { | 29 class ciSymbol : public ciObject { |
30 CI_PACKAGE_ACCESS | 30 CI_PACKAGE_ACCESS |
31 // These friends all make direct use of get_symbolOop: | |
31 friend class ciEnv; | 32 friend class ciEnv; |
32 friend class ciInstanceKlass; | 33 friend class ciInstanceKlass; |
33 friend class ciSignature; | 34 friend class ciSignature; |
34 friend class ciMethod; | 35 friend class ciMethod; |
35 friend class ciObjArrayKlass; | 36 friend class ciObjArrayKlass; |
36 | 37 |
37 private: | 38 private: |
38 ciSymbol(symbolOop s) : ciObject(s) {} | 39 ciSymbol(symbolOop s) : ciObject(s) {} |
39 ciSymbol(symbolHandle s); // for use with vmSymbolHandles | 40 ciSymbol(symbolHandle s); // for use with vmSymbolHandles |
40 | 41 |
41 symbolOop get_symbolOop() { return (symbolOop)get_oop(); } | 42 symbolOop get_symbolOop() const { return (symbolOop)get_oop(); } |
42 | 43 |
43 const char* type_string() { return "ciSymbol"; } | 44 const char* type_string() { return "ciSymbol"; } |
44 | 45 |
45 void print_impl(outputStream* st); | 46 void print_impl(outputStream* st); |
46 | 47 |
47 int byte_at(int i); | 48 // This is public in symbolOop but private here, because the base can move: |
48 jbyte* base(); | 49 jbyte* base(); |
49 | 50 |
50 // Make a ciSymbol from a C string (implementation). | 51 // Make a ciSymbol from a C string (implementation). |
51 static ciSymbol* make_impl(const char* s); | 52 static ciSymbol* make_impl(const char* s); |
52 | 53 |
53 public: | 54 public: |
54 // The text of the symbol as a null-terminated utf8 string. | 55 // The text of the symbol as a null-terminated utf8 string. |
55 const char* as_utf8(); | 56 const char* as_utf8(); |
56 int utf8_length(); | 57 int utf8_length(); |
58 | |
59 // Return the i-th utf8 byte, where i < utf8_length | |
60 int byte_at(int i); | |
61 | |
62 // Tests if the symbol starts with the given prefix. | |
63 bool starts_with(const char* prefix, int len) const; | |
64 | |
65 // Determines where the symbol contains the given substring. | |
66 int index_of_at(int i, const char* str, int len) const; | |
57 | 67 |
58 // What kind of ciObject is this? | 68 // What kind of ciObject is this? |
59 bool is_symbol() { return true; } | 69 bool is_symbol() { return true; } |
60 | 70 |
61 void print_symbol_on(outputStream* st); | 71 void print_symbol_on(outputStream* st); |