Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
23cd9bf
base/builtin/*.c/h adapted to unboxing
sydow May 25, 2026
b644fe9
findAttrSchemas added to Env.hs thanks to Johan N
sydow May 25, 2026
ee9b549
Added constructor Unboxed to Syntax.Type
sydow May 25, 2026
fd6142b
added types tI8, tU8 and tU1, and names serializeKW and deserializeKW…
sydow May 25, 2026
a397be7
added field gtypes to Env.EnvF for use in Boxing pass
sydow May 25, 2026
1da6499
Major changes in Boxing.hs and Boxing.hs towards total unboxing
sydow May 25, 2026
8d2eeb0
significant simplification of standard lib module math
sydow May 25, 2026
c65f753
changes for unboxing to __builtin__.ext.c and standard library files
sydow May 27, 2026
f7cec37
changes for unbox to list.c and rts.c
sydow May 27, 2026
c88d4e9
Changes to actonc for unbox. Actonc can compile __builtin__.act and a…
sydow May 27, 2026
daa4fef
minor change in an example
sydow May 27, 2026
319f9cf
fixed one-off errors in byte_length2
sydow May 28, 2026
07831a6
fixed range tests for unsigned integer constructors
sydow May 28, 2026
663921f
reinstated function name ord
sydow May 28, 2026
bd0b8a8
reinstated from_real_imag
sydow May 28, 2026
7f7a393
minor changes to fix bugs in test suite
sydow May 28, 2026
e981db7
reinstated some outcommented cases after bug fixing
sydow May 29, 2026
3f924b5
reinstated raiseValueError which had disappeared
sydow May 29, 2026
4a2e5a1
small bug fixes in unsigned integer types
sydow May 29, 2026
c873364
fixed bug in printing list element None
sydow May 29, 2026
e9bf852
vfixed bug in.ext.c file in regression test
sydow May 29, 2026
3235637
updated golden files on compiler/acton/test/parse
sydow May 29, 2026
f2e1dc8
temporarily removed test_complex.act waaiting changes in __builtin__.act
sydow May 29, 2026
7683936
Small bugfixes; make test now passes except for golden tests and one …
sydow May 29, 2026
13dbcd1
adapted builtin C code to latest unboxing
sydow May 29, 2026
dc9e595
added gc info printout to examples/sumto.act
sydow May 29, 2026
c2090d2
further unbox optimization in __next__ for ranges and list indexing
sydow May 29, 2026
9e955e6
some names defined in Builtin.hs
sydow May 29, 2026
f181135
adapted some stdlib files to total unboxing
sydow May 29, 2026
bd541cc
minor fir in CodeGen.hs when rebasing
sydow May 29, 2026
d0ebff9
updated names in some stdlib files to branch new-unbox
sydow May 29, 2026
f3e442d
Fix UnitTest snapshot output capture
May 29, 2026
359c9b4
Update golden files for total unboxing
May 29, 2026
b697475
Keep abstract protocol returns boxed in codegen
May 30, 2026
38c063f
Fixed minor bug in CodeGen.hs
sydow May 30, 2026
f6528fb
Fix deserialize of unboxed struct fields
May 30, 2026
c0ed55d
Regenerate codegen goldens for methodCast
May 30, 2026
2340c72
fixed bugs related to printing unsigned types
sydow May 30, 2026
ce88fa0
fixed minor Bug in Boxing.hs
sydow May 30, 2026
6d79e98
Cast method-call receivers before vtable dispatch
sydow Jun 3, 2026
a7703da
Update golden output
Jun 3, 2026
2e4e7e0
Lower unboxed bool calls
Jun 4, 2026
8fd744d
Sync std math with base
Jun 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions base/builtin/bigint.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void zz_malloc_fit(zz_ptr res, len_t m) {
res->alloc = m;
}

B_bigint B_IntegralD_bigintD___lshift__(B_IntegralD_bigint wit, B_bigint a, B_int b);
B_bigint B_IntegralD_bigintD___lshift__(B_IntegralD_bigint wit, B_bigint a, int64_t b);

B_bigint B_bigintG_new(B_atom a, B_int base) {
if (base) {
Expand Down Expand Up @@ -123,7 +123,7 @@ B_bigint B_bigintG_new(B_atom a, B_int base) {
double m = frexp(aval,&e);
if (e>52) {
B_bigint c = toB_bigint((long)(m*4503599627370496.0)); // (1<< 52);
B_int d = toB_int(e-52);
int64_t d = e-52;
return B_IntegralD_bigintD___lshift__(NULL,c,d);
} else {
long al = (long)aval;
Expand Down Expand Up @@ -282,7 +282,7 @@ B_bigint B_IntegralD_bigintD_conjugate(B_IntegralD_bigint wit, B_bigint a) {
return a;
}

B_float B_IntegralD_bigintD___float__ (B_IntegralD_bigint wit, B_bigint n) {
double B_IntegralD_bigintD___float__ (B_IntegralD_bigint wit, B_bigint n) {
return B_floatG_new((B_atom)n);
}

Expand Down Expand Up @@ -327,26 +327,26 @@ B_bigint B_IntegralD_bigintD___round__ (B_IntegralD_bigint wit, B_bigint n, B_in
return wit2->$class->__fromatom__(wit2,(B_atom)res);
}

B_int B_IntegralD_bigintD___int__ (B_IntegralD_bigint wit, B_bigint n) {
int64_t B_IntegralD_bigintD___int__ (B_IntegralD_bigint wit, B_bigint n) {
unsigned long k = n->val.n[0];
long sz = n->val.size;
if (labs(sz) > 1 || (sz==1 && k > 0x7ffffffffffffffful) || sz == -1 && k > 0x8000000000000000ul) {
char errmsg[1024];
snprintf(errmsg, sizeof(errmsg), "bigint.__int__: value %s out of range for type int",get_str(&n->val));
$RAISE((B_BaseException)$NEW(B_ValueError,to$str(errmsg)));
}
return toB_int(k*sz);
return k*sz;
}

B_int B_IntegralD_bigintD___index__ (B_IntegralD_bigint wit, B_bigint n) {
int64_t B_IntegralD_bigintD___index__ (B_IntegralD_bigint wit, B_bigint n) {
unsigned long k = n->val.n[0];
long sz = n->val.size;
if (labs(sz) > 1 || (sz==1 && k > 0x7ffffffffffffffful) || sz == -1 && k > 0x8000000000000000ul) {
char errmsg[1024];
snprintf(errmsg, sizeof(errmsg), "bigint.__index__: value %s out of range for type int",get_str(&n->val));
$RAISE((B_BaseException)$NEW(B_ValueError,to$str(errmsg)));
}
return toB_int(k*sz);
return k*sz;
}

B_tuple B_IntegralD_bigintD___divmod__(B_IntegralD_bigint wit, B_bigint a, B_bigint b) {
Expand Down Expand Up @@ -377,10 +377,10 @@ B_bigint B_IntegralD_bigintD___mod__(B_IntegralD_bigint wit, B_bigint a, B_bigin
return t->components[1];
}

B_bigint B_IntegralD_bigintD___lshift__(B_IntegralD_bigint wit, B_bigint a, B_int b) {
B_bigint B_IntegralD_bigintD___lshift__(B_IntegralD_bigint wit, B_bigint a, int64_t b) {
zz_struct aval = a->val;
long ma = aval.size;
long bval = fromB_int(b);
long bval = b;
if (ma==0 || bval==0)
return a;
if (bval<0) {
Expand Down Expand Up @@ -408,10 +408,10 @@ B_bigint B_IntegralD_bigintD___lshift__(B_IntegralD_bigint wit, B_bigint a, B_i
return res;
}

B_bigint B_IntegralD_bigintD___rshift__(B_IntegralD_bigint wit, B_bigint a, B_int b) {
B_bigint B_IntegralD_bigintD___rshift__(B_IntegralD_bigint wit, B_bigint a, int64_t b) {
zz_struct aval = a->val;
long ma = aval.size;
long bval = fromB_int(b);
long bval = b;
if (ma==0 || bval==0)
return a;
if (bval<0) {
Expand Down Expand Up @@ -628,7 +628,7 @@ B_float B_DivD_bigintD___truediv__ (B_DivD_bigint wit, B_bigint a, B_bigint b) {
zz_div(&ared->val,aval,&g->val);
zz_div(&bred->val,bval,&g->val);
zz_divrem(&q->val,&r->val,&ared->val,&bred->val);
return to$float(B_floatG_new((B_atom)q)->val + B_floatG_new((B_atom)r)->val/ B_floatG_new((B_atom)bred)->val);
return toB_float((B_floatG_new((B_atom)q) + B_floatG_new((B_atom)r)/ B_floatG_new((B_atom)bred)));
}

// B_OrdD_bigint ////////////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions base/builtin/builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ struct $IdentityActorG_class $IdentityActorG_methods = {"$IdentityActor", UNASSI

// Various small functions //////////////////////////////////////////////////////////////

// Code generated by acton
// Code generated by actonc
/*
$WORD B_abs (B_Number W_149, B_Real W_148, $WORD x) {
return W_149->$class->__abs__(W_149, x, W_148);
Expand Down Expand Up @@ -540,7 +540,7 @@ B_tuple B_divmod (B_Integral W_225, $WORD a, $WORD b) {
B_Iterator B_iter (B_Iterable W_278, $WORD x) {
return W_278->$class->__iter__(W_278, x);
}
B_int B_len (B_Collection W_301, $WORD x) {
int64_t B_len (B_Collection W_301, $WORD x) {
return W_301->$class->__len__(W_301, x);
}

Expand Down
4 changes: 2 additions & 2 deletions base/builtin/builtin_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ struct $IdentityActor {
$WORD B_min_def(B_Ord wit, B_Iterable wit2, $WORD iter, $WORD deflt);
$WORD B_max_def(B_Ord wit, B_Iterable wit2, $WORD iter, $WORD deflt);

// Signatures generated by acton
// Signatures generated by actonc

/*
$WORD B_abs (B_Real, B_Number, $WORD);
Expand All @@ -187,7 +187,7 @@ B_bool B_any (B_Iterable, $WORD);
B_tuple B_divmod (B_Integral, $WORD, $WORD);
B_u64 B_hash (B_Hashable, $WORD);
B_Iterator B_iter (B_Iterable, $WORD);
B_int B_len (B_Collection, $WORD);
int64_t B_len (B_Collection, $WORD);
$WORD $next (B_Iterator);
$WORD B_pow (B_Number, $WORD, $WORD);
B_str B_repr(B_value);
Expand Down
4 changes: 2 additions & 2 deletions base/builtin/complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ B_complex B_complexG_new(B_Number wit, $WORD c) {
}

B_complex B_complexD_from_real_imag (B_Real wit1, B_Real wit2, $WORD real, $WORD imag) {
double re = wit1->$class->__float__(wit1, real)->val;
double im = wit2->$class->__float__(wit2, imag)->val;
double re = wit1->$class->__float__(wit1, real);
double im = wit2->$class->__float__(wit2, imag);
return toB_complex(re + im * _Complex_I);
}

Expand Down
36 changes: 18 additions & 18 deletions base/builtin/dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void build_indices(B_Hashable hashwit, $table oldtable, $table newtable,
if (oldtable->tb_size > INIT_SIZE)
hash = ep->hash;
else {
hash = fromB_u64(B_hash(hashwit, ep->key));
hash = B_hash(hashwit, ep->key);
ep->hash = hash;
}
unsigned long i = (unsigned long)hash & mask;
Expand Down Expand Up @@ -201,7 +201,7 @@ static void insertdict(B_dict dict, B_Hashable hashwit, uint64_t hash, $WORD key
if (!dict->table || dict->table->tb_usable <= 0)
dictresize(hashwit,dict);
if (dict->table->tb_size == 2*INIT_SIZE)
hash = fromB_u64(B_hash(hashwit, key));
hash = B_hash(hashwit, key);
int ix = $lookdict(dict,hashwit,hash,key,&old_value);
if (ix == DKIX_EMPTY) {
table = dict->table;
Expand Down Expand Up @@ -351,7 +351,7 @@ B_bool B_dictrel(bool directfalse,B_OrdD_dict w, B_dict a, B_dict b) {
x = it->$class->__next__(it);
long h = 0;
if (a->table->tb_size > INIT_SIZE)
h = fromB_u64(B_hash(wH, x));
h = B_hash(wH, x);
int ixa = $lookdict(a, wH, h, x, &resa);
int ixb = $lookdict(b, wH, h, x ,&resb);
if (ixb<0 || wB->$class->__ne__(wB,resa,resb)->val) {
Expand Down Expand Up @@ -469,8 +469,8 @@ B_dict B_MappingD_dictD___fromiter__ (B_MappingD_dict wit, B_Iterable wit2, $WOR
*/
}

