be used (TBD in a future commit) for optimizing x:=-x and x:=not x on CPUs
that support performing these operations directly in memory (such as x86)
git-svn-id: trunk@35749 -
op=and/or/xor). They generate more optimal code on certain architectures
(including x86). The new inline nodes aren't generated by the compiler yet,
but will be used in the future, at certain optimization levels, whenever the
pattern x:=x op y is detected by the compiler.
git-svn-id: trunk@35666 -
* tasm2.pp already detected this bug if run with -al option. Added a copy of tasm2.pp and configured it with -al, so it is run daily on all suitable machines.
git-svn-id: trunk@35626 -
sysv_abi_cdecl calling conventions on x86-64 to force using the SYSV/
Microsoft ABI on platforms that don't use it by default (mainly to ease
porting pure assembler routines)
git-svn-id: trunk@35425 -
Commit message:
[PATCH] More consistent RTTI (also better performance) for classic
objects (reference to initrtti from fullrtti).
git-svn-id: trunk@35376 -
Commit message of patch:
+ New field TotalFieldCount for TTypeData
* Mark ManagedFldCount as deprecated
* Adjusted test trtti12.pp
git-svn-id: trunk@35180 -
* have tkInt64 and tkQWord entries also contain the OrdType field (basically the compiler can now use the same function to generate them only with different type kinds)
+ added test
git-svn-id: trunk@35135 -
* adjusted test trtti10.pp due to renamed RecInitTable field
Original commit message:
Public interface for init table for records in TypInfo:
* Rename RecInitTable to RecInitInfo (because it is special kind of PTypeInfo for init table of record). Has more sense in practical usage.
+ New structure TRecInitData (and related PRecInitData) to handle data for (init) type info for records (aka init table)
+ New structure TInitManagedField and pointer type PInitManagedField (for init table)
+ Special helper property RecInitData to get PRecInitData for tkRecord
+ test attached
git-svn-id: trunk@35134 -
- indentation in ncgrtti.pas
- fewer ifdefs in rtti.inc
- InitTable/Terminator field as first field to avoid padding on targets that require proper alignment and have SizeOf(Pointer) > 4
Original message by Maciej Izak:
Breaking change for rtti layout for record rtti. Init table
is always accessible from regular rtti. Rtti table contains indirect
reference to init table, additionally init table contains nil-terminator (for
rtl purposes - the only way to determine kind of info : init or rtti). Pros:
* will be possible to create more Delphi compatible code for RTTI, finally end-user can access to *real* managed fields of records (some work on TypInfo.pp is still required but is not necessary).
* important step forward for management operators (anyway this commit is not directly related to management operators)
* much more optimal memory allocation/initialization/finalization for records created/destroyed by InitializeArray/FinalizeArray, for example:
type
TBar = record
f1,f2,f3,f4,f5,f6,f7,f8,f9: byte;
s: string;
end;
previously:
GetMem(PB, SizeOf(TBar));
InitializeArray(PB, TypeInfo(TBar), 1); // FPC_INITIALIZE was executed 10 times
now:
GetMem(PB, SizeOf(TBar));
InitializeArray(PB, TypeInfo(TBar), 1); // FPC_INITIALIZE is executed just once
+ test attached
git-svn-id: trunk@35125 -
Derek (mantis #28830)
o ability for a thread to acquire a readlock when it already holds a
write lock, or vice versa
o detect when thread1 releases a lock while it hadn't acquired one
o correct result of beginwrite (return true only when another thread
held/acquired a write lock before the current thread got it)
o extra compared to Derek's patch: replaced some additional
(mostly pre-existing) interlocked*() hacks with proper memory
barriers, made formatting consistent, fixed compilation on platforms
where tthreadid is not an integer type, improved tthreadid hashing
function for 64 bit platforms, fixed some comments
git-svn-id: trunk@34678 -
all of their values, when kept in a bitpacked array, properly via
pass_typecheck rather than hacking location.size in pass_generate_code:
o the old fix was incomplete (it didn't handle non-constant indices)
o the old fix didn't work for llvm (since it uses defs rather than
location.size)
git-svn-id: trunk@33943 -
fmodule.pas, tmodule:
+ new list pendingspecializations which keeps track of all pending specializations of the current module
psub.pas:
* move generate_specialization_procs and related routines to pgenutil
+ new procedure read_proc_body to read a routine's body, cause generate_specialization_procs needs it (unlike the already existing overload in the implementation section, this one can only handle bodies of non-nested routines)
pgenutil.pas:
* generate_specialization_phase2: add the newly specialized generic to the current module's pending specializations
* generate_specialization_procs: reworked so that it uses the new pendingspecializations field instead of walking the global and local symboltable of the current unit
pmodules.pas:
+ add pgenutil to uses due to the moved generate_specialization_procs
+ added test
git-svn-id: trunk@33826 -
200309041 and thus breaks building i8086-msdos snapshots entirely. Added test
that reproduces the bug in a small program, so it can be fixed eventually.
git-svn-id: trunk@33276 -
characters, so the test's success doesn't depend on getdir returning a
string using the same composition as the used name (fixes test on
OS X 10.11)
git-svn-id: trunk@33270 -
o removed utf8string overload
o always ignore any code page information from the input, and interpret the
contents of the input directly as utf8-encoded bytes
* made utf8tostring() compatible with the JVM backend (mantis #29497)
git-svn-id: trunk@33159 -
The result type of the intrinsic is determined by the Then-expression to provide a bit of control. There might however be some situations in which this fails, for this exceptions need to be added (e.g. a constant string needs to be converted to a normal string).
compinnr.inc:
+ add new constant in_ifthen_x_y_z for the IfThen() intrinsic
psystem.pas:
+ create_intern_symbols: add symbol for IfThen() intrinsic
pexpr.pas:
* statement_syssym: parse parameters of IfThen() intrinsic and return corresponding inline node
ninl.pas, tinlinenode:
+ new method handle_ifthen() which converts the inline node to an if-node which assigns the expressions to a temp node that is returned
* pass_typecheck: handle in_ifthen_x_y_z using handle_ifthen()
* pass_1: in_ifthen_x_y_z does not need a first pass as it's already converted after the typecheck pass
+ added tests
git-svn-id: trunk@33036 -
assembler .obj module. Note that TASM modules aren't fully supported yet,
because our OMF internal linker doesn't support all features of the OMF object
format. This test works, because it's really simple. As more OMF features are
supported, this test will be extended.
git-svn-id: trunk@32353 -
was correct before the ansistrings with codepage support had been
implemented, and by accident kept working afterwards on platforms that
don't use UTF-8 as defaultsystemcodepage, but after r31831 it started
failing. This commit fixes it again, in combination r31847 (by ensuring
that the string data passed to ansistart/endtext is encoded in
defaultsystemcodepage).
git-svn-id: trunk@31848 -
* extend parse_proc_head() with support for /parsing/ generic functions (at least in mode Delphi, mode ObjFPC depends on the new isgeneric parameter to be set)
* adjust parsing of interface mappings with a generic interface (note: in mode ObjFPC this now requires a "specialize" directly before the generic interface's name, which is more in line with other uses of "specialize")
pexpr.pas, factor:
* don't call postfixoperators() if hadspecialize is set
tests/test/tgeneric79.pp:
* adjust test to changed syntax
git-svn-id: trunk@31769 -
parameter instead of immediately doing it in the constructor of the call
node, and then only create it if we actually need it.
It was previously created in the call node constructor because it needs to be
done before pass_1 (which is where it is actually used) due to pass_1 possibly
being performed in the context of inlining (and then a wrong self parameter
may be found, or none at all), and it was done unconditionally because at that
point we don't know yet whether or not a self parameter will be necessary (as
we haven't resolved the overloads/procdef yet).
The problem with this is that if we use the parentfpstruct way of handling
accesses to outer scope locals/parameters, we need to know all locals/
parameters that will be accessed from nested routines after typecheckpass,
otherwise we get crashes. The problem was that if a call to an RTL routine was
generated by the compiler in a routine nested inside a method during pass_1,
and this nested routine itself did not access self of the method (so self was
not added to its parentfpstruct during the typecheckpass), then the
unconditional reference to self when creating the call caused a compiler
crash (introduced in r30908)
git-svn-id: trunk@31197 -
class, which conflicts with java.lang.System in recent jdk javac's
(and we don't access any of the RTL classes explicitly in the
test program)
git-svn-id: trunk@30952 -
sizeint" function that returns:
<0: invalid sequence detected after processing "-result" bytes
0: incomplete (may still be valid if MaxLookAhead is increased)
>0: sequence of result bytes forms a codepoint (+ combining diacritical
marks if that parameter was true)
git-svn-id: trunk@30047 -
instead of the frame pointer register:
1) we exactly know the offsets of the temps from the stack pointer
after pass 1 (based on the require parameter stack size for called
routines), while we don't know it for the frame pointer (it depends
on the number of saved registers)
2) temp offsets from the stack pointer are positive while those from
the frame pointer are negative, and we can directly encode much
bigger positive offsets in the instructions
o move the stack pointer register to a virtual register in
loadparentfpn, because many instructions cannot directly operate
on/with the stack pointer
o add the necessary register interference edges for the stack pointer
register
git-svn-id: trunk@29938 -
type
TTestLongInt = specialize SomeOtherUnit.TTest<LongInt>;
will now have to read as
type
TTestLongInt = SomeOtherUnit.specialize TTest<LongInt>;
While this is not backwards compatible this situation should arise seldomly enough and the benefits especially in context with generic functions/procedures/methods outway the drawbacks.
pbase.pas:
* try_consume_unitsym: add a allow_specialize parameter that allows to parse "specialize" in front of a non-unit symbol; whether it was a specialization or not is reported using a new is_specialize parameter
+ add a new overload try_consume_unitsym_no_specialize that calls try_consume_unit sym with allow_specialize=false and a dummy is_specialize parameter
* switch calls to try_consume_unitsym to try_consume_unitsym_no_specialize
pstatmnt.pas, try_statement:
* switch call to try_consume_unitsym to try_consume_unitsym_no_specialize
* adjust call to parse_nested_types
ptype.pas:
+ extend id_type with the possibility to disallow unit symbols (needed if a specialize was already parsed) and to report whether a specialize was parsed
+ extend parse_nested_types with the possibility to tell it whether specializations are allowed
* have parse_nested_types specialize generic defs if one is encountered and local type defs are allowed
* id_type: only allow "unitsym.specialize sym" or "specialize sym", but not "specialize unitsym.sym"
* single_type: correctly handle specializations with "specialize" keyword
* read_named_type.expr_type: there is no longer a need to check for "specialize" keyword
pexpr.pas:
+ new function handle_specialize_inline_specialization which tries to specialize a type symbol
* handle_factor_typenode: handle specializations after a point that follows a record or object (why isn't this part of postfixoperators anyway? O.o)
* postfixoperators: handle "specialize" after records and objectdefs
* factor_read_id: handle "specialize" in front of an identifier (and after unit symbols)
+ added tests
* adjusted test webtbs/tw16090.pp
git-svn-id: trunk@29768 -
loading them from ppu (like was already done when they were initially
compiler), so they can be called via the "id" type even if no classes are
in scope that implement them
git-svn-id: trunk@29686 -
an Objective-C method masks an identifier from a category, because due
to the fact that all standard categories are imported at the same time via
the CocoaAll unit, this can often happen with categories you don't know/
care about. These errors also didn't happen in 2.6.x
git-svn-id: trunk@29497 -
ptype.pas, id_type:
* don't generate an error if the undefineddef typesym is an explicit rename that belongs to a generic
+ added test
git-svn-id: trunk@29485 -
tests/test/tthlp22.pp:
* this test fails no longer as Mode Delphi by default also contains modeswitch TypeHelpers
* adjust program name for consistency
git-svn-id: trunk@29274 -
fpc_ansistr_to_widechararray(), so that CP_ACP/CP_OEM etc are properly
handled (fixes assign/assignfile with non-ansi characters in source files
that don't explicitly specify the code page)
git-svn-id: trunk@29218 -
pgenutils.pas, check_generic_constraints:
* correctly handle forward defs if the constraint is either a single IInterface/IUnknown or a TObject/class
+ added tests
git-svn-id: trunk@28601 -
procvar in the local state of the block, and then call it insde the
generated invoke routine. We can't call it directly there, because
due to visibility reasons it may not be accessible from a regular
procedure (e.g. if it is a strict private method)
git-svn-id: branches/blocks@28234 -
"reference to ...; cdecl;". The "reference to ..." syntax is what Delphi
uses for anonymous function references. The "cdecl;" indicates that this
is for the C-variant of such references, which is what blocks are
git-svn-id: branches/blocks@28233 -
o blocks are implemented as a variation of procedure variables
o declaration of a block variable: "test: procedure(c: char) is block;"
(C equivalent: (void)(^test)(char c) )
o the compiler automatically converts procedures/functions whose address
is passed to a block parameter or assigned to a block variable into
a "block". This consists of
1) generating a block descriptor (containing the size of the "block
literal" (see below) and the signature of the invocation function
encoded as an Objective-C selector)
2) generating a wrapper function around the original funcion (with C
calling convention), that has an extra first hidden parameter
(marked as vo_is_parentfp in the compiler) whose type is a pointer
to the describing "block literal"
3) generating the "block literal", which contains a pointer to an
external variable indicating whether this block captures context or
not, some flags (see compiler/blockutl.get_block_literal_flags for
info), a pointer to the wrapper function and a pointer to the
descriptor. In the future, it will also contain captured variables.
o right now, only global procedures/functions can be converted to blocks
(because they don't require state capturing). The next steps are (Object
Pascal) methods (not Objective-C methods, because Objective-C method
procvars don't exist) and finally nested functions
o on Mac OS X, the functionality will only work on Mac OS X 10.7 and later,
because we have to use the so-called "ABI.2010.3.16" to ensure that
our blocks aren't called as variadic functions by the runtime (which
came out after the Mac OS X 10.6 release)
o while the currently implemented functionality does not require any
library support at all, there's no use enabling it on other platforms
because unless it has been confirmed to work with a blocks runtime,
there's no point in using blocks (they're just somewhat bulky procvars
right now). Enabling it on other platforms (in combination with the
GNUStep Objective-C run time), should simply be a matter of adding
the right {$linklib xxx} statement to rtl/inc/blockrtl.pp file, adding
that file to Makefile.fpc for that platform and adding that platform
to the compiler/systems.systems_blocks_supported set
git-svn-id: branches/blocks@28232 -
tests that execute a child process. Otherwise, by default, all DOS memory is
reserved in these memory models, there's no DOS memory left for the child
process and exec() fails.
git-svn-id: trunk@28061 -
implemented on two FPC platforms (go32v2 and msdos). On the platforms that
don't need it, it does nothing, so it's safe to call on all platforms.
git-svn-id: trunk@28060 -
o only create an accessor wrapping the inherited accessor at a
potentially lower visibility level if the overriding property
itself does not specify a different accessor to use
o simplified code
o tests
git-svn-id: trunk@27954 -
Currently it is implemented only for x86-CPUs supporting the FMA extension. While it would
be possible to implement it in software or simulate fma(<single>,<single>,<single>) using
double operations, it makes no sense in my opinion to do so.
git-svn-id: trunk@27564 -
+ globtype.pas: add new modeswitch to modeswitch enum and name array
* ptype.pas & pdecobj.pas: check for new modeswitch instead of modeswitch class
* ppu.pas: increase ppu version as we've added a new modeswitch which requires correctly compiled units
* adjusted tests to enabled the modeswitch when necessary
+ added three new tests that check for correct functionality of modeswitch typehelpers
git-svn-id: trunk@26796 -