Matthew Dillon [Mon, 8 Feb 2021 23:05:03 +0000 (15:05 -0800)]
Rune - Code generator and resolver work
* Fix numerous bugs with inline procedure handling. In particular,
properly calculate the non-overlapping temporary between the
inline call arguments, return value, and the inline procedure body.
* Incorporate sg_TmpBytes into tmpbytes and rework constant expression
contexts to use tmpbytes instead of sg->sg_TmpBytes.
* Do a more comprehensive check for direct declarations of restricted
classes.
* Start working on reducing the number of embedded SGs, declarations,
and types in binary outputs.
* Rework the resolver's *Storage() passes. Executable contexts are
only storage-resolved once now, and we assert it. Also rename
RESOLVE_INDIRECT to RESOLVE_FINALIZE (which is what it really is).
* Only reverse the sg_*Base list order in the RESOLVE_FINALIZE pass.
(It was being reversed twice for classes and modules). This fixes
constructor and destructor ordering.
* Misc cleanup.
Matthew Dillon [Mon, 8 Feb 2021 02:10:01 +0000 (18:10 -0800)]
Rune - Code generator work (tests/format.d and tests/gfxslider.d compiles)
* Do a ton of work on the code generator to implement all the
changes made to the language.
* Use EX2F_LVALUE to flag an lvalue vs rvalue in the expression tree.
Do NOT modify the Type structure with SF_LVALUE for this purpose,
it creates massive confusion.
* Get the modifications to the 'this' argument for method calls
operational in the code generator.
* Get some of the object lock side effects (gendata->mobj) operational
again.
* Completely refactor the alignment and storage handling in the
resolver. Also rename many procedures for consistency. Its probably
generating too much (for now), but this revamp was needed.
* For now link libgen and librune to the code and not just libruntime.
I'll have to fix it up later, or perhaps just keep it all in there
to support run-time interpreted code and mixed mode execution in
the future.
* Since we no longer have an RSInfo or fat reference structures,
the reference pointer has to be tested against NULL. If it is
not-NULL we can extract in_DynVec and in_Type directly from a
negative offset relative to the reference pointer.
If it is NULL we use the resolved type from the expression,
basically a LEA of a global symbol.
The conditional uses a simple branch-past / fall-through
sequence by tricking the LEA such that the negative offset in
the branch-past code gives us the correct result.
Matthew Dillon [Thu, 4 Feb 2021 19:21:14 +0000 (11:21 -0800)]
Rune - Cleanup resolver, general cleanup
* Fix expression duplication for the 'this' argument. For example,
when you do: a->b->c(fubar) where c is a method call, the expression
a->b was being duplicated for the invisible 'this' argument, e.g.
(internalized a->b->c(&a->b, fubar)).
Fix by creating a TOK_THISARG placeholder for the 'this' argument and
then adjusting the run-time to set-aside the data reference from the
left-hand-side of the top-level '.' or '->'. The placeholder then
takes ownership of the set-aside data reference.
This is a bit of a mess at the moment but it is better than what I
had before.
* Rename confusing sg_Type to sg_Op
* Rename and adjuset TY_ARYTYPE et_ArySize. Rename to et_ArySizeExp
and fork the field, adding et_OrigArySizExp for DupType operation.
* Duplicate a fresh procedure body for Inlined procedures.
* Assert ResolveExp() only gets called once. This helps catch
situations where we fail to DupExp() an expression.
Matthew Dillon [Thu, 4 Feb 2021 03:50:04 +0000 (19:50 -0800)]
Rune - change 'constant' scope qualifier to '__readonly'
* Get rid of the confusion once and for all and change the 'constant'
scope qualifier to __readonly.
This is not to be confused with the 'const' storage qualifier, which
remains as intended.
* Reminder: Application of __readonly on the left-hand side of a
declaration automatically applies the 'const' storage qualifier to
the facing type. __readonly is prefered because it can always be
specified as a scope-qualifier on the left-hand side whereas if you
want constant storage via the 'const' storage qualifier, the 'const'
might not be on the left. e.g. '__readonly int *ptr;' is easier to
read than 'int * const ptr;'
Matthew Dillon [Tue, 2 Feb 2021 18:32:10 +0000 (10:32 -0800)]
Rune - Objectification of references work part 4 (interp test/gfx* working)
* Interpreter is now operational with some of the more complex
bits of test code.
* Fixed search level (I think).
* Fixed handling of 'super.blah' and 'super->blah'.
* Conslidate storage assignments.
* Set sg_ClassType in parser, with the declared scope, and clean up
SCOPE_UNRESTRICTED tests.
* Enhanced error reporting and some cleanup.
Matthew Dillon [Mon, 1 Feb 2021 02:41:36 +0000 (18:41 -0800)]
Rune - Objectification of references work part 3 (interp partially working)
* Interpreter is now partially working, e.g. tests/hello.d
* Add the concept of an 'unrestricted' class. Unrestricted classes
are allowed to be directly declared or directly embedded in other
classes.
By default, all methods for unrestricted classes pass void *this
instead of void @this.
* Remove the manual typedef refinements of _t in classes/sys/class.d.
Instead, make it entirely automatic. This way declarations and
procedures conveniently have access to the actual class or subclass
type simply by using _t.
This fixes issues where superclass procedures couldn't declare
the actual refined subclass because they didn't know what it was.
Now they do, it is '_t'.
The insertion of the '[refine] typedef <class_or_subclass> _t'
is handled by the resolver.
* Fixup the TOK_COMPOUND handling for compound expressions to not
cast (blah *) to (lvalue void *) when the argument declaration
is (lvalue void *), or (blah @) to (lvalue void @) when the argument
declaration is (lvalue void @).
This way our method procedures properly get the correct lv_Type loaded
in the LValueStor.
* Move the insertion of 'this' for both the method call and the
method declaration out of parse2.c and into resolve.c. This way
we have access to the proper subclass w/regards to refinements.
* Adjust system calls to deal with the fact that, except for 'new()'
type methods, now take a pointer or reference as a single C pointer
instead of an LValueStor.
* Fix several issues from prior commits that hadn't been fixed.
* Change the default this argument for method procedures from
'lvalue class this' to 'class @this'. That is, pass as a
reference, which means that default use cases have to use
this->blah instead of this.blah.
* Allow pointer-to, reference-to, lvalue pointer-to- and
lvalue reference-to types for the 'this' argument to a method.
We no longer allow the 'lvalue class this' (lvalue directly as
the class) method.
* Remove the unary '@' (address of blah returned as a reference).
This was going to be too messy to implement and could only work
on the lvalue class this method argument anyway. Now that it
has been changed, we do not have to worry about it.
* Change the name of the Fs class to Fd. Since this is used to
manage descriptors, calling it Fs was actually rather confusing.
Rename 'fd' identifiers representing a Fd to 'efd' so they do
not get confused with integer descriptors. efd is for 'extended
file descriptor', aka the Fd class.
* Use refineable typedefs for a number of classes.
Matthew Dillon [Sun, 31 Jan 2021 08:55:15 +0000 (00:55 -0800)]
Rune - Objectification of references work part 2 (build broken)
* Major rework and removal of RefStor's, replaced by Rune objects.
A Rune object pre-pends an ObjectInfo at a negative offset from
the base of any @ref object. TY_REFTO can only point to full
fledged objects.
RuneObject - points to the base of the data, same as the data
base pointer but uses a dummy 'RuneObject *'
type.
ObjectInfo - The information structure pre-pending to Rune
objects.
* Readjust headers and do a better job enforcing library order
by conditionalizing prototypes.
Redo the library link order. Make librune our base library.
However, directly include librune.a when creating libruntime
so libruntime can be stand-alone.
* Remove WARNS and cleanup the compile.
* Rename wantminfo to wantmobj (etc).
* Lots of breakage all over the place at the moment.
Matthew Dillon [Mon, 25 Jan 2021 07:43:50 +0000 (23:43 -0800)]
Rune - Objectification of references work part 1
To further distinguish references from pointers, the model for a
reference is going to be changing to embed the meta-data at
negative offsets rather than using an independent Info structure.
This is now possible because I have already fixed the &exp to
distinguish references from pointers. &exp returns a pointer,
which is not an object in any way. So normal address-of operations
will still work just fine.
* Declared globals, variables, fields in structures, etc will no longer
be objectifiable. The only way to create an object will be to allocate
it dynamically (which is the method already in standard-use in Rune).
* Begin removing @variable use cases. The '@this' use-case for
methods is fine as the underlying object is already a dynamically
allocated reference.
* In upcoming commits, the PointerInfo structure will be entirely
removed, which will also remove one level of indirection from
LValueStor and ReferenceStor (the second field will point directly
at the Type instead).
The equivalent of the info structure will become ReferenceInfo and
be stored at a negative offset from the base of the object. Thus,
the object pointer itself will remain sane.
Matthew Dillon [Mon, 25 Jan 2021 06:38:26 +0000 (22:38 -0800)]
Rune - Update Ras documentation.
* Update Ras documentation.
Matthew Dillon [Mon, 25 Jan 2021 02:11:11 +0000 (18:11 -0800)]
Rune - reformat classes/* and tests/*
* Reformat for an indent of 4 and clean up a bit.
Matthew Dillon [Sun, 24 Jan 2021 08:07:58 +0000 (00:07 -0800)]
Rune - Clean up getenv/setenv/etc
* Cleanup some more syscalls that take const char * pointers now
instead of references.
* Fix bugs introduced by the TY_PTRTO type changes.
Matthew Dillon [Sat, 23 Jan 2021 21:02:46 +0000 (13:02 -0800)]
Rune - rename grammer.html
* Yah yah, that's funny. Rename to grammar.html.
Matthew Dillon [Sat, 23 Jan 2021 20:51:54 +0000 (12:51 -0800)]
Rune - Finalize 'char' and other basic integer types
* Finalize 'char' as being 'unsigned 8 bits', remove 'uchar' and 'schar'
entirely.
I thought about this long and hard and, frankly, have come to believe
that 'char' should never have been signed in C, let alone allowed to
be either signed or unsigned.
In Rune I have finalized the definition of 'char' to always be an
unsigned 8-bit quantity, and to ram that home I have removed 'schar'
and 'uchar'. If you want to be more explicit, then use 'int8_t'
or 'uint8_t', simple as that.
* I added 'short' and 'ushort' back in. In Rune 'int' is always 32 bits,
period. Having coded on almost every architecture known to man, including
many 16-bit micro-architectures, I have come to the conclusion that
it is utterly stupid to try to make 'int' follow the machine integer size
for any particular architecture. It creates a portability nightmware,
frankly.
If you are coding on an 8-bit or 16-bit architecture, then use 'short'
instead of 'int', simple as that.
The concept of trying to make libraries portable through the use of
an 'int' that can change width is just flat out stupid. Not only does
it not make libraries portable, it introduces an unimaginable number
of side effects in C, particularly due to automatically type extension,
that has driven me nuts more than a few times.
It is far better to standardize on a width and then simply provide
a different library to standardize on a different width. Simple as
that. And in Rune, this is easy to do because you can refine typedefs
in classes and use those for various argument declarations (Even if I
haven't yet done this to all of Rune's system libraries).
Thus why I added 'short' and 'ushort' back in. This gives 16-bit
coders something convenient to grab on to without having to resort
to the explicit types like int16_t. Not that there is anything wrong
with int16_t, its just that the wordiness can get on coders nerves
for variables that are meant to be relatively generic.
Matthew Dillon [Sat, 23 Jan 2021 19:29:28 +0000 (11:29 -0800)]
Rune - Make all pointers C-like
* Rune has pointers such as 'char *' and references such as 'Fubar @',
and then also has a __clang storage qualifier which was used with
pointers (and for other things) to implement C-style pointers.
The pointers were previously using the same (ptr, info) tuple as
references, and were ref-counted and locked just like references.
This major-ass commit makes pointers behave like C, without needing
the __clang qualifier.
* Now all '*' pointers are just a simple physical pointer without
any ref-counting or locking. It is the programmer's responsibility
to not shoot himself in the foot. Programs should use references
in most situations, particularly involving multi-threading, but can
use pointers for things like iterating buffers and such, when it
makes sense.
Operators that modify pointers now only work with pointers and do not
work with references. This is intentional and will allow references
to (in a later commit) embed the object management fields directly
in the target object, allowing us to get rid of a ton of code-generation
overhead. The fields will be placed at negative offsets so the base
reference always points to the pure structure portion of the object.
* Fix NULL semantics, basically make the 'internal2' pointer and
reference operators more flexible so things like == and != can
mix pointers and references.
* Add a hack/work-around in findOper() related to the resolver missing
something that I haven't figured out yet. This was interfering with
Pointer class operators.
* Add '@exp' as a unary operator for reference-to-expression, producing
a reference to an lvalue. We already had '&exp' but this now produces
only pure pointers, not references and not reference-compatible.
'@exp' will ultimately only work on known objects, and will ultimately
(in a later commit) change how global declarations are laid out
(laying them out as objects instead of pure structures).
* Adjust classes/* and modify some tests/* for the new reality
(needs more work).
* Unfortunately this pointer change also means that runtime calls
like bcopy are not range-checked any more. I will try to come up
with a better means to check pointer validity but we may end up
having to eat the lost determinism.
* Assert in runeid_sym() if the identifier cannot be represented as
a symbol. Also adjust so an id of 0 returns NULL.
* Rename a huge number of symbols in the codebase from Pointer to
Reference, Ptr to Ref or to RawPtr, and many other rename changes,
as appropriate.
* The interpreter and RAS generator can both run tests/gfxinput2.d
with these changes.
Matthew Dillon [Fri, 22 Jan 2021 19:49:29 +0000 (11:49 -0800)]
Rune - Fix binary code generator for recent work
* Adjust the layout code backend_ras.c for changes to the Type
structure.
* Clean-up debug output.
Matthew Dillon [Fri, 22 Jan 2021 06:10:18 +0000 (22:10 -0800)]
Rune - Properly fix 'this' argument for method procedures
* The 'this' argument must be changed to the appropriate subclass
when a procedure is pulled down into the subclass.
* Also, the procedure body was being resolved too early,
which prevented type declarations in the superclass from being
properly modified by refinements in a subclass (among other
things).
* Sometimes a superclass procedure could wind up in a subclass
but compiled using the context of the superclass, which creates
a mess. Change how ed_OrigBody and ed_ProcBody is dealt with.
The parser now only messes with ed_OrigBody, and the resolver
only dups the procedure body to ed_ProcBody and resolves it
when it needs to. The DupDecl() code only copies ed_OrigBody,
requiring re-resolution of the procedure body (to deal with
subclass refinements, etc).
Matthew Dillon [Fri, 22 Jan 2021 06:09:14 +0000 (22:09 -0800)]
Rune - Add copyright notice to classes/
* Add copyright notice to classes.
* Bump the sophistication of the input frame (allows testing of
global constants being refined in subclasses, and affecting
array declarations in the superclass.
Matthew Dillon [Thu, 21 Jan 2021 22:38:04 +0000 (14:38 -0800)]
Rune - fix File.format()
* Pointers can be cast to intptr_t. We were casting to
size_t before and that was fine when it was signed, but it
isn't fine now. Fix.
* Allow pointers to be cast to intptr_t or uintptr_t
Matthew Dillon [Thu, 21 Jan 2021 22:35:07 +0000 (14:35 -0800)]
Rune - Adjust exp temp data to use common structure
* Move RunTmpStor to librune/types.h and rename it to TmpData.
* Use a TmpData declaration instead of the manual exp->u union
that the Exp had before.
* Move PointerStor and LValueStor to librune/types.h. Also
document the absolute necessity of 16-byte aligning these
structures.
* Move a few assertions (mainly assert that all TmpData fields
start at the beginning of the structure, because I'm being anal
about type punning in a ton of places).
Matthew Dillon [Thu, 21 Jan 2021 21:25:08 +0000 (13:25 -0800)]
Rune - add 'P' suffix for integer constants, update documentation
* Add the 'P' (intptr-sized) suffix for integer constants.
* Update the documentation for Z and P suffixes.
Matthew Dillon [Thu, 21 Jan 2021 21:11:46 +0000 (13:11 -0800)]
Rune - Refactor size_t into usize_t and ssize_t
* For now, officially in Rune, we omit size_t and instead have
an explicit usize_t and ssize_t. I may put size_t back in
the future (it would just be a typedef to usize_t).
Matthew Dillon [Thu, 21 Jan 2021 06:04:50 +0000 (22:04 -0800)]
Rune - Implement runeid_t, hashed identifiers, and #id
* Expand the lexer to support '#id', which produces a 64-bit
unsigned integer representing the runeid_t hash for the identifier.
We now support in total:
# comment ('#' + space + comment to end of line). Can be used
for general code comments.
#%comment ('#' + '%' + comment to end of line). Can be used
for documentation meta-data.
#!shell ('#' + '!' + (ignored by parser). # must be in the
first column. Used to script the Run interpreter.
#id Generates a 64-bit runeid_t hash. Must not be in
the first column (since in the first column this form
represents a preprocessor directive).
#directive RESERVED FOR FUTURE PREPROCESSOR DIRECTIVES
To do this, we disallow '#comment' (without whitespace). It
only took a few edits of classes to clean those up, so I think
overloading all of these # features will work out.
* Replace nearly all identifiers stored in various structures
with the new 64-bit hash runeid_t. They used to be string-table
identifiers, now they are not.
NOTE: The DLL symbol lookups are currently broken due to this
change.
* Add ex_Str to struct Exp for double-quoted strings and anything
else that still needs to be a string.
* Remove all String_* globals in favor of HASHID_* constants. Directly
parse code blocks casing HASHID_* constants instead of using the
string-table mechanism. This significantly reudces string-table
overhead.
* Remove all SPECIAL* string table identifiers in favor of HASHID_*
switches.
* The Parser now calculates TOK_INTEGER and TOK_FLOAT, and TOK_SSTRING,
instead of waiting until the resolver gets to it. This allows us to
remove remove yet more string table stuff.
* Fix access to dynamic type data in the code generator.
Matthew Dillon [Wed, 20 Jan 2021 22:45:32 +0000 (14:45 -0800)]
Rune - Syntax cleanup pass 1
* Major syntax cleanup. Run the .c and .h files through
indent -i4 -di8 -ldi8. Basically retab all the code
to 4 and clean up declarations.
* Write and run a script to clean up some indent-generated
mess-ups, including:
func(...) { Brace should be on next line
func(char * x, ...) Remove extra spaces after *'s
* Additional manual cleanups.
Matthew Dillon [Thu, 21 May 2020 18:47:08 +0000 (11:47 -0700)]
Rune - Clean up strings
* Remove 'char' type, require 'uchar' or 'schar' to remove confusion.
Note that 'size_t' is still signed in Rune and for now will remain so.
* Add string_p and string_rw_p. We make 'string_p' basically
'const uchar *' ... i.e. read-only string pointers. This will let
me create a string class for string functions, but I will have to
add the ability to subclass pointers (not yet in).
Matthew Dillon [Mon, 4 Nov 2019 06:49:21 +0000 (22:49 -0800)]
Rune - Fix DupExp() bug (2)
* This blew up double-quoted strings due to the ex_Id replacement.
Fix this a better way, set EXF_PARSE_TYPE to cause DupExp() to
also duplicate the type.
Matthew Dillon [Mon, 4 Nov 2019 06:35:56 +0000 (22:35 -0800)]
Rune - Fix DupExp() bug
* When an Exp is duplicated we must clear EX2F_ESCDONE in order
to ensure that the ex_Type gets properly re-resolved.
Matthew Dillon [Mon, 4 Nov 2019 05:59:22 +0000 (21:59 -0800)]
Rune - Fix broken comment
* Fix a broken comment from a recent commit.
Matthew Dillon [Mon, 4 Nov 2019 05:57:33 +0000 (21:57 -0800)]
Rune - Clean up some tests
* Clean up some of the tests/* functions.
Matthew Dillon [Mon, 4 Nov 2019 05:55:58 +0000 (21:55 -0800)]
Rune - Clean up mmap() and friends
* Clean up mmap(), madvise(), msync(). These functions are
generic Sys.* functions.
* Give the FdMap class its own versions for the above functions
for consistency.
* Fix a bug in the mmap() system call code.
Matthew Dillon [Mon, 4 Nov 2019 05:45:13 +0000 (21:45 -0800)]
Rune - Add __vartype[n] and __type[n]
* Add __vartype[n] and __type[n] to simplify typeof(__vardata[n])
constructs.
Matthew Dillon [Fri, 18 Jan 2019 05:30:30 +0000 (21:30 -0800)]
Rune - Add multi-character single-quoted constants
* Supports multi-character single-quoted constants. Constants
between 1 and 4 characters are directly encoded by shifting
each character into the LSB. The type depends on the length:
length 0 or 1 uint8_t
length 2 uint16_t
length 3 or 4 uint32_t
* Character constants that are 5 characters or longer will be hashed with
the ISCSI crc32 algorithm, bit 31 of the result is set, and the result
is returned as an unsigned 32-bit integer.
Matthew Dillon [Mon, 4 Nov 2019 04:59:22 +0000 (20:59 -0800)]
Rune - Adjust for gcc-8 warnings
* Make adjustments to clean up gcc-8 warnings.
Matthew Dillon [Fri, 29 Jun 2018 06:51:37 +0000 (23:51 -0700)]
Rune - Fix more 64-bit immediates
* Fix 64-bit immediate move operations that need to
use movabsq, i.e. where the immediate value exceeds
a signed-32-bit range.
* sizeof() was improperly being stored in the string
table as an 32-bit integer when it's 64-bits. Fix
by properly passing in a 64-bit value.
* Not completely generic yet but we handle more cases
Matthew Dillon [Mon, 25 Jun 2018 07:27:24 +0000 (00:27 -0700)]
Rune - Inherit scope for refinement, minor fixes
* Update docs.
Matthew Dillon [Mon, 25 Jun 2018 07:23:17 +0000 (00:23 -0700)]
Rune - Inherit scope for refinement, minor fixes
* Refining declarations inherit scope from the superclass
if it is not specified in the refinement.
* Add missing type combinations for ARRAY_ELEMENT_AG().
* Always create sufficient pthreads so cpu-bound rune threads
do not prevent new (or other) rune threads from running.
Matthew Dillon [Mon, 11 Jun 2018 02:45:15 +0000 (19:45 -0700)]
Rune - re-enable bypass optimizations
* Re-enable the BYPASS_SKIP optimization and refine the algorithm.
Previously this bypass optimization could cause one-time-use temporary
registers to be reserved indefinitely for code inside a conditional
block, causing RAS to run out of registers. The refinement should
fix that problem.
The refinement involves converting WRITEs to READ|WRITE (read-modify-
write) in a bypass situation as before, but ONLY if the variable
does not represent RAF_LIFE_BEG, plus a previous match is present
(which tends to go hand-in-hand). Meaning that variables whos
life-time begins with the WRITE can remain WRITE and not be
converted to READ|WRITE despite the bypass.
* The same bug also affected BYPASS_ALL and should also now be fixed
(and even give us not-so-terrible register optimizations).
* Now that this implemented, RAS generates significantly better
registerization, and the complexity of the brute-force algorithm
is significantly reduced.
* WARNING! This is a dangerous change, so if assembly output
starts to break register use it might be due to this commit.
Matthew Dillon [Mon, 11 Jun 2018 02:40:16 +0000 (19:40 -0700)]
Rune - Change regsave burden for syscalls
* RuneRunTime_*() already uses ms_abi, also make our system call
ABI use ms_abi. This greatly reduces register save/restore actions
at higher levels in rune-generated code.
* The above also ensures that a good chunk of the FP registers
become callee-saved, verses none.
* Fix a bug in the run-time where RunGetDeclarationData() did not
have visibility into (exp->ex_Flags & EXF_ADDRUSED), preventing
data->mrs from being set in certain call situations involving
lvalues.
* Rename the *_STD register ABI masks to *_SYS since they are only
used for system calls.
Matthew Dillon [Sun, 10 Jun 2018 05:33:52 +0000 (22:33 -0700)]
Ras - Adjust complexity calculation
* Adjust complexity calculation
Matthew Dillon [Sun, 10 Jun 2018 05:33:16 +0000 (22:33 -0700)]
Rune - Fix runtime random to actually return a 64-bits
* Fix the runtime random to return 64-bits
Matthew Dillon [Fri, 11 May 2018 07:04:44 +0000 (00:04 -0700)]
Rune - Adjust operator precedences
* Adjust precedences to be more compatible with C.
* Closures and structural access are given a
precedence of 90, the highest (most tightly bound)
precedence.
* All unary operators have a precedence of 85.
* By default precedence is 80. This includes multiply,
divide, and modulo.
* Consider any operator containing a '+' or '-' to
be like an add or subtract (prec 60)
* Consider any operator beginning with '<<' or '>>' to be
a shift operator (prec 50).
* Consider any operator containing '<' '=' or '>'
that isn't a shift operator to be a compare operator
(prec 40).
* Consider any operator ending with '=' that is
not a compare operator to be an assignment operator
(prec 20).
Matthew Dillon [Fri, 11 May 2018 06:10:43 +0000 (23:10 -0700)]
Rune - Add BCHECK and RuneMode
* Add a BCHECK (bounds-check) instruction which allows RAS to
generate an appropriate cmp/branch/bounds-trap sequence which
does not require a large regused mask.
* This also removes an explicit branch in the intermediate RAS
output which significantly reduces block characterization times.
* Implement a RuneMode global which allows Rune to detect
what mode its in (e.g. compiling, interpreting, running a
binary, etc).
* Disable the creation or mapping of persistent store when compiling.
* Optimize newly created persistent stores by avoiding the bzero()
if the file did not previously exist or was 0-length.
Matthew Dillon [Fri, 11 May 2018 01:40:04 +0000 (18:40 -0700)]
Ras - Fix EA2 assertion
* If a double-extension is allowed and ext2 is not specified,
set ext2 to ext1.
Matthew Dillon [Thu, 10 May 2018 22:19:55 +0000 (15:19 -0700)]
Rune - PCheck, 64-bit cmpq fixes
* PCheck ignores bounds if in_RefStor is NULL (indicating a degenerate
type.ty_Info structure).
* cmpq $imm64,dea loads the immediate value into a register if
it cannot be represented as a signed 32-bit integer.
Matthew Dillon [Thu, 10 May 2018 21:45:00 +0000 (14:45 -0700)]
Rune - Change default locking
* Most local variable, procedure arguments, and return values are
now untracked by default.
* Remove 'N' version of opcodes, e.g. PATOMN, IATOMN
Matthew Dillon [Thu, 10 May 2018 03:17:18 +0000 (20:17 -0700)]
Rune - Fix content initialization gen for persist store
* Fix an assertion in the content initialization code for
persistent global objects.
Matthew Dillon [Thu, 10 May 2018 03:03:57 +0000 (20:03 -0700)]
Rune - Refactor mmap, madvise, msync, and enhance "project"
* Enhance the "project" directive to allow an absolute path to be
specified. This will override normal HOME and USER based pathing
for shared objects. However, if the RUNEDATA env exists, an absolute
project path will be tacked onto it.
* Move mmap(), madvise(), and msync() out of the FdMap class and
into the Pointer class. This allows these functions to be used
on persist objects.
Matthew Dillon [Thu, 10 May 2018 01:55:18 +0000 (18:55 -0700)]
Rune - doc update
* Improve description of persistent storage, add reference to msync()
Matthew Dillon [Thu, 10 May 2018 01:49:51 +0000 (18:49 -0700)]
Rune - Add random support system calls
* Add srandomdev(), srandom(n), and random()
Matthew Dillon [Thu, 10 May 2018 01:26:55 +0000 (18:26 -0700)]
Rune - Fix &ary[i][j] typing.
* The EXF_REQADDROF flag should not be recursively passed into
sub-expressions for lhs resolution, this will cause the intermediate
&array[i][j] to type as PtrTo-array[i] instead of array[i], resulting
in the address of a pointer to the entire subarray instead of an address
of the subarray element.
Matthew Dillon [Thu, 10 May 2018 00:40:58 +0000 (17:40 -0700)]
Rune - Remove RSRESERVE for persistent objects (2)
* Remove more RSRESERVE.
Matthew Dillon [Thu, 10 May 2018 00:38:15 +0000 (17:38 -0700)]
Rune - Remove RSRESERVE for persistent objects
* Remove header space. Persistent objects are now directly mmap()'d.
Matthew Dillon [Wed, 11 Apr 2018 01:17:07 +0000 (18:17 -0700)]
Rune Serialize - Stabilization, Generation, major overhaul
* Interpreter and compiler work on tests/gfxinput2.d again,
though at the moment most of the threaded test programs are
unsafe due to changes in defaults (e.g. gfx framework topology).
* The cursorThread() and eventThread() method objects needs to be
soft-locked to avoid interference.
* Remove 'hard' qualifier on various method procedures, as this is
now the default for method objects.
* Document the 'untracked', 'unlocked', 'soft', and 'hard' scope
qualifiers. Implement all four qualifiers generically in the
code and make it so they override each other. Allow all four
qualifiers to be used in method procedure declarations.
* Rely on Declaration->d_Storage more, remove sanity checks that
tested d_Storage against SCOPE.
* We no longer assign default SCOPE and SF bits, which caused
confusion with lock+refd overrides. Also setup #define's
for default values.
* Change various default locking modes. Most default locking
modes (e.g. arguments, return values, local variables) are
now REFD.
* Refactor PATOM and PATOMN. PATOM no longer steals a ref
from the original info as this can cause it to implode.
PATOMN (for now) generates an info with no refs and the
caller is responsible for issuing an appropriate ref.
Also add INEWN.
* Refactor the implied lock code a bit just to reduce edge
cases.
* Refactor ptr.new() handling. The runtime new() function now
detects the pointer's target locking mode by observing the
SQFlags in the LValueStor's type. Also ensure that the SQFlags
are properly set in FinishDecl().
* GenPointerAddrInfo() no longer needs a GenFixupContent() call
afterwords. Also simplify GenPointerLVInfo() (reverse its
arguments so they are more natural), and GenFixupLVContent().
* Remove GENSTAT_NONE special cases. Treat all GENSTAT_* lock+refd
modes orthogonally.
Matthew Dillon [Sun, 8 Apr 2018 18:49:46 +0000 (11:49 -0700)]
Rune Serialize - Stabilization, Fix boolean casts and unary operator(s)
* Stabilize the interpreter, don't mistreat data->istmp, don't mistreat
data->storage to fake-out data->istmp operation.
* Allow the resolver to handle scope inheritance.
* Fix default locking modes for intent.
* Get rid of sanity checks against d->d_Storage (allow the resolver to
have final say on d_Storage mechanics).
* Fix Run64 execution for Floating -> Bool casts. The floating exp
was being executed as a Run64 function when it is not compatible with
int64_t.
* Fix Run64 execution for !exp. This unary operator returns a boolean,
so properly return a boolean. In addition, the rhs might not be
Run64 compatible so execute normally if the rhs is Floating.
* Fixes tests/float.d output for ! tests.
Matthew Dillon [Sun, 8 Apr 2018 05:01:58 +0000 (22:01 -0700)]
Rune Serialize - Simplify GenData and RunData
* Remove minfoimplied, crs, and cinfo. Keep the sideband mrs and minfo
as these cannot be obtained from the object. mrs/minfo is implied
if NULL. These will be mandatory in situations where they are needed.
We are getting rid of the side-band 'content' storage, crs and cinfo.
It is duplicative of the content and just creates confusion.
* We will keep the 'storage' specification and the GENSTAT_* operation.
However, we will reclassify the default storage modes for many things.
- Procedure args, return values, local variables, and temporaries
will now be GENSTAT_NONE by default, unless used as an lvalue or the
address is taken. In such cases they will be GENSTAT_REFD to
maintain compatibility with dynamic and static storage, method
APIs, etc. This fixes issues with **ptr's and such.
- Method procedures will be special-cased. Method objects are
serialized by default (the lvalue will be GENSTAT_LOCKH). If
scoped 'unserialized', we will use GENSTAT_NONE. Note that
the underlying object, if declared on a stack somewhere, will
still be GENSTAT_REFD.
- Operators are not method calls and their arguments will be
GENSTAT_NONE by default.
- Dynamic and static storage remain GENSTAT_REFD.
- Temporary storage will be GENSTAT_NONE, meaning that additional
refs are not maintained on expression evaluation temporaries.
These changes will significantly improve run-time performance, fix
operational issues
* Please keep in mind that 'storage' specifications are only applicable
to references, pointers, lvalues (specifically, the s_Info
structure), and compound types (it only recurses through compound
types). The storage mode for e.g. elements of a class is determined
by the declarations making up the class.
* We will at least temporarily remove pointer ranges (in_Beg and
in_End) in order to remove dynamic PointerInfo allocations.
We will stick with using RefStor-embedded info's and
type->ty_Info.
* Adjust docs for intent.
Matthew Dillon [Sun, 8 Apr 2018 01:57:49 +0000 (18:57 -0700)]
Rune - Require minfo in more places
* Allow an expression topology to require minfo for locking
purposes.
* Fixes global locking that was previously missing, among other
things.
Matthew Dillon [Tue, 27 Mar 2018 02:58:23 +0000 (19:58 -0700)]
Rune - Major locking work
* Implement class and procedure 'hard' locking mechanics.
* Refactor SyscallLookup() to return the resolved locking method
that matches the procedure call declaration's expectations.
Implement 'new' for unlocked, locked, and now also hard locked.
* Get rid of EXF_UNLOCKEDMTH (since we have to deal with more than
just normal and unlocked now). Instead we test the declaration.
* GenAssExp() and other dcopy consumers (for the moment) now make a
discrete copy, disabling the direct-copy feature, for objects
that are or contain lvalues, pointers, or references.
This helps deal with problems with blocking locks causing an
assignment to lose its lock half way through, and also helps deal
with self-assignment like 'x = x' which try to release the target
(lhs) before copying the rhs, and thus also lose the rhs.
* GenPointerLVInfo() and GenPointerAddrInfo() now save the resolved
info to the sideband ptr->minfo in the target, allowing the code
to track that a ref on info has already been obtained.
* pointerIndHelper() now always returns sideband minfo in order
to help deal with callers that need it (i.e. method procedure
calls passing LValue's). Previously these consumers would wind up
using the type default info, which doesn't properly represent the
pointer's storage.
* GenDropContent() no longer tries to discard cdata->cinfo. It might
still be needed by the caller.
* GenFixupLVContent() can now adapt to partial ref/lock state
in dst via dst->minfo when finalizing the lock state based on
dst->storage.
* Don't apply SCOPE_UNLOCKED defaulting to procedure declarations.
It is not applicable and creates confusion.
* Improved lock state assertions.
* Fix numerous pseudo-op bugs in RAS which executed the wrong
locking primitives for numerous <blah>H instructions. Due to
bad cut-n-paste on my part.
Matthew Dillon [Mon, 26 Mar 2018 00:48:43 +0000 (17:48 -0700)]
Rune - Fix livelock on heavily contended locks
* Fix a livelock on heavily contended locks. When waking up a list
of blocked threads, a livelock situation can develop where the threads
are placed back on the list asynchronously, preventing the iterator
from ever being able to finish scanning the list.
* Fixed by issuing the wakeup in two passes. The first pass moves td's
to be woken up out of the list and onto a safe list. The second pass
wakes the tds up via the save list.
* Also fix Declaration layout (@rune_decl...), we added two fields.
Matthew Dillon [Sun, 25 Mar 2018 23:51:56 +0000 (16:51 -0700)]
Rune - Improve link debug output
* Track line numbers, generate .file and .loc output, ras
parses .file and .loc output and associated .loc's with
insns, and outputs .loc's in-context.
This allows gdb to show the correct line number for
rune code in rune executables.
* When -g is not specified we can avoid outputting decls
for statement blocks.
Matthew Dillon [Fri, 23 Mar 2018 05:12:37 +0000 (22:12 -0700)]
Rune - Update Copyright
* Update the copyright file, push sunset dates back.
Matthew Dillon [Fri, 23 Mar 2018 05:12:18 +0000 (22:12 -0700)]
Rune - Collapse identical strings
* Strings are placed in a read-only code section, collapse
identical strings.
Matthew Dillon [Fri, 9 Mar 2018 10:10:46 +0000 (02:10 -0800)]
Rune - Fix threading bugs
* Try to avoid getting stuck in blocking kevent()s when runnable threads
are present (anywhere). Still isn't perfect.
* Fix LastQueue handling.
* Fix the push and pull iterator.
Matthew Dillon [Fri, 9 Mar 2018 10:07:32 +0000 (02:07 -0800)]
Rune - Fix globaldata pointer assignment offset
* Fix globaldata address generation for compile-time assigned
pointers. The offset was not being properly added.
* Fix globaldata info generation and operation for non-pointer
operations on global variables. e.g. ++total_count where
total_count is a global now properly acquires the global
info lock.
* TODO: Give each global variable its own RefStor for locking
purposes if needed.
Matthew Dillon [Fri, 9 Mar 2018 10:05:31 +0000 (02:05 -0800)]
Rune - Allow ++*, --* to work like C
* Allow ++* and --* to work the same way it does in C.
Any +* or -* sequence is scanned as if there was a space before
the '*'.
Matthew Dillon [Thu, 8 Mar 2018 07:05:02 +0000 (23:05 -0800)]
Rune - Fix thread issue
* threadPushRunnable() releases and reacquires SchedMtx, which can
cause tdnext to become invalid. Move the call to the target side
of the switch. This fixes thread corruption in tests/gfxinput2.d
* Cleanup, use threadSwitchReturn() in threadDetachSynchronous().
Matthew Dillon [Thu, 8 Mar 2018 07:03:02 +0000 (23:03 -0800)]
Rune - Fix the lock masking during a threaded call detach
* Fix the masking used to reset the lock count to 1 when
transfering ownership from otd to ntd.
Matthew Dillon [Thu, 8 Mar 2018 02:03:49 +0000 (18:03 -0800)]
Rune - Refactor interpreter locking a bit
* Hopefully fix a few issues, particularly related to the &array[n]
and &ptr[n] forms.
* Get rid of the istmp == 2 mode (this used to disable sideband
locks for rundata elements).
* Fix a few situations where locks were not being released,
and instead would accumulate on the thread.
Matthew Dillon [Thu, 8 Mar 2018 02:00:16 +0000 (18:00 -0800)]
Rune - Refactor threaded procedure calls, fix bugs
* Refactor how libruntime deals with threaded procedure calls.
* Fix numerous bugs in the threading code, particularly related to
the disposal of thread contexts for synchronously-returned threaded
procedure calls.
* Fix threadSleepWChan(). Also remove TWSleep and just stick with the
wchan hash array as part of this.
Matthew Dillon [Thu, 8 Mar 2018 01:57:38 +0000 (17:57 -0800)]
Rune - Add more 'bool' operators
* 'bool' is now its own distinct class. Add more operators that can
handle it. Needs work though, results are not masked and bool is
currently defined as an 8-bit byte, so operators like '+' and '-' will
give weird results.
Matthew Dillon [Thu, 8 Mar 2018 01:55:24 +0000 (17:55 -0800)]
Rune - Add a linked field to frames
* Add a linked field and a checklinked() method to Frame, allowing
an asynchronous support function to determine if a frame has been
unlinked before issuing graphics calls on it.
* Fixes an issue where a button which is unlinked while being held down
does not create a ghost image when the button is released.
Matthew Dillon [Sun, 4 Mar 2018 19:09:13 +0000 (11:09 -0800)]
Rune - Change subclass and subinterface syntax
* I've decided to change the subclass and subinterface syntax to
specify the <id> first, for readability. This way the <id> is
in the same place in the syntax for class, subclass, interface,
and subinterface.
* Change from subclass <superclass> as <id>
Change to subclass <id> from <superclass>
* Change from subinterface <superclass> as <id>
Change to subinterface <id> from <superclass>
Matthew Dillon [Sun, 4 Mar 2018 05:59:32 +0000 (21:59 -0800)]
Rune - Fix interpreter array index typing
* Use ex_Run64 for RunAryExp() and RunAddrAryExp(). Also,
RunAddrAryExp() was previously assuming a 32-bit array index.
This also fixes that.
* Fix a bug in RunCachedConstantExp() when processing unsigned
integers. We were testing TF_ISINTEGER before TF_ISUNSIGNED.
But TF_ISINTEGER also covers TF_ISUNSIGNED. Process TF_ISUNSIGNED
first.
* Optimize content adjustments for arrays. Only iterate the array
if its content contains the capabilities being adjusted.
* Code cleanup.
Matthew Dillon [Sun, 4 Mar 2018 05:45:31 +0000 (21:45 -0800)]
Rune - Fix interpreter assignment issue
* The assignment code drops the contents of the destination before
copying. This results in a problem when assigning x = x.
Special-case it.
The problem is still present in the code generator.
Matthew Dillon [Sun, 4 Mar 2018 05:41:37 +0000 (21:41 -0800)]
Rune - StreamPair fixes
* Use separately allocated streams for StreamPair (prior commit).
* Clarify variable names.
Matthew Dillon [Sun, 4 Mar 2018 05:33:27 +0000 (21:33 -0800)]
Rune - Fix thread bugs, add lock debugging
* Fix a number of thread-tracking bugs and races. We have to set
RUNNING a little earlier to prevent stolen locks from being stolen
themselves while we are running.
* Fix a bug in the thread detach code which transfers some of the
old thread's locks over to the new thread. The lock count was
getting mangled.
* Add thread debugging.
* Add lock debugging.
Matthew Dillon [Sun, 4 Mar 2018 05:26:46 +0000 (21:26 -0800)]
Rune - Add Pointer.lockcount(), misc bug fixes
* Add Pointer.lockcount(). This returns the number of locks held on the
pointer target.
* Fix a bug in unbuffered fwrite() (M_NONE). The loop would sometimes
not terminate.
Matthew Dillon [Fri, 2 Mar 2018 06:31:02 +0000 (22:31 -0800)]
Rune - Threading fixes, cleanups
* Implement importdesc(). This sets O_NONBLOCK on the descriptor when
extpread()/extpwrite() are not available.
* Cleanup the Stream and StreamPair class a bit. Separate the allocation
for the read and write streams in StreamPair. This allows accessors to
separately thread the read and write side without deadlocking each other.
* Fix per-rgd TaskReadAry and TaskWriteAry handling. Recent threading
changes now allow all rgd's to maintain their own KQueue.
* Preallocate the array of lists instead of having an array of pointers
for TaskReadAry and TaskWriteAry. Its just easier, and the size of
the array is dynamic anyway (based on number of descriptors).
* Implement I/O support on systems which do not have extpread() and
extpwrite().
* Fix RunThreads accounting.
* Fix threadPushRunnable() use cases.
* Remove a bunch of LASTQUEUE related debugging.
Matthew Dillon [Thu, 1 Mar 2018 07:38:13 +0000 (23:38 -0800)]
Rune - Refactor runtime threading for generated code
* Get rid of a large number of bottlenecks by making the timer and
run queues per-cpu (well, per-GD).
* Fix numerous SMP races in the timer code.
* Fix a few pthread mutex deadlocks.
* Increase various table sizes.
* Do not blindly wakeup all threads on a Timer event's TWSleep[]
list. Just wakeup the thread associated with the Timer event.
* Test with 1 million Rune threads.
Matthew Dillon [Wed, 28 Feb 2018 18:25:08 +0000 (10:25 -0800)]
Rune - Check thread stats more often
* Check the thread stats more often to determine when more real pthreads
are needed.
Matthew Dillon [Mon, 26 Feb 2018 01:54:54 +0000 (17:54 -0800)]
Rune - Add 'mpsafe'
* Add the 'mpsafe' scope identifier (really storage qualifier but
as with 'unlocked', is parsed as a scope identifier to avoid
confusion in procedural declarations).
mpsafe scoped sources disable both the lock and the ref on the
stored version of the pointer or reference, and disables pointer
range checking on indirections.
mpsafe scoped destinations (e.g. of an indirection like (a->b) allow
accesses without any further locks or refs. If the source is also
scoped mpsafe, Rune will not bother generating any of its normal
pointer range checking or lock/ref code for such accesses.
* Clarify handling of 'unlocked', document handling of 'mpsafe'.
* Document 'noinline' scope. This prevents a procedure from being
inlined by Rune's code generator.
Matthew Dillon [Fri, 29 Dec 2017 23:44:20 +0000 (15:44 -0800)]
Rune - Fix global initialization bug
* Fix PointerInfo bug for global initializer. The info structure
contains only the pointer's bounds, not the pointer itself.
Fixes assembler syntax error.
* in_Refs field for argv and argv[n] elements, fixes assertion
for compiled execution.
Matthew Dillon [Fri, 29 Dec 2017 03:31:48 +0000 (19:31 -0800)]
Rune - Refactor storage space tracker
* Refactor the storage space tracker for primary and temporary
data.
* Fixes a bug where temporary storage was not being properly tracked,
causing some format calls to implode.
Matthew Dillon [Thu, 28 Dec 2017 20:15:37 +0000 (12:15 -0800)]
Rune - Fix posix_memalign() usage
* Fix posix_memalign() usage. Arguments were reversed in one case,
and the minimum allowed alignment is sizeof(void *).
* Fixes various bits of corruption.
Matthew Dillon [Thu, 28 Dec 2017 19:42:53 +0000 (11:42 -0800)]
Rune - Add bracketed array initializer support
* Add bracketed array initializer support. That is, something like
this:
int array[6] = [ 1, 2, 3, charlie() ];
* Supports compile-time (interpreted) resolvable functions and
constants like almost everything else.
Matthew Dillon [Thu, 28 Dec 2017 03:05:44 +0000 (19:05 -0800)]
Rune - Add tests for trig/log/exp functions
* Add test scripts for trig/log/exp functions.
Matthew Dillon [Thu, 28 Dec 2017 03:01:17 +0000 (19:01 -0800)]
Rune - Fix bug in FNEG generation
* Fix bug in FNEG -> x86 generation.
Matthew Dillon [Thu, 28 Dec 2017 03:00:40 +0000 (19:00 -0800)]
Rune - Add internal trig, log, pow, exp functions
* Add math support for trig, log, pow, and exp class functions
Matthew Dillon [Wed, 27 Dec 2017 23:35:43 +0000 (15:35 -0800)]
Rune - Fix debug directive
* Fix stack offset debug directive at procedure entry.
Matthew Dillon [Wed, 27 Dec 2017 23:34:02 +0000 (15:34 -0800)]
Rune - Flesh out compile-time global initializations
* Flesh out compile-time global initializations. Fix a recursion
into the same expression when the code generator invokes the
interpreter to resolve a global pointer assignment.
* Document more features.
Matthew Dillon [Wed, 27 Dec 2017 05:30:46 +0000 (21:30 -0800)]
Rune - Fix FP save and restore with mixed ABI calls
* Rune currently uses MSABI which requires XMM6-15, RDI, and RSI
to be saved by procedures in addition to the standard Linux/BSD
ABI which requires procedures to save RBX, RBP, and R12-R15.
We do this because Rune can't inline as well as a C compiler
and often has to make internal ABI calls (which also use MSABI)
in the middle of code the programmer might otherwise believe
does not have to make procedure calls. We want to be able to
maintain FP variables in XMM registers without repeated saving
and restoring. The addition of RBX and RBP to the callee-saves
set also helps Rune's register allocator perform better.
* Fix issues when Rune is calling into a linux/BSD ABI (i.e.
when interfacing with C, making system calls, etc). In this
situation, the Rune procedure was not saving registers that
could get trashed by the system call or C call).
Matthew Dillon [Wed, 27 Dec 2017 05:30:21 +0000 (21:30 -0800)]
Rune - Remove some debugging
* Remove a bit of debugging
Matthew Dillon [Sat, 15 Apr 2017 00:46:05 +0000 (17:46 -0700)]
Rune - Copy tracking minfo in GenPointerInd2()
* Copy tracking minfo in GenPointerInd2(). This removes a few
unnecessary get/put sequences in the generated output.
Matthew Dillon [Mon, 6 Mar 2017 03:41:57 +0000 (19:41 -0800)]
Rune - Change ABI
* Change the ABI to be more like the microsoft call ABI. The main reason
is that fewer registers are scratch across calls, which significantly
reduces the effort the RAS register allocator must make due to the large
number of RuneRunTime_*() calls that are made.
Matthew Dillon [Sat, 4 Mar 2017 00:57:01 +0000 (16:57 -0800)]
Rune - Clarify documentation for ops on reference types
* Clarify the documentation on the limitations of certain types of
operations on reference types.
Matthew Dillon [Sat, 4 Mar 2017 00:31:04 +0000 (16:31 -0800)]
Rune - Convert most library pointers to references
* In Rune we want to encourage the use of references over pointers
at every opportunity. Since no pointer arithmatic is allowed on a ref
and because it will either be NULL or valid, Rune can optimize refs
more easily.
Matthew Dillon [Sat, 4 Mar 2017 00:14:26 +0000 (16:14 -0800)]
RAS - Fix .zero alignment
* .zero alignment was misintpreted as a fill value. Generate a separate
.align pseudo-op for any alignment > 1.
Matthew Dillon [Sat, 11 Feb 2017 20:53:34 +0000 (12:53 -0800)]
Rune - save/restore errno in signal handlers
* Save and restore errno in signal handlers so as not to interfere
with mainline code.
Matthew Dillon [Sun, 11 Dec 2016 18:59:50 +0000 (10:59 -0800)]
Rune - Reorder weak bindings
* Reorder weak bindings for newer versions of GCC which require fully
formed types for weak bindings.
Matthew Dillon [Thu, 15 Sep 2016 02:39:07 +0000 (19:39 -0700)]
Rune - Consolidate most RefStor allocations
* Consolidate most RefStor allocations into allocRefStor().
* Start tracking potential PointerInfo extensions to stack frames and
RefStor's to allow PointerInfo structures to be made static. This
isn't set in stone yet and the counter / index fields are not yet
used.
Matthew Dillon [Thu, 15 Sep 2016 02:34:25 +0000 (19:34 -0700)]
Rune - Optimize getrgd()
* getrgd() has a specific problem in that GCC is badly broken when it comes
to accessing TLS variables in a NxM threading scheme. GCC will cache the
%fs:0 load into a register and nothing we tell it can get it to throw
away that cached value. In a NxM threading scheme, a micro-thread can
block and wind up on a different pthread when it wakes up.
This is particularly painful when GCC does heavy optimizations that
combine what would normally be separate procedural domains.
* The getrgd() I had before was portable, but painfully expensive (two
subroutine calls!). I've decided to optimize getrgd() into an inline
and use __asm to manually retrieve the per-pthread &RuneTLS. This
is not really portable, but it's very important the Rune be able to
switch micro-threads quickly.
Matthew Dillon [Wed, 14 Sep 2016 18:20:48 +0000 (11:20 -0700)]
Rune - Fix interpreter (tests/gfxinput2.d)
* Bring the interpreter's initialization of the PointerInfo structure
up-to-date. type->ty_Info was not being set to PINFO_STATIC. This
fixes interpretation of a number of test programs.