Set correct stack height for <clinit> on companion class

Bug: 186736918
Change-Id: I84c57d3a1cbefd3320b85f1608f2195b7e5b47a1
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceProcessor.java b/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceProcessor.java
index 206a3ed..e8e1cdd 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceProcessor.java
@@ -233,12 +233,14 @@
     CfCode code =
         new CfCode(
             companionType,
-            1,
+            clinitField.getType().isWideType() ? 2 : 1,
             0,
             ImmutableList.of(
                 new CfFieldInstruction(
                     Opcodes.GETSTATIC, clinitField.getReference(), clinitField.getReference()),
-                new CfStackInstruction(Opcode.Pop),
+                clinitField.getType().isWideType()
+                    ? new CfStackInstruction(Opcode.Pop2)
+                    : new CfStackInstruction(Opcode.Pop),
                 new CfReturnVoid()),
             ImmutableList.of(),
             ImmutableList.of());
diff --git a/src/test/java/com/android/tools/r8/shaking/clinit/InterfaceInitializedByInvokeStaticTest.java b/src/test/java/com/android/tools/r8/shaking/clinit/InterfaceInitializedByInvokeStaticTest.java
index e7a460d..7b92596 100644
--- a/src/test/java/com/android/tools/r8/shaking/clinit/InterfaceInitializedByInvokeStaticTest.java
+++ b/src/test/java/com/android/tools/r8/shaking/clinit/InterfaceInitializedByInvokeStaticTest.java
@@ -35,7 +35,7 @@
     testForDesugaring(parameters)
         .addInnerClasses(getClass())
         .run(parameters.getRuntime(), TestClass.class)
-        .assertSuccessWithOutputLines("I");
+        .assertSuccessWithOutputLines("I", "J");
   }
 
   @Test
@@ -47,7 +47,7 @@
         .setMinApi(parameters.getApiLevel())
         .compile()
         .run(parameters.getRuntime(), TestClass.class)
-        .assertSuccessWithOutputLines("I");
+        .assertSuccessWithOutputLines("I", "J");
   }
 
   @Test
@@ -68,12 +68,14 @@
                 .build(),
             TestClass.class);
     assertMayHaveClassInitializationSideEffects(appView, I.class);
+    assertMayHaveClassInitializationSideEffects(appView, J.class);
   }
 
   static class TestClass {
 
     public static void main(String[] args) {
       I.greet();
+      J.greet();
     }
   }
 
@@ -84,10 +86,21 @@
     static void greet() {}
   }
 
+  interface J {
+
+    long value = new Greeter("J").longValue();
+
+    static void greet() {}
+  }
+
   static class Greeter {
 
     Greeter(String greeting) {
       System.out.println(greeting);
     }
+
+    long longValue() {
+      return 42;
+    }
   }
 }