Mercurial > hg > graal-compiler
annotate src/share/vm/adlc/filebuff.hpp @ 8804:91bf0bdae37b
8008217: CDS: Class data sharing limits the malloc heap on Solaris
Summary: In 64bit VM move CDS archive address to 32G on all platforms using new flag SharedBaseAddress. In 32bit VM set CDS archive address to 3Gb on Linux and let other OSs pick the address.
Reviewed-by: kvn, dcubed, zgu, hseigel
author | coleenp |
---|---|
date | Wed, 20 Mar 2013 08:04:54 -0400 |
parents | d336b3173277 |
children |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 1997, 2010, 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:
769
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
769
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:
769
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_ADLC_FILEBUFF_HPP |
26 #define SHARE_VM_ADLC_FILEBUFF_HPP | |
27 | |
0 | 28 // FILEBUFF.HPP - Definitions for parser file buffering routines |
229 | 29 #include <iostream> |
0 | 30 |
229 | 31 using namespace std; |
603
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
488
diff
changeset
|
32 |
0 | 33 // STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES |
6850 | 34 |
35 class BufferedFile { | |
36 public: | |
0 | 37 const char *_name; |
38 FILE *_fp; | |
6850 | 39 inline BufferedFile() { _name = NULL; _fp = NULL; }; |
40 inline ~BufferedFile() {}; | |
41 }; | |
0 | 42 |
43 class ArchDesc; | |
44 | |
45 //------------------------------FileBuff-------------------------------------- | |
46 // This class defines a nicely behaved buffer of text. Entire file of text | |
605 | 47 // is read into buffer at creation, with sentinels at start and end. |
0 | 48 class FileBuff { |
49 friend class FileBuffRegion; | |
50 private: | |
51 long _bufferSize; // Size of text holding buffer. | |
52 long _offset; // Expected filepointer offset. | |
53 long _bufoff; // Start of buffer file offset | |
54 | |
55 char *_buf; // The buffer itself. | |
605 | 56 char *_bigbuf; // The buffer plus sentinels; actual heap area |
57 char *_bufmax; // A pointer to the buffer end sentinel | |
0 | 58 char *_bufeol; // A pointer to the last complete line end |
59 | |
60 int _err; // Error flag for file seek/read operations | |
61 long _filepos; // Current offset from start of file | |
415
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
229
diff
changeset
|
62 int _linenum; |
0 | 63 |
64 ArchDesc& _AD; // Reference to Architecture Description | |
65 | |
66 // Error reporting function | |
67 void file_error(int flag, int linenum, const char *fmt, ...); | |
68 | |
69 public: | |
70 const BufferedFile *_fp; // File to be buffered | |
71 | |
72 FileBuff(BufferedFile *fp, ArchDesc& archDesc); // Constructor | |
73 ~FileBuff(); // Destructor | |
74 | |
75 // This returns a pointer to the start of the current line in the buffer, | |
76 // and increments bufeol and filepos to point at the end of that line. | |
77 char *get_line(void); | |
415
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
229
diff
changeset
|
78 int linenum() const { return _linenum; } |
475
284d0af00d53
6771309: debugging AD files is difficult without #line directives in generated code
jrose
parents:
415
diff
changeset
|
79 void set_linenum(int line) { _linenum = line; } |
0 | 80 |
81 // This converts a pointer into the buffer to a file offset. It only works | |
82 // when the pointer is valid (i.e. just obtained from getline()). | |
769 | 83 long getoff(const char* s) { return _bufoff + (long)(s - _buf); } |
0 | 84 }; |
85 | |
86 //------------------------------FileBuffRegion--------------------------------- | |
87 // A buffer region is really a region of some file, specified as a linked list | |
88 // of offsets and lengths. These regions can be merged; overlapping regions | |
89 // will coalesce. | |
90 class FileBuffRegion { | |
91 public: // Workaround dev-studio friend/private bug | |
92 FileBuffRegion *_next; // Linked list of regions sorted by offset. | |
93 private: | |
94 FileBuff *_bfr; // The Buffer of the file | |
95 int _offset, _length; // The file area | |
96 int _sol; // Start of line where the file area starts | |
97 int _line; // First line of region | |
98 | |
99 public: | |
100 FileBuffRegion(FileBuff*, int sol, int line, int offset, int len); | |
101 ~FileBuffRegion(); | |
102 | |
103 FileBuffRegion *copy(); // Deep copy | |
104 FileBuffRegion *merge(FileBuffRegion*); // Merge 2 regions; delete input | |
105 | |
106 void print(ostream&); | |
107 friend ostream& operator<< (ostream&, FileBuffRegion&); | |
108 }; | |
1972 | 109 |
110 #endif // SHARE_VM_ADLC_FILEBUFF_HPP |