Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
kg committed Feb 23, 2021
1 parent c350f63 commit d4fef0c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ public static unsafe int MakeMarshalSignatureInfo (IntPtr typePtr, IntPtr method

var pResult = (MarshalSignatureInfo *)resultPtr;

MethodBase? mb = MethodBase.GetMethodFromHandle(methodHandle, typeHandle);
MethodBase? mb = (typePtr != IntPtr.Zero)
? MethodBase.GetMethodFromHandle(methodHandle, typeHandle)
: MethodBase.GetMethodFromHandle(methodHandle);
if (mb == null)
return 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,6 @@ public static void MarshalDateTimeAutomatic()
}

/*
// FIXME
// [Fact]
public static void MarshalDateTimeByValueAutomatic()
Expand All @@ -894,6 +893,7 @@ public static void MarshalDateTimeByValueAutomatic()
);
Assert.Equal(ExpectedDateTime, HelperMarshal._dateTimeValue);
}
*/

[Fact]
public static void MarshalUri()
Expand Down Expand Up @@ -971,7 +971,5 @@ public static void ReturnCustomDate()
);
Assert.Equal(ExpectedDateTime, HelperMarshal._dateTimeValue);
}
*/
}
}
20 changes: 12 additions & 8 deletions src/mono/wasm/runtime/binding_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,6 @@ var BindingSupportLib = {
if (!this.make_marshal_signature_info)
return null;

if (!classPtr)
throw new Error("Class ptr not provided");
if (!methodPtr)
throw new Error("Method ptr not provided");

Expand All @@ -1010,17 +1008,19 @@ var BindingSupportLib = {
const bufferSize = 1024;
var infoPtr = Module._malloc(bufferSize);
MONO._zero_region(infoPtr, bufferSize);
var typePtr = this.mono_wasm_class_get_type (classPtr)
console.log(`Calling MakeMarshalSignatureInfo for classPtr ${classPtr}, typePtr ${typePtr} and methodPtr ${methodPtr}, at offset ${infoPtr}`);
var typePtr = classPtr
? this.mono_wasm_class_get_type (classPtr)
: 0;
// console.log(`Calling MakeMarshalSignatureInfo for classPtr ${classPtr}, typePtr ${typePtr} and methodPtr ${methodPtr}, at offset ${infoPtr}`);
var err = this.make_marshal_signature_info (typePtr, methodPtr, infoPtr, bufferSize);
if (err !== 0)
throw new Error (`MakeMarshalSignatureInfo failed with code ${err}`);

var off32 = (infoPtr / 4) | 0;
var pcount = Module.HEAPU32[off32 + 0];

console.log(`MakeMarshalSignatureInfo produced ${pcount} parameter(s)`);
pcount = Math.min(63, pcount);
if (pcount > 512)
throw new Error (`MakeMarshalSignatureInfo produced ${pcount} parameters, almost certainly wrong`);

var decode = function (offset32) {
return {
Expand All @@ -1041,8 +1041,6 @@ var BindingSupportLib = {
"methodPtr": methodPtr
};

console.log(JSON.stringify(result));

Module._free (infoPtr);
if (classMismatch)
console.log("WARNING: Class ptr mismatch for signature info, so caching is disabled");
Expand Down Expand Up @@ -1214,6 +1212,12 @@ var BindingSupportLib = {
// console.log ("preFilter", preFilter);

var convMethod = this.find_method (classPtr, "JSToManaged", 1);
if (!convMethod) {
console.log (`No automatic converter found for classPtr ${classPtr} and methodPtr ${methodPtr}`);
this._automatic_converter_table.set (classPtr, null);
return null;
}

// FIXME
var sigInfo = this.get_method_signature_info (classPtr, convMethod);
// Return unboxed so it can go directly into the arguments list
Expand Down

0 comments on commit d4fef0c

Please sign in to comment.