Index: vm/vmcore/include/environment.h =================================================================== --- vm/vmcore/include/environment.h (revision 426434) +++ vm/vmcore/include/environment.h (working copy) @@ -41,6 +41,8 @@ Properties& properties; DebugUtilsTI* TI; NSOTableItem* nsoTable; + void* portLib; // Classlib's port library + // // globals // Index: vm/vmcore/src/class_support/Environment.cpp =================================================================== --- vm/vmcore/src/class_support/Environment.cpp (revision 426434) +++ vm/vmcore/src/class_support/Environment.cpp (working copy) @@ -139,7 +139,9 @@ shutting_down = 0; TI = NULL; + portLib = NULL; + nsoTable = nso_init_lookup_table(&this->string_pool); } //Global_Env::Global_Env Index: vm/vmcore/src/init/parse_arguments.cpp =================================================================== --- vm/vmcore/src/init/parse_arguments.cpp (revision 426434) +++ vm/vmcore/src/init/parse_arguments.cpp (working copy) @@ -278,7 +278,8 @@ add_pair_to_properties(p_env->properties, "vm.cleanupOnExit", "true"); } else if (strcmp(option, "_org.apache.harmony.vmi.portlib") == 0) { - // Ignore _org.apache.harmony.vmi.portlib for now; + // Store a pointer to the portlib + p_env->portLib = p_env->vm_arguments.options[i].extraInfo; } else { ECHO("Unknown option " << option << USE_JAVA_HELP); Index: vm/vmi/src/vmi.cpp =================================================================== --- vm/vmi/src/vmi.cpp (revision 426434) +++ vm/vmi/src/vmi.cpp (working copy) @@ -124,6 +124,13 @@ if (! initialized) { + // First, try to get the portlib pointer from global env (must have been put there during args parse) + portLibPointer = (HyPortLibrary*)VM_Global_State::loader_env->portLib; + if (NULL != portLibPointer) { + initialized = 1; + return portLibPointer; + } + // If the above fails, initialize portlib here int rc; HyPortLibraryVersion portLibraryVersion; HYPORT_SET_VERSION(&portLibraryVersion, HYPORT_CAPABILITY_MASK); @@ -140,8 +147,8 @@ // know there is portLib is initialized there already. portLibPointer = &portLib; } - TRACE("vmi->GetPortLibrary(): returning: " << &portLib); - return &portLib; + TRACE("vmi->GetPortLibrary(): returning: " << portLibPointer); + return portLibPointer; } @@ -175,8 +182,9 @@ { return zipCachePool; } + HyPortLibrary *portLibPointer = GetPortLibrary(vmi); assert(portLibPointer); - zipCachePool = zipCachePool_new(&portLib); + zipCachePool = zipCachePool_new(portLibPointer); assert(zipCachePool); return zipCachePool; }