Skip to content

Commit 6a62999

Browse files
author
Brian Huffman
committed
Remove non-functional saw-script function jvm_global.
Support for static fields is planned using a different mechanism. (See #908.)
1 parent 7d8e7ea commit 6a62999

File tree

4 files changed

+6
-25
lines changed

4 files changed

+6
-25
lines changed

src/SAWScript/Crucible/JVM/MethodSpecIR.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import qualified SAWScript.Crucible.Common.Setup.Type as Setup
5656
-- ** Language features
5757

5858
type instance MS.HasSetupNull CJ.JVM = 'True
59-
type instance MS.HasSetupGlobal CJ.JVM = 'True
59+
type instance MS.HasSetupGlobal CJ.JVM = 'False
6060
type instance MS.HasSetupStruct CJ.JVM = 'False
6161
type instance MS.HasSetupArray CJ.JVM = 'False
6262
type instance MS.HasSetupElem CJ.JVM = 'False

src/SAWScript/Crucible/JVM/Override.hs

+3-13
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ matchPointsTos opts sc cc spec prepost = go False []
466466
MS.SetupVar i -> Set.singleton i
467467
MS.SetupTerm _ -> Set.empty
468468
MS.SetupNull () -> Set.empty
469-
MS.SetupGlobal () _ -> Set.empty
469+
MS.SetupGlobal empty _ -> absurd empty
470470
MS.SetupStruct empty _ _ -> absurd empty
471471
MS.SetupArray empty _ -> absurd empty
472472
MS.SetupElem empty _ _ -> absurd empty
@@ -580,13 +580,7 @@ matchArg opts sc cc cs prepost actual@(RVal ref) expectedTy setupval =
580580
p <- liftIO (CJ.refIsNull sym ref)
581581
addAssert p (Crucible.SimError (cs ^. MS.csLoc) (Crucible.AssertFailureSimError ("null-equality " ++ stateCond prepost) ""))
582582

583-
MS.SetupGlobal () name ->
584-
do let mem = () -- FIXME cc^.ccLLVMEmptyMem
585-
sym <- Ov.getSymInterface
586-
ref' <- liftIO $ doResolveGlobal sym mem name
587-
588-
p <- liftIO (CJ.refIsEqual sym ref ref')
589-
addAssert p (Crucible.SimError (cs ^. MS.csLoc) (Crucible.AssertFailureSimError ("global-equality " ++ stateCond prepost) ""))
583+
MS.SetupGlobal empty _ -> absurd empty
590584

591585
_ -> failure (cs ^. MS.csLoc) =<<
592586
mkStructuralMismatch opts cc sc cs actual setupval expectedTy
@@ -937,7 +931,7 @@ instantiateSetupValue sc s v =
937931
MS.SetupVar _ -> return v
938932
MS.SetupTerm tt -> MS.SetupTerm <$> doTerm tt
939933
MS.SetupNull () -> return v
940-
MS.SetupGlobal () _ -> return v
934+
MS.SetupGlobal empty _ -> absurd empty
941935
MS.SetupStruct empty _ _ -> absurd empty
942936
MS.SetupArray empty _ -> absurd empty
943937
MS.SetupElem empty _ _ -> absurd empty
@@ -1026,7 +1020,3 @@ decodeJVMVal ty v =
10261020
asRVal :: W4.ProgramLoc -> JVMVal -> OverrideMatcher CJ.JVM w JVMRefVal
10271021
asRVal _ (RVal ptr) = return ptr
10281022
asRVal loc _ = failure loc BadPointerCast
1029-
1030-
doResolveGlobal :: Sym -> () -> String -> IO JVMRefVal
1031-
doResolveGlobal _sym _mem _name = fail "doResolveGlobal: FIXME"
1032-
-- FIXME: replace () with whatever type we need to look up global/static references

src/SAWScript/Crucible/JVM/ResolveSetupValue.hs

+2-4
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ typeOfSetupValue _cc env _nameEnv val =
117117
-- can be used at, and b) it prevents us from doing any
118118
-- type-safe field accesses.
119119
return (J.ClassType (J.mkClassName "java/lang/Object"))
120-
MS.SetupGlobal () name ->
121-
fail ("typeOfSetupValue: unimplemented jvm_global: " ++ name)
120+
MS.SetupGlobal empty _ -> absurd empty
122121
MS.SetupStruct empty _ _ -> absurd empty
123122
MS.SetupArray empty _ -> absurd empty
124123
MS.SetupElem empty _ _ -> absurd empty
@@ -142,8 +141,7 @@ resolveSetupVal cc env _tyenv _nameEnv val =
142141
MS.SetupTerm tm -> resolveTypedTerm cc tm
143142
MS.SetupNull () ->
144143
return (RVal (W4.maybePartExpr sym Nothing))
145-
MS.SetupGlobal () name ->
146-
fail $ "resolveSetupVal: unimplemented jvm_global: " ++ name
144+
MS.SetupGlobal empty _ -> absurd empty
147145
MS.SetupStruct empty _ _ -> absurd empty
148146
MS.SetupArray empty _ -> absurd empty
149147
MS.SetupElem empty _ _ -> absurd empty

src/SAWScript/Interpreter.hs

-7
Original file line numberDiff line numberDiff line change
@@ -2527,13 +2527,6 @@ primitives = Map.fromList
25272527
Experimental
25282528
[ "A JVMValue representing a null pointer value." ]
25292529

2530-
, prim "jvm_global"
2531-
"String -> JVMValue"
2532-
(pureVal (CMS.SetupGlobal () :: String -> CMS.SetupValue CJ.JVM))
2533-
Experimental
2534-
[ "Return a JVMValue representing a pointer to the named global."
2535-
, "The String may be either the name of a global value or a function name." ]
2536-
25372530
, prim "jvm_term"
25382531
"Term -> JVMValue"
25392532
(pureVal (CMS.SetupTerm :: TypedTerm -> CMS.SetupValue CJ.JVM))

0 commit comments

Comments
 (0)