Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConstantDynamic: Verifier checks for Constant dynamic #1278

Closed
tajila opened this issue Feb 26, 2018 · 6 comments
Closed

ConstantDynamic: Verifier checks for Constant dynamic #1278

tajila opened this issue Feb 26, 2018 · 6 comments

Comments

@tajila
Copy link
Contributor

tajila commented Feb 26, 2018

Condy entries are valid for classifies with major version 55 (or greater)
Static constraints: runtime/bcverify/staticverify.c
Runtime verification: runtime/bcverify/rtverify.c

Name and type must match bytecode (ie. 'D' and 'J' must be used with ldc2_w and not ldc)

http://mail.openjdk.java.net/pipermail/valhalla-spec-experts/2018-March/000586.html

@DanHeidinga
Copy link
Member

DanHeidinga commented Feb 28, 2018

Static constraints: runtime/bcverify/staticverify.c
Runtime verification: runtime/bcverify/rtverify.c

@DanHeidinga
Copy link
Member

ldc2w will need to validate the Condy returns a long (J) or double (D)

@fengxue-IS
Copy link
Contributor

fengxue-IS commented Mar 13, 2018

tested with openjdk11-condy build and modified ASM jar (it doesn't generate ldc2_w bytecode),
bytecode:

public static void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: (0x0009) ACC_PUBLIC, ACC_STATIC
    Code:
      stack=2, locals=1, args_size=1
         0: aload_0
         1: ldc2_w        #22                 // Dynamic #0:m:F
         4: return


BootstrapMethods:
  0: #19 REF_invokeStatic A.m:()F

gives

Error: Unable to initialize main class A
Caused by: java.lang.VerifyError: Illegal type at constant pool entry 22 in class A
Exception Details:
  Location:
    A.main([Ljava/lang/String;)V @1: ldc2_w
  Reason:
    Constant pool index 22 is invalid

@tajila
Copy link
Contributor Author

tajila commented Mar 18, 2018

This issue depends on #1426

@tajila
Copy link
Contributor Author

tajila commented Mar 27, 2018

@taliamccormick can you take a look at this

@taliamccormick
Copy link
Contributor

WIP PR here: #1631

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants