Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8315066: Add unsigned bounds and known bits to TypeInt/Long #17508

Open
wants to merge 57 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
3a87d66
implement unsigned bounds and known bits
merykitty Jan 20, 2024
61f4d21
refactor
merykitty Jan 20, 2024
d11497e
fix template parameter
merykitty Jan 20, 2024
12f268a
add unit tests
merykitty Jan 20, 2024
6b417f9
fix tests, add verify
merykitty Jan 20, 2024
756d615
add comments, group arguments to reduce C-style reference passing arg…
merykitty Jan 22, 2024
1faa48b
fix release build
merykitty Jan 22, 2024
ffb0abd
Merge branch 'master' into unsignedbounds
merykitty Mar 15, 2024
6e2e6c5
add comments
merykitty Mar 15, 2024
ec4ca3e
Merge branch 'master' into unsignedbounds
merykitty Aug 14, 2024
d5ad9f1
fix compile errors
merykitty Aug 14, 2024
2c3807b
address reviews
merykitty Sep 3, 2024
ae47385
move static_asserts
merykitty Sep 3, 2024
2bf545f
add more comments, group KnownBits
merykitty Sep 4, 2024
4f4a6be
fix build
merykitty Sep 4, 2024
8d14f8e
fix build
merykitty Sep 4, 2024
f164821
more explanation
merykitty Sep 5, 2024
5990628
rename tests
merykitty Sep 5, 2024
123e055
make should return the correct type
merykitty Sep 5, 2024
089c566
add trivial test cases
merykitty Sep 5, 2024
2e3955d
fix builds
merykitty Sep 5, 2024
e8ab32a
Merge branch 'master' into unsignedbounds
merykitty Sep 8, 2024
9b70213
change (~v & ones) == 0 to (v & ones) == ones
merykitty Sep 8, 2024
81f4e15
add doc to TypeInt, rename parameters, remove unused methods
merykitty Sep 10, 2024
a77e8f4
remove leftover code
merykitty Sep 10, 2024
2564378
refine comments
merykitty Sep 12, 2024
8a5370a
add comments, refactor functions to helper class
merykitty Sep 18, 2024
644bced
address reviews
merykitty Sep 19, 2024
f2d3f3b
formality
merykitty Sep 19, 2024
c440a72
comment adjust_lo empty case
merykitty Sep 20, 2024
4858e12
address reviews
merykitty Sep 20, 2024
7f3316f
Merge branch 'master' into unsignedbounds
merykitty Oct 20, 2024
41082f6
Merge branch 'master' into unsignedbounds
merykitty Nov 13, 2024
468834f
further reviews
merykitty Nov 13, 2024
c2d7d36
whitespace
merykitty Nov 13, 2024
dcc9030
build failures
merykitty Nov 13, 2024
7164653
build failure
merykitty Nov 13, 2024
8c0ac2f
Merge branch 'master' into unsignedbounds
merykitty Dec 6, 2024
cf1de62
move try_cast to Type
merykitty Dec 6, 2024
85acf6e
Merge branch 'master' into unsignedbounds
merykitty Dec 15, 2024
d033833
Merge branch 'master' into unsignedbounds
merykitty Jan 4, 2025
4d33014
copyright
merykitty Jan 4, 2025
539a032
Merge branch 'master' into unsignedbounds
merykitty Jan 22, 2025
c4d46c8
remove precompiled.hpp
merykitty Jan 22, 2025
98aaa03
Merge branch 'master' into unsignedbounds
merykitty Jan 27, 2025
ac1ddfc
Emmanuel's review
merykitty Jan 27, 2025
f85eff5
make con
merykitty Jan 28, 2025
01dc22d
exhaustive tests
Jan 29, 2025
c33576a
assignment operator
Jan 29, 2025
cf56091
refine first_violation
merykitty Jan 30, 2025
a849917
clean up intn_t
merykitty Jan 30, 2025
1d34a54
include
merykitty Jan 30, 2025
ee07d29
number lemmas
merykitty Jan 30, 2025
d87e036
harden SimpleCanonicalResult
merykitty Jan 30, 2025
0f347a5
Merge branch 'master' into unsignedbounds
merykitty Feb 12, 2025
3cd2586
Merge branch 'master' into unsignedbounds
merykitty Feb 13, 2025
5586036
refine comments
merykitty Feb 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/hotspot/share/opto/castnode.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -473,7 +473,11 @@ Node* ConstraintCastNode::make_cast_for_type(Node* c, Node* in, const Type* type

Node* ConstraintCastNode::optimize_integer_cast(PhaseGVN* phase, BasicType bt) {
PhaseIterGVN *igvn = phase->is_IterGVN();
const TypeInteger* this_type = this->type()->is_integer(bt);
const TypeInteger* this_type = this->type()->isa_integer(bt);
if (this_type == nullptr) {
return nullptr;
}

Node* z = in(1);
const TypeInteger* rx = nullptr;
const TypeInteger* ry = nullptr;
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/opto/compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4480,7 +4480,9 @@ Node* Compile::conv_I2X_index(PhaseGVN* phase, Node* idx, const TypeInt* sizetyp
// number. (The prior range check has ensured this.)
// This assertion is used by ConvI2LNode::Ideal.
int index_max = max_jint - 1; // array size is max_jint, index is one less
if (sizetype != nullptr) index_max = sizetype->_hi - 1;
if (sizetype != nullptr && sizetype->_hi > 0) {
index_max = sizetype->_hi - 1;
}
const TypeInt* iidxtype = TypeInt::make(0, index_max, Type::WidenMax);
idx = constrained_convI2L(phase, idx, iidxtype, ctrl);
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/compile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,8 @@ class Compile : public Phase {
bool copy_node_notes_to(Node* dest, Node* source);

// Workhorse function to sort out the blocked Node_Notes array:
inline Node_Notes* locate_node_notes(GrowableArray<Node_Notes*>* arr,
int idx, bool can_grow = false);
Node_Notes* locate_node_notes(GrowableArray<Node_Notes*>* arr,
int idx, bool can_grow = false);

void grow_node_notes(GrowableArray<Node_Notes*>* arr, int grow_by);

Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/opto/graphKit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3881,7 +3881,9 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
if (tilen != nullptr && tilen->_lo < 0) {
// Add a manual constraint to a positive range. Cf. array_element_address.
jint size_max = fast_size_limit;
if (size_max > tilen->_hi) size_max = tilen->_hi;
if (size_max > tilen->_hi && tilen->_hi >= 0) {
size_max = tilen->_hi;
}
const TypeInt* tlcon = TypeInt::make(0, size_max, Type::WidenMin);

// Only do a narrow I2L conversion if the range check passed.
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/share/opto/ifnode.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1049,8 +1049,7 @@ bool IfNode::fold_compares_helper(ProjNode* proj, ProjNode* success, ProjNode* f
if (failtype != nullptr) {
const TypeInt* type2 = filtered_int_type(igvn, n, fail);
if (type2 != nullptr) {
failtype = failtype->join(type2)->is_int();
if (failtype->empty()) {
if (failtype->filter(type2) == Type::TOP) {
// previous if determines the result of this if so
// replace Bool with constant
igvn->replace_input_of(this, 1, igvn->intcon(success->_con));
Expand Down
Loading