mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
First step for internal library functions
This commit is contained in:
parent
c6897d8bf4
commit
5ca933f540
@ -224,6 +224,8 @@ class JavaMethodWasmCodeBuilder extends WasmCodeBuilder {
|
|||||||
addBlockInstruction( WasmBlockOperator.DROP, null, codePos );
|
addBlockInstruction( WasmBlockOperator.DROP, null, codePos );
|
||||||
break;
|
break;
|
||||||
case 89: // dup: duplicate the value on top of the stack
|
case 89: // dup: duplicate the value on top of the stack
|
||||||
|
addCallInstruction( new SyntheticMember( "de/inetsoftware/jwebassembly/module/NativeHelperCode", "dup_i32", "(I)II" ), codePos );
|
||||||
|
break;
|
||||||
case 90: // dup_x1
|
case 90: // dup_x1
|
||||||
case 91: // dup_x2
|
case 91: // dup_x2
|
||||||
case 92: // dup2
|
case 92: // dup2
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2018 Volker Berlin (i-net software)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package de.inetsoftware.jwebassembly.module;
|
||||||
|
|
||||||
|
import de.inetsoftware.jwebassembly.api.annotation.WasmTextCode;
|
||||||
|
|
||||||
|
public class NativeHelperCode {
|
||||||
|
|
||||||
|
@WasmTextCode( signature = "(I)II", value = "get_local 0 get_local 0 return" )
|
||||||
|
native static void dup_i32();
|
||||||
|
|
||||||
|
}
|
72
src/de/inetsoftware/jwebassembly/module/SyntheticMember.java
Normal file
72
src/de/inetsoftware/jwebassembly/module/SyntheticMember.java
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2018 Volker Berlin (i-net software)
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
*/
|
||||||
|
package de.inetsoftware.jwebassembly.module;
|
||||||
|
|
||||||
|
import de.inetsoftware.classparser.Member;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generated member that come not from the Java class parser.
|
||||||
|
*
|
||||||
|
* @author Volker Berlin
|
||||||
|
*/
|
||||||
|
public class SyntheticMember implements Member {
|
||||||
|
|
||||||
|
|
||||||
|
private final String className;
|
||||||
|
private final String name;
|
||||||
|
private final String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new instance
|
||||||
|
*
|
||||||
|
* @param className
|
||||||
|
* the className
|
||||||
|
* @param name
|
||||||
|
* the name
|
||||||
|
* @param type
|
||||||
|
* the Java signature
|
||||||
|
*/
|
||||||
|
SyntheticMember( String className, String name, String type ) {
|
||||||
|
this.className = className;
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getClassName() {
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user