Skip to content

Commit c4629b5

Browse files
committed
Fixed fn pointer type bug
1 parent 544f40b commit c4629b5

37 files changed

+343
-305
lines changed

bin/c_success_corebenches.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ fmt::write_str_macro_debug
148148
fmt::write_str_macro_debug_ascii
149149
fmt::write_str_ref
150150
fmt::write_str_value
151+
fmt::write_u128_max
151152
fmt::write_u128_min
152153
fmt::write_u64_max
153154
fmt::write_u64_min
@@ -318,8 +319,6 @@ num::dec2flt::bench_short_decimal
318319
num::int_log::u128_log10_predictable
319320
num::int_log::u128_log10_random
320321
num::int_log::u128_log10_random_small
321-
num::int_log::u128_log_random
322-
num::int_log::u128_log_random_small
323322
num::int_log::u16_log10_predictable
324323
num::int_log::u16_log10_random
325324
num::int_log::u16_log10_random_small
@@ -345,11 +344,9 @@ num::int_log::u8_log_geometric
345344
num::int_log::u8_log_random
346345
num::int_log::u8_log_random_small
347346
num::int_pow::overflowing_pow_variable
348-
num::int_pow::pow_m7
349-
num::int_pow::pow_m8
350-
num::int_pow::pow_variable
351347
num::int_pow::saturating_pow_variable
352348
num::int_pow::wrapping_pow_variable
349+
num::int_sqrt::u128_sqrt_predictable
353350
num::int_sqrt::u128_sqrt_random
354351
num::int_sqrt::u128_sqrt_random_small
355352
num::int_sqrt::u128_sqrt_uniform

bin/c_success_coretests.txt

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ any::distinct_type_names
1313
any::dyn_type_name
1414
array::array_from_fn
1515
array::array_from_mut
16-
array::array_from_ref
1716
array::array_into_iter_fold
1817
array::array_into_iter_rfold
1918
array::array_intoiter_advance_back_by
@@ -75,6 +74,7 @@ atomic::atomic_alignment
7574
atomic::atomic_compare_exchange
7675
atomic::bool_
7776
atomic::bool_nand
77+
atomic::int_and
7878
atomic::int_max
7979
atomic::int_min
8080
atomic::int_nand
@@ -136,11 +136,13 @@ char::test_decode_utf16
136136
char::test_decode_utf16_size_hint
137137
char::test_encode_utf16
138138
char::test_encode_utf8
139+
char::test_escape_debug
139140
char::test_escape_default
140141
char::test_escape_unicode
141142
char::test_from_str
142143
char::test_is_control
143144
char::test_is_lowercase
145+
char::test_is_numeric
144146
char::test_is_uppercase
145147
char::test_is_whitespace
146148
char::test_len_utf16
@@ -236,11 +238,13 @@ hash::sip::test_write_short_works
236238
hash::test_build_hasher_dyn_compatible
237239
hash::test_custom_state
238240
hash::test_indirect_hasher
241+
hint::select_unpredictable_drop
239242
intrinsics::carrying_mul_add_fallback_i128
240243
intrinsics::carrying_mul_add_fallback_i32
241244
intrinsics::carrying_mul_add_fallback_u128
242245
intrinsics::carrying_mul_add_fallback_u32
243246
intrinsics::test_assume_can_be_in_const_contexts
247+
intrinsics::test_const_allocate_at_runtime
244248
intrinsics::test_const_deallocate_at_runtime
245249
intrinsics::test_hints_in_const_contexts
246250
intrinsics::test_three_way_compare_in_const_contexts
@@ -344,7 +348,6 @@ iter::adapters::map_windows::output_n2
344348
iter::adapters::map_windows::test_case_from_pr_82413_comment
345349
iter::adapters::map_windows::test_laziness
346350
iter::adapters::map_windows::test_size_hint
347-
iter::adapters::map_windows::test_too_large_array_size
348351
iter::adapters::map_windows::test_zero_sized_type
349352
iter::adapters::peekable::test_iterator_peekable
350353
iter::adapters::peekable::test_iterator_peekable_count
@@ -412,7 +415,6 @@ iter::adapters::zip::test_zip_nth_back_side_effects_exhausted
412415
iter::adapters::zip::test_zip_nth_side_effects
413416
iter::adapters::zip::test_zip_trusted_random_access_composition
414417
iter::extend_for_unit
415-
iter::range::test_ascii_char_range
416418
iter::range::test_char_range
417419
iter::range::test_double_ended_range
418420
iter::range::test_range
@@ -562,8 +564,6 @@ mem::uninit_array_assume_init
562564
mem::uninit_const_assume_init_read
563565
mem::uninit_write_clone_of_slice
564566
mem::uninit_write_clone_of_slice_no_drop
565-
mem::uninit_write_clone_of_slice_panic_gt
566-
mem::uninit_write_clone_of_slice_panic_lt
567567
mem::uninit_write_copy_of_slice
568568
mem::uninit_write_copy_of_slice_panic_gt
569569
mem::uninit_write_copy_of_slice_panic_lt
@@ -1360,12 +1360,8 @@ panic::location::location_const_caller
13601360
panic::location::location_const_column
13611361
panic::location::location_const_file
13621362
panic::location::location_const_line
1363-
pattern::double_ended_regression_test
1364-
pattern::test_forward_search_shared_bytes
1365-
pattern::test_reverse_search_shared_bytes
13661363
pattern::test_simple_iteration
13671364
pattern::test_simple_search
1368-
pattern::test_stress_indices
13691365
pin::pin_const
13701366
pin_macro::basic
13711367
pin_macro::extension_works_through_block
@@ -1466,8 +1462,6 @@ slice::slice_index::boundpair_neg_width::pass
14661462
slice::slice_index::boundpair_overflow_end::index_fail
14671463
slice::slice_index::boundpair_overflow_end::index_mut_fail
14681464
slice::slice_index::boundpair_overflow_end::pass
1469-
slice::slice_index::boundpair_overflow_start::index_fail
1470-
slice::slice_index::boundpair_overflow_start::index_mut_fail
14711465
slice::slice_index::boundpair_overflow_start::pass
14721466
slice::slice_index::range_len_len::index_fail
14731467
slice::slice_index::range_len_len::index_mut_fail
@@ -1551,6 +1545,9 @@ slice::test_array_windows_count
15511545
slice::test_array_windows_infer
15521546
slice::test_array_windows_nth
15531547
slice::test_array_windows_nth_back
1548+
slice::test_binary_search
1549+
slice::test_binary_search_by_overflow
1550+
slice::test_binary_search_implementation_details
15541551
slice::test_chunks_count
15551552
slice::test_chunks_exact_count
15561553
slice::test_chunks_exact_last
@@ -1577,7 +1574,6 @@ slice::test_chunks_next_back
15771574
slice::test_chunks_nth
15781575
slice::test_chunks_nth_back
15791576
slice::test_chunks_zip
1580-
slice::test_const_from_ref
15811577
slice::test_copy_within
15821578
slice::test_copy_within_panics_dest_too_long
15831579
slice::test_copy_within_panics_src_inverted
@@ -1606,6 +1602,7 @@ slice::test_iterator_count
16061602
slice::test_iterator_last
16071603
slice::test_iterator_nth
16081604
slice::test_iterator_nth_back
1605+
slice::test_partition_point
16091606
slice::test_position
16101607
slice::test_rchunks_count
16111608
slice::test_rchunks_exact_count
@@ -1654,6 +1651,7 @@ slice::test_windows_nth
16541651
slice::test_windows_nth_back
16551652
slice::test_windows_zip
16561653
str_lossy::chunks
1654+
str_lossy::debug
16571655
task::poll_const
16581656
task::waker_const
16591657
time::abs_diff

