主权项 |
1. A method for use in a first program execution environment, the method comprising:
creating a first map for looking up a class loader by a lookup identifier based, at least in part, on that class loader's first-loaded class; receiving code compiled in a second program execution environment, which code includes: (i) a native class pointer to a target class loaded by a class loader in the second program execution environment, and (ii) an associated lookup identifier based, at least in part, on a first-loaded class of the class loader in the second program execution environment; looking up in the first map, using the associated lookup identifier, a class loader in the first program execution environment; seeking, via a referential identifier of the found class loader, a current native class pointer to the target class; responsive to finding the current native class pointer, updating the native class pointer in the received code with the current native class pointer; and creating a second map of class loaders to first-loaded classes; wherein: the lookup identifier represents a first-loaded class, such that the first map is a map of first-loaded classes to their respective class loaders; and creating the first map and the second map includes:
searching the second map, using an identifier of a class loader of a class being loaded, for a first-loaded class;responsive to a first-loaded class not being found, searching the first map, using an identifier of the class being loaded, for a class loader; andresponsive to a class loader not being found, adding to the first map an association between the class being loaded and the class loader of the class being loaded, and adding to the second map an association between the class loader of the class being loaded and the class being loaded. |