Skip to content
Permalink
Browse files
8269023: [lworld] L/Q<type> support
Co-authored-by: Frederic Parain <fparain@openjdk.org>
Co-authored-by: Tobias Hartmann <thartmann@openjdk.org>
Co-authored-by: Mandy Chung <mchung@openjdk.org>
Co-authored-by: Srikanth Adayapalam <sadayapalam@openjdk.org>
  • Loading branch information
5 people committed Jun 21, 2021
1 parent fab7d7a commit 3c399d9f7f36903e4c2583c16b0080e01181114a
Showing with 2,183 additions and 2,461 deletions.
  1. +3 −3 src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp
  2. +3 −5 src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp
  3. +2 −2 src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
  4. +3 −3 src/hotspot/cpu/x86/c1_CodeStubs_x86.cpp
  5. +3 −4 src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp
  6. +8 −8 src/hotspot/cpu/x86/macroAssembler_x86.cpp
  7. +2 −2 src/hotspot/cpu/x86/macroAssembler_x86.hpp
  8. +9 −9 src/hotspot/cpu/x86/templateTable_x86.cpp
  9. +4 −4 src/hotspot/share/c1/c1_Canonicalizer.cpp
  10. +2 −2 src/hotspot/share/c1/c1_CodeStubs.hpp
  11. +9 −9 src/hotspot/share/c1/c1_GraphBuilder.cpp
  12. +5 −8 src/hotspot/share/c1/c1_Instruction.cpp
  13. +1 −1 src/hotspot/share/c1/c1_Instruction.hpp
  14. +1 −1 src/hotspot/share/c1/c1_LIR.cpp
  15. +3 −8 src/hotspot/share/c1/c1_LIRGenerator.cpp
  16. +15 −4 src/hotspot/share/ci/ciArrayKlass.cpp
  17. +3 −1 src/hotspot/share/ci/ciArrayKlass.hpp
  18. +2 −0 src/hotspot/share/ci/ciClassList.hpp
  19. +3 −2 src/hotspot/share/ci/ciEnv.cpp
  20. +5 −1 src/hotspot/share/ci/ciEnv.hpp
  21. +6 −0 src/hotspot/share/ci/ciField.cpp
  22. +2 −0 src/hotspot/share/ci/ciField.hpp
  23. +3 −2 src/hotspot/share/ci/ciFlatArrayKlass.cpp
  24. +2 −0 src/hotspot/share/ci/ciFlatArrayKlass.hpp
  25. +1 −0 src/hotspot/share/ci/ciKlass.hpp
  26. +5 −0 src/hotspot/share/ci/ciMetadata.hpp
  27. +26 −13 src/hotspot/share/ci/ciObjArrayKlass.cpp
  28. +5 −2 src/hotspot/share/ci/ciObjArrayKlass.hpp
  29. +6 −0 src/hotspot/share/ci/ciObjectFactory.cpp
  30. +2 −0 src/hotspot/share/ci/ciObjectFactory.hpp
  31. +13 −2 src/hotspot/share/ci/ciSignature.cpp
  32. +4 −2 src/hotspot/share/ci/ciSignature.hpp
  33. +2 −2 src/hotspot/share/ci/ciStreams.cpp
  34. +9 −1 src/hotspot/share/ci/ciStreams.hpp
  35. +7 −1 src/hotspot/share/ci/ciSymbol.cpp
  36. +2 −1 src/hotspot/share/ci/ciSymbol.hpp
  37. +35 −0 src/hotspot/share/ci/ciType.hpp
  38. +70 −27 src/hotspot/share/ci/ciTypeFlow.cpp
  39. +2 −0 src/hotspot/share/ci/ciTypeFlow.hpp
  40. +1 −1 src/hotspot/share/classfile/classFileParser.cpp
  41. +69 −12 src/hotspot/share/classfile/javaClasses.cpp
  42. +12 −0 src/hotspot/share/classfile/javaClasses.hpp
  43. +18 −0 src/hotspot/share/classfile/javaClasses.inline.hpp
  44. +18 −7 src/hotspot/share/classfile/systemDictionary.cpp
  45. +2 −0 src/hotspot/share/classfile/vmSymbols.hpp
  46. +6 −3 src/hotspot/share/interpreter/interpreterRuntime.cpp
  47. +4 −4 src/hotspot/share/memory/oopFactory.cpp
  48. +2 −3 src/hotspot/share/oops/arrayKlass.cpp
  49. +1 −1 src/hotspot/share/oops/arrayKlass.hpp
  50. +3 −1 src/hotspot/share/oops/constantPool.cpp
  51. +3 −3 src/hotspot/share/oops/cpCache.cpp
  52. +4 −4 src/hotspot/share/oops/cpCache.hpp
  53. +34 −23 src/hotspot/share/oops/flatArrayKlass.cpp
  54. +4 −0 src/hotspot/share/oops/flatArrayKlass.hpp
  55. +67 −36 src/hotspot/share/oops/inlineKlass.cpp
  56. +38 −8 src/hotspot/share/oops/inlineKlass.hpp
  57. +8 −3 src/hotspot/share/oops/instanceKlass.cpp
  58. +3 −1 src/hotspot/share/oops/instanceKlass.hpp
  59. +0 −2 src/hotspot/share/oops/klass.hpp
  60. +17 −17 src/hotspot/share/oops/markWord.hpp
  61. +1 −1 src/hotspot/share/oops/markWord.inline.hpp
  62. +41 −16 src/hotspot/share/oops/objArrayKlass.cpp
  63. +4 −3 src/hotspot/share/oops/objArrayKlass.hpp
  64. +1 −2 src/hotspot/share/oops/oop.cpp
  65. +2 −3 src/hotspot/share/oops/oop.hpp
  66. +4 −4 src/hotspot/share/oops/oop.inline.hpp
  67. +1 −1 src/hotspot/share/oops/typeArrayKlass.cpp
  68. +5 −4 src/hotspot/share/opto/callGenerator.cpp
  69. +7 −0 src/hotspot/share/opto/compile.cpp
  70. +4 −6 src/hotspot/share/opto/doCall.cpp
  71. +21 −24 src/hotspot/share/opto/graphKit.cpp
  72. +1 −1 src/hotspot/share/opto/graphKit.hpp
  73. +13 −5 src/hotspot/share/opto/inlinetypenode.cpp
  74. +1 −0 src/hotspot/share/opto/inlinetypenode.hpp
  75. +9 −2 src/hotspot/share/opto/memnode.cpp
  76. +1 −1 src/hotspot/share/opto/parse1.cpp
  77. +2 −2 src/hotspot/share/opto/parse2.cpp
  78. +7 −6 src/hotspot/share/opto/parse3.cpp
  79. +6 −6 src/hotspot/share/opto/parseHelper.cpp
  80. +10 −2 src/hotspot/share/opto/subnode.cpp
  81. +1 −1 src/hotspot/share/opto/subtypenode.cpp
  82. +28 −14 src/hotspot/share/opto/type.cpp
  83. +1 −1 src/hotspot/share/opto/type.hpp
  84. +13 −2 src/hotspot/share/prims/jni.cpp
  85. +1 −1 src/hotspot/share/prims/jvm.cpp
  86. +1 −1 src/hotspot/share/runtime/deoptimization.cpp
  87. +7 −3 src/hotspot/share/runtime/reflection.cpp
  88. +2 −1 src/hotspot/share/runtime/signature.cpp
  89. +4 −0 src/hotspot/share/runtime/signature.hpp
  90. +1 −1 src/hotspot/share/utilities/constantTag.cpp
  91. +84 −141 src/java.base/share/classes/java/lang/Class.java
  92. +1 −5 src/java.base/share/classes/java/lang/Object.java
  93. +6 −9 src/java.base/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
  94. +2 −1 src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
  95. +3 −2 src/java.base/share/classes/java/lang/invoke/InfoFromMemberName.java
  96. +4 −3 src/java.base/share/classes/java/lang/invoke/MemberName.java
  97. +0 −4 src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
  98. +11 −11 src/java.base/share/classes/java/lang/invoke/MethodHandles.java
  99. +10 −2 src/java.base/share/classes/java/lang/invoke/MethodType.java
  100. +26 −111 src/java.base/share/classes/java/lang/invoke/ValueBootstrapMethods.java
  101. +6 −0 src/java.base/share/classes/java/lang/invoke/VarHandle.java
  102. +1 −1 src/java.base/share/classes/java/lang/invoke/VarHandles.java
  103. +4 −4 src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template
  104. +3 −2 src/java.base/share/classes/java/lang/reflect/Constructor.java
  105. +8 −0 src/java.base/share/classes/java/lang/reflect/Executable.java
  106. +12 −3 src/java.base/share/classes/java/lang/reflect/Field.java
  107. +4 −3 src/java.base/share/classes/java/lang/reflect/Method.java
  108. +1 −1 src/java.base/share/classes/java/lang/reflect/Proxy.java
  109. +7 −2 src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java
  110. +0 −2 src/java.base/share/classes/jdk/internal/access/JavaLangInvokeAccess.java
  111. +2 −2 src/java.base/share/classes/jdk/internal/misc/Unsafe.java
  112. +6 −2 src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorImpl.java
  113. +2 −1 src/java.base/share/classes/sun/invoke/util/BytecodeDescriptor.java
  114. +5 −5 src/java.base/share/classes/sun/invoke/util/VerifyAccess.java
  115. +1 −26 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
  116. +2 −23 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
  117. +0 −9 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
  118. +18 −66 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
  119. +37 −134 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
  120. +2 −2 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
  121. +4 −11 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/PoolWriter.java
  122. +1 −7 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/TransPrimitiveClass.java
  123. +9 −9 test/hotspot/gtest/oops/test_markWord.cpp
  124. +2 −2 test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestUnloadedInlineTypeArray.java
  125. +9 −9 test/hotspot/jtreg/runtime/valhalla/inlinetypes/EmptyInlineTest.java
  126. +3 −3 test/hotspot/jtreg/runtime/valhalla/inlinetypes/InlineTypeArray.java
  127. +1 −1 test/hotspot/jtreg/runtime/valhalla/inlinetypes/InlineTypesTest.java
  128. +1 −2 test/hotspot/jtreg/runtime/valhalla/inlinetypes/MultiANewArrayTest/MultiANewArrayTest.java
  129. +1 −1 test/hotspot/jtreg/runtime/valhalla/inlinetypes/ObjectMethods.java
  130. +3 −3 test/hotspot/jtreg/runtime/valhalla/inlinetypes/WithFieldAccessorTest.java
  131. +4 −3 test/jdk/java/lang/invoke/common/test/java/lang/invoke/lib/InstructionHelper.java
  132. +150 −169 test/jdk/valhalla/valuetypes/ArrayElementVarHandleTest.java
  133. +289 −0 test/jdk/valhalla/valuetypes/BasicTest.java
  134. +2 −3 test/jdk/valhalla/valuetypes/LambdaConversion.java
  135. +153 −182 test/jdk/valhalla/valuetypes/MethodHandleTest.java
  136. +46 −0 test/jdk/valhalla/valuetypes/MethodReference.java
  137. +80 −0 test/jdk/valhalla/valuetypes/Nest.java
  138. +45 −45 test/jdk/valhalla/valuetypes/ObjectMethods.java
  139. +8 −8 test/jdk/valhalla/valuetypes/{InlineTypeConversionTest.java → PrimitiveTypeConversionTest.java}
  140. +22 −24 test/jdk/valhalla/valuetypes/QTypeDescriptorTest.java
  141. +37 −198 test/jdk/valhalla/valuetypes/Reflection.java
  142. +8 −8 test/jdk/valhalla/valuetypes/Serialization.java
  143. +3 −3 test/jdk/valhalla/valuetypes/{StaticInitFactoryTest.java → StaticFactoryMethodHandleTest.java}
  144. +24 −25 test/jdk/valhalla/valuetypes/{InlineConstructorTest.java → StaticFactoryTest.java}
  145. +2 −2 test/jdk/valhalla/valuetypes/StreamTest.java
  146. +3 −3 test/jdk/valhalla/valuetypes/SubstitutabilityTest.java
  147. +48 −48 test/jdk/valhalla/valuetypes/{UninitializedInlineValueTest.java → UninitializedValueTest.java}
  148. +104 −90 test/jdk/valhalla/valuetypes/ValueArray.java
  149. +1 −27 test/jdk/valhalla/valuetypes/ValueBootstrapMethods.java
  150. +3 −3 test/jdk/valhalla/valuetypes/{InlineReferenceTest.java → WeakReferenceTest.java}
  151. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/AnonymousValueType.java
  152. +4 −4 test/langtools/tools/javac/valhalla/lworld-values/ArrayCreationWithQuestion.java
  153. +2 −6 test/langtools/tools/javac/valhalla/lworld-values/AttributesTest.java
  154. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/BoxValCastTest.java
  155. +2 −2 test/langtools/tools/javac/valhalla/lworld-values/ChainedAssignmentTest.java
  156. +4 −4 test/langtools/tools/javac/valhalla/lworld-values/CheckFieldDescriptors.java
  157. +0 −122 test/langtools/tools/javac/valhalla/lworld-values/CheckNeededCastInMemberAccess.java
  158. +4 −5 test/langtools/tools/javac/valhalla/lworld-values/CheckSeparateCompile.java
  159. +3 −3 test/langtools/tools/javac/valhalla/lworld-values/CheckSeparateCompile0.java
  160. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/ConsumeUnifiedClass.java
  161. +2 −2 test/langtools/tools/javac/valhalla/lworld-values/CtorChain.java
  162. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/InlineClassTest.java
  163. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/InlineDiamondTest.java
  164. +0 −57 test/langtools/tools/javac/valhalla/lworld-values/InlineNestingAttributesTest.java
  165. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/LubWithInlines.java
  166. +0 −1 test/langtools/tools/javac/valhalla/lworld-values/NoUnnecessaryCast.java
  167. +2 −2 test/langtools/tools/javac/valhalla/lworld-values/ProjectedArrayDotClass.java
  168. +0 −49 test/langtools/tools/javac/valhalla/lworld-values/ProjectionSealed.java
  169. +4 −4 test/langtools/tools/javac/valhalla/lworld-values/QualifiedSuperCtor.java
  170. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/RefDotClass.java
  171. +2 −2 test/langtools/tools/javac/valhalla/lworld-values/SideEffectTest.java
  172. +1 −7 test/langtools/tools/javac/valhalla/lworld-values/SignatureTest.java
  173. +0 −118 test/langtools/tools/javac/valhalla/lworld-values/SplitPrimitiveClassBytecodeTest.java
  174. +0 −73 test/langtools/tools/javac/valhalla/lworld-values/SplitPrimitiveClassInnerClassesTest.java
  175. +0 −104 test/langtools/tools/javac/valhalla/lworld-values/SplitPrimitiveClassNestHostTest.java
  176. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/TestQualifierOnInit.java
  177. +2 −11 test/langtools/tools/javac/valhalla/lworld-values/TopInterfaceTest.java
  178. +1 −28 test/langtools/tools/javac/valhalla/lworld-values/UnannotatedProjection.java
  179. +0 −1 test/langtools/tools/javac/valhalla/lworld-values/UnifiedPrimitiveClassBytecodeTest.java
  180. +0 −1 test/langtools/tools/javac/valhalla/lworld-values/UnifiedPrimitiveClassInnerClassesTest.java
  181. +1 −2 test/langtools/tools/javac/valhalla/lworld-values/UnifiedPrimitiveClassNestHostTest.java
  182. +1 −2 test/langtools/tools/javac/valhalla/lworld-values/ValueBootstrapMethodsTest.java
  183. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/ValueConstructorRef.java
  184. +2 −2 test/langtools/tools/javac/valhalla/lworld-values/WithFieldAccessorTest.java
  185. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/WithFieldOfGenericType.java