cilly/src/basic_block.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use fxhash::{FxBuildHasher, FxHashSet};
22
use serde::{Deserialize, Serialize};
33

4-
use crate::{cil_root::CILRoot, cil_tree::CILTree};
4+
use crate::{cil_root::V1Root, cil_tree::CILTree};
55

66
#[derive(Clone, PartialEq, Serialize, Deserialize, Debug)]
77
/// A block of ops that is a valid jump target, and is protected by an exception handler.
@@ -86,7 +86,7 @@ impl BasicBlock {
8686
.last()
8787
.into_iter()
8888
.filter_map(|tree| match tree.root() {
89-
CILRoot::GoTo { target, sub_target } => {
89+
V1Root::GoTo { target, sub_target } => {
9090
if *sub_target != 0 {
9191
None
9292
} else {
@@ -116,7 +116,7 @@ impl BasicBlock {
116116
handler.insert(
117117
0,
118118
Self::new(
119-
vec![CILRoot::GoTo {
119+
vec![V1Root::GoTo {
120120
target: self.id(),
121121
sub_target: *handler_id,
122122
}
@@ -132,7 +132,7 @@ impl BasicBlock {
132132
for (target, sub_target) in targets {
133133
assert_eq!(*sub_target, 0);
134134
self.trees.push(
135-
CILRoot::JumpingPad {
135+
V1Root::JumpingPad {
136136
target: *target,
137137
source: id,
138138
}
@@ -209,7 +209,7 @@ impl BasicBlock {
209209
self.handler.as_ref()
210210
}
211211

212-
pub(crate) fn iter_tree_roots(&self) -> impl Iterator<Item = &CILRoot> {
212+
pub(crate) fn iter_tree_roots(&self) -> impl Iterator<Item = &V1Root> {
213213
let handler_bbs = self
214214
.handler
215215
.iter()

cilly/src/bin/linker/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ fn main() {
343343
MethodImpl::MethodBody {
344344
blocks: vec![cilly::BasicBlock::from_v1(
345345
&cilly::basic_block::BasicBlock::new(
346-
vec![cilly::cil_root::CILRoot::Throw(
346+
vec![cilly::cil_root::V1Root::Throw(
347347
cilly::cil_node::V1Node::NewObj(Box::new(
348348
cilly::cil_node::CallOpArgs {
349349
args: Box::new([conv_usize!(arg0)]),

cilly/src/cil_node.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::v2::method::LocalDef;
66
use crate::FieldDesc;
77
use crate::{
88
call,
9-
cil_root::CILRoot,
9+
cil_root::V1Root,
1010
hashable::{HashableF32, HashableF64},
1111
IString,
1212
};
@@ -365,9 +365,9 @@ impl V1Node {
365365
destination_addr: Self,
366366
val_desc: Interned<FieldDesc>,
367367
flag_desc: Interned<FieldDesc>,
368-
) -> [CILRoot; 2] {
368+
) -> [V1Root; 2] {
369369
// Set the value of the result.
370-
let set_val = CILRoot::SetField {
370+
let set_val = V1Root::SetField {
371371
addr: Box::new(destination_addr.clone()),
372372
value: Box::new(old_val),
373373
desc: val_desc,
@@ -382,7 +382,7 @@ impl V1Node {
382382

383383
[
384384
set_val,
385-
CILRoot::SetField {
385+
V1Root::SetField {
386386
addr: Box::new(destination_addr.clone()),
387387
value: Box::new(cmp),
388388
desc: flag_desc,

cilly/src/cil_root.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
use crate::bimap::Interned;
22
use crate::cilnode::IsPure;
33
use crate::cilnode::MethodKind;
4+
use crate::typecheck::TypeCheckError;
45
use crate::v2::method::LocalDef;
56
use crate::FieldDesc;
67
use crate::{
78
call,
8-
cil_node::{V1Node, CallOpArgs},
9+
cil_node::{CallOpArgs, V1Node},
910
AsmString, IString,
1011
};
1112
use crate::{Assembly, ClassRef, FnSig, MethodRef, StaticFieldDesc, Type};
1213
use serde::{Deserialize, Serialize};
1314
#[derive(Clone, Eq, PartialEq, Hash, Serialize, Deserialize, Debug)]
14-
pub enum CILRoot {
15+
pub enum V1Root {
1516
STLoc {
1617
local: u32,
1718
tree: V1Node,
@@ -153,7 +154,16 @@ pub enum CILRoot {
153154
V2(Interned<crate::v2::CILRoot>),
154155
}
155156
pub type SFI = Box<(std::ops::Range<u64>, std::ops::Range<u64>, IString)>;
156-
impl CILRoot {
157+
impl V1Root {
158+
pub fn try_typecheck(
159+
&self,
160+
asm: &mut Assembly,
161+
fn_sig: Interned<FnSig>,
162+
locals: &[LocalDef],
163+
) -> Result<(), TypeCheckError> {
164+
let Self::V2(root) = self else { return Ok(()) };
165+
asm[*root].clone().typecheck(fn_sig, locals, asm)
166+
}
157167
#[must_use]
158168
pub fn throw(msg: &str, asm: &mut Assembly) -> Self {
159169
let class = ClassRef::exception(asm);

cilly/src/cil_tree.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
use serde::{Deserialize, Serialize};
22

3-
use crate::{cil_root::CILRoot, v2::method::LocalDef};
3+
use crate::{cil_root::V1Root, v2::method::LocalDef};
44

55
#[derive(Clone, PartialEq, Serialize, Deserialize, Debug)]
66
/// A root of a CIL Tree with metadata about local variables it reads/writes into.
77
pub struct CILTree {
88
//tree: InterCow<CILRoot>,
9-
tree: CILRoot,
9+
tree: V1Root,
1010
}
11-
impl From<CILRoot> for CILTree {
12-
fn from(tree: CILRoot) -> Self {
11+
impl From<V1Root> for CILTree {
12+
fn from(tree: V1Root) -> Self {
1313
Self {
1414
//tree: InterCow::new(tree),
1515
tree,
@@ -32,15 +32,15 @@ impl CILTree {
3232
}
3333
/// Retunrs the root of this tree.
3434
#[must_use]
35-
pub fn root(&self) -> &CILRoot {
35+
pub fn root(&self) -> &V1Root {
3636
&self.tree
3737
}
3838

3939
/// Allocates the temporary variables this tree uses.
4040
pub fn allocate_tmps(&mut self, locals: &mut Vec<LocalDef>) {}
4141

4242
// TODO: remember to make this recompute tree metadtata when it is added
43-
pub fn root_mut(&mut self) -> &mut CILRoot {
43+
pub fn root_mut(&mut self) -> &mut V1Root {
4444
//self.tree.borrow_mut()
4545
&mut self.tree
4646
}

0 commit comments

Comments
 (0)