Skip to content

Commit 603b659

Browse files
authored
Merge pull request simdjson#882 from simdjson/jkeiser/move-cpp-files
Split stage2 into files-per-class
2 parents e7e6ac5 + 64abc3e commit 603b659

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+9307
-9111
lines changed

HACKING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ simdjson's source structure, from the top level, looks like this:
2929
```c++
3030
namespace simdjson {
3131
namespace haswell {
32-
#include "generic/stage1_find_marks.h"
32+
#include "generic/stage1/json_structural_indexer.h"
3333
}
3434
}
3535
```

include/simdjson/document.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ class tape_ref {
8989
size_t json_index;
9090
};
9191

92+
#ifdef SIMDJSON_USE_COMPUTED_GOTO
93+
typedef void* ret_address;
94+
#else
95+
typedef char ret_address;
96+
#endif
97+
9298
} // namespace internal
9399

94100
namespace dom {
@@ -977,13 +983,8 @@ class parser {
977983
/** @private Tape location of each open { or [ */
978984
std::unique_ptr<scope_descriptor[]> containing_scope{};
979985

980-
#ifdef SIMDJSON_USE_COMPUTED_GOTO
981-
/** @private Return address of each open { or [ */
982-
std::unique_ptr<void*[]> ret_address{};
983-
#else
984986
/** @private Return address of each open { or [ */
985-
std::unique_ptr<char[]> ret_address{};
986-
#endif
987+
std::unique_ptr<internal::ret_address[]> ret_address{};
987988

988989
/** @private Use `if (parser.parse(...).error())` instead */
989990
bool valid{false};

include/simdjson/inline/document.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,7 @@ inline error_code parser::allocate(size_t capacity, size_t max_depth) noexcept {
509509
// Initialize stage 2 state
510510
//
511511
containing_scope.reset(new (std::nothrow) scope_descriptor[max_depth]); // TODO realloc
512-
#ifdef SIMDJSON_USE_COMPUTED_GOTO
513-
ret_address.reset(new (std::nothrow) void *[max_depth]);
514-
#else
515-
ret_address.reset(new (std::nothrow) char[max_depth]);
516-
#endif
512+
ret_address.reset(new (std::nothrow) internal::ret_address[max_depth]);
517513

518514
if (!ret_address || !containing_scope) {
519515
// Could not allocate memory

include/simdjson/inline/error.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#ifndef SIMDJSON_INLINE_ERROR_H
22
#define SIMDJSON_INLINE_ERROR_H
33

4-
#include "simdjson/error.h"
4+
#include <cstring>
55
#include <string>
6+
#include "simdjson/error.h"
67

78
namespace simdjson {
89
namespace internal {

singleheader/amalgamate.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ set -e
77

88

99
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
10-
PROJECTPATH=$SCRIPTPATH"/.."
10+
PROJECTPATH="$(dirname $SCRIPTPATH)"
1111
echo "Project at "$PROJECTPATH
1212

1313
echo "We are about to amalgamate all simdjson files into one source file. "
1414
echo "See https://www.sqlite.org/amalgamation.html and https://en.wikipedia.org/wiki/Single_Compilation_Unit for rationale. "
1515

16-
if [ -z "$AMALGAMATE_SOURCE_PATH" ]; then AMALGAMATE_SOURCE_PATH="$SCRIPTPATH/../src"; fi
17-
if [ -z "$AMALGAMATE_INCLUDE_PATH" ]; then AMALGAMATE_INCLUDE_PATH="$SCRIPTPATH/../include"; fi
16+
if [ -z "$AMALGAMATE_SOURCE_PATH" ]; then AMALGAMATE_SOURCE_PATH="$PROJECTPATH/src"; fi
17+
if [ -z "$AMALGAMATE_INCLUDE_PATH" ]; then AMALGAMATE_INCLUDE_PATH="$PROJECTPATH/include"; fi
1818
if [ -z "$AMALGAMATE_OUTPUT_PATH" ]; then AMALGAMATE_OUTPUT_PATH="$SCRIPTPATH"; fi
1919

2020
# this list excludes the "src/generic headers"

singleheader/amalgamate_demo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on Tue May 5 20:03:59 EDT 2020. Do not edit! */
1+
/* auto-generated on Tue May 19 13:32:53 PDT 2020. Do not edit! */
22

33
#include <iostream>
44
#include "simdjson.h"

0 commit comments

Comments
 (0)