415 default: |
415 default: |
416 return 0; |
416 return 0; |
417 } |
417 } |
418 } |
418 } |
419 |
419 |
420 bool vmIntrinsics::is_disabled_by_flags(methodHandle method, methodHandle compilation_context) { |
420 bool vmIntrinsics::is_disabled_by_flags(methodHandle method) { |
421 vmIntrinsics::ID id = method->intrinsic_id(); |
421 vmIntrinsics::ID id = method->intrinsic_id(); |
422 assert(id != vmIntrinsics::_none, "must be a VM intrinsic"); |
422 assert(id != vmIntrinsics::_none, "must be a VM intrinsic"); |
423 |
|
424 // Check if the intrinsic corresponding to 'method' has been disabled on |
|
425 // the command line by using the DisableIntrinsic flag (either globally |
|
426 // or on a per-method level, see src/share/vm/compiler/abstractCompiler.hpp |
|
427 // for details). |
|
428 // Usually, the compilation context is the caller of the method 'method'. |
|
429 // The only case when for a non-recursive method 'method' the compilation context |
|
430 // is not the caller of the 'method' (but it is the method itself) is |
|
431 // java.lang.ref.Referene::get. |
|
432 // For java.lang.ref.Reference::get, the intrinsic version is used |
|
433 // instead of the compiled version so that the value in the referent |
|
434 // field can be registered by the G1 pre-barrier code. The intrinsified |
|
435 // version of Reference::get also adds a memory barrier to prevent |
|
436 // commoning reads from the referent field across safepoint since GC |
|
437 // can change the referent field's value. See Compile::Compile() |
|
438 // in src/share/vm/opto/compile.cpp or |
|
439 // GraphBuilder::GraphBuilder() in src/share/vm/c1/c1_GraphBuilder.cpp |
|
440 // for more details. |
|
441 ccstr disable_intr = NULL; |
|
442 if ((DisableIntrinsic[0] != '\0' && strstr(DisableIntrinsic, vmIntrinsics::name_at(id)) != NULL) || |
|
443 (!compilation_context.is_null() && |
|
444 CompilerOracle::has_option_value(compilation_context, "DisableIntrinsic", disable_intr) && |
|
445 strstr(disable_intr, vmIntrinsics::name_at(id)) != NULL) |
|
446 ) { |
|
447 return true; |
|
448 } |
|
449 |
423 |
450 // -XX:-InlineNatives disables nearly all intrinsics except the ones listed in |
424 // -XX:-InlineNatives disables nearly all intrinsics except the ones listed in |
451 // the following switch statement. |
425 // the following switch statement. |
452 if (!InlineNatives) { |
426 if (!InlineNatives) { |
453 switch (id) { |
427 switch (id) { |