350 if (compiler == null) { 351 synchronized (this) { 352 if (compiler == null) { 353 compiler = compilerFactory.createCompiler(this); 354 } 355 } 356 } 357 return compiler; 358 } 359 360 public JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve) { 361 Objects.requireNonNull(accessingType, "cannot resolve type without an accessing class"); 362 // If the name represents a primitive type we can short-circuit the lookup. 363 if (name.length() == 1) { 364 JavaKind kind = JavaKind.fromPrimitiveOrVoidTypeChar(name.charAt(0)); 365 return fromClass(kind.toJavaClass()); 366 } 367 368 // Resolve non-primitive types in the VM. 369 HotSpotResolvedObjectTypeImpl hsAccessingType = (HotSpotResolvedObjectTypeImpl) accessingType; 370 final HotSpotResolvedObjectTypeImpl klass = compilerToVm.lookupType(name, hsAccessingType.mirror(), resolve); 371 372 if (klass == null) { 373 assert resolve == false; 374 return HotSpotUnresolvedJavaType.create(this, name); 375 } 376 return klass; 377 } 378 379 public JVMCIBackend getHostJVMCIBackend() { 380 return hostBackend; 381 } 382 383 public <T extends Architecture> JVMCIBackend getJVMCIBackend(Class<T> arch) { 384 assert arch != Architecture.class; 385 return backends.get(arch); 386 } 387 388 public Map<Class<? extends Architecture>, JVMCIBackend> getJVMCIBackends() { 389 return Collections.unmodifiableMap(backends); 390 } 391 392 /** 393 * Called from the VM. 394 */ 395 @SuppressWarnings({"unused"}) 396 private int adjustCompilationLevel(Class<?> declaringClass, String name, String signature, boolean isOsr, int level) { | 350 if (compiler == null) { 351 synchronized (this) { 352 if (compiler == null) { 353 compiler = compilerFactory.createCompiler(this); 354 } 355 } 356 } 357 return compiler; 358 } 359 360 public JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve) { 361 Objects.requireNonNull(accessingType, "cannot resolve type without an accessing class"); 362 // If the name represents a primitive type we can short-circuit the lookup. 363 if (name.length() == 1) { 364 JavaKind kind = JavaKind.fromPrimitiveOrVoidTypeChar(name.charAt(0)); 365 return fromClass(kind.toJavaClass()); 366 } 367 368 // Resolve non-primitive types in the VM. 369 HotSpotResolvedObjectTypeImpl hsAccessingType = (HotSpotResolvedObjectTypeImpl) accessingType; 370 try { 371 final HotSpotResolvedObjectTypeImpl klass = compilerToVm.lookupType(name, hsAccessingType.mirror(), resolve); 372 373 if (klass == null) { 374 assert resolve == false; 375 return HotSpotUnresolvedJavaType.create(this, name); 376 } 377 return klass; 378 } catch (ClassNotFoundException e) { 379 throw (NoClassDefFoundError) new NoClassDefFoundError().initCause(e); 380 } 381 } 382 383 public JVMCIBackend getHostJVMCIBackend() { 384 return hostBackend; 385 } 386 387 public <T extends Architecture> JVMCIBackend getJVMCIBackend(Class<T> arch) { 388 assert arch != Architecture.class; 389 return backends.get(arch); 390 } 391 392 public Map<Class<? extends Architecture>, JVMCIBackend> getJVMCIBackends() { 393 return Collections.unmodifiableMap(backends); 394 } 395 396 /** 397 * Called from the VM. 398 */ 399 @SuppressWarnings({"unused"}) 400 private int adjustCompilationLevel(Class<?> declaringClass, String name, String signature, boolean isOsr, int level) { |