Repository navigation
Releases
Releases · frostney/hotfpc
hotfpc 1.2.1
- A variable of a unit's interface that only code outside the unit uses, such as the
program's, now needs a restart when it changes its type at the same size (Integerto
Single), on every system while the check of layouts is on (a ppudump that reads the
units), and on Windows when it grows within its padding (Word = 1toLongInt = 1
before anInt64).
The unit's object file came out the same, and the driver checked layouts, and on Windows
sizes, only for units whose object file changed, so the program's recompiled code was
swapped in on the variable's old storage and read it as the new type. Every unit fpc
compiled again in a save, as its.ppushows, now gets those checks
(#45,
#47). - On macOS, a variable that grows within the padding before the next one now needs a
restart, as on Linux:Small: Wordbefore anInt64saved asLongInt, in
the program file, or in a unit while the check of layouts is off, also when a save removed
the variable and a later one brings it back larger. Nor was a unit loaded at all when only
the program's code used such a variable of its interface, as its object file came out the
same: not even the check of layouts saw it. A Mach-O object states no symbol
sizes, and the agent took a variable's size from the distance to the next symbol, 8 bytes
before and after, so it swapped the new code in on the old storage. hotfpc now has fpc keep
the assembler it assembles each object from (-a,<unit>.sbeside<unit>.o), and the
agent reads each variable's size there. A variable the new code would share with the
program needs a restart when its size can't be read there for the version the program
runs, the new one or both:the size of variable <name> is unknown: ...
(#43). - A variable added or removed next to another no longer needs a restart on macOS and Linux
arm64. The agent restarted when the distance from a variable to the next symbol changed
(variable MAIN.FLAG changed size from 8 to 1 bytes) although its size didn't. The size
a datum states, in the ELF symbol or in fpc's assembler on macOS, now decides, and such a
swap no longer notes that the variable changed
(#43). - Homebrew installs hotfpc on Intel Macs and on Linux arm64 too, from 1.2.0 on:
brew install frostney/tap/hotfpc. On an Intel Mac, where Homebrew has no prebuilt fpc, fpc
comes from the freepascal.org installer
(platforms).
hotfpc 1.2.0
- A variable that a save removes and a later save brings back now gets the same checks as a
variable that changes in place, and needs a restart when they find another size, or in a
unit, while the check of layouts is on, another type of the same size (Integerto
Single). The program keeps the variable at its first address, and the agent swapped the
new code in with the notekept without a check, so it used the old storage as the new
type: a larger one ran past it. The agent now keeps the sizes of what a save removes,
thread variables included, and the check of layouts in units the declarations a save
removes. In the program file, which has no unit file for ppudump to read, only a change
of size is found (limits). A
variable that comes back as it was is swapped, with the note<name> is back after a save removed it; it keeps its running value. - A swap no longer overwrites a value the program writes while the swap loads with a
changed initial value. The agent compared the variable with its old initial value
before it stopped the program's threads, and copied the new one in unconditionally once
they were stopped, so a thread's write in between was lost, and hotfpc printed
note: U.SPEED still had its initial value; set to the new one. Now the commit compares
and writes in one atomic step for a variable of up to 8 bytes within one aligned word,
so that also a thread that is still running then (on Linux, one that blocks the agent's
signal and sleeps) keeps its write, and a longer one only while every other thread is
stopped. On Linux a stopped thread now runs none of the program's signal handlers until
the swap lets it go on. The note says what the commit found. - On Linux, a save into a program whose threads come and go no longer fails with
a thread of the program did not stopafter a 2 s wait when a thread ends after the agent sent it
the signal that stops it but before the thread took it. The agent now leaves out a thread
that has ended, as it already did when the thread ended before the signal. - On Windows with fpc 3.2, a swap now applies a changed initial value of a variable in a
unit's implementation section by the same rule as on the other systems (What a swap
keeps):
while the variable still holds the old one, and neither contains an address the linker
fills in. It printsnote: U.SPEED still had its initial value; set to the new one. It
kept the running value and printednote: U.SPEED changed; the running copy is kept: fpc
3.2 names such a variable only by its section, and the agent recognised a variable with
an initial value only by theTC_$prefix of a symbol's name. - A swap no longer breaks a running routine that calls a routine nested in it. When a save
moved the parent's locals, the frame that was still running called the new nested
routine, which read that frame with the new layout: in thenestedframescenario, the
ticks printed wrong numbers, or the program stopped printing. A nested routine's old
entry, and on Windows that of the helper fpc makes for eachfinally, now keeps its old
code for the running frame; new code calls the new version. It happened wherever fpc
names nested routines: on Linux, on macOS, and on Windows with fpc 3.3.1. - On Windows and Linux, a swap now also stops a thread that another thread started while
the agent was stopping them, and a thread that can't be stopped, or on Windows can't be
opened, makes the agent let the others run and try again. Such a thread used to run on
while the agent rewrote code, and on Linux no thread was stopped at all when
/proc/self/taskcouldn't be read, nor on Windows when the list of threads couldn't be
made. On Windows the agent resumes only the threads it suspended. Under Wine before 6.8,
which lacks a call the agent needs for this, every swap is now refused; on Linux a thread
that blocks the agent's signal and sleeps isn't stopped
(limits). - On Windows with fpc 3.2, a swap now redirects the old entry of a routine declared only
in a unit's implementation section, other than a method, to its new code, as it does on
macOS and Linux and with fpc 3.3.1. fpc 3.2 gives such a routine no symbol in a Windows
object file, so the agent couldn't find its old entry: a procedure variable taken before
the swap, or a frame that kept calling the routine, ran its old code. The agent now
finds the routine's section in the linker's map, as it does for such a variable. - On Linux x86-64, a file the agent was given that is no relocatable ELF object for the
system is reported as<file> is not an x86-64 ELF object. The error named aarch64,
Linux arm64's architecture. - A swap that changes the program's main block prints
note: the main block changedonce.
It printed it twice: fpc gives the main block two names,PASCALMAINandmain. - An empty source file in a watched directory, such as an empty
.incnothing uses, no
longer holds back every save. hotfpc took any empty file for a save still being written
and compiled nothing while one was there. Now only a file that a save has just emptied
waits, for half a second, in case the editor has yet to write it. - A program that a signal ends before its agent connects now prints
exit code -1, as when
a signal ends it later, and when that ends hotfpc, hotfpc ends with 255. hotfpc used to
printexit code 0and end with 0, as if the program had succeeded. A program a restart
started that a signal ends before its agent connects still leaves hotfpc watching for the
next save that builds. - macOS x86-64 (Intel Macs): the agent hot-reloads programs built for it, the releases have
amacos-x64archive, and CI builds hotfpc, runs the unit tests and runs the scenarios
on GitHub's Intel macOS runner. - On x86-64, a swap no longer writes the jump at a routine's entry over the routine after
it: with{$codealign proc=1}, fpc can pack an assembler routine shorter than the 5-byte
jump right before the next one, on macOS and on Linux with-Aas, and the program then
crashed when it called one of them through its old address. Such a save now needs a
restart. - On x86-64, a swap no longer writes the jump at a routine's entry over a call in its
first 5 bytes, such as an assembler routine'scall rdi. A thread waiting in the routine
it called returned into the middle of the jump: in theshortcallscenario, it failed
with an access violation. Such a save now needs a restart. - On x86-64, a swap no longer writes the jump at a routine's entry while a thread is to
resume within its first 5 bytes. A signal handler, or on Windows an exception handler,
keeps where the thread it interrupted resumes in its frame, and a thread whose handler
waited past the swap resumed in the middle of the jump: in thesighandlerand
sigmaskedscenarios, it failed with an access violation. The agent now reads each
stopped thread's stack for such an address, and on Linux the stack of a thread that
blocks signals and sleeps; it tries again while there is one, and when one stays the save
needs a restart. On Windows, a thread whose context can't be read now fails the stop
instead of going unchecked. - On macOS, a swap now also stops a thread that another thread started while the agent was
stopping them, and a thread that can't be suspended makes the agent let the others run
and try again. Such a thread used to run on while the agent rewrote code. The agent
resumes only the threads it suspended. - hotfpc no longer crashes, or corrupts its memory, when a source file grows while it reads
it, as when a save or a generator writes the file during the twice-a-second look at the
contents. It read the file's size twice and could read more than it had room for. - A save whose sources change again while fpc compiles them is compiled again once they
settle, before hotfpc swaps, refuses or reports anything. fpc reads one file after the
other, so when an editor wrote the files of one save a few milliseconds apart, or the
next save came during the compile, hotfpc used to act on a mix of old and new files: it
could report errors or a needed restart for a state nobody saved, and then compile the
same save a second time. The same goes for a save's compile to assembler on Windows and
the link of a restart. A save that landed during the first build, after fpc had read the
file, used to be left out until the next save; hotfpc now builds the program again before
it starts it, also when the build failed on it, and waits for a file that save emptied
first, as it does once the program runs, by default for about a second and a half at
most. After three such compiles, links or compiles to assembler in a row, hotfpc uses the
next one as it is, and it waits at most a second for the files to settle before a
compile, or one--settlewait when that is longer, so a file that keeps changing can't
hold back every save, nor keep hotfpc running after the program has ended. On Windows a
save whose sizes of variables with initial values are checked then needs a restart, as
its compile and its compile to assembler may have read different sources; when that
happens to the build a program starts from, every such save needs a restart until it
starts over. hotfpc reads the times of the sources as finely as the file system keeps
them, so a save that came and was put back during a compile, at the same size and within
the same second, shows too. On Windows such a save needs a restart where the times can't
show it, as on a file system that keeps whole seconds, and so does every save that needs
the sizes when the times couldn't show it for the build the program starts ...
hotfpc 1.1.0
- An edit that needs a restart now starts the program over, like webpack's full reload
when a module can't be updated in place: hotfpc names the declaration, links the program
again and starts it with the new code. If the link fails, the program keeps running.
--no-restartkeeps the 1.0.0 behaviour, where the program carries on with its old code. - A restarted program that fails, for example with a runtime error in an initialization
section, doesn't end hotfpc: the next save that builds starts it again. - The closing summary also counts restarts.
- A variable with an initial value in a unit's implementation section that changes size
(Integer = 0toInt64 = 0) now needs a restart. It used to be swapped on Linux and
Windows, and the new code then wrote past the variable: fpc pads such a variable's
section to 16 bytes. The agent now takes the size from the ELF symbol on Linux, and the
check of layouts finds the new type on every system. On Windows, such a variable in the
program file, and with fpc 3.2 a typed constant, still has the gap (README "Limits"). - The check of layouts now covers a unit's implementation section too, from ppudump's text
output: its variables and its records and classes. Swapping two fields of a class
declared there, or giving a variable there another type of the same size (Integerto
Single), now needs a restart. Both used to be swapped, and the program then read its
old values wrongly. The check takes about 8 ms more per save (macOS, fpc 3.2.4).
hotfpc 1.0.0
The first release.
- Hot reloading for Free Pascal 3.2.2 and later: edit a unit of a running program, save, and
the program continues with the new code and its state. Edits that can't be swapped in
safely are reported with the declaration that needs a restart, and the program keeps
running. - Programs for macOS arm64, Linux x86-64 and Windows x86-64; hotfpc itself runs on macOS,
Linux and Windows, and drives Windows programs under Wine from Linux and macOS. - One binary for every compiler version: hotfpc carries the agent's source and compiles it
with the program's own fpc and target options. - Watches the program's directory,
-Fu/-Fidirectories and the directories in@file
response files such as lwpt'slwpt.cfg. - Checks that the compiler is fpc 3.2.2 or later before it builds.
- Builds with fpc and fpcres from a copy of
source/, or withbuild.shandbuild.bat;
no other build tool.