Skip to content

Commit cebe420

Browse files
committed
update growable for patch
1 parent deaa0f7 commit cebe420

File tree

6 files changed

+0
-311
lines changed

6 files changed

+0
-311
lines changed

src/data.table.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -341,20 +341,6 @@ void hash_set(hashtab *, SEXP key, R_xlen_t value);
341341
// Returns the value corresponding to the key present in the hash, otherwise returns ifnotfound.
342342
R_xlen_t hash_lookup(const hashtab *, SEXP key, R_xlen_t ifnotfound);
343343

344-
// growable.c
345-
// Return a new vector of given type. Initially its xlength() is equal to size. Using growable_resize(), it can be increased to up to max_size.
346-
SEXP growable_allocate(SEXPTYPE type, R_xlen_t size, R_xlen_t max_size);
347-
// Return the max_size of a growable vector. Behaviour is undefined if x was not allocated by growable_allocate.
348-
R_xlen_t growable_max_size(SEXP x);
349-
// Resize a growable vector to newsize. Will signal an error if newsize exceeds max_size.
350-
void growable_resize(SEXP x, R_xlen_t newsize);
351-
// Return TRUE if growable_resize(x) and growable_max_size(x) are valid operations.
352-
Rboolean is_growable(SEXP x);
353-
// Transform x into a growable vector. The return value must be reprotected in place of x. What happens to x is deliberately not specified, but no copying occurs.
354-
SEXP make_growable(SEXP x);
355-
#if R_VERSION >= R_Version(4, 3, 0)
356-
void register_altrep_classes(DllInfo*);
357-
#endif
358344
// The dynamically-allocated hash table has a public field for the R protection wrapper.
359345
// Keep it PROTECTed while the table is in use.
360346
typedef struct dhash_tab {

src/growable.c

Lines changed: 0 additions & 274 deletions
This file was deleted.

src/init.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,8 @@ void attribute_visible R_init_data_table(DllInfo *info)
212212

213213
SEXP tmp = PROTECT(allocVector(INTSXP,2));
214214
if (LENGTH(tmp)!=2) error(_("Checking LENGTH(allocVector(INTSXP,2)) [%d] is 2 %s"), LENGTH(tmp), msg);
215-
#if R_VERSION >= R_Version(4, 3, 0)
216-
register_altrep_classes(info);
217-
#else
218215
// Use (long long) to cast R_xlen_t to a fixed type to robustly avoid -Wformat compiler warnings, see #5768
219216
if (TRUELENGTH(tmp)!=0) error(_("Checking TRUELENGTH(allocVector(INTSXP,2)) [%lld] is 0 %s"), (long long)TRUELENGTH(tmp), msg);
220-
#endif
221217
UNPROTECT(1);
222218

223219
// According to IEEE (http://en.wikipedia.org/wiki/IEEE_754-1985#Zero) we can rely on 0.0 being all 0 bits.

src/reorder.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ SEXP reorder(SEXP x, SEXP order)
2424
error(_("Column %d is length %d which differs from length of column 1 (%d). Invalid data.table."), i+1, length(v), nrow);
2525
if (RTYPE_SIZEOF(v) > maxSize)
2626
maxSize=RTYPE_SIZEOF(v);
27-
#ifndef USE_GROWABLE_ALTREP
2827
if (ALTREP(v)) SET_VECTOR_ELT(x, i, copyAsPlain(v));
29-
#endif
3028
}
3129
copySharedColumns(x); // otherwise two columns which point to the same vector would be reordered and then re-reordered, issues linked in PR#3768
3230
} else {
3331
if (RTYPE_SIZEOF(x)!=4 && RTYPE_SIZEOF(x)!=8 && RTYPE_SIZEOF(x)!=16 && RTYPE_SIZEOF(x)!=1)
3432
error(_("reorder accepts vectors but this non-VECSXP is type '%s' which isn't yet supported (RTYPE_SIZEOF=%zu)"), type2char(TYPEOF(x)), RTYPE_SIZEOF(x));
35-
#ifndef USE_GROWABLE_ALTREP
3633
if (ALTREP(x)) internal_error(__func__, "cannot reorder an ALTREP vector. Please see NEWS item 2 in v1.11.4"); // # nocov
37-
#endif
3834
maxSize = RTYPE_SIZEOF(x);
3935
nrow = length(x);
4036
ncol = 1;
@@ -44,9 +40,7 @@ SEXP reorder(SEXP x, SEXP order)
4440
if (length(order) != nrow)
4541
error("nrow(x)[%d]!=length(order)[%d]", nrow, length(order)); // # notranslate
4642
int nprotect = 0;
47-
#ifndef USE_GROWABLE_ALTREP
4843
if (ALTREP(order)) { order=PROTECT(copyAsPlain(order)); nprotect++; } // TODO: if it's an ALTREP sequence some optimizations are possible rather than expand
49-
#endif
5044

5145
const int *restrict idx = INTEGER(order);
5246
int i=0;

src/utils.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ inline bool INHERITS(SEXP x, SEXP char_) {
203203
return false;
204204
}
205205

206-
#ifdef USE_GROWABLE_ALTREP
207-
SEXP copyAsPlain(SEXP x) { return duplicate(x); }
208-
#else
209206
SEXP copyAsPlain(SEXP x) {
210207
// v1.12.2 and before used standard R duplicate() to do this. But duplicate() is not guaranteed to not return an ALTREP.
211208
// e.g. ALTREP 'wrapper' on factor column (with materialized INTSXP) in package VIM under example(hotdeck)
@@ -265,7 +262,6 @@ SEXP copyAsPlain(SEXP x) {
265262
UNPROTECT(1);
266263
return ans;
267264
}
268-
#endif
269265

270266
void copySharedColumns(SEXP x) {
271267
const int ncol = length(x);
@@ -278,9 +274,7 @@ void copySharedColumns(SEXP x) {
278274
SEXP thiscol = xp[i];
279275
if (
280276
hash_lookup(marks, thiscol, 0)<0
281-
#ifndef USE_GROWABLE_ALTREP
282277
|| ALTREP(thiscol)
283-
#endif
284278
) {
285279
shared[i] = true; // we mark ALTREP as 'shared' too, whereas 'tocopy' would be better word to use for ALTREP
286280
nShared++;

src/wrappers.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,6 @@ SEXP address(SEXP x)
8787
return(mkString(buffer));
8888
}
8989

90-
#ifdef USE_GROWABLE_ALTREP
91-
SEXP expandAltRep(SEXP x) {
92-
(void)x;
93-
return R_NilValue;
94-
}
95-
#else
9690
SEXP expandAltRep(SEXP x)
9791
{
9892
// used by setDT to ensure altrep vectors in columns are expanded. Such altrep objects typically come from tests or demos, since
@@ -111,7 +105,6 @@ SEXP expandAltRep(SEXP x)
111105
}
112106
return R_NilValue;
113107
}
114-
#endif
115108

116109
SEXP dim(SEXP x)
117110
{

0 commit comments

Comments
 (0)