44use super :: { LocVar , LuaProto , LuaValue , UpvalueDesc } ;
55use crate :: Instruction ;
66use crate :: gc:: { GcProto , ObjectAllocator , ProtoPtr } ;
7- use crate :: lua_vm:: LuaVM ;
7+ use crate :: lua_vm:: GlobalState ;
88use crate :: lua_vm:: lua_limits:: LUAI_MAXSHORTLEN ;
99use std:: collections:: HashMap ;
1010use std:: io:: { Cursor , Read } ;
@@ -95,7 +95,10 @@ pub fn deserialize_chunk(data: &[u8]) -> Result<LuaProto, String> {
9595}
9696
9797/// Deserialize binary data to a Chunk, directly creating strings with VM
98- pub fn deserialize_chunk_with_strings_vm ( data : & [ u8 ] , vm : & mut LuaVM ) -> Result < LuaProto , String > {
98+ pub fn deserialize_chunk_with_strings_vm (
99+ data : & [ u8 ] ,
100+ vm : & mut GlobalState ,
101+ ) -> Result < LuaProto , String > {
99102 let mut cursor = Cursor :: new ( data) ;
100103
101104 // Verify magic number
@@ -736,7 +739,10 @@ fn read_constant(cursor: &mut Cursor<&[u8]>) -> Result<LuaValue, String> {
736739}
737740
738741#[ allow( dead_code) ]
739- fn read_chunk_with_vm ( cursor : & mut Cursor < & [ u8 ] > , vm : & mut LuaVM ) -> Result < LuaProto , String > {
742+ fn read_chunk_with_vm (
743+ cursor : & mut Cursor < & [ u8 ] > ,
744+ vm : & mut GlobalState ,
745+ ) -> Result < LuaProto , String > {
740746 // Read code
741747 let code_len = read_u32 ( cursor) ? as usize ;
742748 let mut code = Vec :: with_capacity ( code_len) ;
@@ -827,7 +833,10 @@ fn read_chunk_with_vm(cursor: &mut Cursor<&[u8]>, vm: &mut LuaVM) -> Result<LuaP
827833}
828834
829835#[ allow( dead_code) ]
830- fn read_constant_with_vm ( cursor : & mut Cursor < & [ u8 ] > , vm : & mut LuaVM ) -> Result < LuaValue , String > {
836+ fn read_constant_with_vm (
837+ cursor : & mut Cursor < & [ u8 ] > ,
838+ vm : & mut GlobalState ,
839+ ) -> Result < LuaValue , String > {
831840 let tag = read_u8 ( cursor) ?;
832841 match tag {
833842 TAG_NIL => Ok ( LuaValue :: nil ( ) ) ,
@@ -846,7 +855,7 @@ fn read_constant_with_vm(cursor: &mut Cursor<&[u8]>, vm: &mut LuaVM) -> Result<L
846855
847856fn read_chunk_with_vm_dedup (
848857 cursor : & mut Cursor < & [ u8 ] > ,
849- vm : & mut LuaVM ,
858+ vm : & mut GlobalState ,
850859 string_table : & mut Vec < String > ,
851860) -> Result < LuaProto , String > {
852861 // Read code
@@ -940,7 +949,7 @@ fn read_chunk_with_vm_dedup(
940949
941950fn read_constant_with_vm_dedup (
942951 cursor : & mut Cursor < & [ u8 ] > ,
943- vm : & mut LuaVM ,
952+ vm : & mut GlobalState ,
944953 string_table : & mut Vec < String > ,
945954) -> Result < LuaValue , String > {
946955 let tag = read_u8 ( cursor) ?;
0 commit comments