Skip to content

Commit

Permalink
Resolve static field ref in CP if possible
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Despres <[email protected]>
  • Loading branch information
cjjdespres committed Dec 10, 2024
1 parent 9725406 commit 9f4ca45
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions runtime/jit_vm/ctsupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ jitGetClassInClassloaderFromUTF8(J9VMThread *vmStruct, J9ClassLoader *classLoade
}

/**
* This function returns the class associated to a static field ref at a particular cpIndex in a constant pool.
* The class entry will be resolved with resolveStaticFieldRef if it is not already resolved.
*
* @param vmStruct, the current J9VMThread
* @param constantPool, the constant pool that the cpIndex is referring to
* @param fieldIndex, the index of an entry in a constant pool, pointing at a static field ref.
Expand All @@ -95,6 +98,11 @@ jitGetClassOfFieldFromCP(J9VMThread *vmStruct, J9ConstantPool *constantPool, UDA

/* romConstantPool is a J9ROMConstantPoolItem */
ramRefWrapper = ((J9RAMStaticFieldRef*) constantPool) + fieldIndex;

if (!J9RAMSTATICFIELDREF_IS_RESOLVED(ramRefWrapper)) {
vmStruct->javaVM->internalVMFunctions->resolveStaticFieldRef(vmStruct, NULL, constantPool, fieldIndex, J9_RESOLVE_FLAG_JIT_COMPILE_TIME, NULL);
}

if (J9RAMSTATICFIELDREF_IS_RESOLVED(ramRefWrapper)) {
J9Class *classWrapper = J9RAMSTATICFIELDREF_CLASS(ramRefWrapper);
UDATA initStatus = classWrapper->initializeStatus;
Expand Down

0 comments on commit 9f4ca45

Please sign in to comment.