mirror of
https://github.com/Smaug123/WoofWare.PawPrint
synced 2025-10-05 14:18:40 +00:00
Implement Bne_un_s (#102)
This commit is contained in:
@@ -403,9 +403,9 @@ module IlMachineState =
|
|||||||
| PrimitiveType.Double -> baseClassTypes.Double
|
| PrimitiveType.Double -> baseClassTypes.Double
|
||||||
| PrimitiveType.String -> baseClassTypes.String
|
| PrimitiveType.String -> baseClassTypes.String
|
||||||
| PrimitiveType.TypedReference -> failwith "todo"
|
| PrimitiveType.TypedReference -> failwith "todo"
|
||||||
| PrimitiveType.IntPtr -> failwith "todo"
|
| PrimitiveType.IntPtr -> baseClassTypes.IntPtr
|
||||||
| PrimitiveType.UIntPtr -> failwith "todo"
|
| PrimitiveType.UIntPtr -> baseClassTypes.UIntPtr
|
||||||
| PrimitiveType.Object -> failwith "todo"
|
| PrimitiveType.Object -> baseClassTypes.Object
|
||||||
|> TypeInfo.mapGeneric (fun _ -> failwith "none of these types are generic")
|
|> TypeInfo.mapGeneric (fun _ -> failwith "none of these types are generic")
|
||||||
|
|
||||||
state, baseClassTypes.Corelib, ty
|
state, baseClassTypes.Corelib, ty
|
||||||
|
@@ -403,7 +403,34 @@ module internal UnaryConstIlOp =
|
|||||||
else
|
else
|
||||||
id
|
id
|
||||||
|> Tuple.withRight WhatWeDid.Executed
|
|> Tuple.withRight WhatWeDid.Executed
|
||||||
| Bne_un_s b -> failwith "TODO: Bne_un_s unimplemented"
|
| Bne_un_s b ->
|
||||||
|
// Table III.4
|
||||||
|
let value2, state = IlMachineState.popEvalStack currentThread state
|
||||||
|
let value1, state = IlMachineState.popEvalStack currentThread state
|
||||||
|
|
||||||
|
let isNotEqual =
|
||||||
|
match value1, value2 with
|
||||||
|
| EvalStackValue.Int32 v1, EvalStackValue.Int32 v2 -> v1 <> v2
|
||||||
|
| EvalStackValue.Int32 v1, EvalStackValue.NativeInt v2 -> failwith "TODO"
|
||||||
|
| EvalStackValue.Int32 v1, _ -> failwith $"invalid comparison, {v1} with {value2}"
|
||||||
|
| _, EvalStackValue.Int32 v2 -> failwith $"invalid comparison, {value1} with {v2}"
|
||||||
|
| EvalStackValue.Int64 v1, EvalStackValue.Int64 v2 -> v1 <> v2
|
||||||
|
| EvalStackValue.Int64 v1, _ -> failwith $"invalid comparison, {v1} with {value2}"
|
||||||
|
| _, EvalStackValue.Int64 v2 -> failwith $"invalid comparison, {value1} with {v2}"
|
||||||
|
| EvalStackValue.Float v1, EvalStackValue.Float v2 -> v1 <> v2
|
||||||
|
| _, EvalStackValue.Float v2 -> failwith $"invalid comparison, {value1} with {v2}"
|
||||||
|
| EvalStackValue.Float v1, _ -> failwith $"invalid comparison, {v1} with {value2}"
|
||||||
|
| EvalStackValue.NativeInt v1, EvalStackValue.NativeInt v2 -> v1 <> v2
|
||||||
|
| EvalStackValue.ManagedPointer ptr1, EvalStackValue.ManagedPointer ptr2 -> ptr1 <> ptr2
|
||||||
|
| _, _ -> failwith $"TODO {value1} {value2} (see table III.4)"
|
||||||
|
|
||||||
|
state
|
||||||
|
|> IlMachineState.advanceProgramCounter currentThread
|
||||||
|
|> if isNotEqual then
|
||||||
|
IlMachineState.jumpProgramCounter currentThread (int b)
|
||||||
|
else
|
||||||
|
id
|
||||||
|
|> Tuple.withRight WhatWeDid.Executed
|
||||||
| Bge_un_s b ->
|
| Bge_un_s b ->
|
||||||
let value2, state = IlMachineState.popEvalStack currentThread state
|
let value2, state = IlMachineState.popEvalStack currentThread state
|
||||||
let value1, state = IlMachineState.popEvalStack currentThread state
|
let value1, state = IlMachineState.popEvalStack currentThread state
|
||||||
|
Reference in New Issue
Block a user