Mercurial > hg > graal-compiler
comparison src/share/vm/prims/jvmtiRedefineClasses.cpp @ 7624:b14da2e6f2dc
7174978: NPG: Fix bactrace builder for class redefinition
Summary: Remove Method* from backtrace but save version so redefine classes doesn't give inaccurate line numbers. Removed old Merlin API with duplicate code.
Reviewed-by: dholmes, sspitsyn
author | coleenp |
---|---|
date | Thu, 17 Jan 2013 13:40:31 -0500 |
parents | cc6a617fffd2 |
children | 5daaddd917a1 |
comparison
equal
deleted
inserted
replaced
7623:203f64878aab | 7624:b14da2e6f2dc |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2003, 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. |
1332 if (merge_cp_length != the_class->constants()->length() | 1332 if (merge_cp_length != the_class->constants()->length() |
1333 + scratch_class->constants()->length()) { | 1333 + scratch_class->constants()->length()) { |
1334 return JVMTI_ERROR_INTERNAL; | 1334 return JVMTI_ERROR_INTERNAL; |
1335 } | 1335 } |
1336 | 1336 |
1337 int orig_length = old_cp->orig_length(); | 1337 // Update the version number of the constant pool |
1338 if (orig_length == 0) { | 1338 merge_cp->increment_and_save_version(old_cp->version()); |
1339 // This old_cp is an actual original constant pool. We save | |
1340 // the original length in the merged constant pool so that | |
1341 // merge_constant_pools() can be more efficient. If a constant | |
1342 // pool has a non-zero orig_length() value, then that constant | |
1343 // pool was created by a merge operation in RedefineClasses. | |
1344 merge_cp->set_orig_length(old_cp->length()); | |
1345 } else { | |
1346 // This old_cp is a merged constant pool from a previous | |
1347 // RedefineClasses() calls so just copy the orig_length() | |
1348 // value. | |
1349 merge_cp->set_orig_length(old_cp->orig_length()); | |
1350 } | |
1351 | 1339 |
1352 ResourceMark rm(THREAD); | 1340 ResourceMark rm(THREAD); |
1353 _index_map_count = 0; | 1341 _index_map_count = 0; |
1354 _index_map_p = new intArray(scratch_cp->length(), -1); | 1342 _index_map_p = new intArray(scratch_cp->length(), -1); |
1355 | 1343 |
2415 ClassLoaderData* loader_data, | 2403 ClassLoaderData* loader_data, |
2416 instanceKlassHandle scratch_class, constantPoolHandle scratch_cp, | 2404 instanceKlassHandle scratch_class, constantPoolHandle scratch_cp, |
2417 int scratch_cp_length, TRAPS) { | 2405 int scratch_cp_length, TRAPS) { |
2418 assert(scratch_cp->length() >= scratch_cp_length, "sanity check"); | 2406 assert(scratch_cp->length() >= scratch_cp_length, "sanity check"); |
2419 | 2407 |
2420 // scratch_cp is a merged constant pool and has enough space for a | 2408 // scratch_cp is a merged constant pool and has enough space for a |
2421 // worst case merge situation. We want to associate the minimum | 2409 // worst case merge situation. We want to associate the minimum |
2422 // sized constant pool with the klass to save space. | 2410 // sized constant pool with the klass to save space. |
2423 constantPoolHandle smaller_cp(THREAD, | 2411 constantPoolHandle smaller_cp(THREAD, |
2424 ConstantPool::allocate(loader_data, scratch_cp_length, | 2412 ConstantPool::allocate(loader_data, scratch_cp_length, THREAD)); |
2425 THREAD)); | 2413 |
2426 // preserve orig_length() value in the smaller copy | 2414 // preserve version() value in the smaller copy |
2427 int orig_length = scratch_cp->orig_length(); | 2415 int version = scratch_cp->version(); |
2428 assert(orig_length != 0, "sanity check"); | 2416 assert(version != 0, "sanity check"); |
2429 smaller_cp->set_orig_length(orig_length); | 2417 smaller_cp->set_version(version); |
2430 scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD); | 2418 |
2431 scratch_cp = smaller_cp; | 2419 scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD); |
2420 scratch_cp = smaller_cp; | |
2432 | 2421 |
2433 // attach new constant pool to klass | 2422 // attach new constant pool to klass |
2434 scratch_cp->set_pool_holder(scratch_class()); | 2423 scratch_cp->set_pool_holder(scratch_class()); |
2435 | 2424 |
2436 // attach klass to new constant pool | 2425 // attach klass to new constant pool |