mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 22:55:23 +00:00
[JAEGER] Merge from tracemonkey.
This commit is contained in:
commit
0c268b4fe8
@ -1138,12 +1138,26 @@
|
||||
notificationbox.setAttribute("flex", "1");
|
||||
notificationbox.appendChild(b);
|
||||
b.setAttribute("flex", "1");
|
||||
|
||||
var position = this.tabs.length - 1;
|
||||
var uniqueId = "panel" + Date.now() + position;
|
||||
notificationbox.id = uniqueId;
|
||||
t.linkedPanel = uniqueId;
|
||||
t.linkedBrowser = b;
|
||||
t._tPos = position;
|
||||
if (t.previousSibling.selected)
|
||||
t.setAttribute("afterselected", true);
|
||||
|
||||
// NB: this appendChild call causes us to run constructors for the
|
||||
// browser element, which fires off a bunch of notifications. Some
|
||||
// of those notifications can cause code to run that inspects our
|
||||
// state, so it is important that the tab element is fully
|
||||
// initialized by this point.
|
||||
this.mPanelContainer.appendChild(notificationbox);
|
||||
|
||||
this.tabContainer.updateVisibility();
|
||||
|
||||
// wire up a progress listener for the new browser object.
|
||||
var position = this.tabs.length - 1;
|
||||
var tabListener = this.mTabProgressListener(t, b, blank);
|
||||
const filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
|
||||
.createInstance(Components.interfaces.nsIWebProgress);
|
||||
@ -1155,14 +1169,6 @@
|
||||
b._fastFind = this.fastFind;
|
||||
b.droppedLinkHandler = handleDroppedLink;
|
||||
|
||||
var uniqueId = "panel" + Date.now() + position;
|
||||
this.mPanelContainer.lastChild.id = uniqueId;
|
||||
t.linkedPanel = uniqueId;
|
||||
t.linkedBrowser = b;
|
||||
t._tPos = position;
|
||||
if (t.previousSibling.selected)
|
||||
t.setAttribute("afterselected", true);
|
||||
|
||||
this.tabContainer.adjustTabstrip();
|
||||
|
||||
// Dispatch a new tab notification. We do this once we're
|
||||
|
@ -1,4 +1,4 @@
|
||||
var expected = ["TabOpen", "onLocationChange", "onStateChange", "onLinkIconAvailable"];
|
||||
var expected = ["TabOpen", "onStateChange", "onLocationChange", "onLinkIconAvailable"];
|
||||
var actual = [];
|
||||
var tabIndex = -1;
|
||||
__defineGetter__("tab", function () gBrowser.tabs[tabIndex]);
|
||||
|
@ -344,27 +344,29 @@ nsInProcessTabChildGlobal::LoadFrameScript(const nsAString& aURL)
|
||||
}
|
||||
|
||||
if (!dataString.IsEmpty()) {
|
||||
JSAutoRequest ar(mCx);
|
||||
jsval retval;
|
||||
JSObject* global = nsnull;
|
||||
mGlobal->GetJSObject(&global);
|
||||
if (!global) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSPrincipals* jsprin = nsnull;
|
||||
mPrincipal->GetJSPrincipals(mCx, &jsprin);
|
||||
nsContentUtils::XPConnect()->FlagSystemFilenamePrefix(url.get(), PR_TRUE);
|
||||
nsContentUtils::ThreadJSContextStack()->Push(mCx);
|
||||
PRBool tmp = mLoadingScript;
|
||||
mLoadingScript = PR_TRUE;
|
||||
JS_EvaluateUCScriptForPrincipals(mCx, global, jsprin,
|
||||
(jschar*)dataString.get(),
|
||||
dataString.Length(),
|
||||
url.get(), 1, &retval);
|
||||
//XXX Argh, JSPrincipals are manually refcounted!
|
||||
JSPRINCIPALS_DROP(mCx, jsprin);
|
||||
mLoadingScript = tmp;
|
||||
{
|
||||
// Need to scope JSAutoRequest to happen after Push but before Pop,
|
||||
// at least for now. See bug 584673.
|
||||
JSAutoRequest ar(mCx);
|
||||
jsval retval;
|
||||
JSObject* global = nsnull;
|
||||
mGlobal->GetJSObject(&global);
|
||||
if (global) {
|
||||
JSPrincipals* jsprin = nsnull;
|
||||
mPrincipal->GetJSPrincipals(mCx, &jsprin);
|
||||
nsContentUtils::XPConnect()->FlagSystemFilenamePrefix(url.get(), PR_TRUE);
|
||||
PRBool tmp = mLoadingScript;
|
||||
mLoadingScript = PR_TRUE;
|
||||
JS_EvaluateUCScriptForPrincipals(mCx, global, jsprin,
|
||||
(jschar*)dataString.get(),
|
||||
dataString.Length(),
|
||||
url.get(), 1, &retval);
|
||||
//XXX Argh, JSPrincipals are manually refcounted!
|
||||
JSPRINCIPALS_DROP(mCx, jsprin);
|
||||
mLoadingScript = tmp;
|
||||
}
|
||||
}
|
||||
JSContext* unused;
|
||||
nsContentUtils::ThreadJSContextStack()->Pop(&unused);
|
||||
}
|
||||
|
@ -80,6 +80,13 @@ var focusableElements = [
|
||||
"<iframe src=\"about:blank\" tabindex=\"1\"></iframe>",
|
||||
"<iframe src=\"about:blank\" contenteditable=\"true\"></iframe>",
|
||||
|
||||
"<iframe></iframe>",
|
||||
"<iframe tabindex=\"-1\"></iframe>",
|
||||
"<iframe tabindex=\"0\"></iframe>",
|
||||
"<iframe tabindex=\"0\" disabled></iframe>",
|
||||
"<iframe tabindex=\"1\"></iframe>",
|
||||
"<iframe disabled></iframe>",
|
||||
|
||||
"<img tabindex=\"-1\">",
|
||||
"<img tabindex=\"0\">",
|
||||
"<img tabindex=\"0\" disabled>",
|
||||
@ -179,13 +186,6 @@ var nonFocusableElements = [
|
||||
"<div tabindex=\"0\" disabled></div>",
|
||||
"<div disabled></div>",
|
||||
|
||||
"<iframe></iframe>",
|
||||
"<iframe tabindex=\"-1\"></iframe>",
|
||||
"<iframe tabindex=\"0\"></iframe>",
|
||||
"<iframe tabindex=\"0\" disabled></iframe>",
|
||||
"<iframe tabindex=\"1\"></iframe>",
|
||||
"<iframe disabled></iframe>",
|
||||
|
||||
"<img>",
|
||||
"<img disabled>",
|
||||
"<img contenteditable=\"true\">",
|
||||
@ -280,12 +280,19 @@ var focusableInContentEditable = [
|
||||
"<embed contenteditable=\"true\">",
|
||||
|
||||
"<iframe src=\"about:blank\"></iframe>",
|
||||
"<iframe></iframe>",
|
||||
"<iframe src=\"about:blank\" disabled></iframe>",
|
||||
"<iframe disabled></iframe>",
|
||||
"<iframe src=\"about:blank\" tabindex=\"-1\"></iframe>",
|
||||
"<iframe tabindex=\"-1\"></iframe>",
|
||||
"<iframe src=\"about:blank\" tabindex=\"0\"></iframe>",
|
||||
"<iframe tabindex=\"0\"></iframe>",
|
||||
"<iframe src=\"about:blank\" tabindex=\"0\" disabled></iframe>",
|
||||
"<iframe tabindex=\"0\" disabled></iframe>",
|
||||
"<iframe src=\"about:blank\" tabindex=\"1\"></iframe>",
|
||||
"<iframe tabindex=\"1\"></iframe>",
|
||||
"<iframe src=\"about:blank\" contenteditable=\"true\"></iframe>",
|
||||
"<iframe contenteditable=\"true\"></iframe>",
|
||||
|
||||
"<img tabindex=\"-1\">",
|
||||
"<img tabindex=\"0\">",
|
||||
|
@ -120,6 +120,7 @@
|
||||
"<body>test1</body></html>";
|
||||
|
||||
gExpected = [{type: "pagehide", persisted: true},
|
||||
|
||||
{type: "load", title: "test1"},
|
||||
{type: "pageshow", title: "test1", persisted: false}];
|
||||
gBrowser.loadURI(test1Doc);
|
||||
|
@ -240,7 +240,7 @@ function pageEventListener(event) {
|
||||
try {
|
||||
dump("TEST: eventListener received a " + event.type + " event for page " +
|
||||
event.originalTarget.title + ", persisted=" + event.persisted + "\n");
|
||||
}catch(e) {
|
||||
} catch(e) {
|
||||
// Ignore any exception.
|
||||
}
|
||||
|
||||
@ -293,8 +293,8 @@ function pageEventListener(event) {
|
||||
|
||||
if (typeof(expected.persisted) != "undefined") {
|
||||
is(event.persisted, expected.persisted,
|
||||
"The persisted property of the " + event.type + "event on page " +
|
||||
event.originalTarget.title + " had an unexpected value");
|
||||
"The persisted property of the " + event.type + " event on page " +
|
||||
event.originalTarget.location + " had an unexpected value");
|
||||
}
|
||||
|
||||
// If we're out of expected events, let doPageNavigation() return.
|
||||
|
@ -4837,6 +4837,10 @@ nsCommonWindowSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
|
||||
nsGlobalWindow *win = nsGlobalWindow::FromSupports(nativeObj);
|
||||
|
||||
if (win->IsOuterWindow()) {
|
||||
win->EnsureInnerWindow();
|
||||
}
|
||||
|
||||
if (sgo) {
|
||||
*parentObj = sgo->GetGlobalJSObject();
|
||||
|
||||
@ -5164,6 +5168,9 @@ nsCommonWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
// check and return.
|
||||
|
||||
nsGlobalWindow *frameWin = (nsGlobalWindow *)frame.get();
|
||||
NS_ASSERTION(frameWin->IsOuterWindow(), "GetChildFrame gave us an inner?");
|
||||
|
||||
frameWin->EnsureInnerWindow();
|
||||
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
rv = WrapNative(cx, frameWin->GetGlobalJSObject(), frame,
|
||||
|
@ -1304,13 +1304,6 @@ nsGlobalWindow::SetScriptContext(PRUint32 lang_id, nsIScriptContext *aScriptCont
|
||||
|
||||
aScriptContext->SetGCOnDestruction(PR_FALSE);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
|
||||
|
||||
aScriptContext->CreateOuterObject(this, principal);
|
||||
aScriptContext->DidInitializeContext();
|
||||
mJSObject = (JSObject *)aScriptContext->GetNativeGlobal();
|
||||
}
|
||||
|
||||
mContext = aScriptContext;
|
||||
@ -1620,6 +1613,10 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
if (IsFrozen()) {
|
||||
// This outer is now getting its first inner, thaw the outer now
|
||||
// that it's ready and is getting an inner window.
|
||||
mContext->CreateOuterObject(this, aDocument->NodePrincipal());
|
||||
mContext->DidInitializeContext();
|
||||
mJSObject = (JSObject *)mContext->GetNativeGlobal();
|
||||
|
||||
Thaw();
|
||||
}
|
||||
|
||||
|
@ -1520,17 +1520,17 @@ jsvalToPtrExplicit(JSContext* cx, jsval val, uintptr_t* result)
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class IntegerType>
|
||||
template<class IntegerType, class CharType, size_t N, class AP>
|
||||
void
|
||||
IntegerToString(IntegerType i, jsuint radix, AutoString& result)
|
||||
IntegerToString(IntegerType i, jsuint radix, Vector<CharType, N, AP>& result)
|
||||
{
|
||||
JS_STATIC_ASSERT(numeric_limits<IntegerType>::is_exact);
|
||||
|
||||
// The buffer must be big enough for all the bits of IntegerType to fit,
|
||||
// in base-2, including '-'.
|
||||
jschar buffer[sizeof(IntegerType) * 8 + 1];
|
||||
jschar* end = buffer + sizeof(buffer) / sizeof(jschar);
|
||||
jschar* cp = end;
|
||||
CharType buffer[sizeof(IntegerType) * 8 + 1];
|
||||
CharType* end = buffer + sizeof(buffer) / sizeof(CharType);
|
||||
CharType* cp = end;
|
||||
|
||||
// Build the string in reverse. We use multiplication and subtraction
|
||||
// instead of modulus because that's much faster.
|
||||
@ -4636,6 +4636,46 @@ PrepareCIF(JSContext* cx,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FunctionType::BuildSymbolName(JSContext* cx,
|
||||
JSString* name,
|
||||
JSObject* typeObj,
|
||||
AutoCString& result)
|
||||
{
|
||||
FunctionInfo* fninfo = GetFunctionInfo(cx, typeObj);
|
||||
|
||||
switch (GetABICode(cx, fninfo->mABI)) {
|
||||
case ABI_DEFAULT:
|
||||
// For cdecl functions, no mangling is necessary.
|
||||
AppendString(result, name);
|
||||
break;
|
||||
|
||||
case ABI_STDCALL: {
|
||||
// On WIN32, stdcall functions look like:
|
||||
// _foo@40
|
||||
// where 'foo' is the function name, and '40' is the aligned size of the
|
||||
// arguments.
|
||||
AppendString(result, "_");
|
||||
AppendString(result, name);
|
||||
AppendString(result, "@");
|
||||
|
||||
// Compute the suffix by aligning each argument to sizeof(ffi_arg).
|
||||
size_t size = 0;
|
||||
for (size_t i = 0; i < fninfo->mArgTypes.length(); ++i) {
|
||||
JSObject* argType = fninfo->mArgTypes[i];
|
||||
size += Align(CType::GetSize(cx, argType), sizeof(ffi_arg));
|
||||
}
|
||||
|
||||
IntegerToString(size, 10, result);
|
||||
break;
|
||||
}
|
||||
|
||||
case INVALID_ABI:
|
||||
JS_NOT_REACHED("invalid abi");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static FunctionInfo*
|
||||
NewFunctionInfo(JSContext* cx,
|
||||
jsval abiType,
|
||||
|
@ -111,6 +111,8 @@ class Array : public Vector<T, N, SystemAllocPolicy>
|
||||
// String and AutoString classes, based on Vector.
|
||||
typedef Vector<jschar, 0, SystemAllocPolicy> String;
|
||||
typedef Vector<jschar, 64, SystemAllocPolicy> AutoString;
|
||||
typedef Vector<char, 0, SystemAllocPolicy> CString;
|
||||
typedef Vector<char, 64, SystemAllocPolicy> AutoCString;
|
||||
|
||||
// Convenience functions to append, insert, and compare Strings.
|
||||
template <class T, size_t N, class AP, size_t ArrayLength>
|
||||
@ -142,6 +144,20 @@ AppendString(Vector<jschar, N, AP> &v, JSString* str)
|
||||
v.append(str->chars(), str->length());
|
||||
}
|
||||
|
||||
template <size_t N, class AP>
|
||||
void
|
||||
AppendString(Vector<char, N, AP> &v, JSString* str)
|
||||
{
|
||||
JS_ASSERT(str);
|
||||
size_t vlen = v.length();
|
||||
size_t alen = str->length();
|
||||
if (!v.resize(vlen + alen))
|
||||
return;
|
||||
|
||||
for (size_t i = 0; i < alen; ++i)
|
||||
v[i + vlen] = char(str->chars()[i]);
|
||||
}
|
||||
|
||||
template <class T, size_t N, class AP, size_t ArrayLength>
|
||||
void
|
||||
PrependString(Vector<T, N, AP> &v, const char (&array)[ArrayLength])
|
||||
@ -462,6 +478,8 @@ namespace FunctionType {
|
||||
|
||||
FunctionInfo* GetFunctionInfo(JSContext* cx, JSObject* obj);
|
||||
JSObject* GetLibrary(JSContext* cx, JSObject* obj);
|
||||
void BuildSymbolName(JSContext* cx, JSString* name, JSObject* typeObj,
|
||||
AutoCString& result);
|
||||
}
|
||||
|
||||
namespace CClosure {
|
||||
|
@ -268,24 +268,21 @@ Library::Declare(JSContext* cx, uintN argc, jsval* vp)
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
const char* name = JS_GetStringBytesZ(cx, JSVAL_TO_STRING(argv[0]));
|
||||
if (!name)
|
||||
return JS_FALSE;
|
||||
|
||||
JSObject* fnObj = NULL;
|
||||
JSObject* typeObj;
|
||||
js::AutoObjectRooter root(cx);
|
||||
bool isFunction = argc > 2;
|
||||
if (isFunction) {
|
||||
// Case 1).
|
||||
// Create a FunctionType representing the function.
|
||||
typeObj = FunctionType::CreateInternal(cx,
|
||||
argv[1], argv[2], &argv[3], argc - 3);
|
||||
if (!typeObj)
|
||||
fnObj = FunctionType::CreateInternal(cx,
|
||||
argv[1], argv[2], &argv[3], argc - 3);
|
||||
if (!fnObj)
|
||||
return JS_FALSE;
|
||||
root.setObject(typeObj);
|
||||
root.setObject(fnObj);
|
||||
|
||||
// Make a function pointer type.
|
||||
typeObj = PointerType::CreateInternal(cx, typeObj);
|
||||
typeObj = PointerType::CreateInternal(cx, fnObj);
|
||||
if (!typeObj)
|
||||
return JS_FALSE;
|
||||
root.setObject(typeObj);
|
||||
@ -301,16 +298,22 @@ Library::Declare(JSContext* cx, uintN argc, jsval* vp)
|
||||
|
||||
typeObj = JSVAL_TO_OBJECT(argv[1]);
|
||||
if (CType::GetTypeCode(cx, typeObj) == TYPE_pointer) {
|
||||
JSObject* baseType = PointerType::GetBaseType(cx, typeObj);
|
||||
isFunction = baseType && CType::GetTypeCode(cx, baseType) == TYPE_function;
|
||||
fnObj = PointerType::GetBaseType(cx, typeObj);
|
||||
isFunction = fnObj && CType::GetTypeCode(cx, fnObj) == TYPE_function;
|
||||
}
|
||||
}
|
||||
|
||||
void* data;
|
||||
PRFuncPtr fnptr;
|
||||
JSString* nameStr = JSVAL_TO_STRING(argv[0]);
|
||||
AutoCString symbol;
|
||||
if (isFunction) {
|
||||
// Build the symbol, with mangling if necessary.
|
||||
FunctionType::BuildSymbolName(cx, nameStr, fnObj, symbol);
|
||||
AppendString(symbol, "\0");
|
||||
|
||||
// Look up the function symbol.
|
||||
fnptr = PR_FindFunctionSymbol(library, name);
|
||||
fnptr = PR_FindFunctionSymbol(library, symbol.begin());
|
||||
if (!fnptr) {
|
||||
JS_ReportError(cx, "couldn't find function symbol in library");
|
||||
return JS_FALSE;
|
||||
@ -319,7 +322,10 @@ Library::Declare(JSContext* cx, uintN argc, jsval* vp)
|
||||
|
||||
} else {
|
||||
// 'typeObj' is another data type. Look up the data symbol.
|
||||
data = PR_FindSymbol(library, name);
|
||||
AppendString(symbol, nameStr);
|
||||
AppendString(symbol, "\0");
|
||||
|
||||
data = PR_FindSymbol(library, symbol.begin());
|
||||
if (!data) {
|
||||
JS_ReportError(cx, "couldn't find symbol in library");
|
||||
return JS_FALSE;
|
||||
|
@ -1,4 +1,4 @@
|
||||
Patch libffi to fix bug 550602, bug 528129, bug 538216, bug 556902, bug 538002, and bug 581909.
|
||||
Patch libffi to fix bug 550602 and bug 538216.
|
||||
|
||||
diff --git a/js/src/ctypes/libffi/Makefile.in b/js/src/ctypes/libffi/Makefile.in
|
||||
--- a/js/src/ctypes/libffi/Makefile.in
|
||||
@ -107,645 +107,4 @@ diff --git a/js/src/ctypes/libffi/configure b/js/src/ctypes/libffi/configure
|
||||
|
||||
archive_cmds_need_lc=no
|
||||
hardcode_direct=no
|
||||
@@ -12179,17 +12179,17 @@ case "$host" in
|
||||
;;
|
||||
hppa*-*-hpux*)
|
||||
TARGET=PA_HPUX; TARGETDIR=pa
|
||||
;;
|
||||
|
||||
i?86-*-freebsd* | i?86-*-openbsd*)
|
||||
TARGET=X86_FREEBSD; TARGETDIR=x86
|
||||
;;
|
||||
- i?86-win32* | i?86-*-cygwin* | i?86-*-mingw*)
|
||||
+ i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2*)
|
||||
TARGET=X86_WIN32; TARGETDIR=x86
|
||||
# All mingw/cygwin/win32 builds require this for sharedlib
|
||||
AM_LTLDFLAGS="-no-undefined"
|
||||
;;
|
||||
i?86-*-darwin*)
|
||||
TARGET=X86_DARWIN; TARGETDIR=x86
|
||||
;;
|
||||
i?86-*-solaris2.1[0-9]*)
|
||||
diff --git a/js/src/ctypes/libffi/msvcc.sh b/js/src/ctypes/libffi/msvcc.sh
|
||||
--- a/js/src/ctypes/libffi/msvcc.sh
|
||||
+++ b/js/src/ctypes/libffi/msvcc.sh
|
||||
@@ -37,20 +37,21 @@
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#
|
||||
# GCC-compatible wrapper for cl.exe and ml.exe. Arguments are given in GCC
|
||||
# format and translated into something sensible for cl or ml.
|
||||
#
|
||||
|
||||
-args="-nologo -W3"
|
||||
+args="-nologo"
|
||||
md=-MD
|
||||
cl="cl"
|
||||
ml="ml"
|
||||
+safeseh="-safeseh"
|
||||
output=
|
||||
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case $1
|
||||
in
|
||||
-fexceptions)
|
||||
# Don't enable exceptions for now.
|
||||
@@ -58,16 +59,17 @@ do
|
||||
shift 1
|
||||
;;
|
||||
-m32)
|
||||
shift 1
|
||||
;;
|
||||
-m64)
|
||||
cl="cl" # "$MSVC/x86_amd64/cl"
|
||||
ml="ml64" # "$MSVC/x86_amd64/ml64"
|
||||
+ safeseh=
|
||||
shift 1
|
||||
;;
|
||||
-O*)
|
||||
args="$args $1"
|
||||
shift 1
|
||||
;;
|
||||
-g)
|
||||
# Can't specify -RTC1 or -Zi in opt. -Gy is ok. Use -OPT:REF?
|
||||
@@ -103,17 +105,18 @@ do
|
||||
includes="$includes $1"
|
||||
shift 1
|
||||
;;
|
||||
-W|-Wextra)
|
||||
# TODO map extra warnings
|
||||
shift 1
|
||||
;;
|
||||
-Wall)
|
||||
- args="$args -Wall"
|
||||
+ # -Wall on MSVC is overzealous. Use -W3 instead.
|
||||
+ args="$args -W3"
|
||||
shift 1
|
||||
;;
|
||||
-Werror)
|
||||
args="$args -WX"
|
||||
shift 1
|
||||
;;
|
||||
-W*)
|
||||
# TODO map specific warnings
|
||||
@@ -158,17 +161,17 @@ done
|
||||
if [ -n "$assembly" ]; then
|
||||
if [ -z "$outdir" ]; then
|
||||
outdir="."
|
||||
fi
|
||||
ppsrc="$outdir/$(basename $src|sed 's/.S$/.asm/g')"
|
||||
echo "$cl -nologo -EP $includes $defines $src > $ppsrc"
|
||||
"$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $?
|
||||
output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')"
|
||||
- args="-nologo -safeseh $single $output $ppsrc"
|
||||
+ args="-nologo $safeseh $single $output $ppsrc"
|
||||
|
||||
echo "$ml $args"
|
||||
eval "\"$ml\" $args"
|
||||
result=$?
|
||||
|
||||
# required to fix ml64 broken output?
|
||||
#mv *.obj $outdir
|
||||
else
|
||||
diff --git a/js/src/ctypes/libffi/src/powerpc/ffi_darwin.c b/js/src/ctypes/libffi/src/powerpc/ffi_darwin.c
|
||||
--- a/js/src/ctypes/libffi/src/powerpc/ffi_darwin.c
|
||||
+++ b/js/src/ctypes/libffi/src/powerpc/ffi_darwin.c
|
||||
@@ -339,17 +339,17 @@ aix_adjust_aggregate_sizes (ffi_type *s)
|
||||
/* Do not add additional tail padding. */
|
||||
}
|
||||
|
||||
/* Perform machine dependent cif processing. */
|
||||
ffi_status
|
||||
ffi_prep_cif_machdep (ffi_cif *cif)
|
||||
{
|
||||
/* All this is for the DARWIN ABI. */
|
||||
- int i;
|
||||
+ unsigned i;
|
||||
ffi_type **ptr;
|
||||
unsigned bytes;
|
||||
int fparg_count = 0, intarg_count = 0;
|
||||
unsigned flags = 0;
|
||||
unsigned size_al = 0;
|
||||
|
||||
/* All the machine-independent calculation of cif->bytes will be wrong.
|
||||
All the calculation of structure sizes will also be wrong.
|
||||
@@ -537,21 +537,21 @@ ffi_call (ffi_cif *cif, void (*fn)(void)
|
||||
}
|
||||
else
|
||||
ecif.rvalue = rvalue;
|
||||
|
||||
switch (cif->abi)
|
||||
{
|
||||
case FFI_AIX:
|
||||
ffi_call_AIX(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn,
|
||||
- ffi_prep_args);
|
||||
+ FFI_FN(ffi_prep_args));
|
||||
break;
|
||||
case FFI_DARWIN:
|
||||
ffi_call_DARWIN(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn,
|
||||
- ffi_prep_args);
|
||||
+ FFI_FN(ffi_prep_args));
|
||||
break;
|
||||
default:
|
||||
FFI_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void flush_icache(char *);
|
||||
@@ -794,32 +794,32 @@ ffi_closure_helper_DARWIN (ffi_closure *
|
||||
break;
|
||||
|
||||
case FFI_TYPE_STRUCT:
|
||||
#ifdef POWERPC64
|
||||
size_al = arg_types[i]->size;
|
||||
if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE)
|
||||
size_al = ALIGN (arg_types[i]->size, 8);
|
||||
if (size_al < 3 && cif->abi == FFI_DARWIN)
|
||||
- avalue[i] = (void *) pgr + 8 - size_al;
|
||||
+ avalue[i] = (char *) pgr + 8 - size_al;
|
||||
else
|
||||
- avalue[i] = (void *) pgr;
|
||||
+ avalue[i] = pgr;
|
||||
pgr += (size_al + 7) / 8;
|
||||
#else
|
||||
/* Structures that match the basic modes (QI 1 byte, HI 2 bytes,
|
||||
SI 4 bytes) are aligned as if they were those modes. */
|
||||
size_al = arg_types[i]->size;
|
||||
/* If the first member of the struct is a double, then align
|
||||
the struct to double-word. */
|
||||
if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE)
|
||||
size_al = ALIGN(arg_types[i]->size, 8);
|
||||
if (size_al < 3 && cif->abi == FFI_DARWIN)
|
||||
- avalue[i] = (void*) pgr + 4 - size_al;
|
||||
+ avalue[i] = (char*) pgr + 4 - size_al;
|
||||
else
|
||||
- avalue[i] = (void*) pgr;
|
||||
+ avalue[i] = pgr;
|
||||
pgr += (size_al + 3) / 4;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case FFI_TYPE_SINT64:
|
||||
case FFI_TYPE_UINT64:
|
||||
#ifdef POWERPC64
|
||||
case FFI_TYPE_POINTER:
|
||||
diff --git a/js/src/ctypes/libffi/src/x86/ffi.c b/js/src/ctypes/libffi/src/x86/ffi.c
|
||||
--- a/js/src/ctypes/libffi/src/x86/ffi.c
|
||||
+++ b/js/src/ctypes/libffi/src/x86/ffi.c
|
||||
@@ -204,17 +204,17 @@ ffi_status ffi_prep_cif_machdep(ffi_cif
|
||||
else if (cif->rtype->size == 8)
|
||||
{
|
||||
cif->flags = FFI_TYPE_SINT64; /* same as int64 type */
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cif->flags = FFI_TYPE_STRUCT;
|
||||
- // allocate space for return value pointer
|
||||
+ /* allocate space for return value pointer */
|
||||
cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
#ifdef X86_WIN64
|
||||
cif->flags = FFI_TYPE_SINT64;
|
||||
break;
|
||||
@@ -229,17 +229,17 @@ ffi_status ffi_prep_cif_machdep(ffi_cif
|
||||
for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
|
||||
{
|
||||
if (((*ptr)->alignment - 1) & cif->bytes)
|
||||
cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment);
|
||||
cif->bytes += ALIGN((*ptr)->size, FFI_SIZEOF_ARG);
|
||||
}
|
||||
|
||||
#ifdef X86_WIN64
|
||||
- // ensure space for storing four registers
|
||||
+ /* ensure space for storing four registers */
|
||||
cif->bytes += 4 * sizeof(ffi_arg);
|
||||
#endif
|
||||
|
||||
#ifdef X86_DARWIN
|
||||
cif->bytes = (cif->bytes + 15) & ~0xF;
|
||||
#endif
|
||||
|
||||
return FFI_OK;
|
||||
@@ -287,18 +287,18 @@ void ffi_call(ffi_cif *cif, void (*fn)(v
|
||||
ecif.rvalue = rvalue;
|
||||
|
||||
|
||||
switch (cif->abi)
|
||||
{
|
||||
#ifdef X86_WIN64
|
||||
case FFI_WIN64:
|
||||
{
|
||||
- // Make copies of all struct arguments
|
||||
- // NOTE: not sure if responsibility should be here or in caller
|
||||
+ /* Make copies of all struct arguments
|
||||
+ NOTE: not sure if responsibility should be here or in caller */
|
||||
unsigned int i;
|
||||
for (i=0; i < cif->nargs;i++) {
|
||||
size_t size = cif->arg_types[i]->size;
|
||||
if ((cif->arg_types[i]->type == FFI_TYPE_STRUCT
|
||||
&& (size != 1 && size != 2 && size != 4 && size != 8))
|
||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
||||
|| cif->arg_types[i]->type == FFI_TYPE_LONGDOUBLE
|
||||
#endif
|
||||
@@ -580,20 +580,20 @@ ffi_prep_raw_closure_loc (ffi_raw_closur
|
||||
void *codeloc)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (cif->abi != FFI_SYSV) {
|
||||
return FFI_BAD_ABI;
|
||||
}
|
||||
|
||||
- // we currently don't support certain kinds of arguments for raw
|
||||
- // closures. This should be implemented by a separate assembly language
|
||||
- // routine, since it would require argument processing, something we
|
||||
- // don't do now for performance.
|
||||
+ /* we currently don't support certain kinds of arguments for raw
|
||||
+ closures. This should be implemented by a separate assembly language
|
||||
+ routine, since it would require argument processing, something we
|
||||
+ don't do now for performance. */
|
||||
|
||||
for (i = cif->nargs-1; i >= 0; i--)
|
||||
{
|
||||
FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT);
|
||||
FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/js/src/ctypes/libffi/src/x86/ffitarget.h b/js/src/ctypes/libffi/src/x86/ffitarget.h
|
||||
--- a/js/src/ctypes/libffi/src/x86/ffitarget.h
|
||||
+++ b/js/src/ctypes/libffi/src/x86/ffitarget.h
|
||||
@@ -33,17 +33,17 @@
|
||||
|
||||
#if defined (X86_64) && defined (__i386__)
|
||||
#undef X86_64
|
||||
#define X86
|
||||
#endif
|
||||
|
||||
#ifdef X86_WIN64
|
||||
#define FFI_SIZEOF_ARG 8
|
||||
-#define USE_BUILTIN_FFS 0 // not yet implemented in mingw-64
|
||||
+#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */
|
||||
#endif
|
||||
|
||||
/* ---- Generic type definitions ----------------------------------------- */
|
||||
|
||||
#ifndef LIBFFI_ASM
|
||||
#ifdef X86_WIN64
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned __int64 ffi_arg;
|
||||
diff --git a/js/src/ctypes/libffi/src/closures.c b/js/src/ctypes/libffi/src/closures.c
|
||||
--- a/js/src/ctypes/libffi/src/closures.c
|
||||
+++ b/js/src/ctypes/libffi/src/closures.c
|
||||
@@ -39,17 +39,17 @@
|
||||
option is defined will attempt to map such pages once, but if it
|
||||
fails, it falls back to creating a temporary file in a writable and
|
||||
executable filesystem and mapping pages from it into separate
|
||||
locations in the virtual memory space, one location writable and
|
||||
another executable. */
|
||||
# define FFI_MMAP_EXEC_WRIT 1
|
||||
# define HAVE_MNTENT 1
|
||||
# endif
|
||||
-# if defined(X86_WIN32) || defined(X86_WIN64)
|
||||
+# if defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)
|
||||
/* Windows systems may have Data Execution Protection (DEP) enabled,
|
||||
which requires the use of VirtualMalloc/VirtualFree to alloc/free
|
||||
executable memory. */
|
||||
# define FFI_MMAP_EXEC_WRIT 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if FFI_MMAP_EXEC_WRIT && !defined FFI_MMAP_EXEC_SELINUX
|
||||
@@ -188,31 +188,31 @@ static size_t dlmalloc_footprint(void) M
|
||||
static size_t dlmalloc_max_footprint(void) MAYBE_UNUSED;
|
||||
static void** dlindependent_calloc(size_t, size_t, void**) MAYBE_UNUSED;
|
||||
static void** dlindependent_comalloc(size_t, size_t*, void**) MAYBE_UNUSED;
|
||||
static void *dlpvalloc(size_t) MAYBE_UNUSED;
|
||||
static int dlmalloc_trim(size_t) MAYBE_UNUSED;
|
||||
static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED;
|
||||
static void dlmalloc_stats(void) MAYBE_UNUSED;
|
||||
|
||||
-#if !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__)
|
||||
+#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__)
|
||||
/* Use these for mmap and munmap within dlmalloc.c. */
|
||||
static void *dlmmap(void *, size_t, int, int, int, off_t);
|
||||
static int dlmunmap(void *, size_t);
|
||||
-#endif /* !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__) */
|
||||
+#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) */
|
||||
|
||||
#define mmap dlmmap
|
||||
#define munmap dlmunmap
|
||||
|
||||
#include "dlmalloc.c"
|
||||
|
||||
#undef mmap
|
||||
#undef munmap
|
||||
|
||||
-#if !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__)
|
||||
+#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__)
|
||||
|
||||
/* A mutex used to synchronize access to *exec* variables in this file. */
|
||||
static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/* A file descriptor of a temporary file from which we'll map
|
||||
executable pages. */
|
||||
static int execfd = -1;
|
||||
|
||||
@@ -517,17 +517,17 @@ segment_holding_code (mstate m, char* ad
|
||||
&& addr < add_segment_exec_offset (sp->base, sp) + sp->size)
|
||||
return sp;
|
||||
if ((sp = sp->next) == 0)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
-#endif /* !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__) */
|
||||
+#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) */
|
||||
|
||||
/* Allocate a chunk of memory with the given size. Returns a pointer
|
||||
to the writable address, and sets *CODE to the executable
|
||||
corresponding virtual address. */
|
||||
void *
|
||||
ffi_closure_alloc (size_t size, void **code)
|
||||
{
|
||||
void *ptr;
|
||||
diff --git a/js/src/ctypes/libffi/src/dlmalloc.c b/js/src/ctypes/libffi/src/dlmalloc.c
|
||||
--- a/js/src/ctypes/libffi/src/dlmalloc.c
|
||||
+++ b/js/src/ctypes/libffi/src/dlmalloc.c
|
||||
@@ -454,16 +454,24 @@ DEFAULT_MMAP_THRESHOLD default: 25
|
||||
#define LACKS_STRING_H
|
||||
#define LACKS_STRINGS_H
|
||||
#define LACKS_SYS_TYPES_H
|
||||
#define LACKS_ERRNO_H
|
||||
#define MALLOC_FAILURE_ACTION
|
||||
#define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */
|
||||
#endif /* WIN32 */
|
||||
|
||||
+#ifdef __OS2__
|
||||
+#define INCL_DOS
|
||||
+#include <os2.h>
|
||||
+#define HAVE_MMAP 1
|
||||
+#define HAVE_MORECORE 0
|
||||
+#define LACKS_SYS_MMAN_H
|
||||
+#endif /* __OS2__ */
|
||||
+
|
||||
#if defined(DARWIN) || defined(_DARWIN)
|
||||
/* Mac OSX docs advise not to use sbrk; it seems better to use mmap */
|
||||
#ifndef HAVE_MORECORE
|
||||
#define HAVE_MORECORE 0
|
||||
#define HAVE_MMAP 1
|
||||
#endif /* HAVE_MORECORE */
|
||||
#endif /* DARWIN */
|
||||
|
||||
@@ -1283,17 +1291,17 @@ extern void* sbrk(ptrdiff_t);
|
||||
#define CALL_MMAP(s) MFAIL
|
||||
#define CALL_MUNMAP(a, s) (-1)
|
||||
#define DIRECT_MMAP(s) MFAIL
|
||||
|
||||
#else /* HAVE_MMAP */
|
||||
#define IS_MMAPPED_BIT (SIZE_T_ONE)
|
||||
#define USE_MMAP_BIT (SIZE_T_ONE)
|
||||
|
||||
-#ifndef WIN32
|
||||
+#if !defined(WIN32) && !defined (__OS2__)
|
||||
#define CALL_MUNMAP(a, s) munmap((a), (s))
|
||||
#define MMAP_PROT (PROT_READ|PROT_WRITE)
|
||||
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
|
||||
#define MAP_ANONYMOUS MAP_ANON
|
||||
#endif /* MAP_ANON */
|
||||
#ifdef MAP_ANONYMOUS
|
||||
#define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS)
|
||||
#define CALL_MMAP(s) mmap(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0)
|
||||
@@ -1306,16 +1314,52 @@ extern void* sbrk(ptrdiff_t);
|
||||
static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
|
||||
#define CALL_MMAP(s) ((dev_zero_fd < 0) ? \
|
||||
(dev_zero_fd = open("/dev/zero", O_RDWR), \
|
||||
mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \
|
||||
mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0))
|
||||
#endif /* MAP_ANONYMOUS */
|
||||
|
||||
#define DIRECT_MMAP(s) CALL_MMAP(s)
|
||||
+
|
||||
+#elif defined(__OS2__)
|
||||
+
|
||||
+/* OS/2 MMAP via DosAllocMem */
|
||||
+static void* os2mmap(size_t size) {
|
||||
+ void* ptr;
|
||||
+ if (DosAllocMem(&ptr, size, OBJ_ANY|PAG_COMMIT|PAG_READ|PAG_WRITE) &&
|
||||
+ DosAllocMem(&ptr, size, PAG_COMMIT|PAG_READ|PAG_WRITE))
|
||||
+ return MFAIL;
|
||||
+ return ptr;
|
||||
+}
|
||||
+
|
||||
+#define os2direct_mmap(n) os2mmap(n)
|
||||
+
|
||||
+/* This function supports releasing coalesed segments */
|
||||
+static int os2munmap(void* ptr, size_t size) {
|
||||
+ while (size) {
|
||||
+ ULONG ulSize = size;
|
||||
+ ULONG ulFlags = 0;
|
||||
+ if (DosQueryMem(ptr, &ulSize, &ulFlags) != 0)
|
||||
+ return -1;
|
||||
+ if ((ulFlags & PAG_BASE) == 0 ||(ulFlags & PAG_COMMIT) == 0 ||
|
||||
+ ulSize > size)
|
||||
+ return -1;
|
||||
+ if (DosFreeMem(ptr) != 0)
|
||||
+ return -1;
|
||||
+ ptr = ( void * ) ( ( char * ) ptr + ulSize );
|
||||
+ size -= ulSize;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#define CALL_MMAP(s) os2mmap(s)
|
||||
+#define CALL_MUNMAP(a, s) os2munmap((a), (s))
|
||||
+#define DIRECT_MMAP(s) os2direct_mmap(s)
|
||||
+
|
||||
#else /* WIN32 */
|
||||
|
||||
/* Win32 MMAP via VirtualAlloc */
|
||||
static void* win32mmap(size_t size) {
|
||||
void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
return (ptr != 0)? ptr: MFAIL;
|
||||
}
|
||||
|
||||
@@ -1382,30 +1426,40 @@ static int win32munmap(void* ptr, size_t
|
||||
protect against direct calls to MORECORE by other threads not
|
||||
using this lock, so there is still code to cope the best we can on
|
||||
interference.
|
||||
|
||||
* magic_init_mutex ensures that mparams.magic and other
|
||||
unique mparams values are initialized only once.
|
||||
*/
|
||||
|
||||
-#ifndef WIN32
|
||||
+#if !defined(WIN32) && !defined(__OS2__)
|
||||
/* By default use posix locks */
|
||||
#include <pthread.h>
|
||||
#define MLOCK_T pthread_mutex_t
|
||||
#define INITIAL_LOCK(l) pthread_mutex_init(l, NULL)
|
||||
#define ACQUIRE_LOCK(l) pthread_mutex_lock(l)
|
||||
#define RELEASE_LOCK(l) pthread_mutex_unlock(l)
|
||||
|
||||
#if HAVE_MORECORE
|
||||
static MLOCK_T morecore_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif /* HAVE_MORECORE */
|
||||
|
||||
static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
+#elif defined(__OS2__)
|
||||
+#define MLOCK_T HMTX
|
||||
+#define INITIAL_LOCK(l) DosCreateMutexSem(0, l, 0, FALSE)
|
||||
+#define ACQUIRE_LOCK(l) DosRequestMutexSem(*l, SEM_INDEFINITE_WAIT)
|
||||
+#define RELEASE_LOCK(l) DosReleaseMutexSem(*l)
|
||||
+#if HAVE_MORECORE
|
||||
+static MLOCK_T morecore_mutex;
|
||||
+#endif /* HAVE_MORECORE */
|
||||
+static MLOCK_T magic_init_mutex;
|
||||
+
|
||||
#else /* WIN32 */
|
||||
/*
|
||||
Because lock-protected regions have bounded times, and there
|
||||
are no recursive lock calls, we can use simple spinlocks.
|
||||
*/
|
||||
|
||||
#define MLOCK_T long
|
||||
static int win32_acquire_lock (MLOCK_T *sl) {
|
||||
@@ -2487,20 +2541,25 @@ static int init_mparams(void) {
|
||||
if (mparams.magic == 0) {
|
||||
mparams.magic = s;
|
||||
/* Set up lock for main malloc area */
|
||||
INITIAL_LOCK(&gm->mutex);
|
||||
gm->mflags = mparams.default_mflags;
|
||||
}
|
||||
RELEASE_MAGIC_INIT_LOCK();
|
||||
|
||||
-#ifndef WIN32
|
||||
+#if !defined(WIN32) && !defined(__OS2__)
|
||||
mparams.page_size = malloc_getpagesize;
|
||||
mparams.granularity = ((DEFAULT_GRANULARITY != 0)?
|
||||
DEFAULT_GRANULARITY : mparams.page_size);
|
||||
+#elif defined (__OS2__)
|
||||
+ /* if low-memory is used, os2munmap() would break
|
||||
+ if it were anything other than 64k */
|
||||
+ mparams.page_size = 4096u;
|
||||
+ mparams.granularity = 65536u;
|
||||
#else /* WIN32 */
|
||||
{
|
||||
SYSTEM_INFO system_info;
|
||||
GetSystemInfo(&system_info);
|
||||
mparams.page_size = system_info.dwPageSize;
|
||||
mparams.granularity = system_info.dwAllocationGranularity;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
diff --git a/js/src/ctypes/libffi/src/x86/win32.S b/js/src/ctypes/libffi/src/x86/win32.S
|
||||
--- a/js/src/ctypes/libffi/src/x86/win32.S
|
||||
+++ b/js/src/ctypes/libffi/src/x86/win32.S
|
||||
@@ -390,17 +390,19 @@ END
|
||||
|
||||
#else
|
||||
|
||||
.text
|
||||
|
||||
# This assumes we are using gas.
|
||||
.balign 16
|
||||
.globl _ffi_call_win32
|
||||
+#ifndef __OS2__
|
||||
.def _ffi_call_win32; .scl 2; .type 32; .endef
|
||||
+#endif
|
||||
_ffi_call_win32:
|
||||
.LFB1:
|
||||
pushl %ebp
|
||||
.LCFI0:
|
||||
movl %esp,%ebp
|
||||
.LCFI1:
|
||||
# Make room for all of the new args.
|
||||
movl 16(%ebp),%ecx
|
||||
@@ -542,17 +544,19 @@ 1:
|
||||
popl %ebp
|
||||
ret
|
||||
.ffi_call_win32_end:
|
||||
.LFE1:
|
||||
|
||||
# This assumes we are using gas.
|
||||
.balign 16
|
||||
.globl _ffi_closure_SYSV
|
||||
+#ifndef __OS2__
|
||||
.def _ffi_closure_SYSV; .scl 2; .type 32; .endef
|
||||
+#endif
|
||||
_ffi_closure_SYSV:
|
||||
.LFB3:
|
||||
pushl %ebp
|
||||
.LCFI4:
|
||||
movl %esp, %ebp
|
||||
.LCFI5:
|
||||
subl $40, %esp
|
||||
leal -24(%ebp), %edx
|
||||
@@ -663,17 +667,19 @@ 1:
|
||||
#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3)
|
||||
#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4)
|
||||
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
|
||||
#define CIF_FLAGS_OFFSET 20
|
||||
|
||||
# This assumes we are using gas.
|
||||
.balign 16
|
||||
.globl _ffi_closure_raw_SYSV
|
||||
+#ifndef __OS2__
|
||||
.def _ffi_closure_raw_SYSV; .scl 2; .type 32; .endef
|
||||
+#endif
|
||||
_ffi_closure_raw_SYSV:
|
||||
.LFB4:
|
||||
pushl %ebp
|
||||
.LCFI6:
|
||||
movl %esp, %ebp
|
||||
.LCFI7:
|
||||
pushl %esi
|
||||
.LCFI8:
|
||||
@@ -779,17 +785,19 @@ 1:
|
||||
.ffi_closure_raw_SYSV_end:
|
||||
.LFE4:
|
||||
|
||||
#endif /* !FFI_NO_RAW_API */
|
||||
|
||||
# This assumes we are using gas.
|
||||
.balign 16
|
||||
.globl _ffi_closure_STDCALL
|
||||
+#ifndef __OS2__
|
||||
.def _ffi_closure_STDCALL; .scl 2; .type 32; .endef
|
||||
+#endif
|
||||
_ffi_closure_STDCALL:
|
||||
.LFB5:
|
||||
pushl %ebp
|
||||
.LCFI9:
|
||||
movl %esp, %ebp
|
||||
.LCFI10:
|
||||
subl $40, %esp
|
||||
leal -24(%ebp), %edx
|
||||
@@ -885,17 +893,19 @@ 1:
|
||||
.Lscls_noretval:
|
||||
.Lscls_epilogue:
|
||||
movl %ebp, %esp
|
||||
popl %ebp
|
||||
ret
|
||||
.ffi_closure_STDCALL_end:
|
||||
.LFE5:
|
||||
|
||||
+#ifndef __OS2__
|
||||
.section .eh_frame,"w"
|
||||
+#endif
|
||||
.Lframe1:
|
||||
.LSCIE1:
|
||||
.long .LECIE1-.LASCIE1 /* Length of Common Information Entry */
|
||||
.LASCIE1:
|
||||
.long 0x0 /* CIE Identifier Tag */
|
||||
.byte 0x1 /* CIE Version */
|
||||
#ifdef __PIC__
|
||||
.ascii "zR\0" /* CIE Augmentation */
|
||||
|
||||
|
@ -1,3 +1,122 @@
|
||||
2010-08-05 Dan Witte <dwitte@mozilla.com>
|
||||
|
||||
* Makefile.am: Pass FFI_DEBUG define to msvcc.sh for linking to the
|
||||
debug CRT when --enable-debug is given.
|
||||
* configure.ac: Define it.
|
||||
* msvcc.sh: Translate -g and -DFFI_DEBUG appropriately.
|
||||
|
||||
2010-08-04 Dan Witte <dwitte@mozilla.com>
|
||||
|
||||
* src/x86/ffitarget.h: Add X86_ANY define for all x86/x86_64
|
||||
platforms.
|
||||
* src/x86/ffi.c: Remove redundant ifdef checks.
|
||||
* src/prep_cif.c: Push stack space computation into src/x86/ffi.c
|
||||
for X86_ANY so return value space doesn't get added twice.
|
||||
|
||||
2010-08-03 Neil Rashbrooke <neil@parkwaycc.co.uk>
|
||||
|
||||
* msvcc.sh: Don't pass -safeseh to ml64 because behavior is buggy.
|
||||
|
||||
2010-07-22 Dan Witte <dwitte@mozilla.com>
|
||||
|
||||
* src/*/ffitarget.h: Make FFI_LAST_ABI one past the last valid ABI.
|
||||
* src/prep_cif.c: Fix ABI assertion.
|
||||
* src/cris/ffi.c: Ditto.
|
||||
|
||||
2010-07-10 Evan Phoenix <evan@fallingsnow.net>
|
||||
|
||||
* src/closures.c (selinux_enabled_check): Fix strncmp usage bug.
|
||||
|
||||
2010-07-07 Dan Horák <dan@danny.cz>
|
||||
|
||||
* include/ffi.h.in: Protect #define with #ifndef.
|
||||
* src/powerpc/ffitarget.h: Ditto.
|
||||
* src/s390/ffitarget.h: Ditto.
|
||||
* src/sparc/ffitarget.h: Ditto.
|
||||
|
||||
2010-05-11 Dan Witte <dwitte@mozilla.com>
|
||||
|
||||
* doc/libffi.tex: Document previous change.
|
||||
|
||||
2010-05-11 Makoto Kato <m_kato@ga2.so-net.ne.jp>
|
||||
|
||||
* src/x86/ffi.c (ffi_call): Don't copy structs passed by value.
|
||||
|
||||
2010-05-05 Michael Kohler <michaelkohler@live.com>
|
||||
|
||||
* src/dlmalloc.c (dlfree): Fix spelling.
|
||||
* src/ia64/ffi.c (ffi_prep_cif_machdep): Ditto.
|
||||
* configure.ac: Ditto.
|
||||
* configure: Rebuilt.
|
||||
|
||||
2010-04-13 Dan Witte <dwitte@mozilla.com>
|
||||
|
||||
* msvcc.sh: Build with -W3 instead of -Wall.
|
||||
* src/powerpc/ffi_darwin.c: Remove build warnings.
|
||||
* src/x86/ffi.c: Ditto.
|
||||
* src/x86/ffitarget.h: Ditto.
|
||||
|
||||
2010-03-30 Dan Witte <dwitte@mozilla.com>
|
||||
|
||||
* msvcc.sh: Disable build warnings.
|
||||
* README (tested): Clarify windows build procedure.
|
||||
|
||||
2010-03-14 Matthias Klose <doko@ubuntu.com>
|
||||
|
||||
* src/x86/ffi64.c: Fix typo in comment.
|
||||
* src/x86/ffi.c: Use /* ... */ comment style.
|
||||
|
||||
2010-07-07 Neil Roberts <neil@linux.intel.com>
|
||||
|
||||
* src/x86/sysv.S (ffi_call_SYSV): Align the stack pointer to
|
||||
16-bytes.
|
||||
|
||||
2010-07-02 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* Makefile.am (AM_MAKEFLAGS): Pass also mandir to submakes.
|
||||
* Makefile.in: Regenerated.
|
||||
|
||||
2010-05-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
* configure.ac (libffi_cv_as_x86_pcrel): Check for illegal in as
|
||||
output, too.
|
||||
(libffi_cv_as_ascii_pseudo_op): Check for .ascii.
|
||||
(libffi_cv_as_string_pseudo_op): Check for .string.
|
||||
* configure: Regenerate.
|
||||
* fficonfig.h.in: Regenerate.
|
||||
* src/x86/sysv.S (.eh_frame): Use .ascii, .string or error.
|
||||
|
||||
2010-04-07 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* regex.c (byte_re_match_2_internal): Avoid set but not used
|
||||
warning.
|
||||
|
||||
2010-04-02 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||
|
||||
* Makefile.in: Regenerate.
|
||||
* aclocal.m4: Regenerate.
|
||||
* include/Makefile.in: Regenerate.
|
||||
* man/Makefile.in: Regenerate.
|
||||
* testsuite/Makefile.in: Regenerate.
|
||||
|
||||
2010-03-15 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
* configure.ac (libffi_cv_as_x86_64_unwind_section_type): New test.
|
||||
* configure: Regenerate.
|
||||
* fficonfig.h.in: Regenerate.
|
||||
* libffi/src/x86/unix64.S (.eh_frame)
|
||||
[HAVE_AS_X86_64_UNWIND_SECTION_TYPE]: Use @unwind section type.
|
||||
|
||||
2010-02-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
* doc/libffi.texi (The Closure API): Fix typo.
|
||||
* doc/libffi.info: Remove.
|
||||
|
||||
2010-02-15 Matthias Klose <doko@ubuntu.com>
|
||||
|
||||
* src/arm/sysv.S (__ARM_ARCH__): Define for processor
|
||||
__ARM_ARCH_7EM__.
|
||||
|
||||
2010-01-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
PR libffi/40701
|
||||
|
@ -69,6 +69,7 @@ AM_MAKEFLAGS = \
|
||||
"exec_prefix=$(exec_prefix)" \
|
||||
"infodir=$(infodir)" \
|
||||
"libdir=$(libdir)" \
|
||||
"mandir=$(mandir)" \
|
||||
"prefix=$(prefix)" \
|
||||
"AR=$(AR)" \
|
||||
"AS=$(AS)" \
|
||||
@ -151,6 +152,9 @@ endif
|
||||
if FRV
|
||||
nodist_libffi_la_SOURCES += src/frv/eabi.S src/frv/ffi.c
|
||||
endif
|
||||
if MOXIE
|
||||
nodist_libffi_la_SOURCES += src/moxie/eabi.S src/moxie/ffi.c
|
||||
endif
|
||||
if S390
|
||||
nodist_libffi_la_SOURCES += src/s390/sysv.S src/s390/ffi.c
|
||||
endif
|
||||
@ -174,6 +178,14 @@ libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
|
||||
nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
|
||||
|
||||
AM_CFLAGS = -Wall -g -fexceptions
|
||||
if FFI_DEBUG
|
||||
# Build debug. Define FFI_DEBUG on the commandline so that, when building with
|
||||
# MSVC, it can link against the debug CRT.
|
||||
AM_CFLAGS += -DFFI_DEBUG
|
||||
else
|
||||
# Build opt.
|
||||
AM_CFLAGS += -O2
|
||||
endif
|
||||
|
||||
libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Makefile.in generated by automake 1.11 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
@ -55,12 +55,18 @@ target_triplet = @target@
|
||||
@AVR32_TRUE@am__append_17 = src/avr32/sysv.S src/avr32/ffi.c
|
||||
@LIBFFI_CRIS_TRUE@am__append_18 = src/cris/sysv.S src/cris/ffi.c
|
||||
@FRV_TRUE@am__append_19 = src/frv/eabi.S src/frv/ffi.c
|
||||
@S390_TRUE@am__append_20 = src/s390/sysv.S src/s390/ffi.c
|
||||
@X86_64_TRUE@am__append_21 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
|
||||
@SH_TRUE@am__append_22 = src/sh/sysv.S src/sh/ffi.c
|
||||
@SH64_TRUE@am__append_23 = src/sh64/sysv.S src/sh64/ffi.c
|
||||
@PA_LINUX_TRUE@am__append_24 = src/pa/linux.S src/pa/ffi.c
|
||||
@PA_HPUX_TRUE@am__append_25 = src/pa/hpux32.S src/pa/ffi.c
|
||||
@MOXIE_TRUE@am__append_20 = src/moxie/eabi.S src/moxie/ffi.c
|
||||
@S390_TRUE@am__append_21 = src/s390/sysv.S src/s390/ffi.c
|
||||
@X86_64_TRUE@am__append_22 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
|
||||
@SH_TRUE@am__append_23 = src/sh/sysv.S src/sh/ffi.c
|
||||
@SH64_TRUE@am__append_24 = src/sh64/sysv.S src/sh64/ffi.c
|
||||
@PA_LINUX_TRUE@am__append_25 = src/pa/linux.S src/pa/ffi.c
|
||||
@PA_HPUX_TRUE@am__append_26 = src/pa/hpux32.S src/pa/ffi.c
|
||||
# Build debug. Define FFI_DEBUG on the commandline so that, when building with
|
||||
# MSVC, it can link against the debug CRT.
|
||||
@FFI_DEBUG_TRUE@am__append_27 = -DFFI_DEBUG
|
||||
# Build opt.
|
||||
@FFI_DEBUG_FALSE@am__append_28 = -O2
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/doc/stamp-vti \
|
||||
@ -138,13 +144,14 @@ am_libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
|
||||
@AVR32_TRUE@am__objects_17 = src/avr32/sysv.lo src/avr32/ffi.lo
|
||||
@LIBFFI_CRIS_TRUE@am__objects_18 = src/cris/sysv.lo src/cris/ffi.lo
|
||||
@FRV_TRUE@am__objects_19 = src/frv/eabi.lo src/frv/ffi.lo
|
||||
@S390_TRUE@am__objects_20 = src/s390/sysv.lo src/s390/ffi.lo
|
||||
@X86_64_TRUE@am__objects_21 = src/x86/ffi64.lo src/x86/unix64.lo \
|
||||
@MOXIE_TRUE@am__objects_20 = src/moxie/eabi.lo src/moxie/ffi.lo
|
||||
@S390_TRUE@am__objects_21 = src/s390/sysv.lo src/s390/ffi.lo
|
||||
@X86_64_TRUE@am__objects_22 = src/x86/ffi64.lo src/x86/unix64.lo \
|
||||
@X86_64_TRUE@ src/x86/ffi.lo src/x86/sysv.lo
|
||||
@SH_TRUE@am__objects_22 = src/sh/sysv.lo src/sh/ffi.lo
|
||||
@SH64_TRUE@am__objects_23 = src/sh64/sysv.lo src/sh64/ffi.lo
|
||||
@PA_LINUX_TRUE@am__objects_24 = src/pa/linux.lo src/pa/ffi.lo
|
||||
@PA_HPUX_TRUE@am__objects_25 = src/pa/hpux32.lo src/pa/ffi.lo
|
||||
@SH_TRUE@am__objects_23 = src/sh/sysv.lo src/sh/ffi.lo
|
||||
@SH64_TRUE@am__objects_24 = src/sh64/sysv.lo src/sh64/ffi.lo
|
||||
@PA_LINUX_TRUE@am__objects_25 = src/pa/linux.lo src/pa/ffi.lo
|
||||
@PA_HPUX_TRUE@am__objects_26 = src/pa/hpux32.lo src/pa/ffi.lo
|
||||
nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
|
||||
$(am__objects_3) $(am__objects_4) $(am__objects_5) \
|
||||
$(am__objects_6) $(am__objects_7) $(am__objects_8) \
|
||||
@ -153,17 +160,17 @@ nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
|
||||
$(am__objects_15) $(am__objects_16) $(am__objects_17) \
|
||||
$(am__objects_18) $(am__objects_19) $(am__objects_20) \
|
||||
$(am__objects_21) $(am__objects_22) $(am__objects_23) \
|
||||
$(am__objects_24) $(am__objects_25)
|
||||
$(am__objects_24) $(am__objects_25) $(am__objects_26)
|
||||
libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) \
|
||||
$(nodist_libffi_la_OBJECTS)
|
||||
libffi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libffi_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
libffi_convenience_la_LIBADD =
|
||||
am__objects_26 = src/debug.lo src/prep_cif.lo src/types.lo \
|
||||
am__objects_27 = src/debug.lo src/prep_cif.lo src/types.lo \
|
||||
src/raw_api.lo src/java_raw_api.lo src/closures.lo
|
||||
am_libffi_convenience_la_OBJECTS = $(am__objects_26)
|
||||
am__objects_27 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
|
||||
am_libffi_convenience_la_OBJECTS = $(am__objects_27)
|
||||
am__objects_28 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
|
||||
$(am__objects_4) $(am__objects_5) $(am__objects_6) \
|
||||
$(am__objects_7) $(am__objects_8) $(am__objects_9) \
|
||||
$(am__objects_10) $(am__objects_11) $(am__objects_12) \
|
||||
@ -171,8 +178,8 @@ am__objects_27 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
|
||||
$(am__objects_16) $(am__objects_17) $(am__objects_18) \
|
||||
$(am__objects_19) $(am__objects_20) $(am__objects_21) \
|
||||
$(am__objects_22) $(am__objects_23) $(am__objects_24) \
|
||||
$(am__objects_25)
|
||||
nodist_libffi_convenience_la_OBJECTS = $(am__objects_27)
|
||||
$(am__objects_25) $(am__objects_26)
|
||||
nodist_libffi_convenience_la_OBJECTS = $(am__objects_28)
|
||||
libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \
|
||||
$(nodist_libffi_convenience_la_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
@ -319,6 +326,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
@ -448,6 +456,7 @@ AM_MAKEFLAGS = \
|
||||
"exec_prefix=$(exec_prefix)" \
|
||||
"infodir=$(infodir)" \
|
||||
"libdir=$(libdir)" \
|
||||
"mandir=$(mandir)" \
|
||||
"prefix=$(prefix)" \
|
||||
"AR=$(AR)" \
|
||||
"AS=$(AS)" \
|
||||
@ -475,10 +484,10 @@ nodist_libffi_la_SOURCES = $(am__append_1) $(am__append_2) \
|
||||
$(am__append_15) $(am__append_16) $(am__append_17) \
|
||||
$(am__append_18) $(am__append_19) $(am__append_20) \
|
||||
$(am__append_21) $(am__append_22) $(am__append_23) \
|
||||
$(am__append_24) $(am__append_25)
|
||||
$(am__append_24) $(am__append_25) $(am__append_26)
|
||||
libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
|
||||
nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
|
||||
AM_CFLAGS = -Wall -g -fexceptions
|
||||
AM_CFLAGS = -Wall -g -fexceptions $(am__append_27) $(am__append_28)
|
||||
libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS)
|
||||
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
|
||||
AM_CCASFLAGS = $(AM_CPPFLAGS)
|
||||
@ -744,6 +753,16 @@ src/frv/eabi.lo: src/frv/$(am__dirstamp) \
|
||||
src/frv/$(DEPDIR)/$(am__dirstamp)
|
||||
src/frv/ffi.lo: src/frv/$(am__dirstamp) \
|
||||
src/frv/$(DEPDIR)/$(am__dirstamp)
|
||||
src/moxie/$(am__dirstamp):
|
||||
@$(MKDIR_P) src/moxie
|
||||
@: > src/moxie/$(am__dirstamp)
|
||||
src/moxie/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) src/moxie/$(DEPDIR)
|
||||
@: > src/moxie/$(DEPDIR)/$(am__dirstamp)
|
||||
src/moxie/eabi.lo: src/moxie/$(am__dirstamp) \
|
||||
src/moxie/$(DEPDIR)/$(am__dirstamp)
|
||||
src/moxie/ffi.lo: src/moxie/$(am__dirstamp) \
|
||||
src/moxie/$(DEPDIR)/$(am__dirstamp)
|
||||
src/s390/$(am__dirstamp):
|
||||
@$(MKDIR_P) src/s390
|
||||
@: > src/s390/$(am__dirstamp)
|
||||
@ -837,6 +856,10 @@ mostlyclean-compile:
|
||||
-rm -f src/mips/n32.lo
|
||||
-rm -f src/mips/o32.$(OBJEXT)
|
||||
-rm -f src/mips/o32.lo
|
||||
-rm -f src/moxie/eabi.$(OBJEXT)
|
||||
-rm -f src/moxie/eabi.lo
|
||||
-rm -f src/moxie/ffi.$(OBJEXT)
|
||||
-rm -f src/moxie/ffi.lo
|
||||
-rm -f src/pa/ffi.$(OBJEXT)
|
||||
-rm -f src/pa/ffi.lo
|
||||
-rm -f src/pa/hpux32.$(OBJEXT)
|
||||
@ -934,6 +957,8 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/mips/$(DEPDIR)/ffi.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/mips/$(DEPDIR)/n32.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/mips/$(DEPDIR)/o32.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/moxie/$(DEPDIR)/eabi.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/moxie/$(DEPDIR)/ffi.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/ffi.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/hpux32.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/linux.Plo@am__quote@
|
||||
@ -1029,6 +1054,7 @@ clean-libtool:
|
||||
-rm -rf src/m32r/.libs src/m32r/_libs
|
||||
-rm -rf src/m68k/.libs src/m68k/_libs
|
||||
-rm -rf src/mips/.libs src/mips/_libs
|
||||
-rm -rf src/moxie/.libs src/moxie/_libs
|
||||
-rm -rf src/pa/.libs src/pa/_libs
|
||||
-rm -rf src/powerpc/.libs src/powerpc/_libs
|
||||
-rm -rf src/s390/.libs src/s390/_libs
|
||||
@ -1232,7 +1258,7 @@ uninstall-pkgconfigDATA:
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@failcom='exit 1'; \
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
@ -1257,7 +1283,7 @@ $(RECURSIVE_TARGETS):
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@failcom='exit 1'; \
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
@ -1424,7 +1450,8 @@ distdir: $(DISTFILES)
|
||||
top_distdir="$(top_distdir)" distdir="$(distdir)" \
|
||||
dist-info
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
@ -1468,17 +1495,17 @@ dist dist-all: distdir
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lzma*) \
|
||||
unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
@ -1587,6 +1614,8 @@ distclean-generic:
|
||||
-rm -f src/m68k/$(am__dirstamp)
|
||||
-rm -f src/mips/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f src/mips/$(am__dirstamp)
|
||||
-rm -f src/moxie/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f src/moxie/$(am__dirstamp)
|
||||
-rm -f src/pa/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f src/pa/$(am__dirstamp)
|
||||
-rm -f src/powerpc/$(DEPDIR)/$(am__dirstamp)
|
||||
@ -1612,7 +1641,7 @@ clean-am: clean-aminfo clean-generic clean-libLTLIBRARIES \
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR)
|
||||
-rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-hdr distclean-libtool distclean-tags
|
||||
@ -1732,7 +1761,7 @@ installcheck-am:
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR)
|
||||
-rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-aminfo \
|
||||
maintainer-clean-generic maintainer-clean-vti
|
||||
|
@ -75,6 +75,7 @@ tested:
|
||||
| X86 | Linux |
|
||||
| X86 | Mac OSX |
|
||||
| X86 | OpenBSD |
|
||||
| X86 | OS/2 |
|
||||
| X86 | Solaris |
|
||||
| X86 | Windows/Cygwin |
|
||||
| X86 | Windows/MingW |
|
||||
@ -113,9 +114,13 @@ It's also possible to build libffi on Windows platforms with
|
||||
Microsoft's Visual C++ compiler. In this case, use the msvcc.sh
|
||||
wrapper script during configuration like so:
|
||||
|
||||
path/to/configure --enable-shared --enable-static \
|
||||
CC=path/to/msvcc.sh LD=link \
|
||||
CPP=\"cl -nologo -EP\"
|
||||
path/to/configure CC=path/to/msvcc.sh LD=link CPP=\"cl -nologo -EP\"
|
||||
|
||||
For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64".
|
||||
You may also need to specify --build appropriately. When building with MSVC
|
||||
under a MingW environment, you may need to remove the line in configure
|
||||
that sets 'fix_srcfile_path' to a 'cygpath' command. ('cygpath' is not
|
||||
present in MingW, and is not required when using MingW-style paths.)
|
||||
|
||||
Configure has many other options. Use "configure --help" to see them all.
|
||||
|
||||
|
20
js/src/ctypes/libffi/aclocal.m4
vendored
20
js/src/ctypes/libffi/aclocal.m4
vendored
@ -1,4 +1,4 @@
|
||||
# generated automatically by aclocal 1.11 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
@ -13,8 +13,8 @@
|
||||
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],,
|
||||
[m4_warning([this file was generated for autoconf 2.63.
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
|
||||
[m4_warning([this file was generated for autoconf 2.65.
|
||||
You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically `autoreconf'.])])
|
||||
@ -7862,15 +7862,15 @@ m4_define([lt_dict_filter],
|
||||
|
||||
# Generated from ltversion.in.
|
||||
|
||||
# serial 3012 ltversion.m4
|
||||
# serial 3017 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.2.6])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.3012])
|
||||
m4_define([LT_PACKAGE_VERSION], [2.2.6b])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.3017])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.2.6'
|
||||
macro_revision='1.3012'
|
||||
[macro_version='2.2.6b'
|
||||
macro_revision='1.3017'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
||||
@ -7983,7 +7983,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.11'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.11], [],
|
||||
m4_if([$1], [1.11.1], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
@ -7999,7 +7999,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.11])dnl
|
||||
[AM_AUTOMAKE_VERSION([1.11.1])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
6932
js/src/ctypes/libffi/configure
vendored
6932
js/src/ctypes/libffi/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -16,10 +16,14 @@ AM_INIT_AUTOMAKE
|
||||
# We must force CC to /not/ be precious variables; otherwise
|
||||
# the wrong, non-multilib-adjusted value will be used in multilibs.
|
||||
# As a side effect, we have to subst CFLAGS ourselves.
|
||||
# Also save and restore CFLAGS, since AC_PROG_CC will come up with
|
||||
# defaults of its own if none are provided.
|
||||
|
||||
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
|
||||
m4_define([_AC_ARG_VAR_PRECIOUS],[])
|
||||
save_CFLAGS=$CFLAGS
|
||||
AC_PROG_CC
|
||||
CFLAGS=$save_CFLAGS
|
||||
m4_undefine([_AC_ARG_VAR_PRECIOUS])
|
||||
m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
|
||||
|
||||
@ -43,7 +47,7 @@ TARGETDIR="unknown"
|
||||
case "$host" in
|
||||
alpha*-*-*)
|
||||
TARGET=ALPHA; TARGETDIR=alpha;
|
||||
# Support 128-bit long double, changable via command-line switch.
|
||||
# Support 128-bit long double, changeable via command-line switch.
|
||||
HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)'
|
||||
;;
|
||||
|
||||
@ -120,6 +124,10 @@ case "$host" in
|
||||
TARGET=MIPS; TARGETDIR=mips
|
||||
;;
|
||||
|
||||
moxie-*-*)
|
||||
TARGET=MOXIE; TARGETDIR=moxie
|
||||
;;
|
||||
|
||||
powerpc*-*-linux* | powerpc-*-sysv*)
|
||||
TARGET=POWERPC; TARGETDIR=powerpc
|
||||
;;
|
||||
@ -185,6 +193,7 @@ AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
|
||||
AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
|
||||
AM_CONDITIONAL(M32R, test x$TARGET = xM32R)
|
||||
AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
|
||||
AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE)
|
||||
AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
|
||||
AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
|
||||
AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
|
||||
@ -270,7 +279,7 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64
|
||||
libffi_cv_as_x86_pcrel, [
|
||||
libffi_cv_as_x86_pcrel=yes
|
||||
echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
|
||||
if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
|
||||
if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then
|
||||
libffi_cv_as_x86_pcrel=no
|
||||
fi
|
||||
])
|
||||
@ -278,6 +287,32 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64
|
||||
AC_DEFINE(HAVE_AS_X86_PCREL, 1,
|
||||
[Define if your assembler supports PC relative relocs.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([assembler .ascii pseudo-op support],
|
||||
libffi_cv_as_ascii_pseudo_op, [
|
||||
libffi_cv_as_ascii_pseudo_op=unknown
|
||||
# Check if we have .ascii
|
||||
AC_TRY_COMPILE([asm (".ascii \"string\"");],,
|
||||
[libffi_cv_as_ascii_pseudo_op=yes],
|
||||
[libffi_cv_as_ascii_pseudo_op=no])
|
||||
])
|
||||
if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then
|
||||
AC_DEFINE(HAVE_AS_ASCII_PSEUDO_OP, 1,
|
||||
[Define if your assembler supports .ascii.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([assembler .string pseudo-op support],
|
||||
libffi_cv_as_string_pseudo_op, [
|
||||
libffi_cv_as_string_pseudo_op=unknown
|
||||
# Check if we have .string
|
||||
AC_TRY_COMPILE([asm (".string \"string\"");],,
|
||||
[libffi_cv_as_string_pseudo_op=yes],
|
||||
[libffi_cv_as_string_pseudo_op=no])
|
||||
])
|
||||
if test "x$libffi_cv_as_string_pseudo_op" = xyes; then
|
||||
AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1,
|
||||
[Define if your assembler supports .string.])
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$target" in
|
||||
@ -288,6 +323,21 @@ case "$target" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x$TARGET = xX86_64; then
|
||||
AC_CACHE_CHECK([assembler supports unwind section type],
|
||||
libffi_cv_as_x86_64_unwind_section_type, [
|
||||
libffi_cv_as_x86_64_unwind_section_type=yes
|
||||
echo '.section .eh_frame,"a",@unwind' > conftest.s
|
||||
if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
|
||||
libffi_cv_as_x86_64_unwind_section_type=no
|
||||
fi
|
||||
])
|
||||
if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then
|
||||
AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1,
|
||||
[Define if your assembler supports unwind section type.])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether .eh_frame section should be read-only],
|
||||
libffi_cv_ro_eh_frame, [
|
||||
libffi_cv_ro_eh_frame=no
|
||||
@ -354,6 +404,7 @@ AC_ARG_ENABLE(debug,
|
||||
if test "$enable_debug" = "yes"; then
|
||||
AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.])
|
||||
fi)
|
||||
AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes")
|
||||
|
||||
AC_ARG_ENABLE(structs,
|
||||
[ --disable-structs omit code for struct support],
|
||||
|
@ -4,7 +4,7 @@ from ../libffi/doc/libffi.texi.
|
||||
This manual is for Libffi, a portable foreign-function interface
|
||||
library.
|
||||
|
||||
Copyright (C) 2008 Red Hat, Inc.
|
||||
Copyright (C) 2008, 2010 Red Hat, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU General Public License as
|
||||
@ -27,7 +27,7 @@ libffi
|
||||
This manual is for Libffi, a portable foreign-function interface
|
||||
library.
|
||||
|
||||
Copyright (C) 2008 Red Hat, Inc.
|
||||
Copyright (C) 2008, 2010 Red Hat, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU General Public License as
|
||||
@ -89,6 +89,7 @@ File: libffi.info, Node: Using libffi, Next: Missing Features, Prev: Introduc
|
||||
* Types:: libffi type descriptions.
|
||||
* Multiple ABIs:: Different passing styles on one platform.
|
||||
* The Closure API:: Writing a generic function.
|
||||
* Closure Example:: A closure example.
|
||||
|
||||
|
||||
File: libffi.info, Node: The Basics, Next: Simple Example, Up: Using libffi
|
||||
@ -146,7 +147,9 @@ To prepare a call interface object, use the function `ffi_prep_cif'.
|
||||
AVALUES is a vector of `void *' pointers that point to the memory
|
||||
locations holding the argument values for a call. If CIF declares
|
||||
that the function has no arguments (i.e., NARGS was 0), then
|
||||
AVALUES is ignored.
|
||||
AVALUES is ignored. Note that argument values may be modified by
|
||||
the callee (for instance, structs passed by value); the burden of
|
||||
copying pass-by-value arguments is placed on the caller.
|
||||
|
||||
|
||||
File: libffi.info, Node: Simple Example, Next: Types, Prev: The Basics, Up: Using libffi
|
||||
@ -368,7 +371,7 @@ instance, the x86 platform has both `stdcall' and `fastcall' functions.
|
||||
necessarily platform-specific.
|
||||
|
||||
|
||||
File: libffi.info, Node: The Closure API, Prev: Multiple ABIs, Up: Using libffi
|
||||
File: libffi.info, Node: The Closure API, Next: Closure Example, Prev: Multiple ABIs, Up: Using libffi
|
||||
|
||||
2.5 The Closure API
|
||||
===================
|
||||
@ -443,6 +446,62 @@ closure function:
|
||||
is deprecated, as it cannot handle the need for separate writable and
|
||||
executable addresses.
|
||||
|
||||
|
||||
File: libffi.info, Node: Closure Example, Prev: The Closure API, Up: Using libffi
|
||||
|
||||
2.6 Closure Example
|
||||
===================
|
||||
|
||||
A trivial example that creates a new `puts' by binding `fputs' with
|
||||
`stdin'.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ffi.h>
|
||||
|
||||
/* Acts like puts with the file given at time of enclosure. */
|
||||
void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[],
|
||||
FILE *stream)
|
||||
{
|
||||
*ret = fputs(*(char **)args[0], stream);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
ffi_cif cif;
|
||||
ffi_type *args[1];
|
||||
ffi_closure *closure;
|
||||
|
||||
int (*bound_puts)(char *);
|
||||
int rc;
|
||||
|
||||
/* Allocate closure and bound_puts */
|
||||
closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts);
|
||||
|
||||
if (closure)
|
||||
{
|
||||
/* Initialize the argument info vectors */
|
||||
args[0] = &ffi_type_pointer;
|
||||
|
||||
/* Initialize the cif */
|
||||
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
|
||||
&ffi_type_uint, args) == FFI_OK)
|
||||
{
|
||||
/* Initialize the closure, setting stream to stdout */
|
||||
if (ffi_prep_closure_loc(closure, &cif, puts_binding,
|
||||
stdout, bound_puts) == FFI_OK)
|
||||
{
|
||||
rc = bound_puts("Hello World!");
|
||||
/* rc now holds the result of the call to fputs */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Deallocate both closure, and bound_puts */
|
||||
ffi_closure_free(closure);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
File: libffi.info, Node: Missing Features, Next: Index, Prev: Using libffi, Up: Top
|
||||
|
||||
@ -480,7 +539,7 @@ Index
|
||||
* closures: The Closure API. (line 13)
|
||||
* FFI: Introduction. (line 31)
|
||||
* ffi_call: The Basics. (line 41)
|
||||
* ffi_closure_alloca: The Closure API. (line 19)
|
||||
* ffi_closure_alloc: The Closure API. (line 19)
|
||||
* ffi_closure_free: The Closure API. (line 26)
|
||||
* FFI_CLOSURES: The Closure API. (line 13)
|
||||
* ffi_prep_cif: The Basics. (line 16)
|
||||
@ -516,18 +575,19 @@ Index
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Top700
|
||||
Node: Introduction1436
|
||||
Node: Using libffi3072
|
||||
Node: The Basics3507
|
||||
Node: Simple Example6114
|
||||
Node: Types7141
|
||||
Node: Primitive Types7424
|
||||
Node: Structures9244
|
||||
Node: Type Example10104
|
||||
Node: Multiple ABIs11327
|
||||
Node: The Closure API11698
|
||||
Node: Missing Features14618
|
||||
Node: Index15111
|
||||
Node: Top706
|
||||
Node: Introduction1448
|
||||
Node: Using libffi3084
|
||||
Node: The Basics3570
|
||||
Node: Simple Example6356
|
||||
Node: Types7383
|
||||
Node: Primitive Types7666
|
||||
Node: Structures9486
|
||||
Node: Type Example10346
|
||||
Node: Multiple ABIs11569
|
||||
Node: The Closure API11940
|
||||
Node: Closure Example14884
|
||||
Node: Missing Features16443
|
||||
Node: Index16936
|
||||
|
||||
End Tag Table
|
||||
|
@ -171,7 +171,9 @@ discarded.
|
||||
@var{avalues} is a vector of @code{void *} pointers that point to the
|
||||
memory locations holding the argument values for a call. If @var{cif}
|
||||
declares that the function has no arguments (i.e., @var{nargs} was 0),
|
||||
then @var{avalues} is ignored.
|
||||
then @var{avalues} is ignored. Note that argument values may be
|
||||
modified by the callee (for instance, structs passed by value); the
|
||||
burden of copying pass-by-value arguments is placed on the caller.
|
||||
@end defun
|
||||
|
||||
|
||||
@ -438,7 +440,7 @@ require special allocation on platforms that have a non-executable
|
||||
heap. Memory management for closures is handled by a pair of
|
||||
functions:
|
||||
|
||||
@findex ffi_closure_alloca
|
||||
@findex ffi_closure_alloc
|
||||
@defun void *ffi_closure_alloc (size_t @var{size}, void **@var{code})
|
||||
Allocate a chunk of memory holding @var{size} bytes. This returns a
|
||||
pointer to the writable address, and sets *@var{code} to the
|
||||
|
@ -33,6 +33,9 @@
|
||||
*/
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define if your assembler supports .ascii. */
|
||||
#undef HAVE_AS_ASCII_PSEUDO_OP
|
||||
|
||||
/* Define if your assembler supports .cfi_* directives. */
|
||||
#undef HAVE_AS_CFI_PSEUDO_OP
|
||||
|
||||
@ -43,6 +46,12 @@
|
||||
*/
|
||||
#undef HAVE_AS_SPARC_UA_PCREL
|
||||
|
||||
/* Define if your assembler supports .string. */
|
||||
#undef HAVE_AS_STRING_PSEUDO_OP
|
||||
|
||||
/* Define if your assembler supports unwind section type. */
|
||||
#undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE
|
||||
|
||||
/* Define if your assembler supports PC relative relocs. */
|
||||
#undef HAVE_AS_X86_PCREL
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Makefile.in generated by automake 1.11 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
@ -133,6 +133,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
|
@ -57,7 +57,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Specify which architecture libffi is configured for. */
|
||||
#ifndef @TARGET@
|
||||
#define @TARGET@
|
||||
#endif
|
||||
|
||||
/* ---- System configuration information --------------------------------- */
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Generated from ltmain.m4sh.
|
||||
|
||||
# ltmain.sh (GNU libtool) 2.2.6
|
||||
# ltmain.sh (GNU libtool) 2.2.6b
|
||||
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
|
||||
@ -65,7 +65,7 @@
|
||||
# compiler: $LTCC
|
||||
# compiler flags: $LTCFLAGS
|
||||
# linker: $LD (gnu? $with_gnu_ld)
|
||||
# $progname: (GNU libtool) 2.2.6
|
||||
# $progname: (GNU libtool) 2.2.6b
|
||||
# automake: $automake_version
|
||||
# autoconf: $autoconf_version
|
||||
#
|
||||
@ -73,9 +73,9 @@
|
||||
|
||||
PROGRAM=ltmain.sh
|
||||
PACKAGE=libtool
|
||||
VERSION=2.2.6
|
||||
VERSION=2.2.6b
|
||||
TIMESTAMP=""
|
||||
package_revision=1.3012
|
||||
package_revision=1.3017
|
||||
|
||||
# Be Bourne compatible
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
|
10
js/src/ctypes/libffi/m4/ltversion.m4
vendored
10
js/src/ctypes/libffi/m4/ltversion.m4
vendored
@ -9,15 +9,15 @@
|
||||
|
||||
# Generated from ltversion.in.
|
||||
|
||||
# serial 3012 ltversion.m4
|
||||
# serial 3017 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.2.6])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.3012])
|
||||
m4_define([LT_PACKAGE_VERSION], [2.2.6b])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.3017])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.2.6'
|
||||
macro_revision='1.3012'
|
||||
[macro_version='2.2.6b'
|
||||
macro_revision='1.3017'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Makefile.in generated by automake 1.11 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
@ -131,6 +131,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
|
@ -42,7 +42,7 @@
|
||||
# format and translated into something sensible for cl or ml.
|
||||
#
|
||||
|
||||
args="-nologo"
|
||||
args="-nologo -W3"
|
||||
md=-MD
|
||||
cl="cl"
|
||||
ml="ml"
|
||||
@ -67,13 +67,25 @@ do
|
||||
safeseh=
|
||||
shift 1
|
||||
;;
|
||||
-O0)
|
||||
args="$args -Od"
|
||||
shift 1
|
||||
;;
|
||||
-O*)
|
||||
args="$args $1"
|
||||
# If we're optimizing, make sure we explicitly turn on some optimizations
|
||||
# that are implicitly disabled by debug symbols (-Zi).
|
||||
args="$args $1 -OPT:REF -OPT:ICF -INCREMENTAL:NO"
|
||||
shift 1
|
||||
;;
|
||||
-g)
|
||||
# Can't specify -RTC1 or -Zi in opt. -Gy is ok. Use -OPT:REF?
|
||||
args="$args -D_DEBUG -RTC1 -Zi"
|
||||
# Enable debug symbol generation.
|
||||
args="$args -Zi -DEBUG"
|
||||
shift 1
|
||||
;;
|
||||
-DFFI_DEBUG)
|
||||
# Link against debug CRT and enable runtime error checks.
|
||||
args="$args -RTC1"
|
||||
defines="$defines $1"
|
||||
md=-MDd
|
||||
shift 1
|
||||
;;
|
||||
@ -110,8 +122,8 @@ do
|
||||
shift 1
|
||||
;;
|
||||
-Wall)
|
||||
# -Wall on MSVC is overzealous. Use -W3 instead.
|
||||
args="$args -W3"
|
||||
# -Wall on MSVC is overzealous, and we already build with -W3. Nothing
|
||||
# to do here.
|
||||
shift 1
|
||||
;;
|
||||
-Werror)
|
||||
|
@ -34,8 +34,8 @@ typedef signed long ffi_sarg;
|
||||
typedef enum ffi_abi {
|
||||
FFI_FIRST_ABI = 0,
|
||||
FFI_SYSV,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV,
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -74,7 +74,8 @@
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
|
||||
|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__)
|
||||
|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
|
||||
|| defined(__ARM_ARCH_7EM__)
|
||||
# undef __ARM_ARCH__
|
||||
# define __ARM_ARCH__ 7
|
||||
#endif
|
||||
|
@ -34,8 +34,8 @@ typedef signed long ffi_sarg;
|
||||
typedef enum ffi_abi {
|
||||
FFI_FIRST_ABI = 0,
|
||||
FFI_SYSV,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV,
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -146,7 +146,7 @@ selinux_enabled_check (void)
|
||||
p = strchr (p + 1, ' ');
|
||||
if (p == NULL)
|
||||
break;
|
||||
if (strncmp (p + 1, "selinuxfs ", 10) != 0)
|
||||
if (strncmp (p + 1, "selinuxfs ", 10) == 0)
|
||||
{
|
||||
free (buf);
|
||||
fclose (f);
|
||||
|
@ -163,7 +163,7 @@ ffi_prep_cif (ffi_cif * cif,
|
||||
ffi_type **ptr;
|
||||
|
||||
FFI_ASSERT (cif != NULL);
|
||||
FFI_ASSERT ((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI));
|
||||
FFI_ASSERT (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI);
|
||||
|
||||
cif->abi = abi;
|
||||
cif->arg_types = atypes;
|
||||
|
@ -34,8 +34,8 @@ typedef signed long ffi_sarg;
|
||||
typedef enum ffi_abi {
|
||||
FFI_FIRST_ABI = 0,
|
||||
FFI_SYSV,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV,
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -4251,7 +4251,7 @@ void* dlmalloc(size_t bytes) {
|
||||
|
||||
void dlfree(void* mem) {
|
||||
/*
|
||||
Consolidate freed chunks with preceeding or succeeding bordering
|
||||
Consolidate freed chunks with preceding or succeeding bordering
|
||||
free chunks, if they exist, and then place in a bin. Intermixed
|
||||
with special cases for top, dv, mmapped chunks, and usage errors.
|
||||
*/
|
||||
|
@ -35,13 +35,9 @@ typedef signed long ffi_sarg;
|
||||
|
||||
typedef enum ffi_abi {
|
||||
FFI_FIRST_ABI = 0,
|
||||
|
||||
#ifdef FRV
|
||||
FFI_EABI,
|
||||
FFI_DEFAULT_ABI = FFI_EABI,
|
||||
#endif
|
||||
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_EABI
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -225,7 +225,7 @@ ffi_prep_cif_machdep(ffi_cif *cif)
|
||||
int flags;
|
||||
|
||||
/* Adjust cif->bytes to include space for the bits of the ia64_args frame
|
||||
that preceeds the integer register portion. The estimate that the
|
||||
that precedes the integer register portion. The estimate that the
|
||||
generic bits did for the argument space required is good enough for the
|
||||
integer component. */
|
||||
cif->bytes += offsetof(struct ia64_args, gp_regs[0]);
|
||||
|
@ -34,8 +34,8 @@ typedef signed long long ffi_sarg;
|
||||
typedef enum ffi_abi {
|
||||
FFI_FIRST_ABI = 0,
|
||||
FFI_UNIX, /* Linux and all Unix variants use the same conventions */
|
||||
FFI_DEFAULT_ABI = FFI_UNIX,
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_UNIX
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -36,8 +36,8 @@ typedef enum ffi_abi
|
||||
{
|
||||
FFI_FIRST_ABI = 0,
|
||||
FFI_SYSV,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV,
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -34,8 +34,8 @@ typedef signed long ffi_sarg;
|
||||
typedef enum ffi_abi {
|
||||
FFI_FIRST_ABI = 0,
|
||||
FFI_SYSV,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV,
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -186,30 +186,29 @@ typedef enum ffi_abi {
|
||||
FFI_O32_SOFT_FLOAT,
|
||||
FFI_N32_SOFT_FLOAT,
|
||||
FFI_N64_SOFT_FLOAT,
|
||||
FFI_LAST_ABI,
|
||||
|
||||
#ifdef FFI_MIPS_O32
|
||||
#ifdef __mips_soft_float
|
||||
FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT,
|
||||
FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT
|
||||
#else
|
||||
FFI_DEFAULT_ABI = FFI_O32,
|
||||
FFI_DEFAULT_ABI = FFI_O32
|
||||
#endif
|
||||
#else
|
||||
# if _MIPS_SIM==_ABI64
|
||||
# ifdef __mips_soft_float
|
||||
FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT,
|
||||
FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT
|
||||
# else
|
||||
FFI_DEFAULT_ABI = FFI_N64,
|
||||
FFI_DEFAULT_ABI = FFI_N64
|
||||
# endif
|
||||
# else
|
||||
# ifdef __mips_soft_float
|
||||
FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT,
|
||||
FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT
|
||||
# else
|
||||
FFI_DEFAULT_ABI = FFI_N32,
|
||||
FFI_DEFAULT_ABI = FFI_N32
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
} ffi_abi;
|
||||
|
||||
#define FFI_EXTRA_CIF_FIELDS unsigned rstruct_flag
|
||||
|
@ -35,13 +35,9 @@ typedef signed long ffi_sarg;
|
||||
|
||||
typedef enum ffi_abi {
|
||||
FFI_FIRST_ABI = 0,
|
||||
|
||||
#ifdef MOXIE
|
||||
FFI_EABI,
|
||||
FFI_DEFAULT_ABI = FFI_EABI,
|
||||
#endif
|
||||
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_EABI
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -38,21 +38,22 @@ typedef enum ffi_abi {
|
||||
|
||||
#ifdef PA_LINUX
|
||||
FFI_PA32,
|
||||
FFI_DEFAULT_ABI = FFI_PA32,
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_PA32
|
||||
#endif
|
||||
|
||||
#ifdef PA_HPUX
|
||||
FFI_PA32,
|
||||
FFI_DEFAULT_ABI = FFI_PA32,
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_PA32
|
||||
#endif
|
||||
|
||||
#ifdef PA64_HPUX
|
||||
#error "PA64_HPUX FFI is not yet implemented"
|
||||
FFI_PA64,
|
||||
FFI_DEFAULT_ABI = FFI_PA64,
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_PA64
|
||||
#endif
|
||||
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -31,12 +31,18 @@
|
||||
/* ---- System specific configurations ----------------------------------- */
|
||||
|
||||
#if defined (POWERPC) && defined (__powerpc64__) /* linux64 */
|
||||
#ifndef POWERPC64
|
||||
#define POWERPC64
|
||||
#endif
|
||||
#elif defined (POWERPC_DARWIN) && defined (__ppc64__) /* Darwin */
|
||||
#ifndef POWERPC64
|
||||
#define POWERPC64
|
||||
#endif
|
||||
#elif defined (POWERPC_AIX) && defined (__64BIT__) /* AIX64 */
|
||||
#ifndef POWERPC64
|
||||
#define POWERPC64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LIBFFI_ASM
|
||||
typedef unsigned long ffi_arg;
|
||||
|
@ -93,7 +93,7 @@ ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs,
|
||||
ffi_type **ptr;
|
||||
|
||||
FFI_ASSERT(cif != NULL);
|
||||
FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI));
|
||||
FFI_ASSERT(abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI);
|
||||
|
||||
cif->abi = abi;
|
||||
cif->arg_types = atypes;
|
||||
@ -110,7 +110,7 @@ ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs,
|
||||
FFI_ASSERT_VALID_TYPE(cif->rtype);
|
||||
|
||||
/* x86, x86-64 and s390 stack space allocation is handled in prep_machdep. */
|
||||
#if !defined M68K && !defined __i386__ && !defined __x86_64__ && !defined S390 && !defined PA
|
||||
#if !defined M68K && !defined X86_ANY && !defined S390 && !defined PA
|
||||
/* Make space for the return structure pointer */
|
||||
if (cif->rtype->type == FFI_TYPE_STRUCT
|
||||
#ifdef SPARC
|
||||
@ -131,7 +131,7 @@ ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs,
|
||||
check after the initialization. */
|
||||
FFI_ASSERT_VALID_TYPE(*ptr);
|
||||
|
||||
#if !defined __i386__ && !defined __x86_64__ && !defined S390 && !defined PA
|
||||
#if !defined X86_ANY && !defined S390 && !defined PA
|
||||
#ifdef SPARC
|
||||
if (((*ptr)->type == FFI_TYPE_STRUCT
|
||||
&& ((*ptr)->size > 16 || cif->abi != FFI_V9))
|
||||
|
@ -28,8 +28,10 @@
|
||||
#define LIBFFI_TARGET_H
|
||||
|
||||
#if defined (__s390x__)
|
||||
#ifndef S390X
|
||||
#define S390X
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ---- System specific configurations ----------------------------------- */
|
||||
|
||||
@ -40,8 +42,8 @@ typedef signed long ffi_sarg;
|
||||
typedef enum ffi_abi {
|
||||
FFI_FIRST_ABI = 0,
|
||||
FFI_SYSV,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV,
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -36,8 +36,8 @@ typedef signed long ffi_sarg;
|
||||
typedef enum ffi_abi {
|
||||
FFI_FIRST_ABI = 0,
|
||||
FFI_SYSV,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV,
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -36,8 +36,8 @@ typedef signed long ffi_sarg;
|
||||
typedef enum ffi_abi {
|
||||
FFI_FIRST_ABI = 0,
|
||||
FFI_SYSV,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV,
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV
|
||||
} ffi_abi;
|
||||
|
||||
#define FFI_EXTRA_CIF_FIELDS long long flags2
|
||||
|
@ -30,8 +30,10 @@
|
||||
/* ---- System specific configurations ----------------------------------- */
|
||||
|
||||
#if defined(__arch64__) || defined(__sparcv9)
|
||||
#ifndef SPARC64
|
||||
#define SPARC64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LIBFFI_ASM
|
||||
typedef unsigned long ffi_arg;
|
||||
@ -42,12 +44,12 @@ typedef enum ffi_abi {
|
||||
FFI_V8,
|
||||
FFI_V8PLUS,
|
||||
FFI_V9,
|
||||
FFI_LAST_ABI,
|
||||
#ifdef SPARC64
|
||||
FFI_DEFAULT_ABI = FFI_V9,
|
||||
FFI_DEFAULT_ABI = FFI_V9
|
||||
#else
|
||||
FFI_DEFAULT_ABI = FFI_V8,
|
||||
FFI_DEFAULT_ABI = FFI_V8
|
||||
#endif
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -155,12 +155,10 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
||||
switch (cif->rtype->type)
|
||||
{
|
||||
case FFI_TYPE_VOID:
|
||||
#if defined(X86) || defined (X86_WIN32) || defined(X86_FREEBSD) || defined(X86_DARWIN) || defined(X86_WIN64)
|
||||
case FFI_TYPE_UINT8:
|
||||
case FFI_TYPE_UINT16:
|
||||
case FFI_TYPE_SINT8:
|
||||
case FFI_TYPE_SINT16:
|
||||
#endif
|
||||
#ifdef X86_WIN64
|
||||
case FFI_TYPE_UINT32:
|
||||
case FFI_TYPE_SINT32:
|
||||
@ -291,27 +289,8 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
|
||||
{
|
||||
#ifdef X86_WIN64
|
||||
case FFI_WIN64:
|
||||
{
|
||||
/* Make copies of all struct arguments
|
||||
NOTE: not sure if responsibility should be here or in caller */
|
||||
unsigned int i;
|
||||
for (i=0; i < cif->nargs;i++) {
|
||||
size_t size = cif->arg_types[i]->size;
|
||||
if ((cif->arg_types[i]->type == FFI_TYPE_STRUCT
|
||||
&& (size != 1 && size != 2 && size != 4 && size != 8))
|
||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
||||
|| cif->arg_types[i]->type == FFI_TYPE_LONGDOUBLE
|
||||
#endif
|
||||
)
|
||||
{
|
||||
void *local = alloca(size);
|
||||
memcpy(local, avalue[i], size);
|
||||
avalue[i] = local;
|
||||
}
|
||||
}
|
||||
ffi_call_win64(ffi_prep_args, &ecif, cif->bytes,
|
||||
cif->flags, ecif.rvalue, fn);
|
||||
}
|
||||
ffi_call_win64(ffi_prep_args, &ecif, cif->bytes,
|
||||
cif->flags, ecif.rvalue, fn);
|
||||
break;
|
||||
#elif defined(X86_WIN32)
|
||||
case FFI_SYSV:
|
||||
@ -586,9 +565,9 @@ ffi_prep_raw_closure_loc (ffi_raw_closure* closure,
|
||||
}
|
||||
|
||||
/* we currently don't support certain kinds of arguments for raw
|
||||
closures. This should be implemented by a separate assembly language
|
||||
routine, since it would require argument processing, something we
|
||||
don't do now for performance. */
|
||||
closures. This should be implemented by a separate assembly
|
||||
language routine, since it would require argument processing,
|
||||
something we don't do now for performance. */
|
||||
|
||||
for (i = cif->nargs-1; i >= 0; i--)
|
||||
{
|
||||
|
@ -50,9 +50,10 @@ extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
|
||||
gcc/config/i386/i386.c. Do *not* change one without the other. */
|
||||
|
||||
/* Register class used for passing given 64bit part of the argument.
|
||||
These represent classes as documented by the PS ABI, with the exception
|
||||
of SSESF, SSEDF classes, that are basically SSE class, just gcc will
|
||||
use SF or DFmode move instead of DImode to avoid reformating penalties.
|
||||
These represent classes as documented by the PS ABI, with the
|
||||
exception of SSESF, SSEDF classes, that are basically SSE class,
|
||||
just gcc will use SF or DFmode move instead of DImode to avoid
|
||||
reformatting penalties.
|
||||
|
||||
Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves
|
||||
whenever possible (upper half does contain padding). */
|
||||
|
@ -31,6 +31,9 @@
|
||||
|
||||
/* ---- System specific configurations ----------------------------------- */
|
||||
|
||||
/* For code common to all platforms on x86 and x86_64. */
|
||||
#define X86_ANY
|
||||
|
||||
#if defined (X86_64) && defined (__i386__)
|
||||
#undef X86_64
|
||||
#define X86
|
||||
@ -64,28 +67,26 @@ typedef enum ffi_abi {
|
||||
#ifdef X86_WIN32
|
||||
FFI_SYSV,
|
||||
FFI_STDCALL,
|
||||
FFI_LAST_ABI,
|
||||
/* TODO: Add fastcall support for the sake of completeness */
|
||||
FFI_DEFAULT_ABI = FFI_SYSV,
|
||||
#endif
|
||||
FFI_DEFAULT_ABI = FFI_SYSV
|
||||
|
||||
#ifdef X86_WIN64
|
||||
#elif defined(X86_WIN64)
|
||||
FFI_WIN64,
|
||||
FFI_DEFAULT_ABI = FFI_WIN64,
|
||||
#else
|
||||
FFI_LAST_ABI,
|
||||
FFI_DEFAULT_ABI = FFI_WIN64
|
||||
|
||||
#else
|
||||
/* ---- Intel x86 and AMD x86-64 - */
|
||||
#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__) || defined(__i386) || defined(__amd64))
|
||||
FFI_SYSV,
|
||||
FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */
|
||||
FFI_LAST_ABI,
|
||||
#if defined(__i386__) || defined(__i386)
|
||||
FFI_DEFAULT_ABI = FFI_SYSV,
|
||||
FFI_DEFAULT_ABI = FFI_SYSV
|
||||
#else
|
||||
FFI_DEFAULT_ABI = FFI_UNIX64,
|
||||
FFI_DEFAULT_ABI = FFI_UNIX64
|
||||
#endif
|
||||
#endif
|
||||
#endif /* X86_WIN64 */
|
||||
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008 Red Hat, Inc.
|
||||
sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008, 2010 Red Hat, Inc.
|
||||
|
||||
X86 Foreign Function Interface
|
||||
|
||||
@ -48,6 +48,9 @@ ffi_call_SYSV:
|
||||
movl 16(%ebp),%ecx
|
||||
subl %ecx,%esp
|
||||
|
||||
/* Align the stack pointer to 16-bytes */
|
||||
andl $0xfffffff0, %esp
|
||||
|
||||
movl %esp,%eax
|
||||
|
||||
/* Place all of the ffi_prep_args in position */
|
||||
@ -331,10 +334,20 @@ ffi_closure_raw_SYSV:
|
||||
.LSCIE1:
|
||||
.long 0x0 /* CIE Identifier Tag */
|
||||
.byte 0x1 /* CIE Version */
|
||||
#ifdef HAVE_AS_ASCII_PSEUDO_OP
|
||||
#ifdef __PIC__
|
||||
.ascii "zR\0" /* CIE Augmentation */
|
||||
#else
|
||||
.ascii "\0" /* CIE Augmentation */
|
||||
#endif
|
||||
#elif defined HAVE_AS_STRING_PSEUDO_OP
|
||||
#ifdef __PIC__
|
||||
.string "zR" /* CIE Augmentation */
|
||||
#else
|
||||
.string "" /* CIE Augmentation */
|
||||
#endif
|
||||
#else
|
||||
#error missing .ascii/.string
|
||||
#endif
|
||||
.byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */
|
||||
.byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */
|
||||
|
@ -324,7 +324,11 @@ ffi_closure_unix64:
|
||||
.LUW9:
|
||||
.size ffi_closure_unix64,.-ffi_closure_unix64
|
||||
|
||||
#ifdef HAVE_AS_X86_64_UNWIND_SECTION_TYPE
|
||||
.section .eh_frame,"a",@unwind
|
||||
#else
|
||||
.section .eh_frame,"a",@progbits
|
||||
#endif
|
||||
.Lframe1:
|
||||
.long .LECIE1-.LSCIE1 /* CIE Length */
|
||||
.LSCIE1:
|
||||
|
1
js/src/ctypes/libffi/stamp-h.in
Normal file
1
js/src/ctypes/libffi/stamp-h.in
Normal file
@ -0,0 +1 @@
|
||||
timestamp
|
@ -1,4 +1,4 @@
|
||||
# Makefile.in generated by automake 1.11 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
@ -108,6 +108,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
|
@ -17,11 +17,9 @@ int main (void)
|
||||
ffi_cif cif;
|
||||
void *code;
|
||||
ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
|
||||
void* args[1];
|
||||
ffi_type* arg_types[1];
|
||||
|
||||
arg_types[0] = NULL;
|
||||
args[0] = NULL;
|
||||
|
||||
CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void,
|
||||
arg_types) == FFI_BAD_ABI);
|
||||
|
@ -123,16 +123,6 @@
|
||||
* (e.g., some HP systems), it may be necessary to #define NAN_WORD0
|
||||
* appropriately -- to the most significant word of a quiet NaN.
|
||||
* (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.)
|
||||
* When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined,
|
||||
* strtod also accepts (case insensitively) strings of the form
|
||||
* NaN(x), where x is a string of hexadecimal digits and spaces;
|
||||
* if there is only one string of hexadecimal digits, it is taken
|
||||
* for the 52 fraction bits of the resulting NaN; if there are two
|
||||
* or more strings of hex digits, the first is for the high 20 bits,
|
||||
* the second and subsequent for the low 32 bits, with intervening
|
||||
* white space ignored; but if this results in none of the 52
|
||||
* fraction bits being on (an IEEE Infinity symbol), then NAN_WORD0
|
||||
* and NAN_WORD1 are used instead.
|
||||
* #define MULTIPLE_THREADS if the system offers preemptively scheduled
|
||||
* multiple threads. In this case, you must provide (or suitably
|
||||
* #define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed
|
||||
@ -1531,76 +1521,6 @@ match
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef No_Hex_NaN
|
||||
static void
|
||||
hexnan
|
||||
#ifdef KR_headers
|
||||
(rvp, sp) U *rvp; CONST char **sp;
|
||||
#else
|
||||
(U *rvp, CONST char **sp)
|
||||
#endif
|
||||
{
|
||||
ULong c, x[2];
|
||||
CONST char *s;
|
||||
int havedig, udx0, xshift;
|
||||
|
||||
x[0] = x[1] = 0;
|
||||
havedig = xshift = 0;
|
||||
udx0 = 1;
|
||||
s = *sp;
|
||||
/* allow optional initial 0x or 0X */
|
||||
while((c = *(CONST unsigned char*)(s+1)) && c <= ' ')
|
||||
++s;
|
||||
if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X'))
|
||||
s += 2;
|
||||
while((c = *(CONST unsigned char*)++s)) {
|
||||
if (c >= '0' && c <= '9')
|
||||
c -= '0';
|
||||
else if (c >= 'a' && c <= 'f')
|
||||
c += 10 - 'a';
|
||||
else if (c >= 'A' && c <= 'F')
|
||||
c += 10 - 'A';
|
||||
else if (c <= ' ') {
|
||||
if (udx0 && havedig) {
|
||||
udx0 = 0;
|
||||
xshift = 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#ifdef GDTOA_NON_PEDANTIC_NANCHECK
|
||||
else if (/*(*/ c == ')' && havedig) {
|
||||
*sp = s + 1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
return; /* invalid form: don't change *sp */
|
||||
#else
|
||||
else {
|
||||
do {
|
||||
if (/*(*/ c == ')') {
|
||||
*sp = s + 1;
|
||||
break;
|
||||
}
|
||||
} while((c = *++s));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
havedig = 1;
|
||||
if (xshift) {
|
||||
xshift = 0;
|
||||
x[0] = x[1];
|
||||
x[1] = 0;
|
||||
}
|
||||
if (udx0)
|
||||
x[0] = (x[0] << 4) | (x[1] >> 28);
|
||||
x[1] = (x[1] << 4) | c;
|
||||
}
|
||||
if ((x[0] &= 0xfffff) || x[1]) {
|
||||
word0(*rvp) = Exp_mask | x[0];
|
||||
word1(*rvp) = x[1];
|
||||
}
|
||||
}
|
||||
#endif /*No_Hex_NaN*/
|
||||
#endif /* INFNAN_CHECK */
|
||||
|
||||
static double
|
||||
@ -1782,10 +1702,6 @@ _strtod
|
||||
if (match(&s, "an")) {
|
||||
word0(rv) = NAN_WORD0;
|
||||
word1(rv) = NAN_WORD1;
|
||||
#ifndef No_Hex_NaN
|
||||
if (*s == '(') /*)*/
|
||||
hexnan(&rv, &s);
|
||||
#endif
|
||||
goto ret;
|
||||
}
|
||||
}
|
||||
|
@ -568,7 +568,8 @@ JSRuntime::init(uint32 maxbytes)
|
||||
#endif
|
||||
|
||||
if (!(defaultCompartment = new JSCompartment(this)) ||
|
||||
!defaultCompartment->init()) {
|
||||
!defaultCompartment->init() ||
|
||||
!compartments.append(defaultCompartment)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -657,8 +658,10 @@ JSRuntime::~JSRuntime()
|
||||
JS_DESTROY_LOCK(debuggerLock);
|
||||
#endif
|
||||
propertyTree.finish();
|
||||
if (defaultCompartment)
|
||||
delete defaultCompartment;
|
||||
/* Delete all remaining Compartments. Ideally only the defaultCompartment should be left. */
|
||||
for (JSCompartment **c = compartments.begin(); c != compartments.end(); ++c)
|
||||
delete *c;
|
||||
compartments.clear();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSRuntime *)
|
||||
|
@ -624,12 +624,7 @@ JS_DECLARE_CALLINFO(js_String_tn)
|
||||
JS_DECLARE_CALLINFO(js_CompareStrings)
|
||||
JS_DECLARE_CALLINFO(js_ConcatStrings)
|
||||
JS_DECLARE_CALLINFO(js_EqualStrings)
|
||||
JS_DECLARE_CALLINFO(js_String_getelem)
|
||||
JS_DECLARE_CALLINFO(js_String_p_charCodeAt)
|
||||
JS_DECLARE_CALLINFO(js_String_p_charCodeAt0)
|
||||
JS_DECLARE_CALLINFO(js_String_p_charCodeAt0_int)
|
||||
JS_DECLARE_CALLINFO(js_String_p_charCodeAt_double_int)
|
||||
JS_DECLARE_CALLINFO(js_String_p_charCodeAt_int_int)
|
||||
JS_DECLARE_CALLINFO(js_Flatten)
|
||||
|
||||
/* Defined in jstypedarray.cpp. */
|
||||
JS_DECLARE_CALLINFO(js_TypedArray_uint8_clamp_double)
|
||||
|
@ -2983,6 +2983,10 @@ SweepCompartments(JSContext *cx)
|
||||
JSCompartment **read = rt->compartments.begin();
|
||||
JSCompartment **end = rt->compartments.end();
|
||||
JSCompartment **write = read;
|
||||
|
||||
/* Delete defaultCompartment only during runtime shutdown */
|
||||
rt->defaultCompartment->marked = true;
|
||||
|
||||
while (read < end) {
|
||||
JSCompartment *compartment = (*read++);
|
||||
if (compartment->marked) {
|
||||
|
@ -2329,7 +2329,7 @@ class RegExpNativeCompiler {
|
||||
Fragment* fragment;
|
||||
LirWriter* lir;
|
||||
#ifdef DEBUG
|
||||
LirWriter* validate_writer;
|
||||
ValidateWriter* validate_writer;
|
||||
#endif
|
||||
#ifdef NJ_VERBOSE
|
||||
LirWriter* verbose_filter;
|
||||
@ -3243,6 +3243,15 @@ class RegExpNativeCompiler {
|
||||
lirbuf->state = state = addName(lirbuf, lir->insParam(0, 0), "state");
|
||||
lirbuf->param1 = cpend = addName(lirbuf, lir->insParam(1, 0), "cpend");
|
||||
|
||||
#ifdef DEBUG
|
||||
// Do this before any REGlobalData loads/stores occur. 'extras' can
|
||||
// be stack-allocated.
|
||||
{
|
||||
void* extras[] = { /* dummy */NULL, /* dummy */NULL };
|
||||
validate_writer->setCheckAccSetExtras(extras);
|
||||
}
|
||||
#endif
|
||||
|
||||
loopLabel = lir->ins0(LIR_label);
|
||||
// If profiling, record where the loop label is, so that the
|
||||
// assembler can insert a frag-entry-counter increment at that
|
||||
|
104
js/src/jsstr.cpp
104
js/src/jsstr.cpp
@ -176,6 +176,18 @@ JSString::flatten()
|
||||
topNode->initFlatMutable(chars, pos, capacity);
|
||||
}
|
||||
|
||||
#ifdef JS_TRACER
|
||||
|
||||
int32 JS_FASTCALL
|
||||
js_Flatten(JSString* str)
|
||||
{
|
||||
str->flatten();
|
||||
return 0;
|
||||
}
|
||||
JS_DEFINE_CALLINFO_1(extern, INT32, js_Flatten, STRING, 0, nanojit::ACCSET_STORE_ANY)
|
||||
|
||||
#endif /* !JS_TRACER */
|
||||
|
||||
static JS_ALWAYS_INLINE size_t
|
||||
RopeAllocSize(const size_t length, size_t *capacity)
|
||||
{
|
||||
@ -977,17 +989,6 @@ str_substring(JSContext *cx, uintN argc, Value *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
#ifdef JS_TRACER
|
||||
static JSString* FASTCALL
|
||||
String_p_toString(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
if (!InstanceOf(cx, obj, &js_StringClass, NULL))
|
||||
return NULL;
|
||||
Value v = obj->getPrimitiveThis();
|
||||
return v.toString();
|
||||
}
|
||||
#endif
|
||||
|
||||
JSString* JS_FASTCALL
|
||||
js_toLowerCase(JSContext *cx, JSString *str)
|
||||
{
|
||||
@ -1111,8 +1112,8 @@ str_localeCompare(JSContext *cx, uintN argc, Value *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
str_charAt(JSContext *cx, uintN argc, Value *vp)
|
||||
JSBool
|
||||
js_str_charAt(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
JSString *str;
|
||||
jsint i;
|
||||
@ -1150,8 +1151,8 @@ out_of_range:
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
str_charCodeAt(JSContext *cx, uintN argc, Value *vp)
|
||||
JSBool
|
||||
js_str_charCodeAt(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
JSString *str;
|
||||
jsint i;
|
||||
@ -1186,60 +1187,6 @@ out_of_range:
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
#ifdef JS_TRACER
|
||||
|
||||
jsdouble FASTCALL
|
||||
js_String_p_charCodeAt(JSString* str, jsdouble d)
|
||||
{
|
||||
d = js_DoubleToInteger(d);
|
||||
if (d < 0 || (int32)str->length() <= d)
|
||||
return js_NaN;
|
||||
return jsdouble(str->chars()[jsuint(d)]);
|
||||
}
|
||||
|
||||
int32 FASTCALL
|
||||
js_String_p_charCodeAt_int_int(JSString* str, jsint i)
|
||||
{
|
||||
if (i < 0 || (int32)str->length() <= i)
|
||||
return 0;
|
||||
return str->chars()[i];
|
||||
}
|
||||
JS_DEFINE_CALLINFO_2(extern, INT32, js_String_p_charCodeAt_int_int, STRING, INT32,
|
||||
1, nanojit::ACCSET_NONE)
|
||||
|
||||
int32 FASTCALL
|
||||
js_String_p_charCodeAt_double_int(JSString* str, double d)
|
||||
{
|
||||
d = js_DoubleToInteger(d);
|
||||
if (d < 0 || (int32)str->length() <= d)
|
||||
return 0;
|
||||
return str->chars()[jsuint(d)];
|
||||
}
|
||||
JS_DEFINE_CALLINFO_2(extern, INT32, js_String_p_charCodeAt_double_int, STRING, DOUBLE,
|
||||
1, nanojit::ACCSET_NONE)
|
||||
|
||||
jsdouble FASTCALL
|
||||
js_String_p_charCodeAt0(JSString* str)
|
||||
{
|
||||
if ((int32)str->length() == 0)
|
||||
return js_NaN;
|
||||
return jsdouble(str->chars()[0]);
|
||||
}
|
||||
|
||||
/*
|
||||
* The FuncFilter replaces the generic double version of charCodeAt with the
|
||||
* integer fast path if appropriate.
|
||||
*/
|
||||
int32 FASTCALL
|
||||
js_String_p_charCodeAt0_int(JSString* str)
|
||||
{
|
||||
if ((int32)str->length() == 0)
|
||||
return 0;
|
||||
return str->chars()[0];
|
||||
}
|
||||
JS_DEFINE_CALLINFO_1(extern, INT32, js_String_p_charCodeAt0_int, STRING, 1, nanojit::ACCSET_NONE)
|
||||
#endif
|
||||
|
||||
jsint
|
||||
js_BoyerMooreHorspool(const jschar *text, jsuint textlen,
|
||||
const jschar *pat, jsuint patlen)
|
||||
@ -2852,19 +2799,8 @@ js_String_getelem(JSContext* cx, JSString* str, int32 i)
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_DEFINE_TRCINFO_1(js_str_toString,
|
||||
(2, (extern, STRING_RETRY, String_p_toString, CONTEXT, THIS,
|
||||
1, nanojit::ACCSET_NONE)))
|
||||
JS_DEFINE_TRCINFO_1(str_charAt,
|
||||
(3, (extern, STRING_RETRY, js_String_getelem, CONTEXT, THIS_STRING, INT32,
|
||||
1, nanojit::ACCSET_NONE)))
|
||||
JS_DEFINE_TRCINFO_2(str_charCodeAt,
|
||||
(1, (extern, DOUBLE, js_String_p_charCodeAt0, THIS_STRING,
|
||||
1, nanojit::ACCSET_NONE)),
|
||||
(2, (extern, DOUBLE, js_String_p_charCodeAt, THIS_STRING, DOUBLE,
|
||||
1, nanojit::ACCSET_NONE)))
|
||||
JS_DEFINE_TRCINFO_1(str_concat,
|
||||
(3, (extern, STRING_RETRY, js_ConcatStrings, CONTEXT, THIS_STRING, STRING,
|
||||
(3, (extern, STRING_RETRY, js_ConcatStrings, CONTEXT, THIS_STRING, STRING,
|
||||
1, nanojit::ACCSET_NONE)))
|
||||
|
||||
#define GENERIC JSFUN_GENERIC_NATIVE
|
||||
@ -2878,14 +2814,14 @@ static JSFunctionSpec string_methods[] = {
|
||||
#endif
|
||||
|
||||
/* Java-like methods. */
|
||||
JS_TN(js_toString_str, js_str_toString, 0,JSFUN_THISP_STRING, &js_str_toString_trcinfo),
|
||||
JS_FN(js_toString_str, js_str_toString, 0,JSFUN_THISP_STRING),
|
||||
JS_FN(js_valueOf_str, js_str_toString, 0,JSFUN_THISP_STRING),
|
||||
JS_FN(js_toJSON_str, js_str_toString, 0,JSFUN_THISP_STRING),
|
||||
JS_FN("substring", str_substring, 2,GENERIC_PRIMITIVE),
|
||||
JS_FN("toLowerCase", str_toLowerCase, 0,GENERIC_PRIMITIVE),
|
||||
JS_FN("toUpperCase", str_toUpperCase, 0,GENERIC_PRIMITIVE),
|
||||
JS_TN("charAt", str_charAt, 1,GENERIC_PRIMITIVE, &str_charAt_trcinfo),
|
||||
JS_TN("charCodeAt", str_charCodeAt, 1,GENERIC_PRIMITIVE, &str_charCodeAt_trcinfo),
|
||||
JS_FN("charAt", js_str_charAt, 1,GENERIC_PRIMITIVE),
|
||||
JS_FN("charCodeAt", js_str_charCodeAt, 1,GENERIC_PRIMITIVE),
|
||||
JS_FN("indexOf", str_indexOf, 1,GENERIC_PRIMITIVE),
|
||||
JS_FN("lastIndexOf", str_lastIndexOf, 1,GENERIC_PRIMITIVE),
|
||||
JS_FN("trim", str_trim, 0,GENERIC_PRIMITIVE),
|
||||
|
@ -1125,6 +1125,12 @@ str_replace(JSContext *cx, uintN argc, js::Value *vp);
|
||||
extern JSBool
|
||||
js_str_toString(JSContext *cx, uintN argc, js::Value *vp);
|
||||
|
||||
extern JSBool
|
||||
js_str_charAt(JSContext *cx, uintN argc, js::Value *vp);
|
||||
|
||||
extern JSBool
|
||||
js_str_charCodeAt(JSContext *cx, uintN argc, js::Value *vp);
|
||||
|
||||
/*
|
||||
* Convert one UCS-4 char and write it into a UTF-8 buffer, which must be at
|
||||
* least 6 bytes long. Return the number of UTF-8 bytes of data written.
|
||||
|
@ -141,10 +141,10 @@ StackFilter::getTop(LIns* guard)
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void ValidateWriter::checkAccSet(LOpcode op, LIns* base, AccSet accSet)
|
||||
void ValidateWriter::checkAccSet(LOpcode op, LIns* base, int32_t disp, AccSet accSet)
|
||||
{
|
||||
LIns* sp = checkAccSetIns1;
|
||||
LIns* rp = checkAccSetIns2;
|
||||
LIns* sp = (LIns*)checkAccSetExtras[0];
|
||||
LIns* rp = (LIns*)checkAccSetExtras[1];
|
||||
|
||||
bool isRstack = base == rp;
|
||||
bool isStack =
|
||||
@ -2361,6 +2361,16 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* anchor, VMFragment* frag
|
||||
fragment->loopLabel = entryLabel;
|
||||
})
|
||||
|
||||
#ifdef DEBUG
|
||||
// Need to set these up before any loads/stores occur.
|
||||
// 'extras' is heap-allocated because its lifetime matches validate[12]'s.
|
||||
void** extras = new (tempAlloc()) void*[2];
|
||||
extras[0] = 0; // we'll set it shortly
|
||||
extras[1] = 0; // we'll set it shortly
|
||||
validate1->setCheckAccSetExtras(extras);
|
||||
validate2->setCheckAccSetExtras(extras);
|
||||
#endif
|
||||
|
||||
lirbuf->sp =
|
||||
addName(lir->insLoad(LIR_ldp, lirbuf->state, offsetof(TracerState, sp), ACCSET_OTHER), "sp");
|
||||
lirbuf->rp =
|
||||
@ -2373,11 +2383,9 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* anchor, VMFragment* frag
|
||||
addName(lir->insLoad(LIR_ldp, lirbuf->state, offsetof(TracerState, eor), ACCSET_OTHER), "eor");
|
||||
|
||||
#ifdef DEBUG
|
||||
// Need to set these up before any stack/rstack loads/stores occur.
|
||||
validate1->setCheckAccSetIns1(lirbuf->sp);
|
||||
validate2->setCheckAccSetIns1(lirbuf->sp);
|
||||
validate1->setCheckAccSetIns2(lirbuf->rp);
|
||||
validate2->setCheckAccSetIns2(lirbuf->rp);
|
||||
// Need to update these before any stack/rstack loads/stores occur.
|
||||
extras[0] = lirbuf->sp;
|
||||
extras[1] = lirbuf->rp;
|
||||
#endif
|
||||
|
||||
/* If we came from exit, we might not have enough global types. */
|
||||
@ -8573,20 +8581,6 @@ TraceRecorder::d2i(LIns* f, bool resultCanBeImpreciseIfFractional)
|
||||
LIns* args[] = { fcallarg(f, 1), fcallarg(f, 0) };
|
||||
return lir->insCall(&js_StringToInt32_ci, args);
|
||||
}
|
||||
if (ci == &js_String_p_charCodeAt0_ci) {
|
||||
// Use a fast path builtin for a charCodeAt that converts to an int right away.
|
||||
LIns* args[] = { fcallarg(f, 0) };
|
||||
return lir->insCall(&js_String_p_charCodeAt0_int_ci, args);
|
||||
}
|
||||
if (ci == &js_String_p_charCodeAt_ci) {
|
||||
LIns* idx = fcallarg(f, 1);
|
||||
if (isPromote(idx)) {
|
||||
LIns* args[] = { demote(lir, idx), fcallarg(f, 0) };
|
||||
return lir->insCall(&js_String_p_charCodeAt_int_int_ci, args);
|
||||
}
|
||||
LIns* args[] = { idx, fcallarg(f, 0) };
|
||||
return lir->insCall(&js_String_p_charCodeAt_double_int_ci, args);
|
||||
}
|
||||
}
|
||||
return resultCanBeImpreciseIfFractional
|
||||
? lir->ins1(LIR_d2i, f)
|
||||
@ -8701,9 +8695,7 @@ TraceRecorder::ifop()
|
||||
lir->insEqI_0(lir->ins2(LIR_eqd, v_ins, lir->insImmD(0))));
|
||||
} else if (v.isString()) {
|
||||
cond = v.toString()->length() != 0;
|
||||
x = lir->ins2ImmI(LIR_rshup, lir->insLoad(LIR_ldp, v_ins,
|
||||
offsetof(JSString, mLengthAndFlags), ACCSET_OTHER),
|
||||
JSString::FLAGS_LENGTH_SHIFT);
|
||||
x = getStringLength(v_ins);
|
||||
} else {
|
||||
JS_NOT_REACHED("ifop");
|
||||
return ARECORD_STOP;
|
||||
@ -9024,9 +9016,20 @@ TraceRecorder::equalityHelper(Value& l, Value& r, LIns* l_ins, LIns* r_ins,
|
||||
JS_ASSERT(r.isBoolean());
|
||||
cond = (l == r);
|
||||
} else if (l.isString()) {
|
||||
args[0] = r_ins, args[1] = l_ins;
|
||||
l_ins = lir->insCall(&js_EqualStrings_ci, args);
|
||||
r_ins = lir->insImmI(1);
|
||||
JSString *l_str = l.toString();
|
||||
JSString *r_str = r.toString();
|
||||
if (!l_str->isRope() && !r_str->isRope() && l_str->length() == 1 && r_str->length() == 1) {
|
||||
VMSideExit *exit = snapshot(BRANCH_EXIT);
|
||||
LIns *c = INS_CONSTWORD(1);
|
||||
guard(true, lir->ins2(LIR_eqp, getStringLength(l_ins), c), exit);
|
||||
guard(true, lir->ins2(LIR_eqp, getStringLength(r_ins), c), exit);
|
||||
l_ins = lir->insLoad(LIR_ldus2ui, getStringChars(l_ins), 0, ACCSET_OTHER, LOAD_CONST);
|
||||
r_ins = lir->insLoad(LIR_ldus2ui, getStringChars(r_ins), 0, ACCSET_OTHER, LOAD_CONST);
|
||||
} else {
|
||||
args[0] = r_ins, args[1] = l_ins;
|
||||
l_ins = lir->insCall(&js_EqualStrings_ci, args);
|
||||
r_ins = lir->insImmI(1);
|
||||
}
|
||||
cond = !!js_EqualStrings(l.toString(), r.toString());
|
||||
} else {
|
||||
JS_ASSERT(l.isNumber() && r.isNumber());
|
||||
@ -9457,7 +9460,12 @@ TraceRecorder::test_property_cache(JSObject* obj, LIns* obj_ins, JSObject*& obj2
|
||||
JS_PROPERTY_CACHE(cx).test(cx, pc, aobj, obj2, entry, atom);
|
||||
if (atom) {
|
||||
// Miss: pre-fill the cache for the interpreter, as well as for our needs.
|
||||
// FIXME: bug 458271.
|
||||
jsid id = ATOM_TO_JSID(atom);
|
||||
|
||||
// The lookup below may change object shapes.
|
||||
forgetGuardedShapes();
|
||||
|
||||
JSProperty* prop;
|
||||
if (JOF_OPMODE(*pc) == JOF_NAME) {
|
||||
JS_ASSERT(aobj == obj);
|
||||
@ -10873,9 +10881,7 @@ TraceRecorder::record_JSOP_NOT()
|
||||
return ARECORD_CONTINUE;
|
||||
}
|
||||
JS_ASSERT(v.isString());
|
||||
set(&v, lir->insEqP_0(lir->ins2ImmI(LIR_rshup, lir->insLoad(LIR_ldp, get(&v),
|
||||
offsetof(JSString, mLengthAndFlags), ACCSET_OTHER),
|
||||
JSString::FLAGS_LENGTH_SHIFT)));
|
||||
set(&v, lir->insEqP_0(getStringLength(get(&v))));
|
||||
return ARECORD_CONTINUE;
|
||||
}
|
||||
|
||||
@ -11359,13 +11365,33 @@ TraceRecorder::callNative(uintN argc, JSOp mode)
|
||||
|
||||
switch (argc) {
|
||||
case 1:
|
||||
if (vp[2].isNumber() &&
|
||||
(native == js_math_ceil || native == js_math_floor || native == js_math_round)) {
|
||||
LIns* a = get(&vp[2]);
|
||||
if (isPromote(a)) {
|
||||
set(&vp[0], a);
|
||||
pendingSpecializedNative = IGNORE_NATIVE_CALL_COMPLETE_CALLBACK;
|
||||
return RECORD_CONTINUE;
|
||||
if (vp[2].isNumber()) {
|
||||
if (native == js_math_ceil || native == js_math_floor || native == js_math_round) {
|
||||
LIns* a = get(&vp[2]);
|
||||
if (isPromote(a)) {
|
||||
set(&vp[0], a);
|
||||
pendingSpecializedNative = IGNORE_NATIVE_CALL_COMPLETE_CALLBACK;
|
||||
return RECORD_CONTINUE;
|
||||
}
|
||||
}
|
||||
if (vp[1].isString()) {
|
||||
JSString *str = vp[1].toString();
|
||||
if (native == (FastNative)js_str_charAt) {
|
||||
LIns* str_ins = get(&vp[1]);
|
||||
LIns* idx_ins = get(&vp[2]);
|
||||
set(&vp[0], getCharAt(str, str_ins, idx_ins));
|
||||
pendingSpecializedNative = IGNORE_NATIVE_CALL_COMPLETE_CALLBACK;
|
||||
return RECORD_CONTINUE;
|
||||
} else if (native == (FastNative)js_str_charCodeAt) {
|
||||
jsdouble i = vp[2].toNumber();
|
||||
if (i < 0 || i >= str->length())
|
||||
RETURN_STOP("charCodeAt out of bounds");
|
||||
LIns* str_ins = get(&vp[1]);
|
||||
LIns* idx_ins = get(&vp[2]);
|
||||
set(&vp[0], getCharCodeAt(str, str_ins, idx_ins));
|
||||
pendingSpecializedNative = IGNORE_NATIVE_CALL_COMPLETE_CALLBACK;
|
||||
return RECORD_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -12471,6 +12497,85 @@ TraceRecorder::getPropertyWithScriptGetter(JSObject *obj, LIns* obj_ins, JSScope
|
||||
}
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK LIns*
|
||||
TraceRecorder::getStringLength(LIns* str_ins)
|
||||
{
|
||||
return addName(lir->ins2ImmI(LIR_rshup,
|
||||
addName(lir->insLoad(LIR_ldp, str_ins,
|
||||
offsetof(JSString, mLengthAndFlags),
|
||||
ACCSET_OTHER, LOAD_CONST), "mLengthAndFlags"),
|
||||
JSString::FLAGS_LENGTH_SHIFT), "length");
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK LIns*
|
||||
TraceRecorder::getStringChars(LIns* str_ins)
|
||||
{
|
||||
return addName(lir->insLoad(LIR_ldp, str_ins,
|
||||
offsetof(JSString, mChars),
|
||||
ACCSET_OTHER, LOAD_CONST), "chars");
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK LIns*
|
||||
TraceRecorder::getCharCodeAt(JSString *str, LIns* str_ins, LIns* idx_ins)
|
||||
{
|
||||
idx_ins = lir->insUI2P(makeNumberInt32(idx_ins));
|
||||
LIns *length_ins = lir->insLoad(LIR_ldp, str_ins, offsetof(JSString, mLengthAndFlags),
|
||||
ACCSET_OTHER, LOAD_CONST);
|
||||
LIns *br = lir->insBranch(LIR_jt,
|
||||
lir->insEqP_0(lir->ins2(LIR_andp,
|
||||
length_ins,
|
||||
INS_CONSTWORD(JSString::ROPE_BIT))),
|
||||
NULL);
|
||||
lir->insCall(&js_Flatten_ci, &str_ins);
|
||||
br->setTarget(lir->ins0(LIR_label));
|
||||
|
||||
guard(true,
|
||||
lir->ins2(LIR_ltup, idx_ins, lir->ins2ImmI(LIR_rshup, length_ins, JSString::FLAGS_LENGTH_SHIFT)),
|
||||
snapshot(MISMATCH_EXIT));
|
||||
LIns *chars_ins = getStringChars(str_ins);
|
||||
return i2d(lir->insLoad(LIR_ldus2ui,
|
||||
lir->ins2(LIR_addp, chars_ins, lir->ins2ImmI(LIR_lshp, idx_ins, 1)), 0,
|
||||
ACCSET_OTHER, LOAD_CONST));
|
||||
}
|
||||
|
||||
JS_STATIC_ASSERT(sizeof(JSString) == 16 || sizeof(JSString) == 32);
|
||||
|
||||
JS_REQUIRES_STACK LIns*
|
||||
TraceRecorder::getCharAt(JSString *str, LIns* str_ins, LIns* idx_ins)
|
||||
{
|
||||
idx_ins = lir->insUI2P(makeNumberInt32(idx_ins));
|
||||
LIns *length_ins = lir->insLoad(LIR_ldp, str_ins, offsetof(JSString, mLengthAndFlags),
|
||||
ACCSET_OTHER, LOAD_CONST);
|
||||
LIns *br = lir->insBranch(LIR_jt,
|
||||
lir->insEqP_0(lir->ins2(LIR_andp,
|
||||
length_ins,
|
||||
INS_CONSTWORD(JSString::ROPE_BIT))),
|
||||
NULL);
|
||||
lir->insCall(&js_Flatten_ci, &str_ins);
|
||||
br->setTarget(lir->ins0(LIR_label));
|
||||
|
||||
LIns *phi_ins = lir->insAlloc(sizeof(JSString *));
|
||||
lir->insStore(LIR_stp, INS_CONSTSTR(cx->runtime->emptyString), phi_ins, 0, ACCSET_OTHER);
|
||||
|
||||
br = lir->insBranch(LIR_jf,
|
||||
lir->ins2(LIR_ltup, idx_ins, lir->ins2ImmI(LIR_rshup, length_ins, JSString::FLAGS_LENGTH_SHIFT)),
|
||||
NULL);
|
||||
LIns *chars_ins = getStringChars(str_ins);
|
||||
LIns *ch_ins = lir->insLoad(LIR_ldus2ui,
|
||||
lir->ins2(LIR_addp, chars_ins, lir->ins2ImmI(LIR_lshp, idx_ins, 1)), 0,
|
||||
ACCSET_OTHER, LOAD_CONST);
|
||||
guard(true, lir->ins2ImmI(LIR_ltui, ch_ins, UNIT_STRING_LIMIT), snapshot(MISMATCH_EXIT));
|
||||
LIns *unitstr_ins = lir->ins2(LIR_addp,
|
||||
INS_CONSTPTR(JSString::unitStringTable),
|
||||
lir->ins2ImmI(LIR_lshp,
|
||||
lir->insUI2P(ch_ins),
|
||||
(sizeof(JSString) == 16) ? 4 : 5));
|
||||
lir->insStore(LIR_stp, unitstr_ins, phi_ins, 0, ACCSET_OTHER);
|
||||
br->setTarget(lir->ins0(LIR_label));
|
||||
|
||||
return lir->insLoad(LIR_ldp, phi_ins, 0, ACCSET_OTHER);
|
||||
}
|
||||
|
||||
// Typed array tracing depends on EXPANDED_LOADSTORE and F2I
|
||||
#if NJ_EXPANDED_LOADSTORE_SUPPORTED && NJ_F2I_SUPPORTED
|
||||
static bool OkToTraceTypedArrays = true;
|
||||
@ -12496,11 +12601,7 @@ TraceRecorder::record_JSOP_GETELEM()
|
||||
int i = asInt32(idx);
|
||||
if (size_t(i) >= lval.toString()->length())
|
||||
RETURN_STOP_A("Invalid string index in JSOP_GETELEM");
|
||||
idx_ins = makeNumberInt32(idx_ins);
|
||||
LIns* args[] = { idx_ins, obj_ins, cx_ins };
|
||||
LIns* unitstr_ins = lir->insCall(&js_String_getelem_ci, args);
|
||||
guard(false, lir->insEqP_0(unitstr_ins), MISMATCH_EXIT);
|
||||
set(&lval, unitstr_ins);
|
||||
set(&lval, getCharAt(lval.toString(), obj_ins, idx_ins));
|
||||
return ARECORD_CONTINUE;
|
||||
}
|
||||
|
||||
@ -12539,14 +12640,15 @@ TraceRecorder::record_JSOP_GETELEM()
|
||||
if (int_idx < 0 || int_idx >= afp->argc)
|
||||
RETURN_STOP_A("cannot trace arguments with out of range index");
|
||||
|
||||
guard(true,
|
||||
VMSideExit *exit = snapshot(MISMATCH_EXIT);
|
||||
guard(true,
|
||||
addName(lir->ins2(LIR_gei, idx_ins, INS_CONST(0)),
|
||||
"guard(upvar index >= 0)"),
|
||||
MISMATCH_EXIT);
|
||||
exit);
|
||||
guard(true,
|
||||
addName(lir->ins2(LIR_lti, idx_ins, INS_CONST(afp->argc)),
|
||||
"guard(upvar index in range)"),
|
||||
MISMATCH_EXIT);
|
||||
exit);
|
||||
|
||||
JSValueType type = getCoercedType(*vp);
|
||||
|
||||
@ -15788,10 +15890,7 @@ TraceRecorder::record_JSOP_LENGTH()
|
||||
if (l.isPrimitive()) {
|
||||
if (!l.isString())
|
||||
RETURN_STOP_A("non-string primitive JSOP_LENGTH unsupported");
|
||||
set(&l, lir->ins1(LIR_i2d,
|
||||
p2i(lir->ins2ImmI(LIR_rshup, lir->insLoad(LIR_ldp, get(&l),
|
||||
offsetof(JSString, mLengthAndFlags), ACCSET_OTHER),
|
||||
JSString::FLAGS_LENGTH_SHIFT))));
|
||||
set(&l, lir->ins1(LIR_i2d, p2i(getStringLength(get(&l)))));
|
||||
return ARECORD_CONTINUE;
|
||||
}
|
||||
|
||||
|
@ -1291,6 +1291,13 @@ class TraceRecorder
|
||||
nanojit::LIns* obj_ins,
|
||||
JSScopeProperty* sprop);
|
||||
|
||||
JS_REQUIRES_STACK nanojit::LIns* getStringLength(nanojit::LIns* str_ins);
|
||||
JS_REQUIRES_STACK nanojit::LIns* getStringChars(nanojit::LIns* str_ins);
|
||||
JS_REQUIRES_STACK nanojit::LIns* getCharCodeAt(JSString *str,
|
||||
nanojit::LIns* str_ins, nanojit::LIns* idx_ins);
|
||||
JS_REQUIRES_STACK nanojit::LIns* getCharAt(JSString *str,
|
||||
nanojit::LIns* str_ins, nanojit::LIns* idx_ins);
|
||||
|
||||
JS_REQUIRES_STACK RecordingStatus nativeSet(JSObject* obj, nanojit::LIns* obj_ins,
|
||||
JSScopeProperty* sprop,
|
||||
const Value &v, nanojit::LIns* v_ins);
|
||||
|
@ -140,10 +140,11 @@ nanojit::LInsPrinter::accNames[] = {
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
void ValidateWriter::checkAccSet(LOpcode op, LIns* base, AccSet accSet)
|
||||
void ValidateWriter::checkAccSet(LOpcode op, LIns* base, int32_t disp, AccSet accSet)
|
||||
{
|
||||
(void)op;
|
||||
(void)base;
|
||||
(void)disp;
|
||||
NanoAssert(accSet == ACCSET_OTHER);
|
||||
}
|
||||
#endif
|
||||
|
@ -1 +1 @@
|
||||
186f3f376d662375ff9182cf0b470468335ef442
|
||||
982cd218ddb049bdbbcdda4fa3a9d7e40e45e0be
|
||||
|
@ -2035,13 +2035,17 @@ namespace nanojit
|
||||
}
|
||||
|
||||
void CseFilter::clearNL(NLKind nlkind) {
|
||||
VMPI_memset(m_listNL[nlkind], 0, sizeof(LIns*)*m_capNL[nlkind]);
|
||||
m_usedNL[nlkind] = 0;
|
||||
if (m_usedNL[nlkind] > 0) {
|
||||
VMPI_memset(m_listNL[nlkind], 0, sizeof(LIns*)*m_capNL[nlkind]);
|
||||
m_usedNL[nlkind] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CseFilter::clearL(CseAcc a) {
|
||||
VMPI_memset(m_listL[a], 0, sizeof(LIns*)*m_capL[a]);
|
||||
m_usedL[a] = 0;
|
||||
if (m_usedL[a] > 0) {
|
||||
VMPI_memset(m_listL[a], 0, sizeof(LIns*)*m_capL[a]);
|
||||
m_usedL[a] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CseFilter::clearAll() {
|
||||
@ -2478,9 +2482,12 @@ namespace nanojit
|
||||
// Clear all normal (excludes CONST and MULTIPLE) loads
|
||||
// aliased by stores and calls since the last time we were in
|
||||
// this function.
|
||||
for (CseAcc a = 0; a < EMB_NUM_USED_ACCS; a++)
|
||||
if (storesSinceLastLoad & (1 << a))
|
||||
clearL(a);
|
||||
AccSet a = storesSinceLastLoad & ((1 << EMB_NUM_USED_ACCS) - 1);
|
||||
while (a) {
|
||||
int acc = msbSet(a);
|
||||
clearL((CseAcc)acc);
|
||||
a &= ~(1 << acc);
|
||||
}
|
||||
|
||||
// No need to clear CONST loads (those in the CSE_ACC_CONST table).
|
||||
|
||||
@ -2877,13 +2884,13 @@ namespace nanojit
|
||||
|
||||
ValidateWriter::ValidateWriter(LirWriter *out, LInsPrinter* printer, const char* where)
|
||||
: LirWriter(out), printer(printer), whereInPipeline(where),
|
||||
checkAccSetIns1(0), checkAccSetIns2(0)
|
||||
checkAccSetExtras(0)
|
||||
{}
|
||||
|
||||
LIns* ValidateWriter::insLoad(LOpcode op, LIns* base, int32_t d, AccSet accSet,
|
||||
LoadQual loadQual)
|
||||
{
|
||||
checkAccSet(op, base, accSet);
|
||||
checkAccSet(op, base, d, accSet);
|
||||
|
||||
switch (loadQual) {
|
||||
case LOAD_CONST:
|
||||
@ -2921,7 +2928,7 @@ namespace nanojit
|
||||
|
||||
LIns* ValidateWriter::insStore(LOpcode op, LIns* value, LIns* base, int32_t d, AccSet accSet)
|
||||
{
|
||||
checkAccSet(op, base, accSet);
|
||||
checkAccSet(op, base, d, accSet);
|
||||
|
||||
int nArgs = 2;
|
||||
LTy formals[2] = { LTy_V, LTy_P }; // LTy_V is overwritten shortly
|
||||
|
@ -262,6 +262,11 @@ namespace nanojit
|
||||
static const AccSet ACCSET_LOAD_ANY = ACCSET_ALL; // synonym
|
||||
static const AccSet ACCSET_STORE_ANY = ACCSET_ALL; // synonym
|
||||
|
||||
inline bool isSingletonAccSet(AccSet accSet) {
|
||||
// This is a neat way of testing if a value has only one bit set.
|
||||
return (accSet & (accSet - 1)) == 0;
|
||||
}
|
||||
|
||||
// Full AccSets don't fit into load and store instructions. But
|
||||
// load/store AccSets almost always contain a single access region. We
|
||||
// take advantage of this to create a compressed AccSet, MiniAccSet, that
|
||||
@ -284,23 +289,35 @@ namespace nanojit
|
||||
struct MiniAccSet { MiniAccSetVal val; };
|
||||
static const MiniAccSet MINI_ACCSET_MULTIPLE = { 99 };
|
||||
|
||||
#if defined(_WIN32) && (_MSC_VER >= 1300) && (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64))
|
||||
extern "C" unsigned char _BitScanReverse(unsigned long * Index, unsigned long Mask);
|
||||
# pragma intrinsic(_BitScanReverse)
|
||||
|
||||
// Returns the index of the most significant bit that is set.
|
||||
static int msbSet(uint32_t x) {
|
||||
unsigned long idx;
|
||||
_BitScanReverse(&idx, (unsigned long)(x | 1)); // the '| 1' ensures a 0 result when x==0
|
||||
return idx;
|
||||
}
|
||||
#elif (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
static int msbSet(uint32_t x) {
|
||||
return 31 - __builtin_clz(x | 1);
|
||||
}
|
||||
#else
|
||||
static int msbSet(uint32_t x) { // slow fallback version
|
||||
for (int i = 31; i >= 0; i--)
|
||||
if ((1 << i) & x)
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static MiniAccSet compressAccSet(AccSet accSet) {
|
||||
// As the number of regions increase, this may become a bottleneck.
|
||||
// If it does we can first count the number of bits using Kernighan's
|
||||
// technique
|
||||
// (http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan)
|
||||
// and if it's a single-region set, use a bit-scanning instruction to
|
||||
// work out which single-region set it is. That would require
|
||||
// factoring out the bit-scanning code currently in
|
||||
// nRegisterAllocFromSet().
|
||||
//
|
||||
// Try all the single-region AccSets first.
|
||||
for (int i = 0; i < NUM_ACCS; i++) {
|
||||
if (accSet == (1U << i)) {
|
||||
MiniAccSet ret = { uint8_t(i) };
|
||||
return ret;
|
||||
}
|
||||
if (isSingletonAccSet(accSet)) {
|
||||
MiniAccSet ret = { uint8_t(msbSet(accSet)) };
|
||||
return ret;
|
||||
}
|
||||
|
||||
// If we got here, it must be a multi-region AccSet.
|
||||
return MINI_ACCSET_MULTIPLE;
|
||||
}
|
||||
@ -2234,15 +2251,14 @@ namespace nanojit
|
||||
void checkLInsHasOpcode(LOpcode op, int argN, LIns* ins, LOpcode op2);
|
||||
void checkLInsIsACondOrConst(LOpcode op, int argN, LIns* ins);
|
||||
void checkLInsIsNull(LOpcode op, int argN, LIns* ins);
|
||||
void checkAccSet(LOpcode op, LIns* base, AccSet accSet); // defined by the embedder
|
||||
void checkAccSet(LOpcode op, LIns* base, int32_t disp, AccSet accSet); // defined by the embedder
|
||||
|
||||
// These can be set by the embedder and used in checkAccSet().
|
||||
LIns *checkAccSetIns1, *checkAccSetIns2;
|
||||
void** checkAccSetExtras;
|
||||
|
||||
public:
|
||||
ValidateWriter(LirWriter* out, LInsPrinter* printer, const char* where);
|
||||
void setCheckAccSetIns1(LIns* ins) { checkAccSetIns1 = ins; }
|
||||
void setCheckAccSetIns2(LIns* ins) { checkAccSetIns2 = ins; }
|
||||
void setCheckAccSetExtras(void** extras) { checkAccSetExtras = extras; }
|
||||
|
||||
LIns* insLoad(LOpcode op, LIns* base, int32_t d, AccSet accSet, LoadQual loadQual);
|
||||
LIns* insStore(LOpcode op, LIns* value, LIns* base, int32_t d, AccSet accSet);
|
||||
|
@ -1065,6 +1065,14 @@ PutStr(JSContext *cx, uintN argc, jsval *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
Now(JSContext *cx, uintN argc, jsval *vp)
|
||||
{
|
||||
jsdouble now = PRMJ_Now() / double(PRMJ_USEC_PER_MSEC);
|
||||
JS_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(now));
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
Print(JSContext *cx, uintN argc, jsval *vp)
|
||||
{
|
||||
@ -2210,6 +2218,18 @@ DumpHeap(JSContext *cx, uintN argc, jsval *vp)
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
JSBool
|
||||
DumpObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
JSObject *arg0 = NULL;
|
||||
if (!JS_ConvertArguments(cx, argc, argv, "o", &arg0))
|
||||
return JS_FALSE;
|
||||
|
||||
js_DumpObject(arg0);
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifdef TEST_CVTARGS
|
||||
@ -3920,6 +3940,7 @@ static JSFunctionSpec shell_functions[] = {
|
||||
JS_FN("readline", ReadLine, 0,0),
|
||||
JS_FN("print", Print, 0,0),
|
||||
JS_FN("putstr", PutStr, 0,0),
|
||||
JS_FN("now", Now, 0,0),
|
||||
JS_FS("help", Help, 0,0,0),
|
||||
JS_FS("quit", Quit, 0,0,0),
|
||||
JS_FN("assertEq", AssertEq, 2,0),
|
||||
@ -3946,6 +3967,7 @@ static JSFunctionSpec shell_functions[] = {
|
||||
JS_FS("disfile", DisassFile, 1,0,0),
|
||||
JS_FS("dissrc", DisassWithSrc, 1,0,0),
|
||||
JS_FN("dumpHeap", DumpHeap, 0,0),
|
||||
JS_FS("dumpObject", DumpObject, 1,0,0),
|
||||
JS_FS("notes", Notes, 1,0,0),
|
||||
JS_FS("tracing", Tracing, 0,0,0),
|
||||
JS_FS("stats", DumpStats, 1,0,0),
|
||||
@ -4013,6 +4035,7 @@ static const char *const shell_help_messages[] = {
|
||||
"readline() Read a single line from stdin",
|
||||
"print([exp ...]) Evaluate and print expressions",
|
||||
"putstr([exp]) Evaluate and print expression without newline",
|
||||
"now() Return the current time with sub-ms precision",
|
||||
"help([name ...]) Display usage and help messages",
|
||||
"quit() Quit the shell",
|
||||
"assertEq(actual, expected[, msg])\n"
|
||||
@ -4049,6 +4072,7 @@ static const char *const shell_help_messages[] = {
|
||||
"dissrc([fun]) Disassemble functions with source lines",
|
||||
"dumpHeap([fileName[, start[, toFind[, maxDepth[, toIgnore]]]]])\n"
|
||||
" Interface to JS_DumpHeap with output sent to file",
|
||||
"dumpObject() Dump an internal representation of an object",
|
||||
"notes([fun]) Show source notes for functions",
|
||||
"tracing([true|false|filename]) Turn bytecode execution tracing on/off.\n"
|
||||
" With filename, send to file.\n",
|
||||
|
@ -52,9 +52,14 @@ function test()
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
var doc;
|
||||
if (typeof document == 'undefined')
|
||||
{
|
||||
document = {};
|
||||
doc = {};
|
||||
}
|
||||
else
|
||||
{
|
||||
doc = document;
|
||||
}
|
||||
|
||||
if (typeof alert == 'undefined')
|
||||
@ -63,16 +68,16 @@ function test()
|
||||
}
|
||||
|
||||
// Crash:
|
||||
document.watch("title", function(a,b,c,d) {
|
||||
doc.watch("title", function(a,b,c,d) {
|
||||
return { toString : function() { alert(1); } };
|
||||
});
|
||||
document.title = "xxx";
|
||||
doc.title = "xxx";
|
||||
|
||||
// No crash:
|
||||
document.watch("title", function() {
|
||||
doc.watch("title", function() {
|
||||
return { toString : function() { alert(1); } };
|
||||
});
|
||||
document.title = "xxx";
|
||||
doc.title = "xxx";
|
||||
|
||||
reportCompare(expect, actual, summary);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,12 @@
|
||||
To run narcissus with jstests.py, change to the js/src/tests/ directory and run
|
||||
the following command (which excludes tests that are particularly slow):
|
||||
|
||||
python jstests.py -d -j 4 $OBJDIR/njs -m narcissus.list -x slow-narcissus.txt
|
||||
python jstests.py -d -j 4 $OBJDIR/njs -x slow-narcissus.txt
|
||||
|
||||
|
||||
The js/src/tests/narcissus directory can be used for any tweaks that might be needed
|
||||
to make Narcissus work properly. Currently, Narcissus is failing a number of
|
||||
tests. narcissus-failures.txt can be used to ignore those tests. Note that
|
||||
narcissus-failures.txt also includes all of the tests from slow-narcissus.txt.
|
||||
Currently, Narcissus is failing a number of tests. narcissus-failures.txt can
|
||||
be used to ignore those tests. Note that narcissus-failures.txt also includes
|
||||
all of the tests from slow-narcissus.txt.
|
||||
|
||||
python jstests.py -d -j 4 $OBJDIR/njs -m narcissus.list -x narcissus-failures.txt
|
||||
python jstests.py -d -j 4 $OBJDIR/njs -x narcissus-failures.txt
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
include ../jstests.list
|
@ -1,4 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/**
|
||||
* Hacks to work around Narcissus-specific problems
|
||||
*/
|
10
js/src/trace-test/tests/basic/bug584565.js
Normal file
10
js/src/trace-test/tests/basic/bug584565.js
Normal file
@ -0,0 +1,10 @@
|
||||
// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/licenses/publicdomain/
|
||||
// Contributor: Luke Wagner <lw@mozilla.com>
|
||||
|
||||
var x, f;
|
||||
for (var i = 0; i < 100; i++) {
|
||||
f = function() {};
|
||||
f.foo;
|
||||
x = f.length;
|
||||
}
|
@ -412,6 +412,8 @@ WrapObject(JSContext *cx, JSObject *parent, jsval *vp, XPCWrappedNative* wn)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
CheckWindow(wn);
|
||||
|
||||
// The parent must be the inner global object for its scope.
|
||||
parent = JS_GetGlobalForObject(cx, parent);
|
||||
OBJ_TO_INNER_OBJECT(cx, parent);
|
||||
|
@ -1069,6 +1069,8 @@ JSObject *
|
||||
XPCNativeWrapper::GetNewOrUsed(JSContext *cx, XPCWrappedNative *wrapper,
|
||||
JSObject *scope, nsIPrincipal *aObjectPrincipal)
|
||||
{
|
||||
CheckWindow(wrapper);
|
||||
|
||||
if (aObjectPrincipal) {
|
||||
nsIScriptSecurityManager *ssm = GetSecurityManager();
|
||||
|
||||
|
@ -324,6 +324,12 @@ WrapObject(JSContext *cx, JSObject *scope, jsval v, jsval *vp)
|
||||
return ThrowException(NS_ERROR_FAILURE, cx);
|
||||
}
|
||||
|
||||
XPCWrappedNative *wn =
|
||||
XPCWrappedNative::GetWrappedNativeOfJSObject(cx, objToWrap);
|
||||
if (wn) {
|
||||
CheckWindow(wn);
|
||||
}
|
||||
|
||||
JSObject *wrapperObj =
|
||||
JS_NewObjectWithGivenProto(cx, js::Jsvalify(&SJOWClass), nsnull, scope);
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include "XPCWrapper.h"
|
||||
#include "XPCNativeWrapper.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
namespace XPCWrapper {
|
||||
|
||||
@ -189,6 +190,35 @@ static js::Class IteratorClass = {
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
CheckWindow(XPCWrappedNative *wn)
|
||||
{
|
||||
JSClass *clasp = wn->GetFlatJSObject()->getJSClass();
|
||||
|
||||
// Censor objects that can't be windows.
|
||||
switch (clasp->name[0]) {
|
||||
case 'C': // ChromeWindow?
|
||||
if (clasp->name[1] != 'h') {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'M': // ModalContentWindow
|
||||
break;
|
||||
case 'W': // Window
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> pwin(do_QueryWrappedNative(wn));
|
||||
if (!pwin || pwin->IsInnerWindow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
pwin->EnsureInnerWindow();
|
||||
}
|
||||
|
||||
JSBool
|
||||
RewrapObject(JSContext *cx, JSObject *scope, JSObject *obj, WrapperType hint,
|
||||
jsval *vp)
|
||||
|
@ -444,6 +444,13 @@ WrapFunction(JSContext *cx, JSObject *wrapperObj, JSObject *funobj, jsval *v,
|
||||
: XPCCrossOriginWrapper::WrapFunction(cx, wrapperObj, funobj, v);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a JSObject that might represent a Window object, ensures that the
|
||||
* window object has an inner window.
|
||||
*/
|
||||
void
|
||||
CheckWindow(XPCWrappedNative *wn);
|
||||
|
||||
/**
|
||||
* Given a potentially-wrapped object, creates a wrapper for it.
|
||||
*/
|
||||
|
@ -146,14 +146,6 @@ XPCCallContext::Init(XPCContext::LangType callerLanguage,
|
||||
return;
|
||||
}
|
||||
|
||||
// Get into the request as early as we can to avoid problems with scanning
|
||||
// callcontexts on other threads from within the gc callbacks.
|
||||
|
||||
NS_ASSERTION(!callBeginRequest || mCallerLanguage == NATIVE_CALLER,
|
||||
"Don't call JS_BeginRequest unless the caller is native.");
|
||||
if(callBeginRequest)
|
||||
JS_BeginRequest(mJSContext);
|
||||
|
||||
if(topJSContext != mJSContext)
|
||||
{
|
||||
if(NS_FAILED(stack->Push(mJSContext)))
|
||||
@ -164,6 +156,14 @@ XPCCallContext::Init(XPCContext::LangType callerLanguage,
|
||||
mContextPopRequired = JS_TRUE;
|
||||
}
|
||||
|
||||
// Get into the request as early as we can to avoid problems with scanning
|
||||
// callcontexts on other threads from within the gc callbacks.
|
||||
|
||||
NS_ASSERTION(!callBeginRequest || mCallerLanguage == NATIVE_CALLER,
|
||||
"Don't call JS_BeginRequest unless the caller is native.");
|
||||
if(callBeginRequest)
|
||||
JS_BeginRequest(mJSContext);
|
||||
|
||||
mXPCContext = XPCContext::GetXPCContext(mJSContext);
|
||||
mPrevCallerLanguage = mXPCContext->SetCallingLangType(mCallerLanguage);
|
||||
|
||||
@ -386,6 +386,10 @@ XPCCallContext::~XPCCallContext()
|
||||
shouldReleaseXPC = mPrevCallContext == nsnull;
|
||||
}
|
||||
|
||||
// NB: Needs to happen before the context stack pop.
|
||||
if(mJSContext && mCallerLanguage == NATIVE_CALLER)
|
||||
JS_EndRequest(mJSContext);
|
||||
|
||||
if(mContextPopRequired)
|
||||
{
|
||||
XPCJSContextStack* stack = mThreadData->GetJSContextStack();
|
||||
@ -404,9 +408,6 @@ XPCCallContext::~XPCCallContext()
|
||||
|
||||
if(mJSContext)
|
||||
{
|
||||
if(mCallerLanguage == NATIVE_CALLER)
|
||||
JS_EndRequest(mJSContext);
|
||||
|
||||
if(mDestroyJSContextInDestructor)
|
||||
{
|
||||
#ifdef DEBUG_xpc_hacker
|
||||
|
@ -113,7 +113,10 @@ Module::Call(nsIXPConnectWrappedNative* wrapper,
|
||||
jsval* vp,
|
||||
PRBool* _retval)
|
||||
{
|
||||
JSObject* global = JS_GetGlobalObject(cx);
|
||||
JSObject* global = JS_GetGlobalForScopeChain(cx);
|
||||
if (!global)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
*_retval = InitAndSealCTypesClass(cx, global);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -75,39 +75,39 @@ test_void_t_cdecl()
|
||||
return;
|
||||
}
|
||||
|
||||
#define DEFINE_TYPE(name, type, ffiType) \
|
||||
#define FUNCTION_TESTS(name, type, ffiType, suffix) \
|
||||
type ABI \
|
||||
get_##name##_cdecl() \
|
||||
get_##name##_##suffix() \
|
||||
{ \
|
||||
return ValueTraits<type>::literal(); \
|
||||
} \
|
||||
\
|
||||
type ABI \
|
||||
set_##name##_cdecl(type x) \
|
||||
set_##name##_##suffix(type x) \
|
||||
{ \
|
||||
return x; \
|
||||
} \
|
||||
\
|
||||
type ABI \
|
||||
sum_##name##_cdecl(type x, type y) \
|
||||
sum_##name##_##suffix(type x, type y) \
|
||||
{ \
|
||||
return ValueTraits<type>::sum(x, y); \
|
||||
} \
|
||||
\
|
||||
type ABI \
|
||||
sum_alignb_##name##_cdecl(char a, type x, char b, type y, char c) \
|
||||
sum_alignb_##name##_##suffix(char a, type x, char b, type y, char c) \
|
||||
{ \
|
||||
return ValueTraits<type>::sum(x, y); \
|
||||
} \
|
||||
\
|
||||
type ABI \
|
||||
sum_alignf_##name##_cdecl(float a, type x, float b, type y, float c) \
|
||||
sum_alignf_##name##_##suffix(float a, type x, float b, type y, float c) \
|
||||
{ \
|
||||
return ValueTraits<type>::sum(x, y); \
|
||||
} \
|
||||
\
|
||||
type ABI \
|
||||
sum_many_##name##_cdecl( \
|
||||
sum_many_##name##_##suffix( \
|
||||
type a, type b, type c, type d, type e, type f, type g, type h, type i, \
|
||||
type j, type k, type l, type m, type n, type o, type p, type q, type r) \
|
||||
{ \
|
||||
@ -116,6 +116,7 @@ sum_many_##name##_cdecl( \
|
||||
}
|
||||
|
||||
#define ABI /* cdecl */
|
||||
#define DEFINE_TYPE(x, y, z) FUNCTION_TESTS(x, y, z, cdecl)
|
||||
#include "typedefs.h"
|
||||
#undef ABI
|
||||
|
||||
@ -129,6 +130,7 @@ test_void_t_stdcall()
|
||||
}
|
||||
|
||||
#define ABI NS_STDCALL
|
||||
#define DEFINE_TYPE(x, y, z) FUNCTION_TESTS(x, y, z, stdcall)
|
||||
#include "typedefs.h"
|
||||
#undef ABI
|
||||
|
||||
|
@ -653,11 +653,18 @@ function run_UInt64_tests() {
|
||||
function run_basic_abi_tests(library, t, name, toprimitive,
|
||||
get_test, set_tests, sum_tests, sum_many_tests) {
|
||||
// Test the function call ABI for calls involving the type.
|
||||
run_single_abi_tests(library, ctypes.default_abi, t, name + "_cdecl",
|
||||
function declare_fn_cdecl(fn_t, prefix) {
|
||||
return library.declare(prefix + name + "_cdecl", fn_t);
|
||||
}
|
||||
run_single_abi_tests(declare_fn_cdecl, ctypes.default_abi, t,
|
||||
toprimitive, get_test, set_tests, sum_tests, sum_many_tests);
|
||||
#ifdef _WIN32
|
||||
#ifndef _WIN64
|
||||
run_single_abi_tests(library, ctypes.stdcall_abi, t, name + "_stdcall",
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef HAVE_64BIT_OS
|
||||
function declare_fn_stdcall(fn_t, prefix) {
|
||||
return library.declare(prefix + name + "_stdcall", fn_t);
|
||||
}
|
||||
run_single_abi_tests(declare_fn_stdcall, ctypes.stdcall_abi, t,
|
||||
toprimitive, get_test, set_tests, sum_tests, sum_many_tests);
|
||||
#endif
|
||||
#endif
|
||||
@ -667,23 +674,28 @@ function run_basic_abi_tests(library, t, name, toprimitive,
|
||||
check_struct_stats(library, t);
|
||||
}
|
||||
|
||||
function run_single_abi_tests(library, abi, t, name, toprimitive,
|
||||
function run_single_abi_tests(decl, abi, t, toprimitive,
|
||||
get_test, set_tests, sum_tests, sum_many_tests) {
|
||||
let getter = library.declare("get_" + name, abi, t);
|
||||
let getter_t = ctypes.FunctionType(abi, t).ptr;
|
||||
let getter = decl(getter_t, "get_");
|
||||
do_check_eq(toprimitive(getter()), get_test);
|
||||
|
||||
let setter = library.declare("set_" + name, ctypes.default_abi, t, t);
|
||||
let setter_t = ctypes.FunctionType(abi, t, [t]).ptr;
|
||||
let setter = decl(setter_t, "set_");
|
||||
for each (let i in set_tests)
|
||||
do_check_eq(toprimitive(setter(i)), i);
|
||||
|
||||
let sum = library.declare("sum_" + name, ctypes.default_abi, t, t, t);
|
||||
let sum_t = ctypes.FunctionType(abi, t, [t, t]).ptr;
|
||||
let sum = decl(sum_t, "sum_");
|
||||
for each (let a in sum_tests)
|
||||
do_check_eq(toprimitive(sum(a[0], a[1])), a[2]);
|
||||
|
||||
let sum_alignb = library.declare("sum_alignb_" + name, ctypes.default_abi, t,
|
||||
ctypes.char, t, ctypes.char, t, ctypes.char);
|
||||
let sum_alignf = library.declare("sum_alignf_" + name, ctypes.default_abi, t,
|
||||
ctypes.float, t, ctypes.float, t, ctypes.float);
|
||||
let sum_alignb_t = ctypes.FunctionType(abi, t,
|
||||
[ctypes.char, t, ctypes.char, t, ctypes.char]).ptr;
|
||||
let sum_alignb = decl(sum_alignb_t, "sum_alignb_");
|
||||
let sum_alignf_t = ctypes.FunctionType(abi, t,
|
||||
[ctypes.float, t, ctypes.float, t, ctypes.float]).ptr;
|
||||
let sum_alignf = decl(sum_alignf_t, "sum_alignf_");
|
||||
for each (let a in sum_tests) {
|
||||
do_check_eq(toprimitive(sum_alignb(0, a[0], 0, a[1], 0)), a[2]);
|
||||
do_check_eq(toprimitive(sum_alignb(1, a[0], 1, a[1], 1)), a[2]);
|
||||
@ -691,13 +703,14 @@ function run_single_abi_tests(library, abi, t, name, toprimitive,
|
||||
do_check_eq(toprimitive(sum_alignf(1, a[0], 1, a[1], 1)), a[2]);
|
||||
}
|
||||
|
||||
let sum_many = library.declare("sum_many_" + name, ctypes.default_abi, t,
|
||||
t, t, t, t, t, t, t, t, t, t, t, t, t, t, t, t, t, t);
|
||||
let sum_many_t = ctypes.FunctionType(abi, t,
|
||||
[t, t, t, t, t, t, t, t, t, t, t, t, t, t, t, t, t, t]).ptr;
|
||||
let sum_many = decl(sum_many_t, "sum_many_");
|
||||
for each (let a in sum_many_tests)
|
||||
do_check_eq(toprimitive(
|
||||
sum_many(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7],
|
||||
a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15],
|
||||
a[16], a[17])), a[18]);
|
||||
do_check_eq(
|
||||
toprimitive(sum_many(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7],
|
||||
a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15],
|
||||
a[16], a[17])), a[18]);
|
||||
}
|
||||
|
||||
function check_struct_stats(library, t) {
|
||||
@ -1824,11 +1837,11 @@ function run_FunctionType_tests() {
|
||||
ctypes.char.ptr.array().ptr).ptr.ptr.array(8).array();
|
||||
do_check_eq(f3_t.name, "char*(*(**[][8])())[]");
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef _WIN64
|
||||
#ifdef WIN32
|
||||
#ifndef HAVE_64BIT_OS
|
||||
f3_t = ctypes.FunctionType(ctypes.stdcall_abi,
|
||||
ctypes.char.ptr.array().ptr).ptr.array(8).array();
|
||||
do_check_eq(f3_t.ptr.name, "char*(__stdcall *(**[][8])())[]");
|
||||
ctypes.char.ptr.array().ptr).ptr.ptr.array(8).array();
|
||||
do_check_eq(f3_t.name, "char*(*(__stdcall **[][8])())[]");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -2016,8 +2029,8 @@ function run_void_tests(library) {
|
||||
library.declare("test_void_t_cdecl", ctypes.default_abi, ctypes.void_t, ctypes.void_t);
|
||||
}, Error);
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef _WIN64
|
||||
#ifdef WIN32
|
||||
#ifndef HAVE_64BIT_OS
|
||||
test_void_t = library.declare("test_void_t_stdcall", ctypes.stdcall_abi, ctypes.void_t);
|
||||
do_check_eq(test_void_t(), undefined);
|
||||
#endif
|
||||
@ -2170,8 +2183,8 @@ function run_function_tests(library)
|
||||
function run_closure_tests(library)
|
||||
{
|
||||
run_single_closure_tests(library, ctypes.default_abi, "cdecl");
|
||||
#ifdef _WIN32
|
||||
#ifndef _WIN64
|
||||
#ifdef WIN32
|
||||
#ifndef HAVE_64BIT_OS
|
||||
run_single_closure_tests(library, ctypes.stdcall_abi, "stdcall");
|
||||
#endif
|
||||
#endif
|
||||
@ -2233,8 +2246,8 @@ function run_variadic_tests(library) {
|
||||
ctypes.FunctionType(ctypes.default_abi, ctypes.bool, ["..."]);
|
||||
}, Error);
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef _WIN64
|
||||
#ifdef WIN32
|
||||
#ifndef HAVE_64BIT_OS
|
||||
do_check_throws(function() {
|
||||
ctypes.FunctionType(ctypes.stdcall_abi, ctypes.bool,
|
||||
[ctypes.bool, "..."]);
|
||||
|
Loading…
Reference in New Issue
Block a user