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

Value types field setting consistency checks #8

Open
wants to merge 3 commits into
base: LW1
Choose a base branch
from

Conversation

anikser
Copy link

@anikser anikser commented Aug 16, 2018

This change implements consistency checking for value type related field setting. A hash table of the names listed in a class's ValueTypes attribute is created, and used to perform the following checks during runtime bytecode verification:

  • Value type fields are non-nullable - this check can be performed
    during bytecode verification for some cases, ie. when aconst_null
    appears immediately before putfield.
  • Withfield can only operate on a field belonging to a value type class
  • Only withfield can be used to set instance fields belonging to a value type class

Also add a couple missing #if defined statements in field setting bytecode verification.

/* cannot set value type to null
* TODO: proper exception */
printf("BIG ERROR\n");
goto _inconsistentStack;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than an NLS message, how should I implement the exception throwing? I notice there are some constants defined for the verboseErrorCode in j9consts.h, but are these mapped to something?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya they used in errormessageframeworkrtv.c.

I think in this case it would be better to use the _miscError target and add your own errorcode (similar to BCV_ERR_BAD_ACCESS_PROTECTED)

Signed-off-by: Mohammad Ali Nikseresht <anikser@ibm.com>
@anikser anikser force-pushed the vt-field-attribute-membership branch 2 times, most recently from d460b8c to 13fc6a5 Compare August 17, 2018 14:54
Value type fields are non-nullable - this check can be performed
during bytecode verification for some cases, ie. when aconst_null
appears immediately before putfield.

Signed-off-by: Mohammad Ali Nikseresht <anikser@ibm.com>
@anikser anikser force-pushed the vt-field-attribute-membership branch 2 times, most recently from a2d1634 to 05047fb Compare August 23, 2018 21:35
Withfield can only operate on a value type class field, and
putfield and putstatic cannot operate on a value type class
field.

Signed-off-by: Mohammad Ali Nikseresht <anikser@ibm.com>
@anikser anikser force-pushed the vt-field-attribute-membership branch from 05047fb to de86920 Compare August 23, 2018 21:57
tajila pushed a commit that referenced this pull request Jun 21, 2019
Added wrapper for image memory allocate and image memory free
tajila pushed a commit that referenced this pull request Mar 13, 2020
Implment monitor enter/exit for valuetypes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants