src/share/vm/prims/jvmtiRedefineClasses.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8039525 Sdiff src/share/vm/prims

src/share/vm/prims/jvmtiRedefineClasses.cpp

Print this page




3001 // Simultaneous add of prefixes         m       ->  3_2_1_m
3002 // Simultaneous removal of prefixes     3_2_1_m ->  m
3003 // Simultaneous add and remove          1_m     ->  2_m
3004 // Same, caused by prefix removal only  3_2_1_m ->  3_2_m
3005 //
3006 class TransferNativeFunctionRegistration {
3007  private:
3008   instanceKlassHandle the_class;
3009   int prefix_count;
3010   char** prefixes;
3011 
3012   // Recursively search the binary tree of possibly prefixed method names.
3013   // Iteration could be used if all agents were well behaved. Full tree walk is
3014   // more resilent to agents not cleaning up intermediate methods.
3015   // Branch at each depth in the binary tree is:
3016   //    (1) without the prefix.
3017   //    (2) with the prefix.
3018   // where 'prefix' is the prefix at that 'depth' (first prefix, second prefix,...)
3019   Method* search_prefix_name_space(int depth, char* name_str, size_t name_len,
3020                                      Symbol* signature) {
3021     TempNewSymbol name_symbol = SymbolTable::probe(name_str, (int)name_len);
3022     if (name_symbol != NULL) {
3023       Method* method = the_class()->lookup_method(name_symbol, signature);
3024       if (method != NULL) {
3025         // Even if prefixed, intermediate methods must exist.
3026         if (method->is_native()) {
3027           // Wahoo, we found a (possibly prefixed) version of the method, return it.
3028           return method;
3029         }
3030         if (depth < prefix_count) {
3031           // Try applying further prefixes (other than this one).
3032           method = search_prefix_name_space(depth+1, name_str, name_len, signature);
3033           if (method != NULL) {
3034             return method; // found
3035           }
3036 
3037           // Try adding this prefix to the method name and see if it matches
3038           // another method name.
3039           char* prefix = prefixes[depth];
3040           size_t prefix_len = strlen(prefix);
3041           size_t trial_len = name_len + prefix_len;




3001 // Simultaneous add of prefixes         m       ->  3_2_1_m
3002 // Simultaneous removal of prefixes     3_2_1_m ->  m
3003 // Simultaneous add and remove          1_m     ->  2_m
3004 // Same, caused by prefix removal only  3_2_1_m ->  3_2_m
3005 //
3006 class TransferNativeFunctionRegistration {
3007  private:
3008   instanceKlassHandle the_class;
3009   int prefix_count;
3010   char** prefixes;
3011 
3012   // Recursively search the binary tree of possibly prefixed method names.
3013   // Iteration could be used if all agents were well behaved. Full tree walk is
3014   // more resilent to agents not cleaning up intermediate methods.
3015   // Branch at each depth in the binary tree is:
3016   //    (1) without the prefix.
3017   //    (2) with the prefix.
3018   // where 'prefix' is the prefix at that 'depth' (first prefix, second prefix,...)
3019   Method* search_prefix_name_space(int depth, char* name_str, size_t name_len,
3020                                      Symbol* signature) {
3021     TempNewSymbol name_symbol = SymbolTable::lookup_and_ignore_hash(name_str, (int)name_len);
3022     if (name_symbol != NULL) {
3023       Method* method = the_class()->lookup_method(name_symbol, signature);
3024       if (method != NULL) {
3025         // Even if prefixed, intermediate methods must exist.
3026         if (method->is_native()) {
3027           // Wahoo, we found a (possibly prefixed) version of the method, return it.
3028           return method;
3029         }
3030         if (depth < prefix_count) {
3031           // Try applying further prefixes (other than this one).
3032           method = search_prefix_name_space(depth+1, name_str, name_len, signature);
3033           if (method != NULL) {
3034             return method; // found
3035           }
3036 
3037           // Try adding this prefix to the method name and see if it matches
3038           // another method name.
3039           char* prefix = prefixes[depth];
3040           size_t prefix_len = strlen(prefix);
3041           size_t trial_len = name_len + prefix_len;


src/share/vm/prims/jvmtiRedefineClasses.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File