Mercurial > hg > graal-compiler
annotate src/share/vm/runtime/stubCodeGenerator.hpp @ 1782:f353275af40e
6981773: incorrect fill value with OptimizeFill
Reviewed-by: kvn, twisti
author | never |
---|---|
date | Thu, 02 Sep 2010 11:40:02 -0700 |
parents | 126ea7725993 |
children | f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 // All the basic framework for stubcode generation/debugging/printing. | |
26 | |
27 | |
28 // A StubCodeDesc describes a piece of generated code (usually stubs). | |
29 // This information is mainly useful for debugging and printing. | |
30 // Currently, code descriptors are simply chained in a linked list, | |
31 // this may have to change if searching becomes too slow. | |
32 | |
33 class StubCodeDesc: public CHeapObj { | |
34 protected: | |
35 static StubCodeDesc* _list; // the list of all descriptors | |
36 static int _count; // length of list | |
37 | |
38 StubCodeDesc* _next; // the next element in the linked list | |
39 const char* _group; // the group to which the stub code belongs | |
40 const char* _name; // the name assigned to the stub code | |
41 int _index; // serial number assigned to the stub | |
42 address _begin; // points to the first byte of the stub code (included) | |
43 address _end; // points to the first byte after the stub code (excluded) | |
44 | |
45 void set_end(address end) { | |
46 assert(_begin <= end, "begin & end not properly ordered"); | |
47 _end = end; | |
48 } | |
49 | |
50 void set_begin(address begin) { | |
51 assert(begin >= _begin, "begin may not decrease"); | |
52 assert(_end == NULL || begin <= _end, "begin & end not properly ordered"); | |
53 _begin = begin; | |
54 } | |
55 | |
56 friend class StubCodeMark; | |
57 friend class StubCodeGenerator; | |
58 | |
59 public: | |
60 static StubCodeDesc* desc_for(address pc); // returns the code descriptor for the code containing pc or NULL | |
61 static StubCodeDesc* desc_for_index(int); // returns the code descriptor for the index or NULL | |
62 static const char* name_for(address pc); // returns the name of the code containing pc or NULL | |
63 | |
64 StubCodeDesc(const char* group, const char* name, address begin) { | |
65 assert(name != NULL, "no name specified"); | |
66 _next = _list; | |
67 _group = group; | |
68 _name = name; | |
69 _index = ++_count; // (never zero) | |
70 _begin = begin; | |
71 _end = NULL; | |
72 _list = this; | |
73 }; | |
74 | |
75 const char* group() const { return _group; } | |
76 const char* name() const { return _name; } | |
77 int index() const { return _index; } | |
78 address begin() const { return _begin; } | |
79 address end() const { return _end; } | |
80 int size_in_bytes() const { return _end - _begin; } | |
81 bool contains(address pc) const { return _begin <= pc && pc < _end; } | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
82 void print_on(outputStream* st) const; |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
83 void print() const { print_on(tty); } |
0 | 84 }; |
85 | |
86 // The base class for all stub-generating code generators. | |
87 // Provides utility functions. | |
88 | |
89 class StubCodeGenerator: public StackObj { | |
90 protected: | |
91 MacroAssembler* _masm; | |
92 | |
93 StubCodeDesc* _first_stub; | |
94 StubCodeDesc* _last_stub; | |
95 | |
96 public: | |
97 StubCodeGenerator(CodeBuffer* code); | |
98 ~StubCodeGenerator(); | |
99 | |
100 MacroAssembler* assembler() const { return _masm; } | |
101 | |
102 virtual void stub_prolog(StubCodeDesc* cdesc); // called by StubCodeMark constructor | |
103 virtual void stub_epilog(StubCodeDesc* cdesc); // called by StubCodeMark destructor | |
104 }; | |
105 | |
106 | |
107 // Stack-allocated helper class used to assciate a stub code with a name. | |
108 // All stub code generating functions that use a StubCodeMark will be registered | |
109 // in the global StubCodeDesc list and the generated stub code can be identified | |
110 // later via an address pointing into it. | |
111 | |
112 class StubCodeMark: public StackObj { | |
113 protected: | |
114 StubCodeGenerator* _cgen; | |
115 StubCodeDesc* _cdesc; | |
116 | |
117 public: | |
118 StubCodeMark(StubCodeGenerator* cgen, const char* group, const char* name); | |
119 ~StubCodeMark(); | |
120 | |
121 }; |