Skip to content

Commit

Permalink
Post-unword elimination renamings
Browse files Browse the repository at this point in the history
This renames VAL_BIND* routines to the more informative and
pattern-following VAL_TYPESET* names.  It also makes the bits
access of typeset more obvious with VAL_TYPESET_BITS instead
of just using VAL_TYPESET, which will also generalize better for
a typeset that may be capable of storing its list another way.

The BUF_WORDS buffer was used both for collecting keys of objects
(once unwords, now typesets) as well as in the Collect_Words routines
where they are still collecting actual REB_WORDs.  It doesn't make
sense to have two such buffers just because of the type difference
when they don't overlap, hence this is changed to BUF_COLLECT to
indicate appropiate type-neutrality.

Also, one user-visible error that should have been an assert was
converted to an assert.
  • Loading branch information
hostilefork committed Sep 22, 2015
1 parent ffc46c5 commit 9ad1f07
Show file tree
Hide file tree
Showing 24 changed files with 175 additions and 176 deletions.
1 change: 0 additions & 1 deletion src/boot/errors.r
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ Internal: [

io-error: {problem with IO}
max-words: {too many words}
word-list: {word list (cache) already in use}
locked-series: {locked series expansion}
no-saved-state: {saved state frame is missing}
max-events: {event queue overflow}
Expand Down
2 changes: 1 addition & 1 deletion src/boot/task.r
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ stack-error ; special stack overlow error object
halt-error ; special halt error object
this-context ; current context
buf-emit ; temporary emit output block
buf-words ; temporary word cache
buf-collect ; temporary cache for collecting object keys or words
buf-utf8 ; UTF8 reused buffer
buf-print ; temporary print output - used by raw print
buf-form ; temporary form buffer - used by raw print
Expand Down
2 changes: 1 addition & 1 deletion src/core/a-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ extern int Do_Callback(REBSER *obj, u32 name, RXIARG *args, RXIARG *result);
// One less, because SELF not included.
syms = OS_ALLOC_ARRAY(u32, obj->tail);
for (index = 0; index < (obj->tail - 1); keys++, index++) {
syms[index] = VAL_BIND_CANON(keys);
syms[index] = VAL_TYPESET_CANON(keys);
}
syms[index] = 0;
return syms;
Expand Down
2 changes: 1 addition & 1 deletion src/core/b-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ static BOOT_BLK *Boot_Block;

// Val_Init_Block and Val_Init_String would call Manage_Series and
// make the series GC Managed, which would be a bad thing for series
// like BUF_WORDS...because that would make all the series copied
// like BUF_COLLECT...because that would make all the series copied
// from it managed too, and we don't always want that. For now
// we reproduce the logic of the routines.

Expand Down
18 changes: 9 additions & 9 deletions src/core/c-do.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ void Trace_Arg(REBINT num, const REBVAL *arg, const REBVAL *path)
}

// Optimize, if the refinement is the next arg:
if (SAME_SYM(VAL_WORD_SYM(out), VAL_BIND_SYM(param))) {
if (SAME_SYM(VAL_WORD_SYM(out), VAL_TYPESET_SYM(param))) {
refinements++;

#if !defined(NDEBUG)
Expand All @@ -881,7 +881,7 @@ void Trace_Arg(REBINT num, const REBVAL *arg, const REBVAL *path)
#endif

Val_Init_Word_Unbound(
arg, REB_WORD, VAL_BIND_SYM(param)
arg, REB_WORD, VAL_TYPESET_SYM(param)
);

// skip type check on refinement itself, and let the
Expand Down Expand Up @@ -917,7 +917,7 @@ void Trace_Arg(REBINT num, const REBVAL *arg, const REBVAL *path)
for (; NOT_END(param); param++, arg++) {
if (VAL_GET_EXT(param, EXT_TYPESET_REFINEMENT))
if (SAME_SYM(
VAL_BIND_SYM(param), VAL_WORD_SYM(out)
VAL_TYPESET_SYM(param), VAL_WORD_SYM(out)
)) {
refinements++;

Expand All @@ -930,7 +930,7 @@ void Trace_Arg(REBINT num, const REBVAL *arg, const REBVAL *path)
#endif

Val_Init_Word_Unbound(
arg, REB_WORD, VAL_BIND_SYM(param)
arg, REB_WORD, VAL_TYPESET_SYM(param)
);
break; // will fall through to continue below
}
Expand Down Expand Up @@ -1589,7 +1589,7 @@ void Trace_Arg(REBINT num, const REBVAL *arg, const REBVAL *path)
SET_TRUE(arg);
} else
Val_Init_Word_Unbound(
arg, REB_WORD, VAL_BIND_SYM(param)
arg, REB_WORD, VAL_TYPESET_SYM(param)
);
#endif
}
Expand Down Expand Up @@ -1931,8 +1931,8 @@ void Trace_Arg(REBINT num, const REBVAL *arg, const REBVAL *path)
param2
&& VAL_GET_EXT(param2, EXT_TYPESET_REFINEMENT)
&& (
VAL_BIND_CANON(param2)
== VAL_BIND_CANON(param)
VAL_TYPESET_CANON(param2)
== VAL_TYPESET_CANON(param)
)
) {
*arg = *DSF_ARG(DSF, isrc);
Expand All @@ -1945,8 +1945,8 @@ void Trace_Arg(REBINT num, const REBVAL *arg, const REBVAL *path)
if (
VAL_GET_EXT(param2, EXT_TYPESET_REFINEMENT)
&& (
VAL_BIND_CANON(param2)
== VAL_BIND_CANON(param)
VAL_TYPESET_CANON(param2)
== VAL_TYPESET_CANON(param)
)
) {
*arg = *DSF_ARG(DSF, isrc);
Expand Down
4 changes: 2 additions & 2 deletions src/core/c-error.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@
{
REBVAL key_name;
assert(IS_TYPESET(key));
Val_Init_Word_Unbound(&key_name, REB_WORD, VAL_BIND_SYM(key));
Val_Init_Word_Unbound(&key_name, REB_WORD, VAL_TYPESET_SYM(key));

Error_1(RE_LOCKED_WORD, &key_name);
}
Expand Down Expand Up @@ -846,7 +846,7 @@
{
REBVAL param_word;
assert(IS_TYPESET(param));
Val_Init_Word_Unbound(&param_word, REB_WORD, VAL_BIND_SYM(param));
Val_Init_Word_Unbound(&param_word, REB_WORD, VAL_TYPESET_SYM(param));

assert(IS_DATATYPE(arg_type));
Error_3(RE_EXPECT_ARG, DSF_LABEL(call), &param_word, arg_type);
Expand Down
Loading

0 comments on commit 9ad1f07

Please sign in to comment.