This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA/JVMTI] Implement GetLocalVariableTable and GetMaxLocals


>>>>> "Kyle" == Kyle Galloway <kgallowa@redhat.com> writes:

Kyle> This patch implements the JVMTI method GetLocalVariableTable.  This
Kyle> grabs the local variable table attribute out of a class file when it
Kyle> is loaded, similar to how a line table is obtained.  When a JVMTI
Kyle> request for this information is given, it loads the information into a
Kyle> JVMTI appropriate structure, or reports the data is absent if the
Kyle> class file contained no table for this method.

Kyle> Comments?

This is pretty much ok.

Kyle> +  char* name;
Kyle> +  char* descriptor;

The libgcj style is to put the '*' by the name, like 'char *name'.
(There may be exceptions to this but they are generally really old
code.)

Kyle> +  int get_local_var_table (char **name, char **sig, char **generic_sig,
Kyle> +                           long *startloc, jint *length, jint *slot,
Kyle> +                           int table_slot)
Kyle> +        *name = reinterpret_cast<char *> 
Kyle> +          (_Jv_AllocBytes (strlen (local_var_table[table_slot].name) + 1));

I don't see how memory allocated here can ever be freed.

But ... maybe we don't need to make copies of the names and such?
I don't know whether user code might mess with the data here.

Kyle>  static jvmtiError JNICALL
Kyle> +_Jv_JVMTI_GetLocalVariableTable (MAYBE_UNUSED jvmtiEnv *env, jmethodID method,

Remove the MAYBE_UNUSED here.  This occurs in a couple places in the
patch.

Do we need to verify that the info in the variable table is valid?
For instance whether the PC values or variable table indices are valid?

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]