Sat, 28 Mar 2009 15:47:29 -0700
6819891: ParNew: Fix work queue overflow code to deal correctly with +UseCompressedOops
Summary: When using compressed oops, rather than chaining the overflowed grey objects' pre-images through their klass words, we use GC-worker thread-local overflow stacks.
Reviewed-by: jcoomes, jmasa
duke@435 | 1 | /* |
duke@435 | 2 | * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | # include "incls/_precompiled.incl" |
duke@435 | 26 | # include "incls/_fieldType.cpp.incl" |
duke@435 | 27 | |
duke@435 | 28 | void FieldType::skip_optional_size(symbolOop signature, int* index) { |
duke@435 | 29 | jchar c = signature->byte_at(*index); |
duke@435 | 30 | while (c >= '0' && c <= '9') { |
duke@435 | 31 | *index = *index + 1; |
duke@435 | 32 | c = signature->byte_at(*index); |
duke@435 | 33 | } |
duke@435 | 34 | } |
duke@435 | 35 | |
duke@435 | 36 | BasicType FieldType::basic_type(symbolOop signature) { |
duke@435 | 37 | return char2type(signature->byte_at(0)); |
duke@435 | 38 | } |
duke@435 | 39 | |
duke@435 | 40 | // Check if it is a valid array signature |
duke@435 | 41 | bool FieldType::is_valid_array_signature(symbolOop sig) { |
duke@435 | 42 | assert(sig->utf8_length() > 1, "this should already have been checked"); |
duke@435 | 43 | assert(sig->byte_at(0) == '[', "this should already have been checked"); |
duke@435 | 44 | // The first character is already checked |
duke@435 | 45 | int i = 1; |
duke@435 | 46 | int len = sig->utf8_length(); |
duke@435 | 47 | // First skip all '['s |
duke@435 | 48 | while(i < len - 1 && sig->byte_at(i) == '[') i++; |
duke@435 | 49 | |
duke@435 | 50 | // Check type |
duke@435 | 51 | switch(sig->byte_at(i)) { |
duke@435 | 52 | case 'B': // T_BYTE |
duke@435 | 53 | case 'C': // T_CHAR |
duke@435 | 54 | case 'D': // T_DOUBLE |
duke@435 | 55 | case 'F': // T_FLOAT |
duke@435 | 56 | case 'I': // T_INT |
duke@435 | 57 | case 'J': // T_LONG |
duke@435 | 58 | case 'S': // T_SHORT |
duke@435 | 59 | case 'Z': // T_BOOLEAN |
duke@435 | 60 | // If it is an array, the type is the last character |
duke@435 | 61 | return (i + 1 == len); |
duke@435 | 62 | case 'L': |
duke@435 | 63 | // If it is an object, the last character must be a ';' |
duke@435 | 64 | return sig->byte_at(len - 1) == ';'; |
duke@435 | 65 | } |
duke@435 | 66 | |
duke@435 | 67 | return false; |
duke@435 | 68 | } |
duke@435 | 69 | |
duke@435 | 70 | |
duke@435 | 71 | BasicType FieldType::get_array_info(symbolOop signature, jint* dimension, symbolOop* object_key, TRAPS) { |
duke@435 | 72 | assert(basic_type(signature) == T_ARRAY, "must be array"); |
duke@435 | 73 | int index = 1; |
duke@435 | 74 | int dim = 1; |
duke@435 | 75 | skip_optional_size(signature, &index); |
duke@435 | 76 | while (signature->byte_at(index) == '[') { |
duke@435 | 77 | index++; |
duke@435 | 78 | dim++; |
duke@435 | 79 | skip_optional_size(signature, &index); |
duke@435 | 80 | } |
duke@435 | 81 | ResourceMark rm; |
duke@435 | 82 | symbolOop element = oopFactory::new_symbol(signature->as_C_string() + index, CHECK_(T_BYTE)); |
duke@435 | 83 | BasicType element_type = FieldType::basic_type(element); |
duke@435 | 84 | if (element_type == T_OBJECT) { |
duke@435 | 85 | char* object_type = element->as_C_string(); |
duke@435 | 86 | object_type[element->utf8_length() - 1] = '\0'; |
duke@435 | 87 | *object_key = oopFactory::new_symbol(object_type + 1, CHECK_(T_BYTE)); |
duke@435 | 88 | } |
duke@435 | 89 | // Pass dimension back to caller |
duke@435 | 90 | *dimension = dim; |
duke@435 | 91 | return element_type; |
duke@435 | 92 | } |