1 /* |
1 /* |
2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2019, 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. |
72 import jdk.vm.ci.code.site.DataPatch; |
72 import jdk.vm.ci.code.site.DataPatch; |
73 import jdk.vm.ci.code.site.Site; |
73 import jdk.vm.ci.code.site.Site; |
74 import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; |
74 import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; |
75 import jdk.vm.ci.hotspot.HotSpotCompiledCode; |
75 import jdk.vm.ci.hotspot.HotSpotCompiledCode; |
76 import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment; |
76 import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment; |
|
77 import jdk.vm.ci.hotspot.HotSpotCompiledNmethod; |
77 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; |
78 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; |
78 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; |
79 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; |
79 import jdk.vm.ci.hotspot.HotSpotVMEventListener; |
80 import jdk.vm.ci.hotspot.HotSpotVMEventListener; |
80 import jdk.vm.ci.meta.Assumptions.Assumption; |
81 import jdk.vm.ci.meta.Assumptions.Assumption; |
81 import jdk.vm.ci.meta.ResolvedJavaMethod; |
82 import jdk.vm.ci.meta.ResolvedJavaMethod; |
116 } catch (NoSuchMethodException e) { |
117 } catch (NoSuchMethodException e) { |
117 throw new Error("TEST BUG: Can't find " + METHOD_NAME, e); |
118 throw new Error("TEST BUG: Can't find " + METHOD_NAME, e); |
118 } |
119 } |
119 HotSpotResolvedJavaMethod method = CTVMUtilities |
120 HotSpotResolvedJavaMethod method = CTVMUtilities |
120 .getResolvedMethod(SimpleClass.class, testMethod); |
121 .getResolvedMethod(SimpleClass.class, testMethod); |
121 HotSpotCompiledCode compiledCode = new HotSpotCompiledCode(METHOD_NAME, |
122 HotSpotCompiledCode compiledCode = new HotSpotCompiledNmethod(METHOD_NAME, |
122 new byte[0], 0, new Site[0], new Assumption[0], |
123 new byte[0], 0, new Site[0], new Assumption[0], |
123 new ResolvedJavaMethod[]{method}, new Comment[0], new byte[0], |
124 new ResolvedJavaMethod[]{method}, new Comment[0], new byte[0], |
124 16, new DataPatch[0], false, 0, null); |
125 16, new DataPatch[0], false, 0, null, |
|
126 method, 0, 1, 0L, false); |
125 codeCache.installCode(method, compiledCode, /* installedCode = */ null, |
127 codeCache.installCode(method, compiledCode, /* installedCode = */ null, |
126 /* speculationLog = */ null, /* isDefault = */ false); |
128 /* speculationLog = */ null, /* isDefault = */ false); |
127 Asserts.assertEQ(gotInstallNotification, 1, |
129 Asserts.assertEQ(gotInstallNotification, 1, |
128 "Got unexpected event count after 1st install attempt"); |
130 "Got unexpected event count after 1st install attempt"); |
129 // since "empty" compilation result is ok, a second attempt should be ok |
131 // since "empty" compilation result is ok, a second attempt should be ok |