Mercurial > hg > truffle
comparison src/share/vm/opto/parseHelper.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 | 9a28ddfc1f4a |
children | e626685e9f6c |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1998, 2010, 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. |
44 | 44 |
45 // Get base of thread-local storage area | 45 // Get base of thread-local storage area |
46 Node* thread = _gvn.transform( new (C, 1) ThreadLocalNode() ); | 46 Node* thread = _gvn.transform( new (C, 1) ThreadLocalNode() ); |
47 | 47 |
48 // Get method | 48 // Get method |
49 const TypeInstPtr* method_type = TypeInstPtr::make(TypePtr::Constant, method->klass(), true, method, 0); | 49 const TypePtr* method_type = TypeMetadataPtr::make(method); |
50 Node *method_node = _gvn.transform( ConNode::make(C, method_type) ); | 50 Node *method_node = _gvn.transform( ConNode::make(C, method_type) ); |
51 | 51 |
52 kill_dead_locals(); | 52 kill_dead_locals(); |
53 | 53 |
54 // For some reason, this call reads only raw memory. | 54 // For some reason, this call reads only raw memory. |
218 Node* cur_thread = _gvn.transform( new (C, 1) ThreadLocalNode() ); | 218 Node* cur_thread = _gvn.transform( new (C, 1) ThreadLocalNode() ); |
219 Node* merge = new (C, 3) RegionNode(3); | 219 Node* merge = new (C, 3) RegionNode(3); |
220 _gvn.set_type(merge, Type::CONTROL); | 220 _gvn.set_type(merge, Type::CONTROL); |
221 Node* kls = makecon(TypeKlassPtr::make(klass)); | 221 Node* kls = makecon(TypeKlassPtr::make(klass)); |
222 | 222 |
223 Node* init_thread_offset = _gvn.MakeConX(in_bytes(instanceKlass::init_thread_offset())); | 223 Node* init_thread_offset = _gvn.MakeConX(in_bytes(InstanceKlass::init_thread_offset())); |
224 Node* adr_node = basic_plus_adr(kls, kls, init_thread_offset); | 224 Node* adr_node = basic_plus_adr(kls, kls, init_thread_offset); |
225 Node* init_thread = make_load(NULL, adr_node, TypeRawPtr::BOTTOM, T_ADDRESS); | 225 Node* init_thread = make_load(NULL, adr_node, TypeRawPtr::BOTTOM, T_ADDRESS); |
226 Node *tst = Bool( CmpP( init_thread, cur_thread), BoolTest::eq); | 226 Node *tst = Bool( CmpP( init_thread, cur_thread), BoolTest::eq); |
227 IfNode* iff = create_and_map_if(control(), tst, PROB_ALWAYS, COUNT_UNKNOWN); | 227 IfNode* iff = create_and_map_if(control(), tst, PROB_ALWAYS, COUNT_UNKNOWN); |
228 set_control(IfTrue(iff)); | 228 set_control(IfTrue(iff)); |
229 merge->set_req(1, IfFalse(iff)); | 229 merge->set_req(1, IfFalse(iff)); |
230 | 230 |
231 Node* init_state_offset = _gvn.MakeConX(in_bytes(instanceKlass::init_state_offset())); | 231 Node* init_state_offset = _gvn.MakeConX(in_bytes(InstanceKlass::init_state_offset())); |
232 adr_node = basic_plus_adr(kls, kls, init_state_offset); | 232 adr_node = basic_plus_adr(kls, kls, init_state_offset); |
233 // Use T_BOOLEAN for instanceKlass::_init_state so the compiler | 233 // Use T_BOOLEAN for InstanceKlass::_init_state so the compiler |
234 // can generate code to load it as unsigned byte. | 234 // can generate code to load it as unsigned byte. |
235 Node* init_state = make_load(NULL, adr_node, TypeInt::UBYTE, T_BOOLEAN); | 235 Node* init_state = make_load(NULL, adr_node, TypeInt::UBYTE, T_BOOLEAN); |
236 Node* being_init = _gvn.intcon(instanceKlass::being_initialized); | 236 Node* being_init = _gvn.intcon(InstanceKlass::being_initialized); |
237 tst = Bool( CmpI( init_state, being_init), BoolTest::eq); | 237 tst = Bool( CmpI( init_state, being_init), BoolTest::eq); |
238 iff = create_and_map_if(control(), tst, PROB_ALWAYS, COUNT_UNKNOWN); | 238 iff = create_and_map_if(control(), tst, PROB_ALWAYS, COUNT_UNKNOWN); |
239 set_control(IfTrue(iff)); | 239 set_control(IfTrue(iff)); |
240 merge->set_req(2, IfFalse(iff)); | 240 merge->set_req(2, IfFalse(iff)); |
241 | 241 |
334 | 334 |
335 //----------------------increment_and_test_invocation_counter------------------- | 335 //----------------------increment_and_test_invocation_counter------------------- |
336 void Parse::increment_and_test_invocation_counter(int limit) { | 336 void Parse::increment_and_test_invocation_counter(int limit) { |
337 if (!count_invocations()) return; | 337 if (!count_invocations()) return; |
338 | 338 |
339 // Get the methodOop node. | 339 // Get the Method* node. |
340 const TypePtr* adr_type = TypeOopPtr::make_from_constant(method()); | 340 const TypePtr* adr_type = TypeMetadataPtr::make(method()); |
341 Node *methodOop_node = makecon(adr_type); | 341 Node *method_node = makecon(adr_type); |
342 | 342 |
343 // Load the interpreter_invocation_counter from the methodOop. | 343 // Load the interpreter_invocation_counter from the Method*. |
344 int offset = methodOopDesc::interpreter_invocation_counter_offset_in_bytes(); | 344 int offset = Method::interpreter_invocation_counter_offset_in_bytes(); |
345 Node* adr_node = basic_plus_adr(methodOop_node, methodOop_node, offset); | 345 Node* adr_node = basic_plus_adr(method_node, method_node, offset); |
346 Node* cnt = make_load(NULL, adr_node, TypeInt::INT, T_INT, adr_type); | 346 Node* cnt = make_load(NULL, adr_node, TypeInt::INT, T_INT, adr_type); |
347 | 347 |
348 test_counter_against_threshold(cnt, limit); | 348 test_counter_against_threshold(cnt, limit); |
349 | 349 |
350 // Add one to the counter and store | 350 // Add one to the counter and store |
352 store_to_memory( NULL, adr_node, incr, T_INT, adr_type ); | 352 store_to_memory( NULL, adr_node, incr, T_INT, adr_type ); |
353 } | 353 } |
354 | 354 |
355 //----------------------------method_data_addressing--------------------------- | 355 //----------------------------method_data_addressing--------------------------- |
356 Node* Parse::method_data_addressing(ciMethodData* md, ciProfileData* data, ByteSize counter_offset, Node* idx, uint stride) { | 356 Node* Parse::method_data_addressing(ciMethodData* md, ciProfileData* data, ByteSize counter_offset, Node* idx, uint stride) { |
357 // Get offset within methodDataOop of the data array | 357 // Get offset within MethodData* of the data array |
358 ByteSize data_offset = methodDataOopDesc::data_offset(); | 358 ByteSize data_offset = MethodData::data_offset(); |
359 | 359 |
360 // Get cell offset of the ProfileData within data array | 360 // Get cell offset of the ProfileData within data array |
361 int cell_offset = md->dp_to_di(data->dp()); | 361 int cell_offset = md->dp_to_di(data->dp()); |
362 | 362 |
363 // Add in counter_offset, the # of bytes into the ProfileData of counter or flag | 363 // Add in counter_offset, the # of bytes into the ProfileData of counter or flag |
364 int offset = in_bytes(data_offset) + cell_offset + in_bytes(counter_offset); | 364 int offset = in_bytes(data_offset) + cell_offset + in_bytes(counter_offset); |
365 | 365 |
366 const TypePtr* adr_type = TypeOopPtr::make_from_constant(md); | 366 const TypePtr* adr_type = TypeMetadataPtr::make(md); |
367 Node* mdo = makecon(adr_type); | 367 Node* mdo = makecon(adr_type); |
368 Node* ptr = basic_plus_adr(mdo, mdo, offset); | 368 Node* ptr = basic_plus_adr(mdo, mdo, offset); |
369 | 369 |
370 if (stride != 0) { | 370 if (stride != 0) { |
371 Node* str = _gvn.MakeConX(stride); | 371 Node* str = _gvn.MakeConX(stride); |