94 } 95 Asserts.assertTrue(IS_POSITIVE, 96 "Haven't caught InternalError in negative case"); 97 Method testMethod; 98 try { 99 testMethod = SimpleClass.class.getDeclaredMethod(METHOD_NAME); 100 } catch (NoSuchMethodException e) { 101 throw new Error("TEST BUG: Can't find " + METHOD_NAME, e); 102 } 103 HotSpotResolvedJavaMethod method = CTVMUtilities 104 .getResolvedMethod(SimpleClass.class, testMethod); 105 CompilationResult compResult = new CompilationResult(METHOD_NAME); 106 HotSpotCompilationRequest compRequest = new HotSpotCompilationRequest(method, -1, 0L); 107 // to pass sanity check of default -1 108 compResult.setTotalFrameSize(0); 109 codeCache.installCode(compRequest, compResult, /* installedCode = */ null, /* speculationLog = */ null, 110 /* isDefault = */ false); 111 Asserts.assertEQ(gotInstallNotification, 1, 112 "Got unexpected event count after 1st install attempt"); 113 // since "empty" compilation result is ok, a second attempt should be ok 114 codeCache.installCode(compRequest, compResult, /* installedCode = */ null, /* speculationLog = */ null, 115 /* isDefault = */ false); 116 Asserts.assertEQ(gotInstallNotification, 2, 117 "Got unexpected event count after 2nd install attempt"); 118 } 119 120 @Override 121 public void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, 122 InstalledCode installedCode, CompilationResult compResult) { 123 gotInstallNotification++; 124 } 125 } | 94 } 95 Asserts.assertTrue(IS_POSITIVE, 96 "Haven't caught InternalError in negative case"); 97 Method testMethod; 98 try { 99 testMethod = SimpleClass.class.getDeclaredMethod(METHOD_NAME); 100 } catch (NoSuchMethodException e) { 101 throw new Error("TEST BUG: Can't find " + METHOD_NAME, e); 102 } 103 HotSpotResolvedJavaMethod method = CTVMUtilities 104 .getResolvedMethod(SimpleClass.class, testMethod); 105 CompilationResult compResult = new CompilationResult(METHOD_NAME); 106 HotSpotCompilationRequest compRequest = new HotSpotCompilationRequest(method, -1, 0L); 107 // to pass sanity check of default -1 108 compResult.setTotalFrameSize(0); 109 codeCache.installCode(compRequest, compResult, /* installedCode = */ null, /* speculationLog = */ null, 110 /* isDefault = */ false); 111 Asserts.assertEQ(gotInstallNotification, 1, 112 "Got unexpected event count after 1st install attempt"); 113 // since "empty" compilation result is ok, a second attempt should be ok 114 compResult = new CompilationResult(METHOD_NAME); // create another instance with fresh state 115 compResult.setTotalFrameSize(0); 116 codeCache.installCode(compRequest, compResult, /* installedCode = */ null, /* speculationLog = */ null, 117 /* isDefault = */ false); 118 Asserts.assertEQ(gotInstallNotification, 2, 119 "Got unexpected event count after 2nd install attempt"); 120 } 121 122 @Override 123 public void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, 124 InstalledCode installedCode, CompilationResult compResult) { 125 gotInstallNotification++; 126 } 127 } |