Mercurial > hg > truffle
comparison src/share/vm/memory/metadataFactory.hpp @ 12857:d37a0525c0fe
8024667: VM crashes with "assert(method() != NULL) failed: must have set method"
Summary: Check if data is in shared spaces before deallocating it.
Reviewed-by: coleenp, dcubed
author | hseigel |
---|---|
date | Sat, 12 Oct 2013 15:39:16 -0400 |
parents | 59a58e20dc60 |
children | 2c6ef90f030a |
comparison
equal
deleted
inserted
replaced
12856:3e265ce4d2dd | 12857:d37a0525c0fe |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2010, 2013, 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. |
63 | 63 |
64 template <typename T> | 64 template <typename T> |
65 static void free_array(ClassLoaderData* loader_data, Array<T>* data) { | 65 static void free_array(ClassLoaderData* loader_data, Array<T>* data) { |
66 if (data != NULL) { | 66 if (data != NULL) { |
67 assert(loader_data != NULL, "shouldn't pass null"); | 67 assert(loader_data != NULL, "shouldn't pass null"); |
68 assert(!data->is_shared(), "cannot deallocate array in shared spaces"); | |
68 int size = data->size(); | 69 int size = data->size(); |
69 if (DumpSharedSpaces) { | 70 if (DumpSharedSpaces) { |
70 loader_data->ro_metaspace()->deallocate((MetaWord*)data, size, false); | 71 loader_data->ro_metaspace()->deallocate((MetaWord*)data, size, false); |
71 } else { | 72 } else { |
72 loader_data->metaspace_non_null()->deallocate((MetaWord*)data, size, false); | 73 loader_data->metaspace_non_null()->deallocate((MetaWord*)data, size, false); |
81 assert(loader_data != NULL, "shouldn't pass null"); | 82 assert(loader_data != NULL, "shouldn't pass null"); |
82 int size = md->size(); | 83 int size = md->size(); |
83 // Call metadata's deallocate function which will call deallocate fields | 84 // Call metadata's deallocate function which will call deallocate fields |
84 assert(!DumpSharedSpaces, "cannot deallocate metadata when dumping CDS archive"); | 85 assert(!DumpSharedSpaces, "cannot deallocate metadata when dumping CDS archive"); |
85 assert(!md->on_stack(), "can't deallocate things on stack"); | 86 assert(!md->on_stack(), "can't deallocate things on stack"); |
87 assert(!md->is_shared(), "cannot deallocate if in shared spaces"); | |
86 md->deallocate_contents(loader_data); | 88 md->deallocate_contents(loader_data); |
87 loader_data->metaspace_non_null()->deallocate((MetaWord*)md, size, md->is_klass()); | 89 loader_data->metaspace_non_null()->deallocate((MetaWord*)md, size, md->is_klass()); |
88 } | 90 } |
89 } | 91 } |
90 }; | 92 }; |