Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/TestDescription.java
40955 views
1
/*
2
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
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
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
25
/*
26
* @test
27
*
28
* @summary converted from VM Testbase nsk/jvmti/ClassFileLoadHook/classfloadhk009.
29
* VM Testbase keywords: [quick, jpda, jvmti, noras, redefine]
30
* VM Testbase readme:
31
* DESCRIPTION
32
* This JVMTI test exercises JVMTI event ClassFileLoadHook().
33
* This test checks if CLASS_FILE_LOAD_HOOK event is received
34
* for class being redefined and the new instrumented bytecode
35
* returned from this event callback will be used for tested
36
* class after redefinition.
37
* The tested class is loaded with default classloader.
38
* This test uses three different bytecodes of the tested class
39
* 'classfloadhk009r' compiled from the different sources.
40
* This directory contains original source of the tested class,
41
* which is used to load class with default loader in debuggee class.
42
* The subdirectory 'newclass' contains redefined class
43
* with changed implementation of methods.
44
* The subdirectory 'newclass01' contains new instrumented class
45
* with one more changed implementation of methods.
46
* The test performs the following checks:
47
* - CLASS_FILE_LOAD_HOOK event callback is invoked and only once
48
* for the tested class upon its redefinition
49
* - pointers to new redefined bytecode and size passed to
50
* the event callback are not NULL
51
* - the new instrumented bytecode is successfully returned
52
* from the event callback
53
* - the new instrumented bytecode of the tested class is actually
54
* used after class redefinition
55
* The debuggee class preliminary loads redefined and instrumented
56
* bytecodes of the tested class into static fields and agent gets
57
* these bytecodes to use them in CLASS_FILE_LOAD_HOOK event callback.
58
* The debuggee loads tested class using default classloader.
59
* The agent enables CLASS_FILE_LOAD_HOOK event and redefines
60
* tested class with the redefined bytecode.
61
* Upon receiving CLASS_FILE_LOAD_HOOK event the agent performs checks
62
* and replaces redefined bytecode with the new instrumented bytecode.
63
* If no CLASS_FILE_LOAD_HOOK events were received, the agent
64
* complains an error.
65
* After tested class has been redefined debuggee uses reflection
66
* API to call static method of this class. If method returns value
67
* according to the new instrumented implementation, then the new
68
* bytecode was actually used for creation of tested class. Otherwise,
69
* if method returns value according to the original or redefined
70
* implementation, or any unexpected value, then the test complains
71
* an error.
72
* The agent does not deallocate memory used for instrumented
73
* bytecode, because this is VM responsibility.
74
* If all checks are successfull, the test passes with exit code 95,
75
* otherwise the test fails with exit code 97.
76
* COMMENTS
77
* Modified due to fix of the rfe
78
* 5010823 TEST_RFE: some JVMTI tests use the replaced capability
79
*
80
* @library /vmTestbase
81
* /test/lib
82
* @build nsk.jvmti.ClassFileLoadHook.classfloadhk009
83
*
84
* @comment compile loadclassXX to bin/loadclassXX
85
* @run driver nsk.share.ExtraClassesBuilder
86
* loadclass
87
*
88
* @comment compile newclassXX to bin/newclassXX
89
* @run driver nsk.share.ExtraClassesBuilder
90
* newclass newclass01
91
*
92
* @run main/othervm/native
93
* -agentlib:classfloadhk009=-waittime=5
94
* nsk.jvmti.ClassFileLoadHook.classfloadhk009
95
* ./bin
96
*/
97
98
99