Skip to content

Commit 6cbee62

Browse files
committed
debug
Signed-off-by: Tobi Ajila <[email protected]>
1 parent cf0437b commit 6cbee62

File tree

7 files changed

+20
-8
lines changed

7 files changed

+20
-8
lines changed

jcl/src/java.base/share/classes/com/ibm/oti/vm/VM.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ public static int markCurrentThreadAsSystem()
631631
* constantpool associated with clazz
632632
*/
633633
public static ConstantPool getConstantPoolFromAnnotationBytes(Class<?> clazz, byte[] array) {
634-
/* Check the cp cache on the Class object first */
634+
/* Check the cp cache on the Class object first. */
635635
ConstantPool cp = VM.getVMLangAccess().getConstantPoolCache(clazz);
636636
if (null != cp) {
637637
return cp;

jcl/src/java.base/share/classes/com/ibm/oti/vm/VMLangAccess.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public interface VMLangAccess {
214214
/*[ENDIF] JAVA_SPEC_VERSION >= 11*/
215215

216216
/**
217-
* Returns a cached constantPool Object from a given java.lang.Class
217+
* Returns a cached constantPool Object from a given java.lang.Class.
218218
*
219219
* @param clazz
220220
*

jcl/src/java.base/share/classes/java/lang/InternalConstantPool.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
2323
*/
2424

25+
import com.ibm.oti.vm.VM;
26+
2527
/**
2628
* Represents the internal J9ConstantPool
2729
*
@@ -34,5 +36,6 @@ final class InternalConstantPool {
3436
public InternalConstantPool(long addr, Class<?> clazz) {
3537
this.vmRef = addr;
3638
this.clazz = clazz;
39+
VM.dumpString("addr: " + addr + " clazz: " + clazz.getName());
3740
}
3841
}

runtime/include/ffi_cfi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#ifndef FFI_CFI_H
88
#define FFI_CFI_H
99

10+
#undef HAVE_AS_CFI_PSEUDO_OP
11+
1012
#ifdef HAVE_AS_CFI_PSEUDO_OP
1113

1214
# define cfi_startproc .cfi_startproc

runtime/jcl/common/com_ibm_oti_vm_VM.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,10 @@ Java_com_ibm_oti_vm_VM_markCurrentThreadAsSystemImpl(JNIEnv *env)
167167
jlong JNICALL
168168
Java_com_ibm_oti_vm_VM_getJ9ConstantPoolFromJ9Class(JNIEnv *env, jclass unused, jlong j9clazz)
169169
{
170-
J9Class *clazz = (J9Class *)JLONG_TO_POINTER(j9clazz);
171-
return JLONG_FROM_POINTER(clazz->ramConstantPool);
170+
J9Class *clazz = (J9Class *)(UDATA)j9clazz;
171+
172+
Trc_JCL_accessCPEntry2((J9VMThread*)env, clazz, clazz->ramConstantPool);
173+
return (jlong)(UDATA)clazz->ramConstantPool;
172174
}
173175

174176
/**

runtime/jcl/common/java_lang_Access.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ Java_java_lang_Access_getConstantPool(JNIEnv *env, jclass unusedClass, jobject c
6767
vmFunctions->internalEnterVMFromJNI(vmThread);
6868
classObject = J9_JNI_UNWRAP_REFERENCE(classToIntrospect);
6969
if (J9VMJAVALANGCLASS_OR_NULL(vmThread->javaVM) == J9OBJECT_CLAZZ(vmThread, classObject)) {
70-
clazz = J9VM_J9CLASS_FROM_HEAPCLASS(vmThread, classObject);
71-
J9ConstantPool *j9CP = (J9ConstantPool *)clazz->ramConstantPool;
70+
J9ConstantPool *j9CP = NULL;
7271
J9Class *internalConstantPool = J9VMJAVALANGINTERNALCONSTANTPOOL_OR_NULL(vmThread->javaVM);
7372
Assert_JCL_notNull(internalConstantPool);
7473
j9object_t internalConstantPoolObject = gcFunctions->J9AllocateObject(vmThread, internalConstantPool, J9_GC_ALLOCATE_OBJECT_NON_INSTRUMENTABLE);
@@ -77,9 +76,13 @@ Java_java_lang_Access_getConstantPool(JNIEnv *env, jclass unusedClass, jobject c
7776
vmFunctions->internalExitVMToJNI(vmThread);
7877
return NULL;
7978
}
79+
classObject = J9_JNI_UNWRAP_REFERENCE(classToIntrospect);
80+
clazz = J9VM_J9CLASS_FROM_HEAPCLASS(vmThread, classObject);
81+
j9CP = (J9ConstantPool *)clazz->ramConstantPool;
8082
J9VMJAVALANGINTERNALCONSTANTPOOL_SET_VMREF(vmThread, internalConstantPoolObject, j9CP);
8183
J9VMJAVALANGINTERNALCONSTANTPOOL_SET_CLAZZ(vmThread, internalConstantPoolObject, classObject);
8284
classToIntrospect = vmFunctions->j9jni_createLocalRef(env, internalConstantPoolObject);
85+
Trc_JCL_accessCPEntry(vmThread, J9_JNI_UNWRAP_REFERENCE(constantPool), J9_JNI_UNWRAP_REFERENCE(classToIntrospect), clazz, j9CP);
8386
}
8487

8588
#if JAVA_SPEC_VERSION == 8

runtime/jcl/j9jcl.tdf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright IBM Corp. and others 2006
2-
//
2+
//
33
// This program and the accompanying materials are made available under
44
// the terms of the Eclipse Public License 2.0 which accompanies this
55
// distribution and is available at https://www.eclipse.org/legal/epl-2.0/
@@ -506,7 +506,7 @@ TraceExit=Trc_JCL_com_ibm_tenant_TenantContext_bindToAllocationContext_Exit Obso
506506

507507
TraceAssert=Assert_JCL_Natives_Not_Offloaded noEnv Overhead=1 Level=1 Assert="(0 /* unreachable */)"
508508

509-
TraceEvent=Trc_JCL_com_ibm_oti_vm_VM_dumpString Group=verboseclass Overhead=1 Level=3 Template="com_ibm_oti_vm_VM_dumpString: %s"
509+
TraceEvent=Trc_JCL_com_ibm_oti_vm_VM_dumpString Group=verboseclass Overhead=1 Level=1 Template="com_ibm_oti_vm_VM_dumpString: %s"
510510

511511

512512
TraceEntry=Trc_JCL_com_ibm_tenant_TenantContext_freeze_Entry Obsolete Overhead=1 Level=1 Template="com_ibm_tenant_TenantContext_freeze(tenantRef=%p)"
@@ -715,3 +715,5 @@ TraceExit=Trc_JCL_com_ibm_oti_shared_getCpeTypeForProtocol_ExitFail3 Noenv Overh
715715
TraceEntry=Trc_JCL_com_ibm_oti_shared_getCachedURL_Entry_1 Overhead=1 Level=2 Template="JCL: com.ibm.oti.shared getCachedURL: Entering for helperID=%d"
716716

717717
TraceEvent=Trc_JCL_signal_pid noEnv Overhead=1 Level=1 Template="%s received from process id %zu name '%s'"
718+
TraceEvent=Trc_JCL_accessCPEntry Overhead=1 Level=1 Template="Java_java_lang_Access_getConstantPool cpObject=%p internalCPOject=%p clazz=%p cp=%p"
719+
TraceEvent=Trc_JCL_accessCPEntry2 Overhead=1 Level=1 Template="Java_com_ibm_oti_vm_VM_getJ9ConstantPoolFromJ9Class clazz=%p cp=%p"

0 commit comments

Comments
 (0)