B_int B_MappingD_dictD___len__ (B_MappingD_dict wit, B_dict dict) {
return toB_int(dict->numelements);
int64_t B_MappingD_dictD___len__ (B_MappingD_dict wit, B_dict dict) {
return dict->numelements;
}

B_bool B_MappingD_dictD___contains__ (B_MappingD_dict wit, B_dict dict, $WORD key) {
Expand All @@ -480,7 +480,7 @@ B_bool B_MappingD_dictD___contains__ (B_MappingD_dict wit, B_dict dict, $WORD ke
$WORD res;
long h = 0;
if (dict->table->tb_size > INIT_SIZE)
h = fromB_u64(B_hash(hashwit, key));
h = B_hash(hashwit, key);
return toB_bool($lookdict(dict,hashwit,h,key,&res) >= 0);
}

Expand All @@ -494,7 +494,7 @@ B_bool B_MappingD_dictD___containsnot__ (B_MappingD_dict wit, B_dict dict, $WORD
uint64_t hash = 0;
B_Hashable hashwit = wit->W_HashableD_AD_MappingD_dict;
if (dict->table->tb_size > INIT_SIZE)
hash = fromB_u64(B_hash(hashwit, key));
hash = B_hash(hashwit, key);
$WORD res;
int ix = $lookdict(dict,hashwit,hash,key,&res);
if (ix < 0)
Expand All @@ -509,7 +509,7 @@ B_bool B_MappingD_dictD___containsnot__ (B_MappingD_dict wit, B_dict dict, $WORD
uint64_t hash = 0;
B_Hashable hashwit = wit->W_HashableD_AD_MappingD_dict;
if (dict->table->tb_size > INIT_SIZE)
hash = fromB_u64(B_hash(hashwit, key));
hash = B_hash(hashwit, key);
$WORD res;
int ix = $lookdict(dict,hashwit,hash,key,&res);
if (ix < 0)
Expand All @@ -525,7 +525,7 @@ B_bool B_MappingD_dictD___containsnot__ (B_MappingD_dict wit, B_dict dict, $WORD
uint64_t hash = 0;
B_Hashable hashwit = wit->W_HashableD_AD_MappingD_dict;
if (table->tb_size > INIT_SIZE) {
hash = fromB_u64(B_hash(hashwit, key));
hash = B_hash(hashwit, key);
}
$WORD res;
int ix = $lookdict(dict,hashwit,hash,key,&res);
Expand All @@ -551,7 +551,7 @@ B_bool B_MappingD_dictD___containsnot__ (B_MappingD_dict wit, B_dict dict, $WORD
uint64_t hash = 0;
B_Hashable hashwit = wit->W_HashableD_AD_MappingD_dict;
if (table->tb_size > INIT_SIZE) {
hash = fromB_u64(B_hash(hashwit, key));
hash = B_hash(hashwit, key);
}
$WORD res;
int ix = $lookdict(dict,hashwit,hash,key,&res);
Expand Down Expand Up @@ -726,7 +726,7 @@ B_tuple B_MappingD_dictD_popitem (B_MappingD_dict wit, B_dict dict) {
$entry_t entry = &TB_ENTRIES(table)[ix];
if (entry->value != DELETED) {
if (table->tb_size > INIT_SIZE) {
uint64_t hash = fromB_u64(B_hash(hashwit, entry->key));
uint64_t hash = B_hash(hashwit, entry->key);
int i = $lookdict_index(table,hash,ix);
table->tb_indices[i] = DKIX_DUMMY;
}
Expand All @@ -742,7 +742,7 @@ B_tuple B_MappingD_dictD_popitem (B_MappingD_dict wit, B_dict dict) {
$WORD B_MappingD_dictD_setdefault (B_MappingD_dict wit, B_dict dict, $WORD key, $WORD deflt) {
if (!deflt) deflt = B_None;
B_Hashable hashwit = wit->W_HashableD_AD_MappingD_dict;
uint64_t hash = fromB_u64(B_hash(hashwit, key));
uint64_t hash = B_hash(hashwit, key);
$WORD value;
int ix = $lookdict(dict,hashwit,hash,key,&value);
if (ix >= 0)
Expand All @@ -760,7 +760,7 @@ B_tuple B_MappingD_dictD_popitem (B_MappingD_dict wit, B_dict dict) {
B_Hashable hashwit = ((B_MappingD_dict)wit->W_Mapping)->W_HashableD_AD_MappingD_dict;
uint64_t hash = 0;
if (dict->table->tb_size > INIT_SIZE) {
hash = fromB_u64(B_hash(hashwit, key));
hash = B_hash(hashwit, key);
}
$WORD res;
int ix = $lookdict(dict,hashwit,hash,key,&res);
Expand All @@ -774,7 +774,7 @@ B_NoneType B_IndexedD_MappingD_dictD___setitem__ (B_IndexedD_MappingD_dict wit,
B_Hashable hashwit = ((B_MappingD_dict)wit->W_Mapping)->W_HashableD_AD_MappingD_dict;
uint64_t hash = 0;
if (dict->table && dict->table->tb_size > INIT_SIZE) {
hash = fromB_u64(B_hash(hashwit, key));
hash = B_hash(hashwit, key);
}
insertdict(dict, hashwit, hash, key, value);
return B_None;
Expand All @@ -788,7 +788,7 @@ B_NoneType B_IndexedD_MappingD_dictD___delitem__ (B_IndexedD_MappingD_dict wit,
uint64_t hash = 0;
B_Hashable hashwit = ((B_MappingD_dict)wit->W_Mapping)->W_HashableD_AD_MappingD_dict;
if (dict->table->tb_size > INIT_SIZE) {
hash = fromB_u64(B_hash(hashwit, key));
hash = B_hash(hashwit, key);
}
$WORD res;
int ix = $lookdict(dict,hashwit,hash,key,&res);
Expand All @@ -813,7 +813,7 @@ B_NoneType B_IndexedD_MappingD_dictD___delitem__ (B_IndexedD_MappingD_dict wit,
void B_dictD_setitem(B_dict dict, B_Hashable hashwit, $WORD key, $WORD value) {
uint64_t hash = 0;
if (dict->table && dict->table->tb_size > INIT_SIZE) {
hash = fromB_u64(B_hash(hashwit, key));
hash = B_hash(hashwit, key);
}
insertdict(dict, hashwit, hash, key, value);
}
Expand All @@ -823,7 +823,7 @@ void B_dictD_setitem(B_dict dict, B_Hashable hashwit, $WORD key, $WORD value) {
return deflt;
uint64_t hash = 0;
if (dict->table->tb_size > INIT_SIZE) {
hash = fromB_u64(B_hash(hashwit, key));
hash = B_hash(hashwit, key);
}
$WORD res;
int ix = $lookdict(dict,hashwit,hash,key,&res);
Expand All @@ -839,7 +839,7 @@ void B_dictD_setitem(B_dict dict, B_Hashable hashwit, $WORD key, $WORD value) {
$table table = dict->table;
uint64_t hash = 0;
if (table->tb_size > INIT_SIZE) {
hash = fromB_u64(B_hash(hashwit, key));
hash = B_hash(hashwit, key);
}
$WORD res;
int ix = $lookdict(dict,hashwit,hash,key,&res);
Expand Down
4 changes: 2 additions & 2 deletions base/builtin/env.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ void read_stdin(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) {
return $R_CONT(c$cont, B_None);
}

$R B_EnvD_exitG_local (B_Env self, $Cont c$cont, B_int n) {
return_val = fromB_int(n);
$R B_EnvD_exitG_local (B_Env self, $Cont c$cont, int64_t n) {
return_val = n;
rts_shutdown();
return $R_CONT(c$cont, B_None);
}
Expand Down
2 changes: 1 addition & 1 deletion base/builtin/exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ extern struct $RETG_class $RETG_methods;
$RET $RETG_new(B_value);

$WORD $raiseValueError(B_str str);

Loading