Skip to content

Commit ed0c05d

Browse files
committed
taking a stab
Signed-off-by: Heinz N. Gies <heinz@licenser.net>
1 parent 21cc445 commit ed0c05d

File tree

10 files changed

+178
-83
lines changed

10 files changed

+178
-83
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ colored = { version = "2.0", optional = true }
3434
getopts = { version = "0.2", optional = true }
3535
jemallocator = { version = "0.5", optional = true }
3636
perfcnt = { version = "0.8", optional = true }
37+
iex = { version = "0.2", optional = false }
3738

3839
ref-cast = "1.0"
3940

src/impls/avx2/deser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use crate::{
2323
clippy::too_many_lines
2424
)]
2525
#[cfg_attr(not(feature = "no-inline"), inline)]
26+
#[iex::iex]
2627
pub(crate) unsafe fn parse_str<'invoke, 'de>(
2728
input: SillyWrapper<'de>,
2829
data: &'invoke [u8],

src/impls/native/deser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::{
55
};
66

77
#[allow(clippy::cast_possible_truncation)]
8+
#[iex::iex]
89
pub(crate) unsafe fn parse_str<'invoke, 'de>(
910
input: SillyWrapper<'de>,
1011
data: &'invoke [u8],

src/impls/neon/deser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ fn find_bs_bits_and_quote_bits(v0: uint8x16_t, v1: uint8x16_t) -> (u32, u32) {
4242

4343
#[allow(clippy::if_not_else, clippy::too_many_lines)]
4444
#[cfg_attr(not(feature = "no-inline"), inline)]
45+
#[iex::iex]
4546
pub(crate) fn parse_str<'invoke, 'de>(
4647
input: SillyWrapper<'de>,
4748
data: &'invoke [u8],

src/impls/portable/deser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::{
77
};
88

99
#[cfg_attr(not(feature = "no-inline"), inline)]
10+
#[iex::iex]
1011
pub(crate) unsafe fn parse_str<'invoke, 'de>(
1112
input: SillyWrapper<'de>,
1213
data: &'invoke [u8],

src/impls/simd128/deser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::{
1414
clippy::too_many_lines
1515
)]
1616
#[cfg_attr(not(feature = "no-inline"), inline)]
17+
#[iex::iex]
1718
pub(crate) fn parse_str<'invoke, 'de>(
1819
input: SillyWrapper<'de>,
1920
data: &'invoke [u8],

src/impls/sse42/deser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use arch::{
1717
#[target_feature(enable = "sse4.2")]
1818
#[allow(clippy::if_not_else, clippy::cast_possible_wrap)]
1919
#[cfg_attr(not(feature = "no-inline"), inline)]
20+
#[iex::iex]
2021
pub(crate) unsafe fn parse_str<'invoke, 'de>(
2122
input: SillyWrapper<'de>,
2223
data: &'invoke [u8],

src/lib.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ mod numberparse;
139139
mod safer_unchecked;
140140
mod stringparse;
141141

142+
use iex::Outcome;
142143
use safer_unchecked::GetSaferUnchecked;
143144
use stage2::StackState;
144145

@@ -547,6 +548,7 @@ impl<'de> Deserializer<'de> {
547548
feature = "runtime-detection",
548549
any(target_arch = "x86_64", target_arch = "x86"),
549550
))]
551+
#[iex::iex]
550552
pub(crate) unsafe fn parse_str_<'invoke>(
551553
input: *mut u8,
552554
data: &'invoke [u8],
@@ -606,6 +608,7 @@ impl<'de> Deserializer<'de> {
606608
target_feature = "simd128",
607609
target_arch = "aarch64",
608610
)))]
611+
#[iex::iex]
609612
pub(crate) unsafe fn parse_str_<'invoke>(
610613
input: *mut u8,
611614
data: &'invoke [u8],
@@ -620,6 +623,7 @@ impl<'de> Deserializer<'de> {
620623
}
621624
#[cfg_attr(not(feature = "no-inline"), inline)]
622625
#[cfg(all(feature = "portable", not(feature = "runtime-detection")))]
626+
#[iex::iex]
623627
pub(crate) unsafe fn parse_str_<'invoke>(
624628
input: *mut u8,
625629
data: &'invoke [u8],
@@ -639,6 +643,7 @@ impl<'de> Deserializer<'de> {
639643
not(feature = "portable"),
640644
not(feature = "runtime-detection"),
641645
))]
646+
#[iex::iex]
642647
pub(crate) unsafe fn parse_str_<'invoke>(
643648
input: *mut u8,
644649
data: &'invoke [u8],
@@ -656,6 +661,7 @@ impl<'de> Deserializer<'de> {
656661
not(feature = "runtime-detection"),
657662
not(feature = "portable"),
658663
))]
664+
#[iex::iex]
659665
pub(crate) unsafe fn parse_str_<'invoke>(
660666
input: *mut u8,
661667
data: &'invoke [u8],
@@ -668,6 +674,7 @@ impl<'de> Deserializer<'de> {
668674

669675
#[cfg_attr(not(feature = "no-inline"), inline)]
670676
#[cfg(all(target_arch = "aarch64", not(feature = "portable")))]
677+
#[iex::iex]
671678
pub(crate) unsafe fn parse_str_<'invoke>(
672679
input: *mut u8,
673680
data: &'invoke [u8],
@@ -679,6 +686,7 @@ impl<'de> Deserializer<'de> {
679686
}
680687
#[cfg_attr(not(feature = "no-inline"), inline)]
681688
#[cfg(all(target_feature = "simd128", not(feature = "portable")))]
689+
#[iex::iex]
682690
pub(crate) unsafe fn parse_str_<'invoke>(
683691
input: *mut u8,
684692
data: &'invoke [u8],
@@ -842,7 +850,7 @@ impl<'de> Deserializer<'de> {
842850

843851
let mut buffer = Buffers::new(len);
844852

845-
Self::from_slice_with_buffers(input, &mut buffer)
853+
Self::from_slice_with_buffers(input, &mut buffer).into_result()
846854
}
847855

848856
/// Fills the tape without creating a serializer, this function poses
@@ -854,6 +862,7 @@ impl<'de> Deserializer<'de> {
854862
/// Will return `Err` if `input` is invalid JSON.
855863
#[allow(clippy::uninit_vec)]
856864
#[cfg_attr(not(feature = "no-inline"), inline)]
865+
#[iex::iex(captures = "'de")]
857866
fn fill_tape(
858867
input: &'de mut [u8],
859868
buffer: &mut Buffers,
@@ -905,7 +914,8 @@ impl<'de> Deserializer<'de> {
905914
&buffer.structural_indexes,
906915
&mut buffer.stage2_stack,
907916
tape,
908-
)
917+
)?;
918+
Ok(())
909919
}
910920

911921
/// Creates a serializer from a mutable slice of bytes using a temporary
@@ -914,6 +924,7 @@ impl<'de> Deserializer<'de> {
914924
/// # Errors
915925
///
916926
/// Will return `Err` if `s` is invalid JSON.
927+
#[iex::iex]
917928
pub fn from_slice_with_buffers(input: &'de mut [u8], buffer: &mut Buffers) -> Result<Self> {
918929
let mut tape: Vec<Node<'de>> = Vec::with_capacity(buffer.structural_indexes.len());
919930

0 commit comments

Comments
 (0)