WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 2b9cc393 authored by John Zhang's avatar John Zhang
Browse files

fix: leave NULL constants as constants, rather than loading a NULL value from global cell.

parent 7cc45097
......@@ -168,7 +168,7 @@ class MuTyper:
assert mutype.mutypeOf(muv) == MuT
if isinstance(muv, mutype._muobject_reference):
if isinstance(muv, mutype._muobject_reference) and not muv._is_null():
GCl_T = mutype.MuGlobalCell(MuT)
if id(muv) in self._objrefid2gcl_dic:
gcl = self._objrefid2gcl_dic[id(muv)]
......
......@@ -328,3 +328,18 @@ def test_pass_heap_obj_in_link_arg():
op = blk.operations[-2] # load from global cell in second last
assert op.opname == 'mu_load'
assert isinstance(op.args[0].concretetype, mutype.MuGlobalCell)
def test_NULL_const():
from rpython.rtyper.lltypesystem.rstr import STR
def f():
return lltype.nullptr(STR)
t = Translation(f, [], backend='mu')
t.mutype()
g = graph_of(f, t)
assert len(g.startblock.operations) == 1
assert g.startblock.operations[0].opname == 'mu_branch'
arg = g.startblock.operations[0].args[0].value.args[0]
assert isinstance(arg, Constant)
assert arg.value._is_null()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment