Граф коммитов

736 Коммитов

Автор SHA1 Сообщение Дата
Nika Layzell 3043db4105 Bug 1457972 - Part 10: Make sure to allocate ExtendedVal inline, r=froydnj 2018-05-14 17:55:57 -04:00
Nika Layzell e2240ec5a2 Bug 1457972 - Part 4: Remove dipper types, r=mccr8
In XPConnect, native values are passed around within nsXPTCMiniVariant objects.
an [nsXPTCMiniVariant] contains 64-bits of data in a union type.

nsXPTCMiniVariant values are created by the platform-specific glue code and
passed into XPConnect proper when calling from C++ into JS.

When calling from JS into C++, we instead create nsXPTCVariant objects and pass
them into the glue code. These objects have extra information in addition to the
nsXPTCMiniVariant: namely they also have a `type` field with the type stored in
the variant, space for flags, and a `ptr` field which is passed over IPC instead
of the inner nsXPTCMiniVariant when a flag (`PTR_IS_DATA`) is set.

The JSValue type in XPConnect is always passed as a pointer to a JSValue object,
both for in parameters and out parameters. This is handled by making the JSValue
type be unconditionally flagged as [`IsIndirect()`] This flag is also used for
all types of outparameters.

When the `IsIndirect()` flag is set, it means that the actual data is stored in
the nsXPTCVariant's val field, and it sets the flag to tell the glue code to
instead pass the `ptr` field (which is always pointing to the `val` field for
[legacy reasons]) into the C++ code.

In contrast "dipper" is a different and super weird flag. Currently only the
string class types (nsACString & nsAString) are marked as "dipper". A "dipper"
type is always passed as an "in" type (and thus always passed "directly"), even
when it's actually an out parameter.

XPConnect treats these types as though they are pointer types (nsAString*). This
means that there is no space in the nsXPTCVariant to store the actual nsAString
types when passing from JS into C++, so these values have to be allocated by a
different mechanism (in the current code, there is a size 2 buffer for each
string type in the context and once that buffer is exceeded, we heap allocate
the nsString values).

In effect, the current state looks something like this:
+------------+---------------------+---------------------+
| type       | out (xpt/native)    | in (xpt/native)     |
+------------+---------------------+---------------------+
| TD_INT32   | indirect (int32_t*) | direct (int32_t)    |
+------------+---------------------+---------------------+
| TD_JSVAL   | indirect (JSValue*) | indirect (JSValue*) |
+------------+---------------------+---------------------+
| TD_ASTRING | direct (nsAString*) | direct (nsAString*) |
+------------+---------------------+---------------------+

This patch ensures there is enough space in the nsXPTCVariant to fit the
nsString value, and switches string class types to being unconditionally
indirect instead of using the dipper system. This allows us to delete a ton of
dipper-specific code, and unify the indirect and string class codepaths.

This only affects the size of nsXPTCVariant objects, and does not affect
nsXPTCMiniVariant objects. nsXPTCVariant objects are never allocated by the
platform-specific binding code, rather, they are allocated in an AutoTArray on
the stack as part of the CallMethodHelper object.

The size increase is a total of 1 word, so 4 bytes in 32-bit builds, and 8 bytes
in 64-bit builds, which is ignorable for stack allocated objects.

[nsXPTCMiniVariant]: https://searchfox.org/mozilla-central/rev/eb6c5214a63e20a3fff455e92c876287a8d2e188/xpcom/reflect/xptcall/xptcall.h#20-47
[`IsIndirect()`]: https://searchfox.org/mozilla-central/rev/c0d81882c7941c4ff13a50603e37095cdab0d1ea/xpcom/reflect/xptinfo/xptinfo.h#371
[legacy reasons]: https://searchfox.org/mozilla-central/rev/eb6c5214a63e20a3fff455e92c876287a8d2e188/xpcom/reflect/xptcall/xptcall.h#66-79
2018-05-14 17:55:55 -04:00
Nika Layzell c9d0fe3dd2 Bug 1455217 - Part 1: Add an explicit Promise type to xpidl, r=mccr8
This type is fairly simple on the idl parsing side of things. I handle it in the
same way that special types such as ns[C]String, nsid, and jsval are handled, by
using a special native type.

The logic for converting the value between C++ and JS follows the existing logic
from the nsISupports <=> JS Promise conversions.
2018-05-14 17:55:53 -04:00
Jeff Walden 04d21ccac0 Bug 1451248. r=jorendorff, r=bz
--HG--
extra : rebase_source : e26439a5954162bdaf332fbd63d623a3810e19e0
2018-04-25 19:40:09 -07:00
Nika Layzell e5f31c03d8 Bug 1444991 - Part 4: Handle DOM Objects in XPConnect, r=mccr8
This patch goes through the XPConnect conversion methods, and adds cases for
T_DOMOBJECT which call the Wrap, Unwrap, and Cleanup methods from the
nsXPTDOMObjectInfo objects created in the last part.

For consistency with normal interface pointers, and because it wasn't too
complex, I also added support for including T_DOMOBJECTs in XPCOM arrays.
2018-04-17 19:21:03 -04:00
Nika Layzell 14da321a67 Bug 1444745 - Part 5: Update consumers of nsIInterfaceInfo to use the nsXPTInterfaceInfo directly, r=mccr8
Due to the decision to keep the old API on nsXPTInterfaceInfo in part 4, this is
a fairly straightforward patch.

1. I had to change a couple of consumers of `IsRetval()` due to the movement of
that flag.
2. I changed all code which held a nsIInterfaceInfo to hold an `const
nsXPTInterfaceInfo*` instead.
3. I changed code which used the nsIInterfaceInfoManager to instead call the
static methods on nsXPTInterfaceInfo.
2018-04-17 19:20:56 -04:00
Nika Layzell f5f86c989e Bug 1444745 - Part 1: Clear out xptinfo and typelib to make way for the this patch, r=mccr8
Unfortunately, I wasn't able to figure out a way to make firefox build & run in
the intermediate stages of these commits. Because of this, I am going to just
delete most of the code which I am deleting in the first patch, as I figure that
those are somewhat uninteresting changes, and then make the other changes in the
following patches.

In total, the following things are deleted:
1. All of xpcom/typelib, except for `xpt/tools` - this directory is being
subsumed entirely into xpcom/reflect/xptinfo.
2. Most of the code in xpcom/reflect/xptinfo, it is being rewritten to avoid
allocating and contain all of the necessary data structures.
3. idl-parser's typelib.py XPT generator, as it will be replaced.
4. Most includes of files which have been deleted.

NOTE: xpcom/typelib/xpt/tools/xpt.py was not removed, as it is used by bundling
code & bundling tests, which we don't want to remove yet.
2018-04-17 19:20:50 -04:00
Ryan VanderMeulen 5383105dd9 Bug 1086964 - Remove uses of no_pgo that are no longer needed. r=dmajor 2018-03-14 18:18:32 -04:00
Ryan VanderMeulen 0007daf65b Backed out changeset 1ec0f839a905 (bug 1086964) for mass Win7 debug test failures. 2018-03-14 20:35:43 -04:00
Ryan VanderMeulen 3f80fd8acc Bug 1086964 - Remove uses of no_pgo that are no longer needed. r=dmajor 2018-03-14 18:18:32 -04:00
Kannan Vijayan 627eb6ae9a Bug 1411415 - r=bz r=fitzgen 2018-03-05 19:27:02 -05:00
Andrew McCreight ee205d4ac0 Bug 1441217 - Use nsXPTMethodInfo instead of XPTMethodDescriptor in XPConnect. r=njn
nsXPTMethodInfo is a nicer structure to use, and this paves the way
for making the two types different, which will be needed if I make
XPTMethodDescriptor statically allocated.

Also, use the higher level accessor methods.

MozReview-Commit-ID: JbRdLU5Wwyt

--HG--
extra : rebase_source : 48f6c4e98e43c75006ceeb02bd727b59d3726681
2018-02-26 08:19:02 -08:00
qiaopengcheng-hf@loongson.cn 6193e70667 Bug 1429650 - mips64-linux PrepareAndDispatch float-formate data error when running xpcshell-test js/xpconnect/tests/unit/test_attribute.js and test_params.js r=froydnj 2018-01-15 09:59:11 +08:00
Chris Peterson 37efe4d0e6 Bug 1428535 - Add missing override specifiers to overridden virtual functions. r=froydnj
MozReview-Commit-ID: DCPTnyBooIe

--HG--
extra : rebase_source : cfec2d96faeb11656d86d760a34e0a04cacddb13
extra : intermediate-source : 6176724d63788b0fe8caa3f91607c2d93dbaa7ec
extra : source : eebbb0600447f9b64aae3bcd47b4be66c02a51ea
2017-11-05 19:37:28 -08:00
Sylvestre Ledru 9bfe27d903 Bug 1394734 - Replace CONFIG['GNU_C*'] by CONFIG['CC_TYPE'] r=glandium
MozReview-Commit-ID: 7duJk2gSd4m

--HG--
extra : rebase_source : 7312fe276e561e8c034a5f6749774ae812727f9c
2017-12-07 22:09:15 +01:00
David Major 66bfbba514 Bug 1423791: Remove clang-cl workarounds from xptcstubs.cpp. r=jrmuizel
The clang-cl-specific code is hitting https://bugs.llvm.org/show_bug.cgi?id=35482 on 32-bit ThinLTO builds. As far as I can tell, this workaround is no longer needed in clang-cl anyway; it should be able to support declspec(naked) etc nowadays.

Drive-by MSVC warnings fix.

--HG--
extra : rebase_source : a8b585c554674daca6d75bae66c1a1d892ed6e57
2017-12-01 16:29:47 -05:00
Ted Mielczarek 586c3a1834 bug 1253607 - remove xpcom/reflect/xptcall/md/unix/Makefile.in. r=mshal
This Makefile.in contains a bunch of cruft for Tier-3 platforms. If
someone is still supporting any of them they can make the necessary
fixes to moz.build files themselves.

MozReview-Commit-ID: HxbbCv395Y5

--HG--
extra : rebase_source : 94f04128d2b3dd1285dfeafbfeb320b2f0d0bb19
extra : histedit_source : 2353127161ae58e54b6296e98b6b4b972ae439fe
2017-10-04 06:37:43 -04:00
qiaopengcheng-hf@loongson.cn b051bf36d9 Bug 1394286 - mips64: fix error correction about stackpointer within function _NS_InvokeByIndex. r=froydnj
--HG--
extra : rebase_source : 716b6ff862d57e13b2169ba7fcc1f6e6ef2d636e
2017-08-30 10:01:26 +08:00
Sylvestre Ledru 4e9cf83ee8 Bug 1378712 - Remove all trailing whitespaces r=Ehsan
MozReview-Commit-ID: Kdz2xtTF9EG

--HG--
extra : rebase_source : 7235b3802f25bab29a8c6ba40a181a722f3df0ce
2017-07-06 14:00:35 +02:00
Petr Sumbera b9cd2c83f0 Bug 1369713 - Solaris gcc build of xptcall wrongly expects xptcstubsdef_asm.solx86. r=glandium
--HG--
extra : rebase_source : cf7139ba22da4208c00dbaf1175abf1bfee6f5ba
2017-06-02 05:46:31 -07:00
Jim Chen 14dbe23a6c Bug 1360321 - 6. Add AArch64 support in xpcom; r=froydnj
Add breakpoint support for AArch64, and fix a scanf format specifier
warning. Also fix an #if line in xptcinvoke_arm.cpp to work as intended.

MozReview-Commit-ID: BSjYVD8Zq0t
2017-05-17 13:06:23 -04:00
Nathan Froyd bfc429531b Bug 1355853 - add CFI directives for x86-64 Linux xptcall assembly routines; r=jseward
Adding these directives means unwinding the stack with the profiler will
no longer get confused when we need to unwind through these functions.
2017-04-13 08:30:56 -04:00
Jan Beich 5f6e848e09 Bug 1330119 - Build Linux aarch64 code in XPTCALL also on BSDs. r=froydnj
MozReview-Commit-ID: 92T1qG5yVx2

--HG--
extra : rebase_source : db1579c6ef5493bbdeb347d9021faa521261d24b
2017-01-10 22:50:32 +00:00
Sylvestre Ledru 5bedb078f1 Bug 1338086 - Remove useless else blocks in order to reduce complexity in xpcom/ r=froydnj
MozReview-Commit-ID: JUJARn5Nspp

--HG--
extra : rebase_source : c719d19215fb26ace822269c2a28faf5cf35ffbb
2017-02-09 15:31:35 +01:00
Benjamin Smedberg 5030045d16 Bug 1332631 part F - move nsXPTCUtils.h to xpcom/reflect/xptcall, r=froydnj
MozReview-Commit-ID: 7h69wKKdvwe

--HG--
rename : xpcom/glue/nsXPTCUtils.h => xpcom/reflect/xptcall/nsXPTCUtils.h
extra : rebase_source : 5939339f35e842e025538fed616d405f15749d82
extra : histedit_source : 99784f8fad561d895dfa09ff996d120bacc325fd
2017-01-20 14:25:46 -05:00
Benjamin Smedberg c7352a6657 Bug 1306329 - Stop exporting XPCOM and XUL symbols. r=glandium
--HG--
extra : rebase_source : 482177f9c1026e527cff9f23b36a5076fa6d07a5
2016-12-02 12:55:34 -05:00
Wes Kocher d4ced30f67 Backed out 4 changesets (bug 1306329) for 3000+ hazards a=backout
Backed out changeset 1c2f51ce3faf (bug 1306329)
Backed out changeset 6bb17b9a62d8 (bug 1306329)
Backed out changeset 377ca1419f1a (bug 1306329)
Backed out changeset ad4e531c7070 (bug 1306329)

MozReview-Commit-ID: KJAxdyJeJ6J
2017-01-17 17:55:24 -08:00
Benjamin Smedberg d616a7ec44 Bug 1306329 - Stop exporting XPCOM and XUL symbols. r=glandium
--HG--
extra : rebase_source : 8c700498470b42279197f316d553154b1f2ed235
2016-12-02 12:55:34 -05:00
John David Anglin 0beeba79e1 Bug 1325495 - xpcom: Save %r26 in arg0 stack slot on hppa with gcc. r=froydnj
In the 32-bit parisc runtime, the first four non floating-point
arguments are passed in registers (%r26, %r25, %r24 and %r23).
The remaining arguments are passed on the stack. There are four
reserved slots on the stack that the callee can use to save the
first four argument registers if the callee desires.

The StubN functions are special in that arguments are not explicitly
declared. %r26 is used for the "self" pointer. The call to SharedStub(n)
loads n into %r26 and clobbers the "self" pointer in %r26. The hppa
SharedStub implementation expects to find the "self" pointer on the
stack in the slot reserved for StubN. However, gcc doesn't copy any
arguments to the stack as no arguments are declared for StubN. Even
if it did, there's no guarantee that we could force gcc to save the
argument on the stack as that's more expensive than copying to a
free register. Thus, we need to copy %r26 to the stack slot manually.
2017-01-12 06:37:13 +09:00
John Paul Adrian Glaubitz fde7f4bca8 Bug 1275204 - Use OpenBSD/sparc64 xptcall stubs on Linux/sparc64. r=froydnj 2017-01-11 16:04:34 +09:00
Andrew McCreight fccb0645ed Bug 1323042 - forbid MOZ_COUNT_{CTOR,DTOR} for nsISupports classes; r=froydnj 2016-12-12 09:27:58 -05:00
Nathan Froyd 826598caba Backout aba6c73511a2 (bug 1307961) for massive test bustage resulting in a CLOSED TREE; r=alltheorange 2016-12-12 08:45:46 -05:00
Andrew McCreight e31b5489da Bug 1307961 - require consistent bloatview reporting for nsISupports classes; r=froydnj 2016-12-12 07:58:33 -05:00
Trevor Saunders ed793c18d7 bug 1272498 - remove a obsolete and now useless comment 2016-11-16 01:17:40 -05:00
Trevor Saunders 17486e3454 bug 1272498 - rewrite NS_InvokeByIndex in assembly r=froydnj 2016-11-15 22:07:40 -05:00
Eric Rahm 2b4f954694 Bug 1316737 - Remove XPCOM test TestXPTCInvoke. r=froydnj
This removes the GeckoSimpleProgram TestXPTCInvoke which is neither compiled
nor run.

MozReview-Commit-ID: 5JdVEjEUUmu
2016-11-11 12:02:10 -08:00
Laszlo Ersek b3ba117711 Bug 1304962 - fix argument processing in AARCH64 xptcall; r=froydnj
The invoke_copy_to_stack() function passes incorrect "stack_args" and
"end" arguments to the alloc_word() utility function, for parameter types
T_I8..T_I64, T_U8..T_U64, T_BOOL, T_CHAR and T_WCHAR.

Namely, the "end" input parameter of invoke_copy_to_stack(), which is
currently incorrectly passed as "end" to alloc_word(), points to the very
end of the entire exchange area between _NS_InvokeByIndex() and
invoke_copy_to_stack(). However, alloc_word()'s "end" parameter should
point to the end of the "ireg" (integer registers) sub-area of the
exchange area. That is, "ireg_end" should be passed to alloc_word() as
"end".

Because invoke_copy_to_stack()'s "end" input parameter is strictly greater
than "ireg_end", alloc_word() will happily trample over the "freg"
(floating point registers) area, on the above-mentioned type branches,
given a large enough "paramCount".

Similarly, as second argument, "stack_args" should be passed to
alloc_word(), pointing to the next available stack slot, for spilled-over
arguments. Passing "stk", which initially points to the base of the entire
exchange area (and hence the base of the "ireg" area) makes no sense.

The two other alloc_word() calls in the function are correct. So
centralize all calls to alloc_word() to a single location -- thereby
ending up with a sole call site per alloc_XXX() function --, and compute
only the last argument, "word", conditionally.

This fixes an obscure SIGSEGV in AARCH64 Firefox. Triggering the bug
requires a target function with seven integer-like parameters (not
counting the implicit "this" -- aka "that" -- parameter), followed by at
least one parameter of the above buggy types. nsIOService::NewChannel2()
is such a target function, for example.

DONTBUILD because NPTOB
2016-09-24 06:36:16 +02:00
Tom Tromey 5538d692d3 Bug 1286877 - do not set c-basic-offset for python-mode; r=gps
This removes the unnecessary setting of c-basic-offset from all
python-mode files.

This was automatically generated using

    perl -pi -e 's/; *c-basic-offset: *[0-9]+//'

... on the affected files.

The bulk of these files are moz.build files but there a few others as
well.

MozReview-Commit-ID: 2pPf3DEiZqx

--HG--
extra : rebase_source : 0a7dcac80b924174a2c429b093791148ea6ac204
2016-07-14 10:16:42 -06:00
Chris Peterson 8a9e2d2bd4 Bug 1272513 - Part 2: Remove redundant -Wshadow CXXFLAGS from moz.build files. r=glandium 2016-05-14 00:54:55 -07:00
Christian Holler 66408836a1 Bug 1252072 - Prevent ASan instrumentation for unsafe xpcom functions. r=froydnj
MozReview-Commit-ID: 5k2RAVPlcAI

