Skip to content

Commit

Permalink
Start implementing index-based sequence caches
Browse files Browse the repository at this point in the history
  • Loading branch information
GrieferAtWork committed Dec 22, 2024
1 parent 6f9abdf commit 4fb0b39
Show file tree
Hide file tree
Showing 8 changed files with 1,274 additions and 20 deletions.
2 changes: 2 additions & 0 deletions include/deemon/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ struct Dee_gc_head {
DFUNDEF ATTR_RETNONNULL NONNULL((1)) DeeObject *DCALL DeeGC_Track(DeeObject *__restrict ob);
DFUNDEF ATTR_RETNONNULL NONNULL((1)) DeeObject *DCALL DeeGC_Untrack(DeeObject *__restrict ob);

#define DeeGC_TRACK(T, ob) ((DREF T *)DeeGC_Track((DREF DeeObject *)Dee_REQUIRES_OBJECT(ob)))

/* Try to collect at most `max_objects' GC-objects,
* returning the actual amount collected. */
DFUNDEF size_t DCALL DeeGC_Collect(size_t max_objects);
Expand Down
2 changes: 1 addition & 1 deletion src/deemon/objects/int.c
Original file line number Diff line number Diff line change
Expand Up @@ -3909,7 +3909,7 @@ DeeInt_Size_TryCompareEq(size_t lhs, DeeObject *rhs) {


/* Integer compare. */
PRIVATE WUNUSED NONNULL((1, 2)) Dee_ssize_t DCALL
INTERN WUNUSED NONNULL((1, 2)) Dee_ssize_t DCALL /* Needed by "seq/cached-seq.c" */
int_compareint(DeeIntObject const *a, DeeIntObject const *b) {
Dee_ssize_t sign;
if (a->ob_size != b->ob_size) {
Expand Down
2 changes: 1 addition & 1 deletion src/deemon/objects/seq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2142,7 +2142,7 @@ PRIVATE struct type_getset tpconst seq_getsets[] = {
/**/ "print (for (local x: { 5, 7 }) seq.rfind(x)) > ...; /* 3 */"
"}\n"
"This works because ?#find and similar functions always perform comparisons with the "
/**/ "item being searched on the left-hand-side, meaning *its* compare operators are "
/**/ "item being searched on the left-hand-side, meaning #Iits compare operators are "
/**/ "invoked in order to determine equality. As such, ${(seq.some == foo).operator bool()} "
/**/ "has been programmed to return the same as ${(foo in seq).operator bool()}"),
TYPE_GETTER("ids", &SeqIds_New,
Expand Down
Loading

0 comments on commit 4fb0b39

Please sign in to comment.