Mercurial > hg > truffle
comparison src/share/vm/adlc/output_c.cpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | db2e64ca2d5a |
children | 0702f188baeb |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1998, 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. |
1882 bool _doing_emit_d32; | 1882 bool _doing_emit_d32; |
1883 bool _doing_emit_d16; | 1883 bool _doing_emit_d16; |
1884 bool _doing_emit_hi; | 1884 bool _doing_emit_hi; |
1885 bool _doing_emit_lo; | 1885 bool _doing_emit_lo; |
1886 bool _may_reloc; | 1886 bool _may_reloc; |
1887 bool _must_reloc; | |
1888 reloc_format _reloc_form; | 1887 reloc_format _reloc_form; |
1889 const char * _reloc_type; | 1888 const char * _reloc_type; |
1890 bool _processing_noninput; | 1889 bool _processing_noninput; |
1891 | 1890 |
1892 NameList _strings_to_emit; | 1891 NameList _strings_to_emit; |
1921 _doing_emit_d32= false; | 1920 _doing_emit_d32= false; |
1922 _doing_emit_d16= false; | 1921 _doing_emit_d16= false; |
1923 _doing_emit_hi = false; | 1922 _doing_emit_hi = false; |
1924 _doing_emit_lo = false; | 1923 _doing_emit_lo = false; |
1925 _may_reloc = false; | 1924 _may_reloc = false; |
1926 _must_reloc = false; | |
1927 _reloc_form = RELOC_NONE; | 1925 _reloc_form = RELOC_NONE; |
1928 _reloc_type = AdlcVMDeps::none_reloc_type(); | 1926 _reloc_type = AdlcVMDeps::none_reloc_type(); |
1929 _strings_to_emit.clear(); | 1927 _strings_to_emit.clear(); |
1930 } | 1928 } |
1931 | 1929 |
2193 fprintf(_fp,"->disp(ra_,this,idx%d), ", _operand_idx); | 2191 fprintf(_fp,"->disp(ra_,this,idx%d), ", _operand_idx); |
2194 } | 2192 } |
2195 | 2193 |
2196 _reg_status = LITERAL_ACCESSED; | 2194 _reg_status = LITERAL_ACCESSED; |
2197 emit_rep_var( rep_var ); | 2195 emit_rep_var( rep_var ); |
2198 fprintf(_fp,"->disp_is_oop())"); | 2196 fprintf(_fp,"->disp_reloc())"); |
2199 | 2197 |
2200 // skip trailing $Address | 2198 // skip trailing $Address |
2201 _strings_to_emit.iter(); | 2199 _strings_to_emit.iter(); |
2202 } else { | 2200 } else { |
2203 // A replacement variable, '$' prefix | 2201 // A replacement variable, '$' prefix |
2230 fprintf(_fp, "%s", type) | 2228 fprintf(_fp, "%s", type) |
2231 ; | 2229 ; |
2232 } | 2230 } |
2233 | 2231 |
2234 | 2232 |
2235 void gen_emit_x_reloc(const char *d32_lo_hi ) { | |
2236 fprintf(_fp,"emit_%s_reloc(cbuf, ", d32_lo_hi ); | |
2237 emit_replacement(); fprintf(_fp,", "); | |
2238 emit_reloc_type( _reloc_type ); fprintf(_fp,", "); | |
2239 fprintf(_fp, "%d", _reloc_form);fprintf(_fp, ");"); | |
2240 } | |
2241 | |
2242 | |
2243 void emit() { | 2233 void emit() { |
2244 // | 2234 // |
2245 // "emit_d32_reloc(" or "emit_hi_reloc" or "emit_lo_reloc" | 2235 // "emit_d32_reloc(" or "emit_hi_reloc" or "emit_lo_reloc" |
2246 // | 2236 // |
2247 // Emit the function name when generating an emit function | 2237 // Emit the function name when generating an emit function |
2252 if ( ! _may_reloc ) { | 2242 if ( ! _may_reloc ) { |
2253 // Definitely don't need relocation information | 2243 // Definitely don't need relocation information |
2254 fprintf( _fp, "emit_%s(cbuf, ", d32_hi_lo ); | 2244 fprintf( _fp, "emit_%s(cbuf, ", d32_hi_lo ); |
2255 emit_replacement(); fprintf(_fp, ")"); | 2245 emit_replacement(); fprintf(_fp, ")"); |
2256 } | 2246 } |
2257 else if ( _must_reloc ) { | |
2258 // Must emit relocation information | |
2259 gen_emit_x_reloc( d32_hi_lo ); | |
2260 } | |
2261 else { | 2247 else { |
2262 // Emit RUNTIME CHECK to see if value needs relocation info | 2248 // Emit RUNTIME CHECK to see if value needs relocation info |
2263 // If emitting a relocatable address, use 'emit_d32_reloc' | 2249 // If emitting a relocatable address, use 'emit_d32_reloc' |
2264 const char *disp_constant = _doing_disp ? "disp" : _doing_constant ? "constant" : "INVALID"; | 2250 const char *disp_constant = _doing_disp ? "disp" : _doing_constant ? "constant" : "INVALID"; |
2265 assert( (_doing_disp || _doing_constant) | 2251 assert( (_doing_disp || _doing_constant) |
2266 && !(_doing_disp && _doing_constant), | 2252 && !(_doing_disp && _doing_constant), |
2267 "Must be emitting either a displacement or a constant"); | 2253 "Must be emitting either a displacement or a constant"); |
2268 fprintf(_fp,"\n"); | 2254 fprintf(_fp,"\n"); |
2269 fprintf(_fp,"if ( opnd_array(%d)->%s_is_oop() ) {\n", | 2255 fprintf(_fp,"if ( opnd_array(%d)->%s_reloc() != relocInfo::none ) {\n", |
2270 _operand_idx, disp_constant); | 2256 _operand_idx, disp_constant); |
2271 fprintf(_fp," "); | 2257 fprintf(_fp," "); |
2272 gen_emit_x_reloc( d32_hi_lo ); fprintf(_fp,"\n"); | 2258 fprintf(_fp,"emit_%s_reloc(cbuf, ", d32_hi_lo ); |
2259 emit_replacement(); fprintf(_fp,", "); | |
2260 fprintf(_fp,"opnd_array(%d)->%s_reloc(), ", | |
2261 _operand_idx, disp_constant); | |
2262 fprintf(_fp, "%d", _reloc_form);fprintf(_fp, ");"); | |
2263 fprintf(_fp,"\n"); | |
2273 fprintf(_fp,"} else {\n"); | 2264 fprintf(_fp,"} else {\n"); |
2274 fprintf(_fp," emit_%s(cbuf, ", d32_hi_lo); | 2265 fprintf(_fp," emit_%s(cbuf, ", d32_hi_lo); |
2275 emit_replacement(); fprintf(_fp, ");\n"); fprintf(_fp,"}"); | 2266 emit_replacement(); fprintf(_fp, ");\n"); fprintf(_fp,"}"); |
2276 } | 2267 } |
2277 } | 2268 } |