--HG--
extra : rebase_source : cf9270a5f743d032f5e8cb0f1f8d691ec3d965b1
2016-02-29 21:39:03 +01:00
Paul Bignier 73d69ff7c5 Bug 1245099 - Fixed uninitialized variable warning. r=bsmedberg 2016-02-02 06:41:00 +01:00
Jan Beich b99a9577ea Bug 1235610 - Add xpctall support for Bitrig and DragonFly. r=glandium
--HG--
extra : transplant_source : %AD%3E%B5E%09%15%D7%CF%86%E37%FA%09%BF%E1%40%AF%E8%DCK
2015-12-29 18:06:20 +00:00
Nathan Froyd 0fe98fa9ef Bug 1234860 - move win32 NS_InvokeByIndex implementation to a separate assembly file; r=aklotz,ted.m
On win32, NS_InvokeByIndex is implemented with inline assembly.  This
inline assembly assumes that it is wrapped by the compiler with the
standard x86 prologue and epilogue:

    push ebp
    mov ebp, esp
    [inline assembly that manipulates the stack pointer]
    pop ebp
    ret

In particular, the last instruction of the inline assembly is:

    mov esp, ebp

which cancels out the effects of the stack manipulation performed by all
the inline assembly that proceeds the instruction.

When compiling with clang-cl, however, the above assumption does not
hold, as clang-cl inserts a more complex prologue and epilogue,
something like:

    push ebp
    mov ebp, esp
    sub esp, frame_size
    [save registers into stack frame]
    [inline assembly that manipulates the stack pointer]
    [restore registers from stack frame]
    add esp, frame_size
    mov esp, ebp
    pop ebp
    ret

Combining this more extensive prologue and epilogue with the assumptions
of the inline assembly leads to interesting crashes when
NS_InvokeByIndex is called: the inline assembly effectively deallocates
the stack allocated by the inline assembly *and* the stack frame
allocated by the compiler itself.  The compiler-generated code then
attemptes to deallocate the stack frame, leading to the crash, as the
code now returns to an unspecified address.

To avoid these sorts of problems in clang-cl and make the code more
robust generally, let's move the NS_InvokeByIndex implementation to a
separate assembly file.  We can then write exactly what we need to have
happen, safe from any manipulations of the compiler.

Since we don't compile much (any?) code in Gecko with MASM, we need to
add the /SAFESEH flag to the assembler invocation so that the object
file with be appropriately marked as not containing exception handlers;
the linker (which is invoked with the /SAFESEH flag itself) will then
consent to link it into libxul.
2015-12-23 11:45:38 -05:00
Ted Mielczarek c669bcf3d2 bug 681602 - Implement xptcall for arm iOS. r=glandium
xptcstubs_arm mostly works on iOS but Apple's assembler is ridiculous so
the inline assembly for the SharedStub and the stub methods needs judicious
preprocessor use.

--HG--
extra : commitid : ChAcktTzVX0
extra : rebase_source : 11fbaa4940fd9aaeba51e2477d4c8b1a7851791e
2015-09-23 09:57:10 -04:00
Chris Peterson 71920a9550 Bug 1207030 - Enable -Wshadow flag in more directories that have no -Wshadow warnings. r=glandium 2015-09-22 21:39:03 -07:00
Chris Peterson 0dbaae1ce2 Bug 1204403 - Fix -Wshadow warnings in xpcom. r=mccr8 2015-09-07 23:56:16 -07:00
Nicholas Nethercote f44287005f Bug 1198334 (part 1) - Replace the opt-in FAIL_ON_WARNINGS with the opt-out ALLOW_COMPILER_WARNINGS. r=glandium.
The patch removes 455 occurrences of FAIL_ON_WARNINGS from moz.build files, and
adds 78 instances of ALLOW_COMPILER_WARNINGS. About half of those 78 are in
code we control and which should be removable with a little effort.

--HG--
extra : rebase_source : 82e3387abfbd5f1471e953961d301d3d97ed2973
2015-08-27 20:44:53 -07:00
David Major 521d956cba Bug 1196370 - Remove the clang assembly workaround from bug 1028613. r=ehsan 2015-08-20 14:34:57 -07:00
Andrew McCreight 12b6a0a427 Bug 1189423 - part 2 - Remove superfluous |new| result check. r=froydnj 2015-07-30 15:06:00 +02:00
Andrew McCreight 0869c89dae Bug 1189423 - part 1 - Add MOZ_COUNT_CTOR/DTOR for nsXPTCStubBase. r=froydnj 2015-08-04 14:30:00 +02:00