@@ -255,12 +255,12 @@ void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
// Implementation of NewObjectArrayStub

NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result,
CodeEmitInfo* info, bool is_inline_type) {
CodeEmitInfo* info, bool is_null_free) {
_klass_reg = klass_reg;
_result = result;
_length = length;
_info = new CodeEmitInfo(info);
_is_inline_type = is_inline_type;
_is_null_free = is_null_free;
}


@@ -270,7 +270,7 @@ void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
assert(_length->as_register() == r19, "length must in r19,");
assert(_klass_reg->as_register() == r3, "klass_reg must in r3");

if (_is_inline_type) {
if (_is_null_free) {
__ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_flat_array_id)));
} else {
__ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_object_array_id)));
@@ -511,10 +511,8 @@ void LIR_Assembler::return_op(LIR_Opr result, C1SafepointPollStub* code_stub) {
assert(result->is_illegal() || !result->is_single_cpu() || result->as_register() == r0, "word returns are in r0,");

ciMethod* method = compilation()->method();

ciType* return_type = method->return_type();
if (InlineTypeReturnedAsFields && return_type->is_inlinetype()) {
ciInlineKlass* vk = return_type->as_inline_klass();
if (InlineTypeReturnedAsFields && method->signature()->returns_null_free_inline_type()) {
ciInlineKlass* vk = method->return_type()->as_inline_klass();
if (vk->can_be_returned_as_fields()) {
address unpack_handler = vk->unpack_handler();
assert(unpack_handler != NULL, "must be");
@@ -1629,7 +1627,7 @@ void LIR_Assembler::emit_opNullFreeArrayCheck(LIR_OpNullFreeArrayCheck* op) {
__ br(Assembler::NE, test_mark_word);
__ load_prototype_header(tmp, op->array()->as_register());
__ bind(test_mark_word);
__ tst(tmp, markWord::nullfree_array_bit_in_place);
__ tst(tmp, markWord::null_free_array_bit_in_place);
} else {
Register klass = op->tmp()->as_register();
__ load_klass(klass, op->array()->as_register());
@@ -1599,11 +1599,11 @@ void MacroAssembler::test_non_flattened_array_oop(Register oop, Register temp_re
}

void MacroAssembler::test_null_free_array_oop(Register oop, Register temp_reg, Label& is_null_free_array) {
test_oop_prototype_bit(oop, temp_reg, markWord::nullfree_array_bit_in_place, true, is_null_free_array);
test_oop_prototype_bit(oop, temp_reg, markWord::null_free_array_bit_in_place, true, is_null_free_array);
}

void MacroAssembler::test_non_null_free_array_oop(Register oop, Register temp_reg, Label&is_non_null_free_array) {
test_oop_prototype_bit(oop, temp_reg, markWord::nullfree_array_bit_in_place, false, is_non_null_free_array);
test_oop_prototype_bit(oop, temp_reg, markWord::null_free_array_bit_in_place, false, is_non_null_free_array);
}

void MacroAssembler::test_flattened_array_layout(Register lh, Label& is_flattened_array) {
@@ -310,12 +310,12 @@ void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
// Implementation of NewObjectArrayStub

NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result,
CodeEmitInfo* info, bool is_inline_type) {
CodeEmitInfo* info, bool is_null_free) {
_klass_reg = klass_reg;
_result = result;
_length = length;
_info = new CodeEmitInfo(info);
_is_inline_type = is_inline_type;
_is_null_free = is_null_free;
}


@@ -324,7 +324,7 @@ void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
__ bind(_entry);
assert(_length->as_register() == rbx, "length must in rbx,");
assert(_klass_reg->as_register() == rdx, "klass_reg must in rdx");
if (_is_inline_type) {
if (_is_null_free) {
__ call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_flat_array_id)));
} else {
__ call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_object_array_id)));
@@ -531,9 +531,8 @@ void LIR_Assembler::return_op(LIR_Opr result, C1SafepointPollStub* code_stub) {
}

ciMethod* method = compilation()->method();
ciType* return_type = method->return_type();
if (InlineTypeReturnedAsFields && return_type->is_inlinetype()) {
ciInlineKlass* vk = return_type->as_inline_klass();
if (InlineTypeReturnedAsFields && method->signature()->returns_null_free_inline_type()) {
ciInlineKlass* vk = method->return_type()->as_inline_klass();
if (vk->can_be_returned_as_fields()) {
#ifndef _LP64
Unimplemented();
@@ -2030,7 +2029,7 @@ void LIR_Assembler::emit_opNullFreeArrayCheck(LIR_OpNullFreeArrayCheck* op) {
__ jccb(Assembler::notZero, test_mark_word);
__ load_prototype_header(tmp, op->array()->as_register(), rscratch1);
__ bind(test_mark_word);
__ testl(tmp, markWord::nullfree_array_bit_in_place);
__ testl(tmp, markWord::null_free_array_bit_in_place);
} else {
Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
Register klass = op->tmp()->as_register();
@@ -2954,20 +2954,20 @@ void MacroAssembler::test_klass_is_empty_inline_type(Register klass, Register te
jcc(Assembler::notZero, is_empty_inline_type);
}

void MacroAssembler::test_field_is_inline_type(Register flags, Register temp_reg, Label& is_inline_type) {
void MacroAssembler::test_field_is_null_free_inline_type(Register flags, Register temp_reg, Label& is_null_free_inline_type) {
movl(temp_reg, flags);
shrl(temp_reg, ConstantPoolCacheEntry::is_inline_type_shift);
shrl(temp_reg, ConstantPoolCacheEntry::is_null_free_inline_type_shift);
andl(temp_reg, 0x1);
testl(temp_reg, temp_reg);
jcc(Assembler::notZero, is_inline_type);
jcc(Assembler::notZero, is_null_free_inline_type);
}

void MacroAssembler::test_field_is_not_inline_type(Register flags, Register temp_reg, Label& not_inline_type) {
void MacroAssembler::test_field_is_not_null_free_inline_type(Register flags, Register temp_reg, Label& not_null_free_inline_type) {
movl(temp_reg, flags);
shrl(temp_reg, ConstantPoolCacheEntry::is_inline_type_shift);
shrl(temp_reg, ConstantPoolCacheEntry::is_null_free_inline_type_shift);
andl(temp_reg, 0x1);
testl(temp_reg, temp_reg);
jcc(Assembler::zero, not_inline_type);
jcc(Assembler::zero, not_null_free_inline_type);
}

void MacroAssembler::test_field_is_inlined(Register flags, Register temp_reg, Label& is_inlined) {
@@ -3019,7 +3019,7 @@ void MacroAssembler::test_non_flattened_array_oop(Register oop, Register temp_re

void MacroAssembler::test_null_free_array_oop(Register oop, Register temp_reg, Label&is_null_free_array) {
#ifdef _LP64
test_oop_prototype_bit(oop, temp_reg, markWord::nullfree_array_bit_in_place, true, is_null_free_array);
test_oop_prototype_bit(oop, temp_reg, markWord::null_free_array_bit_in_place, true, is_null_free_array);
#else
load_klass(temp_reg, oop, noreg);
movl(temp_reg, Address(temp_reg, Klass::layout_helper_offset()));
@@ -3029,7 +3029,7 @@ void MacroAssembler::test_null_free_array_oop(Register oop, Register temp_reg, L

void MacroAssembler::test_non_null_free_array_oop(Register oop, Register temp_reg, Label&is_non_null_free_array) {
#ifdef _LP64
test_oop_prototype_bit(oop, temp_reg, markWord::nullfree_array_bit_in_place, false, is_non_null_free_array);
test_oop_prototype_bit(oop, temp_reg, markWord::null_free_array_bit_in_place, false, is_non_null_free_array);
#else
load_klass(temp_reg, oop, noreg);
movl(temp_reg, Address(temp_reg, Klass::layout_helper_offset()));
@@ -118,8 +118,8 @@ class MacroAssembler: public Assembler {
// get_default_value_oop with extra assertion for empty inline klass
void get_empty_inline_type_oop(Register inline_klass, Register temp_reg, Register obj);

void test_field_is_inline_type(Register flags, Register temp_reg, Label& is_inline);
void test_field_is_not_inline_type(Register flags, Register temp_reg, Label& not_inline);
void test_field_is_null_free_inline_type(Register flags, Register temp_reg, Label& is_null_free);
void test_field_is_not_null_free_inline_type(Register flags, Register temp_reg, Label& not_null_free);
void test_field_is_inlined(Register flags, Register temp_reg, Label& is_inlined);

// Check oops for special arrays, i.e. flattened and/or null-free
@@ -2992,14 +2992,14 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
if (is_static) {
__ load_heap_oop(rax, field);
if (EnableValhalla) {
Label is_inline_type, uninitialized;
Label is_null_free_inline_type, uninitialized;
// Issue below if the static field has not been initialized yet
__ test_field_is_inline_type(flags2, rscratch1, is_inline_type);
// field is not an inline type
__ test_field_is_null_free_inline_type(flags2, rscratch1, is_null_free_inline_type);
// field is not a null free inline type
__ push(atos);
__ jmp(Done);
// field is an inline type, must not return null even if uninitialized
__ bind(is_inline_type);
// field is a null free inline type, must not return null even if uninitialized
__ bind(is_null_free_inline_type);
__ testptr(rax, rax);
__ jcc(Assembler::zero, uninitialized);
__ push(atos);
@@ -3026,9 +3026,9 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
} else {
Label is_inlined, nonnull, is_inline_type, rewrite_inline;
if (EnableValhalla) {
__ test_field_is_inline_type(flags2, rscratch1, is_inline_type);
__ test_field_is_null_free_inline_type(flags2, rscratch1, is_inline_type);
}
// field is not an inline type
// field is not a null free inline type
pop_and_check_object(obj);
__ load_heap_oop(rax, field);
__ push(atos);
@@ -3379,7 +3379,7 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri
if (is_static) {
Label is_inline_type;
if (EnableValhalla) {
__ test_field_is_not_inline_type(flags2, rscratch1, is_inline_type);
__ test_field_is_not_null_free_inline_type(flags2, rscratch1, is_inline_type);
__ null_check(rax);
__ bind(is_inline_type);
}
@@ -3388,7 +3388,7 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri
} else {
Label is_inline_type, is_inlined, rewrite_not_inline, rewrite_inline;
if (EnableValhalla) {
__ test_field_is_inline_type(flags2, rscratch1, is_inline_type);
__ test_field_is_null_free_inline_type(flags2, rscratch1, is_inline_type);
}
// Not an inline type
pop_and_check_object(obj);
@@ -676,14 +676,14 @@ void Canonicalizer::do_CheckCast (CheckCast* x) {
klass->as_instance_klass()->is_interface();
// Interface casts can't be statically optimized away since verifier doesn't
// enforce interface types in bytecode.
if (!is_interface && klass->is_subtype_of(x->klass())) {
if (!is_interface && klass->is_subtype_of(x->klass()) && (!x->is_null_free() || obj->is_null_free())) {
assert(!x->klass()->is_inlinetype() || x->klass() == klass, "Inline klasses can't have subtypes");
set_canonical(obj);
return;
}
}
// checkcast of null returns null for non-inline klasses
if (!x->klass()->is_inlinetype() && obj->as_Constant() && obj->type()->as_ObjectType()->constant_value()->is_null_object()) {
// checkcast of null returns null for non null-free klasses
if (!x->is_null_free() && obj->is_null_obj()) {
set_canonical(obj);
}
}
@@ -697,7 +697,7 @@ void Canonicalizer::do_InstanceOf (InstanceOf* x) {
return;
}
// instanceof null returns false
if (obj->as_Constant() && obj->type()->as_ObjectType()->constant_value()->is_null_object()) {
if (obj->as_Constant() && obj->is_null_obj()) {
set_constant(0);
}
}
@@ -384,9 +384,9 @@ class NewObjectArrayStub: public CodeStub {
LIR_Opr _length;
LIR_Opr _result;
CodeEmitInfo* _info;
bool _is_inline_type;
bool _is_null_free;
public:
NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info, bool is_inline_type);
NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info, bool is_null_free);
virtual void emit_code(LIR_Assembler* e);
virtual CodeEmitInfo* info() const { return _info; }
virtual void visit(LIR_OpVisitState* visitor) {
@@ -1840,7 +1840,7 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
assert(!field->is_stable() || !field_value.is_null_or_zero(),
"stable static w/ default value shouldn't be a constant");
constant = make_constant(field_value, field);
} else if (field_type == T_INLINE_TYPE && field->type()->as_inline_klass()->is_empty()) {
} else if (field->is_null_free() && field->type()->is_loaded() && field->type()->as_inline_klass()->is_empty()) {
// Loading from a field of an empty inline type. Just return the default instance.
constant = new Constant(new InstanceConstant(field->type()->as_inline_klass()->default_instance()));
}
@@ -1865,7 +1865,7 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
Value mask = append(new Constant(new IntConstant(1)));
val = append(new LogicOp(Bytecodes::_iand, val, mask));
}
if (field_type == T_INLINE_TYPE && field->type()->as_inline_klass()->is_empty()) {
if (field->is_null_free() && field->type()->is_loaded() && field->type()->as_inline_klass()->is_empty()) {
// Storing to a field of an empty inline type. Ignore.
break;
}
@@ -1883,7 +1883,7 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
if (!has_pending_field_access() && !has_pending_load_indexed()) {
obj = apop();
ObjectType* obj_type = obj->type()->as_ObjectType();
if (field_type == T_INLINE_TYPE && field->type()->as_inline_klass()->is_empty()) {
if (field->is_null_free() && field->type()->is_loaded() && field->type()->as_inline_klass()->is_empty()) {
// Loading from a field of an empty inline type. Just return the default instance.
null_check(obj);
constant = new Constant(new InstanceConstant(field->type()->as_inline_klass()->default_instance()));
@@ -1892,7 +1892,7 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
if (!const_oop->is_null_object() && const_oop->is_loaded()) {
ciConstant field_value = field->constant_value_of(const_oop);
if (field_value.is_valid()) {
if (field->signature()->is_Q_signature() && field_value.is_null_or_zero()) {
if (field->is_null_free() && field_value.is_null_or_zero()) {
// Non-flattened inline type field. Replace null by the default value.
constant = new Constant(new InstanceConstant(field->type()->as_inline_klass()->default_instance()));
} else {
@@ -2038,7 +2038,7 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
Value mask = append(new Constant(new IntConstant(1)));
val = append(new LogicOp(Bytecodes::_iand, val, mask));
}
if (field_type == T_INLINE_TYPE && field->type()->as_inline_klass()->is_empty()) {
if (field->is_null_free() && field->type()->is_loaded() && field->type()->as_inline_klass()->is_empty()) {
// Storing to a field of an empty inline type. Ignore.
null_check(obj);
} else if (!field->is_flattened()) {
@@ -2470,7 +2470,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
}

Invoke* result = new Invoke(code, result_type, recv, args, target, state_before,
declared_signature->return_type()->is_inlinetype());
declared_signature->returns_null_free_inline_type());
// push result
append_split(result);

@@ -2514,7 +2514,7 @@ void GraphBuilder::new_type_array() {
void GraphBuilder::new_object_array() {
bool will_link;
ciKlass* klass = stream()->get_klass(will_link);
bool null_free = stream()->is_inline_klass();
bool null_free = stream()->has_Q_signature();
ValueStack* state_before = !klass->is_loaded() || PatchALot ? copy_state_before() : copy_state_exhandling();
NewArray* n = new NewObjectArray(klass, ipop(), state_before, null_free);
apush(append_split(n));
@@ -2541,7 +2541,7 @@ bool GraphBuilder::direct_compare(ciKlass* k) {
void GraphBuilder::check_cast(int klass_index) {
bool will_link;
ciKlass* klass = stream()->get_klass(will_link);
bool null_free = stream()->is_inline_klass();
bool null_free = stream()->has_Q_signature();
ValueStack* state_before = !klass->is_loaded() || PatchALot ? copy_state_before() : copy_state_for_exception();
CheckCast* c = new CheckCast(klass, apop(), state_before, null_free);
apush(append_split(c));
@@ -3569,7 +3569,7 @@ ValueStack* GraphBuilder::state_at_entry() {
// don't allow T_ARRAY to propagate into locals types
if (is_reference_type(basic_type)) basic_type = T_OBJECT;
ValueType* vt = as_ValueType(basic_type);
state->store_local(idx, new Local(type, vt, idx, false, type->is_inlinetype()));
state->store_local(idx, new Local(type, vt, idx, false, sig->is_null_free_at(i)));
idx += type->size();
}

@@ -108,7 +108,7 @@ void Instruction::state_values_do(ValueVisitor* f) {
}

ciType* Instruction::exact_type() const {
ciType* t = declared_type();
ciType* t = declared_type();
if (t != NULL && t->is_klass()) {
return t->as_klass()->exact_klass();
}
@@ -138,15 +138,13 @@ bool Instruction::maybe_flattened_array() {
if (UseFlatArray) {
ciType* type = declared_type();
if (type != NULL) {
if (type->is_obj_array_klass()) {
// Due to array covariance, the runtime type might be a flattened array.
if (type->is_obj_array_klass() && !type->as_obj_array_klass()->is_elem_null_free()) {
// The runtime type of [LMyValue might be [QMyValue due to [QMyValue <: [LMyValue.
ciKlass* element_klass = type->as_obj_array_klass()->element_klass();
if (element_klass->can_be_inline_klass() && (!element_klass->is_inlinetype() || element_klass->as_inline_klass()->flatten_array())) {
return true;
}
} else if (type->is_flat_array_klass()) {
ciKlass* element_klass = type->as_flat_array_klass()->element_klass();
assert(!element_klass->is_loaded() || element_klass->flatten_array(), "must be flattened");
return true;
} else if (type->is_klass() && type->as_klass()->is_java_lang_Object()) {
// This can happen as a parameter to System.arraycopy()
@@ -166,8 +164,7 @@ bool Instruction::maybe_null_free_array() {
if (type != NULL) {
if (type->is_obj_array_klass()) {
// Due to array covariance, the runtime type might be a null-free array.
ciKlass* element_klass = type->as_obj_array_klass()->element_klass();
if (element_klass->can_be_inline_klass()) {
if (type->as_obj_array_klass()->can_be_inline_array_klass()) {
return true;
}
}
@@ -290,7 +287,7 @@ ciType* NewTypeArray::exact_type() const {
}

ciType* NewObjectArray::exact_type() const {
return ciArrayKlass::make(klass());
return ciArrayKlass::make(klass(), is_null_free());
}

ciType* NewMultiArray::exact_type() const {
@@ -861,7 +861,7 @@ LEAF(LoadField, AccessField)
ciInlineKlass* inline_klass = NULL, Value default_value = NULL )
: AccessField(obj, offset, field, is_static, state_before, needs_patching)
{
set_null_free(field->signature()->is_Q_signature());
set_null_free(field->is_null_free());
}

ciType* declared_type() const;

0 comments on commit 3c399d9

Please sign in to comment.