open Cpool
open Bytes
+module Set = Core.Std.Set
+type 'a set = 'a Set.t
+
+
type trait_body = Slot of int
type trait = string * trait_body
exceptions: int list;
}
-type mmap = meth Pool.map
+type mmap = meth list
type config = {
op: int;
args: Cpool.t * mmap -> Bytes.t list;
collect child in
m',Cpool.append c c'
| None ->
- Pool.empty,c in
+ Set.empty,c in
let meths,consts =
List.fold_left
- (fun (m0,c0) (m,c) -> Pool.append m m0,Cpool.append c c0)
- (Pool.empty,Cpool.empty) @@ List.map meth_and_const insts in
+ (fun (m0,c0) (m,c) -> Set.union m m0,Cpool.append c c0)
+ (Set.empty,Cpool.empty) @@ List.map meth_and_const insts in
let traits' =
collect_traits traits in
- Pool.add meth meths,consts
+ Set.add meth meths,consts
(* convert instruction *)
let add (max,current) n =
let assemble meth =
let meths,cpool =
collect meth in
- let mmap =
- Pool.to_map meths in
let meths' =
- Pool.to_list meths in
+ Set.to_list meths in
let info,body =
- ExtList.List.split @@ ExtList.List.mapi (fun i x-> asm_method (cpool,mmap) i x) meths' in
+ ExtList.List.split @@ ExtList.List.mapi (fun i x-> asm_method (cpool,meths') i x) meths' in
Cpool.to_abc cpool,info,body
open Base
-module Set = Core.Std.Set
type namespace =
Namespace of string
QName of namespace * string
| Multiname of string * namespace_set
+module Set = Core.Std.Set
type 'a set = 'a Set.t
type t = {
multiname = Set.singleton name }
(* conversion *)
+let index x xs =
+ 1+Base.index x xs
+
let of_namespace ~string ns =
let i =
index (ns_name ns) string in
NewObject of int:op=0x55; args=const [Bytes.u30 arg0]; stack=1-arg0
NewArray of int:op=0x56; args=const [Bytes.u30 arg0]
NewActivation:op=0x57; stack=1
-NewFunction of meth: op=0x40; stack=1; meth=Some arg0; args=fun (_,mmap)->[Bytes.u30 (Pool.get arg0 mmap)]
+NewFunction of meth: op=0x40; stack=1; meth=Some arg0; args=fun (_,mmap)->[Bytes.u30 (index arg0 mmap)]
Dup: op=0x2a; stack= 2