Skip to content

IL Generation for defaultvalue bytecode instruction - #9030

Merged
andrewcraik merged 2 commits into
eclipse-openj9:masterfrom
hzongaro:defaultvalue-ilgen
Apr 2, 2020
Merged

andrewcraik merged 2 commits into
eclipse-openj9:masterfrom
hzongaro:defaultvalue-ilgen

Conversation

@hzongaro

Copy link
Copy Markdown
Member

This change adds prototype IL generation support for the value type defaultvalue bytecode in the case where the class specified is resolved. If the class is unresolved, the JIT compilation is aborted with an UnsupportedValueTypeOperation exception.

@hzongaro

Copy link
Copy Markdown
Member Author

Andrew @andrewcraik, may I ask you to review this change?

@andrewcraik andrewcraik self-assigned this Mar 31, 2020
@andrewcraik

Copy link
Copy Markdown
Contributor

@DanHeidinga could we have your review for the change in the runtime/jit_vm/ctsupport.cpp ?

@andrewcraik

Copy link
Copy Markdown
Contributor

Jenkins test sanity all jdk14

@andrewcraik andrewcraik added the project:valhalla Used to track Project Valhalla related work label Apr 1, 2020

@DanHeidinga DanHeidinga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Treating L & Q identically is probably the right initial choice. Is it worth differentiating them now though? We'll likely want to treat them differently as we look at optimized calling sequences, etc

Comment thread runtime/jit_vm/ctsupport.cpp Resolved
@hzongaro

hzongaro commented Apr 1, 2020 •

Copy link
Copy Markdown
Member Author

Treating L & Q identically is probably the right initial choice. Is it worth differentiating them now though? We'll likely want to treat them differently as we look at optimized calling sequences, etc

Dan @DanHeidinga, you're right about wanting to treat the two differently, of course. I'd be happy to define a J9_NATIVE_TYPE_VALUE in j9consts.h whose value would be the same as that of J9_NATIVE_TYPE_OBJECT. However, the scope of what you're suggesting feels much bigger than that one trivial change, so I'm not sure this pull request is the best place to start it off.

@DanHeidinga

Copy link
Copy Markdown
Member

Can you add a /* TODO: this should return J9_NATIVE_TYPE_VALUE in the future */ to anywhere that processes the Q? Something to indicate work is still needed here or we'll be chasing bugs related to returning the wrong type in the future

@hzongaro
hzongaro force-pushed the defaultvalue-ilgen branch from b9a2347 to 79d5737 Compare April 1, 2020 18:47
Comment thread runtime/jit_vm/ctsupport.cpp Resolved
Comment thread runtime/compiler/env/J9ClassEnv.cpp Resolved
@hzongaro
hzongaro force-pushed the defaultvalue-ilgen branch from 3035978 to 2af5c52 Compare April 1, 2020 19:15
hzongaro added 2 commits April 1, 2020 15:28
The experimental value types support uses the letter Q before the class
name for a value type class.  This change handles the following cases:

1) In building a TR:TypeLayout in J9ClassEnv.cpp, treat a field that
   has Q before a class name as being of type TR::Address.

2) The code in TR_J9VM::getClassFromSignature strips off any leading 'L'
   and trailing semicolon from the signature string for a class that it
   is looking up.  For value types, it also needs to strip off any
   leading 'Q'.

3) In jitParseSignature in ctsupport.cpp, allow for the letter Q before
   a class name in parsing signatures.

Signed-off-by:  Henry Zongaro <zongaro@ca.ibm.com>
For a defaultvalue bytecode, if the class is resolved, generate a
newvalue instruction with default values for the fields as operands.
Recursively generate a newvalue for any fields that are themselves
value types.

The JIT compiler is not yet able to handle the case of an unresolved
class used in a defaultvalue bytecode instruction.  Simply fail the
compilation during ILGen if an unresolved class is encountered in that
situation.  The failure is reported as an
UnsupportedValueTypeOperation exception.  The intention is that these
can be replaced with OSR points in the future.

In order to track the frequency with which we are failing compilations
due to encountering unresolved classes during IL generation for the
defaultvalue bytecode, use static debug counters that begin with
the string "ilgen.abort/unresolved/defaultvalue".

Signed-off-by:  Henry Zongaro <zongaro@ca.ibm.com>
@hzongaro
hzongaro force-pushed the defaultvalue-ilgen branch from 2af5c52 to c34da9e Compare April 1, 2020 19:29

@DanHeidinga DanHeidinga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

changes look ok to me

@DanHeidinga

Copy link
Copy Markdown
Member

@andrewcraik I'll leave builds and merging to you

@andrewcraik

Copy link
Copy Markdown
Contributor

Jenkins test sanity all jdk14

@andrewcraik

Copy link
Copy Markdown
Contributor

390 failed with infra issues rest of the builds are clean and there is nothing 390 specific so this can merge.

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

Labels

comp:jit project:valhalla Used to track Project Valhalla related work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants