author | mlarsson |
Tue, 29 Mar 2016 09:43:05 +0200 | |
changeset 37201 | 928cf689af1a |
parent 14582 | 490bb6c0df7c |
permissions | -rw-r--r-- |
14582
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
1 |
/* |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
2 |
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
4 |
* |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
8 |
* |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
13 |
* accompanied this code). |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
14 |
* |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
18 |
* |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
21 |
* questions. |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
22 |
* |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
23 |
*/ |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
24 |
|
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
25 |
public class Victim implements Test8003720.CallMe { |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
26 |
public void callme() { |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
27 |
// note: Victim.this is dead here |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
28 |
Test8003720.println("executing in loader=" + Victim.class.getClassLoader()); |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
29 |
|
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
30 |
long now = System.currentTimeMillis(); |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
31 |
|
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
32 |
while ((System.currentTimeMillis() - now) < Test8003720.DURATION) { |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
33 |
long count = VictimClassLoader.counter++; |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
34 |
if (count % 1000000 == 0) System.gc(); |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
35 |
if (count % 16180000 == 0) blurb(); |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
36 |
new Object[1].clone(); |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
37 |
} |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
38 |
} |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
39 |
static void blurb() { |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
40 |
Test8003720.println("count=" + VictimClassLoader.counter); |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
41 |
} |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
42 |
static { |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
43 |
blather(); |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
44 |
} |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
45 |
static void blather() { |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
46 |
new java.util.ArrayList<Object>(1000000); |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
47 |
Class<Victim> c = Victim.class; |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
48 |
Test8003720.println("initializing " + c + "#" + System.identityHashCode(c) + " in " + c.getClassLoader()); |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
49 |
} |
490bb6c0df7c
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff
changeset
|
50 |
} |