Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

crossrealm_d source realm

Functions 5

func DoubleCounter

crossing Action
1func DoubleCounter(cur realm) int
source

DoubleCounter reads counter and doubles it. Used to show that if counter were silently corrupted in memory, subsequent crossing calls would act on the wrong value.

func MutateBytes

Action
1func MutateBytes(bz []byte)
source

MutateBytes mutates the first byte of bz to 0xff. Used to test whether a foreign realm can write to caller-allocated bytes. Under storage=authority, bz has PkgID=caller; borrow rule #1 here makes m.Realm=crossrealm_d (declaring realm); the write site (bz[0] = ...) should fire readonly because bz.PkgID != m.Realm.ID.

func SetCounter

Action
1func SetCounter(n int)
source

SetCounter: non-crossing. Calling this cross-realm triggers the readonly check because it directly assigns a package var.

func SetCounterCrossing

crossing Action
1func SetCounterCrossing(cur realm, n int)
source

SetCounterCrossing: crossing version. This works correctly cross-realm because the caller enters this realm's context.

Source Files 2