https://bz.apache.org/bugzilla/show_bug.cgi?id=67080

--- Comment #3 from John Engebretson <jeng...@amazon.com> ---
I used javap to examine the bytecode of the reproducer - the full output is
attached but the critical portion is below.  In short, it hashes each constant
and switches based on that hash.

This is superior to binary search because it's constant-time and superior to
HashMap because there is no object instantiation/traversal.


 protected void runNewTest();
    descriptor: ()V
    flags: (0x0004) ACC_PROTECTED
    Code:
      stack=5, locals=5, args_size=1
         0: iconst_m1
         1: istore_1
         2: iconst_0
         3: istore_2
         4: goto          363
         7: getstatic     #40                 // Field
TEST_SCOPES:[Ljava/lang/String;
        10: iload_2
        11: aaload
        12: astore_3
        13: aload_3
        14: dup
        15: astore        4
        17: invokevirtual #62                 // Method
java/lang/String.hashCode:()I
        20: lookupswitch  { // 11
             -1354757532: 120
             -1221270899: 133
              -697829026: 146
              -272077475: 159
              -214877152: 172
               -10806556: 185
               106436749: 198
               872295685: 211
               889144335: 224
              1291689221: 237
              2073857551: 250
                 default: 324
            }
       120: aload         4
       122: ldc           #18                 // String cookie
       124: invokevirtual #66                 // Method
java/lang/String.equals:(Ljava/lang/Object;)Z
       127: ifne          294
       130: goto          324
       133: aload         4
       135: ldc           #20                 // String header
       137: invokevirtual #66                 // Method
java/lang/String.equals:(Ljava/lang/Object;)Z
       140: ifne          283
       143: goto          324
       146: aload         4

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to